UIPress: Bringing Optical Token Compression to UI-to-Code Generation
Organizations: The Chinese University of Hong Kong China · Peking University China · University of Chinese Academy of Sciences China · University of Technology Sydney Australia ·
Abstract
UI-to-Code generation requires vision-language models (VLMs) to produce thousands of tokens of structured HTML/CSS from a single screenshot, making visual token efficiency critical. Existing compression methods either select tokens at inference time using task-agnostic heuristics, or zero out low-attention features without actually shortening the sequence -- neither truly reduces prefill latency or adapts to the non-uniform information density of UI screenshots. Meanwhile, optical (encoder-side learned) compression has shown strong results for document OCR, yet no prior work has adapted this paradigm to UI-to-Code generation. We propose UIPress, a lightweight learned compression module inserted between the frozen ViT encoder and the LLM decoder of Qwen3-VL-8B. UIPress combines depthwise-separable convolutions, element-guided spatial reweighting, and Transformer refinement to compress 6{,}700 visual tokens to a fixed budget of 256. Together with Low-Rank Adaptation (LoRA) on the decoder to bridge the representation gap, the entire system adds only 21.7M trainable parameters (0.26% of the 8B base model). Under a fair comparison on the same base model against four baselines on Design2Code, UIPress at 256 tokens achieves a CLIP score of 0.8127, outperforming the uncompressed baseline by +7.5% and the strongest inference-time method by +4.6%, while delivering 9.1 time-to-first-token speedup. To the best of our knowledge, UIPress is the first encoder-side learned compression method for the UI-to-Code task.
Figures & tables
| Method | Type | Tokens | Compress. | CLIP | 95% CI | TTFT (ms) | Lat. (s) |
| No compression | |||||||
| Qwen3-VL (native) | — | 6,517 | 1.0 | 0.7563 | [0.710, 0.794] | 384 | 124.1 |
| Inference-time (training-free) | |||||||
| Resolution scaling (480px) | resolution | 845 | 7.7 | 0.7768 | [0.749, 0.804] | 69 | 94.0 |
| VisionZip-256 ( Yang and others, 2024 ) | selection | 256 | 25.5 | 0.7333 | [0.705, 0.761] | 45 | 110.4 |
| EfficientUI (60% prune) ( Yun and others, 2024 ) | element | 730 | 8.9 | 0.7523 | [0.724, 0.780] | 99 | 99.5 |
| Configuration | CLIP | |
| Full UIPress (Conv+Pool+Refine+LoRA) | 0.8127 | — |
| LoRA (compressor only) | 0.7046 | 0.108 |
| Transformer refinement | 0.7940 | 0.019 |
| Depthwise-sep. std Conv | 0.8020 | 0.011 |
| LoRA only (no compressor, 6,517 tok.) | 0.7610 | 0.052 |
| Compressor only (no LoRA) | 0.7046 | 0.108 |
| Compress. | CLIP | Lat. (s) | |
|---|---|---|---|
| 64 | 102 | 0.6890 | 48.2 |
| 128 | 51 | 0.7250 | 49.1 |
| 256 | 25.5 | 0.8127 | 52.5 |
| 512 | 12.7 | 0.8150 | 65.3 |
| Method | CLIP (WebSight) | Rel. |
|---|---|---|
| Baseline (native) | 0.845 | — |
| Resolution (480px) | 0.777 | 8.0% |
| VisionZip-256 | 0.733 | 13.3% |
| UIPress -256 | 0.872 | +3.2% |
| Page Type | Base / UIPress | ||
|---|---|---|---|
| Text-heavy (blogs) | 12 | 0.782 / 0.843 | +7.8% |
| Layout-rich (dashboards) | 18 | 0.756 / 0.826 | +9.3% |
| Image-heavy (galleries) | 12 | 0.732 / 0.775 | +5.9% |
| Complex (e-commerce) | 8 | 0.748 / 0.770 | +2.9% |
Appendix figures & tables1 asset
Supplementary material from the paper’s appendix.