Run this model with HF Jobs
Run Wix/ui-encoder-ours-bal on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/Wix/ui-encoder-ours-bal. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/Wix/ui-encoder-ours-bal on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use Wix/ui-encoder-ours-bal with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Wix/ui-encoder-ours-bal with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="Wix/ui-encoder-ours-bal")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("Wix/ui-encoder-ours-bal") model = AutoModel.from_pretrained("Wix/ui-encoder-ours-bal", device_map="auto") - Notebooks
- Google Colab
- Kaggle
SigLIP2 + efficient packed I-JEPA — ours+bal (component-conditioned masking, class-balanced loss)
This repository contains the seed-0 context encoder from the paper's
ours+bal 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,
class-balanced patch loss, 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 and loss variant: ours+bal
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.
The +bal variant re-weights the loss so that every class's masked patches carry the same total weight, however many patches the class contributes. The mask decides which patches become prediction targets; loss balancing decides how much gradient the targets from each class carry.
DOM rectangles and class annotations are used only during pretraining. 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 | Smooth-L1 latent prediction, class-balanced (+bal) |
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) | 68.13 |
In the paper (Table 5), ours+bal gains +3.7 macro F1 over random⁺ (64.6), averaged over three pretraining seeds: the largest gain, best in nine of the twelve classes. 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-bal"
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 and component labels shaped pretraining but do not make the released encoder a DOM parser or component classifier. 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
- 33
Model tree for Wix/ui-encoder-ours-bal
Base model
google/siglip2-so400m-patch16-naflex