SigLIP2 + efficient packed I-JEPA — random

This repository contains the seed-0 context encoder from the paper's random masking arm. Starting from google/siglip2-so400m-patch16-naflex, we continued pretraining on webpage screenshots for 17,000 steps with the I-JEPA latent-prediction objective and an efficient packed predictor.

Code: wix-incubator/UI-encoder · Project page: wix-incubator.github.io/UI-encoder · Evaluation data: Wix/ui-components · Paper: coming soon

What was trained

I-JEPA learns by predicting representations of hidden image patches from the visible patches:

  • the context encoder sees the visible patches and is updated by training;
  • a frozen target encoder, initialized from the same SigLIP2 checkpoint, supplies the target patch representations; and
  • a randomly initialized six-layer ViT predictor (width 384, six attention heads) predicts the hidden representations from the visible context.

Training minimizes smooth-L1 distance in feature space. This repository releases the trained context encoder only—the target encoder and predictor are training-time components and are not required for feature extraction or downstream fine-tuning.

Efficient packed I-JEPA

The training implementation predicts all target blocks from a page in one packed predictor pass. One sequence contains the visible context followed by the queries for every target block. A block-aware attention mask lets each target query attend to the shared context and to queries from its own block, but not to queries from other blocks. The visible context is therefore encoded once per page instead of being repeated for every target block. Packing changes the execution cost, not the I-JEPA learning objective or the released encoder architecture.

Masking variant: random

Each training page uses four randomly positioned rectangular target blocks. Each block covers 15–20% of the page and has an aspect ratio between 0.75 and 1.5. The full page outside the union of those target blocks remains available as context. Component rectangles and class labels do not determine target placement in this arm.

Shared training setup

Setting Value
Starting encoder SigLIP2 SO400M, patch size 16, NaFlex
Maximum image tokens 1,024 patches
Training pages 118,583 webpage screenshots
Training length 17,000 steps (approximately 9 epochs)
Effective batch size 64 pages
Target encoder Frozen
Predictor 6-layer ViT, width 384, 6 heads
Context-encoder delay Frozen for the first 500 steps while the predictor warms up
Optimizer AdamW, cosine schedule, peak learning rate 5e-5
Loss Plain smooth-L1 latent prediction loss

Evaluation

The encoder is frozen and evaluated with a 12-class linear probe over component representations. A component representation is the mean of the encoder patch features overlapping its rectangle. The probe is trained from the 4,000-page seed split and evaluated on the held-out 5,000-page test split.

Result Test macro F1
This checkpoint (seed 0) 62.66

In the paper (Table 2), random masking gains +1.7 macro F1 over the frozen SigLIP2 encoder (61.5), averaged over three pretraining seeds (seed standard deviation ±0.71). The released checkpoint is pretraining seed 0; its score above is the one the evaluation code reproduces.

Usage

from PIL import Image
from transformers import AutoImageProcessor, Siglip2VisionModel

repo_id = "Wix/ui-encoder-random"
processor = AutoImageProcessor.from_pretrained(repo_id, use_fast=False)
model = Siglip2VisionModel.from_pretrained(repo_id).eval()

image = Image.open("page.png").convert("RGB")
inputs = processor(images=image, return_tensors="pt")
outputs = model(**inputs)
patch_features = outputs.last_hidden_state

Load the bundled image processor with use_fast=False, as in the example: the reported evaluation resizes with Pillow, and the fast processor (used when torchvision is installed) gives slightly different pixel values. This is a vision encoder, not a component detector or a 12-class classifier; downstream tasks require their own pooling and prediction head.

Intended use and limitations

The model is intended for research on webpage and user-interface representations, frozen feature extraction, and downstream fine-tuning. It was continued-pretrained on screenshots from a single website-building platform, so performance may not transfer unchanged to other platforms, mobile UIs, or natural images. The reported score is specific to the paper's component-level linear-probe protocol.

Citation

Citation metadata will be added with the camera-ready paper.

License

Wix’s contributions to this fine-tuned checkpoint are released under the Creative Commons Attribution-NonCommercial 4.0 International license.

This checkpoint is based on Google SigLIP2 SO400M Patch16 NaFlex. Google’s applicable upstream terms remain Apache 2.0. See NOTICE for attribution and a description of the modifications.

Downloads last month
-
Safetensors
Model size
0.4B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for Wix/ui-encoder-random

Finetuned
(17)
this model

Collection including Wix/ui-encoder-random