Phase-wise MLLM Tuning for Multi-framework WebUI Code Generation

Haoran Ma, Linxiao Li, Chenyue Wang, Haochen Sui, Jiechao GaoNeurIPS 2026

TL;DR

Multimodal large language models (MLLMs) are surprisingly good at turning webpage screenshots into plain HTML/CSS, yet they fall apart when asked to juggle modern frameworks like React, Vue, and Angular—often hallucinating Franken-code that fails to compile. This paper introduces a clever "phase-wise" fine-tuning method that measures how well different frameworks get along before training begins. By grouping compatible frameworks together and dynamically gating shared knowledge, the authors get a relatively compact 7B model to outperform frontier giants like GPT-4o and Claude-3.7 in generating runnable, multi-framework UI code.

What Problem Does This Paper Address?

Imagine learning Spanish, Italian, and German simultaneously in the same classroom; you’re almost guaranteed to accidentally slip a German verb into an Italian sentence. MLLMs suffer from a very similar headache—known as negative transfer—when fine-tuned to translate UI screenshots into multiple frontend frameworks at once.

While standard benchmarks usually assume plain HTML/CSS ("Vanilla"), real-world software engineering relies heavily on React, Vue, and Angular, each with strict, mutually incompatible syntax rules and component structures. When you train a model on all of them jointly, conflicting gradient updates tug the shared model parameters in opposite directions. The result? Models mix up HTML class= with React’s className=, forget Angular’s @Component decorators, and output broken code that won't compile.

Methods

Instead of throwing all frameworks into one giant training pot, the authors freeze a Qwen2.5-VL-7B-Instruct backbone and attach lightweight parameter-efficient Adapters: one shared adapter (to capture universal visual layout concepts) and four framework-specific adapters (to handle strict syntax rules).

What’s new here is how they orchestrate the training using two offline signals computed before fine-tuning starts:

  1. Heterogeneity ($\Delta$): First, they normalize the training code to strip away superficial noise like custom variable names and literal text, leaving pure structural syntax. They then measure the statistical distance (Jensen-Shannon divergence) between frameworks' code distributions.
  2. Compatibility ($S$): They pass a small batch of data through the initialized model to look at the "pre-gradients" on the shared adapter. If two frameworks push the shared weights in the same direction (high cosine similarity), they have high synergy.

Using an optimization objective backed by generalization bounds, an algorithm automatically partitions the frameworks into ordered training phases—pairing compatible frameworks like {React, Vue} in Phase 1, and leaving {Vanilla, Angular} for Phase 2. Finally, a deterministic gating mechanism scales how much each framework is allowed to update the shared adapter during training, protecting isolated frameworks from interference.

Datasets

To train their model, the authors constructed a balanced multi-framework fine-tuning dataset (10,862 training, 1,206 validation, and 1,156 test samples) by combining screenshot–code pairs from DesignBench and WebCode2M across Vanilla, React, Vue, and Angular.

Table 1: Dataset statistics per framework.

For evaluation, they tested on two public benchmarks:

  • DesignBench: Evaluates multi-framework generation across all four frameworks, measuring Compilation Success Rate (CSR) and visual fidelity (CLIP similarity of the rendered page).
  • Design2Code: A 484-sample real-world Vanilla HTML/CSS benchmark used to verify that multi-framework specialization doesn't degrade foundational web coding skills.

Key Insights and Ideas

  • Angular needs quarantine (and the math knows it): Without human intervention, the offline statistics gave React and Vue wide-open shared gates ($0.96$ and $0.95$) because their component mental models align well. Conversely, Angular—being the most syntactically strict and divergent—received a gate of 0.00. The model learned to rely entirely on Angular's specific adapter, preventing cross-framework contamination.
  • Cheap offline "pre-gradients" beat expensive online tracking: Measuring gradient alignment once at initialization adds just +2% extra compute cost, yet slightly outperforms tracking gradients live during training (+23% extra cost). Early directional preferences are remarkably reliable proxies for full training dynamics.
  • Learning frameworks boosts plain HTML: Training on multiple frameworks didn't hurt Vanilla HTML/CSS performance on Design2Code; shared structural supervision across diverse UI paradigms actually improved layout and visual reconstruction.

Key Results

On the multi-framework DesignBench benchmark, the proposed 7B model beat both specialized UI coders and massive zero-shot frontier models, achieving an average 90.07% Compilation Success Rate (CSR) and 0.7950 CLIP score (compared to Claude-3.7’s 80.44% CSR / 0.7470 CLIP, and GPT-4o’s 76.48% CSR / 0.7000 CLIP). The jump on strict frameworks was dramatic: Angular CSR rose from 60.29% (Claude-3.7) and 73.89% (ungated baseline) to 81.35%.

Table 2: Results on DesignBench Generation task. Best results are bold; second best are underlined.

On the Vanilla-only Design2Code benchmark, their approach took the top spot in four out of five metrics—including Block Match (94.7 vs. GPT-4o's 93.0) and CLIP (91.3 vs. 90.4)—trailing GPT-4o slightly only in raw text copying (97.9 vs. 98.2).

Ablation studies confirmed that every piece pulls its weight: adding phase scheduling and combined gating steadily climbed from a naive shared+specific adapter baseline (84.79% CSR) up to the full 90.07% CSR.

Table 4: Architecture ablation.

Limitations and Future Work

Not discussed in the paper. (Note: The provided main text concludes at Section 5 without a dedicated limitations or future work section).

Summary updated

BibTeX
@inproceedings{ma2026phase,
  author = {Haoran Ma and Linxiao Li and Chenyue Wang and Haochen Sui and Jiechao Gao},
  title = {{Phase-wise MLLM Tuning for Multi-framework WebUI Code Generation}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=v877QpbW7u},
}
Figure