Instructions to use Wix/ui-encoder-ours with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Wix/ui-encoder-ours with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="Wix/ui-encoder-ours")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("Wix/ui-encoder-ours") model = AutoModel.from_pretrained("Wix/ui-encoder-ours", device_map="auto") - Notebooks
- Google Colab
- Kaggle
SigLIP2 + efficient packed I-JEPA — component-conditioned masking
This repository contains the seed-0 context encoder from the paper's
ours 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, component-conditioned masking, 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
Component-conditioned masking can create dozens of target blocks on one page. Running the predictor separately for every block would repeat the same visible context many times. Our implementation instead predicts every target block in one packed pass: one sequence contains the visible context followed by all target-block queries, and a block-aware attention mask keeps the blocks independent. Each target query can attend to the shared context and to queries from its own block, but not to queries from other blocks. The visible context is encoded once per page, so compute follows the number of patches rather than repeating with the number of components. Packing changes the execution cost, not the I-JEPA objective or the released encoder architecture.
Masking variant: ours
During pretraining, the page's DOM supplies the rectangle of every mapped UI component. The sampler visits components from smallest to largest. For each, it samples a target share between 50% and 70% and places a contiguous target block inside its rectangle, aiming to hide part of the component while preserving visible context. It adds no target blocks on non-component background. A component too small to hold both a target and visible context contributes no target, and a page on which no component supplies a target block falls back to one random block.
Component identity does not change the allocation: the mask uses component rectangles, not their class frequencies. DOM rectangles are used only to build the pretraining mask. At inference time the encoder consumes pixels alone and does not require DOM data, rectangles, or class labels.
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) | 66.00 |
In the paper (Table 2), component-conditioned masking gains +4.5 macro F1 over the frozen SigLIP2 encoder (61.5), averaged over three pretraining seeds (seed standard deviation ±0.21). Its lead over random⁺, +1.3 macro F1, holds across the three seeds (paired t-test, p = 0.045). 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-ours"
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. DOM structure shaped the pretraining masks but does not make the released encoder a DOM parser. 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
- 39
Model tree for Wix/ui-encoder-ours
Base model
google/siglip2-so400m-patch16-naflex