Run this model with HF Jobs

Run Wix/ui-encoder-random-plus-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-random-plus-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-random-plus-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.

SigLIP2 + efficient packed I-JEPA — rnd⁺+bal (random⁺ masking, class-balanced loss)

This repository contains the seed-0 context encoder from the paper's rnd⁺+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, random+ 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

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 and loss variant: rnd⁺+bal

The mask is the same as random+: each page uses sixteen randomly positioned rectangular target blocks, each covering 2–8% of the page. The count and scale are corpus-level hyperparameters; target placement is not matched to the components on each page.

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 class annotations affect only the loss weighting, not where targets are placed, and are not needed at inference time.

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) 66.63

In the paper (Table 5), the class-balanced loss lifts random⁺ (64.6) by +2.0 macro F1, averaged over three pretraining seeds. 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-plus-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. 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
36
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-plus-bal

Finetuned
(18)
this model

Collection including Wix/ui-encoder-random-plus-bal