ASE 2026 41st IEEE/ACM Int'l Conf. on Automated Software Engineering

Pattern Over Pixels Measuring Pattern Completion Bias in Multimodal Code Generation

Khai-Nguyen Nguyen, Oscar Chaparro, Antonio Mastropaolo

William & Mary

69.78%
mean bias rate
card width patterns
80.22%
mean bias rate
text font-size patterns
5 / 5
frontier MLLMs affected
across 1,440 screenshots

The problem

Plausible code that ignores the pixels

Screenshot-to-code benchmarks mostly measure page-level fidelity: does the output look like the input? But a model can produce globally plausible HTML/CSS while silently normalizing away a small, intentional local deviation — a card that is deliberately wider, a nav item deliberately larger.

These are exactly the errors that matter in front-end work. The output looks broadly correct, so the mistake survives review, yet the generated code fails to preserve the precise design detail the developer intended.

What the figure shows. One post card has width:__ while every sibling is width:100%. Sonnet‑4.6 observes that the card extends past its container and computes the right ratio (≈118% → 120%) — then discards its own calculation to “match the others.”
A model computes the correct card width of 120 percent, then discards its own answer to match the repeated pattern.

Abstract

Multimodal large language models (MLLMs) are increasingly used to translate webpage screenshots into front-end code, but repeated UI patterns may sway them toward visually incorrect yet pattern-consistent outputs. We test how repeated webpage patterns hurt MLLM accuracy on an objective screenshot-to-code fill-in-the-blank task. We introduce the first benchmark for visual pattern-completion bias, where one localized element in a repeated UI pattern is perturbed and the model must recover the masked width or font-size value from the screenshot and HTML context. Starting from 30 webpages curated from Design2Code, we build 1,440 evaluated screenshots spanning structural card and text-style patterns under standard and noise-overlaid conditions. We evaluate five frontier MLLMs and find that all are strongly biased toward the repeated baseline. Mean bias rate reaches 69.78% on card-width perturbations and 80.22% on text font-size perturbations, while mean accuracy is only 21.17% and 7.89%, respectively. Reasoning analysis shows that greater reasoning effort correlates with lower bias, yet qualitative evidence reveals that models can identify the anomalous element and still override it with the pattern-consistent answer.

The benchmark

Pattern2Code

We start from 484 Design2Code webpages and keep the 30 with clear repeated UI structures. From each page we extract one card pattern and one text pattern, normalize every element in the pattern to 100%, then perturb exactly one element.

Pattern2Code construction pipeline: 484 webpages filtered to 30, one element perturbed across three positions and four magnitudes, rendered under two image conditions.
Benchmark construction. From 484 webpages we retain 30 with repeated UI structures, perturb one element per pattern across three positions and four magnitudes, and render each under standard and noise-overlaid conditions — 1,440 screenshots per model.
30
real webpages
720
masked instances
1,440
screenshots / model
5
frontier MLLMs

The task

The model sees a rendered screenshot and the element's HTML with the target value masked:

You are doing a visual code fill-in-the-blank task. Given the webpage
screenshot and HTML snippet below, fill the blank token __ with ONLY the
missing CSS/HTML value. The goal is to predict the masked value to recreate
the {pattern} in the webpage design. Return the final answer in JSON format:
{"answer":"<value>"}. The blank must be a percentage value divisible by 10.
Correct — the true perturbed value Bias-aligned — the repeated baseline 100% Other error — neither

Main result

All five models default to the pattern

Accuracy / Bias / Other Error (%) under the standard image condition. Bars under the bias column show its magnitude.

Outcome distribution per modelCorrectBias-aligned (100%)Other errorCODE-SPECIALIZEDCodex-5.3width68.626.4font-size13.970.615.6Opus-4.6width6.487.8font-size88.16.4GENERAL-PURPOSEChatGPT-5.3width8.369.422.2font-size10.366.922.8Sonnet-4.6width8.183.38.6font-size8.979.411.7Flash-3.0width14.481.9font-size96.1Meanwidth21.269.89.1font-size7.980.211.90%25%50%75%100%
Show the underlying numbers (accuracy / bias / other, %)
Model Card patterns — width Text patterns — font-size
Acc.BiasOther Acc.BiasOther
Code-specialized
Codex-5.3 68.6126.395.00 13.8970.5615.56
Opus-4.6 6.3987.785.83 5.5688.066.39
General-purpose
ChatGPT-5.3 8.3369.4422.22 10.2866.9422.78
Sonnet-4.6 8.0683.338.61 8.8979.4411.67
Flash-3.0 14.4481.943.61 0.8396.113.06
Mean 21.1769.789.06 7.8980.2211.89
Code specialization does not save you. Codex-5.3 is by far the most visually grounded model (68.61% on cards) — yet Opus-4.6, also code-specialized, is among the most biased (87.78% cards, 88.06% text). And every model collapses on fine-grained text perturbations.

Analysis

Bias tracks visual saliency

Three independent knobs — noise, magnitude, position — all modulate the same underlying variable: how hard the deviation is to see. Each one below pairs the claim with a demonstration built from real benchmark screenshots and the measured result across all five models.

01

Noise amplifies bias

Overlaying eight opaque rectangles raises mean card bias 69.78% → 73.89% (+4.11). Text bias is already near ceiling, so it moves less (+1.84).

The rectangles never cover the target element — they only make the page noisier to read. The layout is byte-for-byte identical in both renders.

Standard
A forum thread rendered normally.
Noise-overlaid
The same forum thread with opaque rectangles overlaid at random positions.
Bias rate under the standard and noise-overlaid conditionsEach row runs from the standard render to the noise-overlaid render of the same instances.Card patterns (width)050100Text patterns (font-size)050100Codex-5.3+4.44+4.44Opus-4.6+2.22+2.22ChatGPT-5.3−1.67+1.39Sonnet-4.6+6.11+1.12Flash-3.0+9.440.00Mean+4.11+1.84standardnoise-overlaid (red = bias rose, green = fell)
Show the underlying numbers (bias rate, %)
Model Card bias rate (%) Text bias rate (%)
StandardNoiseΔ StandardNoiseΔ
Code-specialized
Codex-5.326.3930.83+4.4470.5675.00+4.44
Opus-4.687.7890.00+2.2288.0690.28+2.22
General-purpose
ChatGPT-5.369.4467.78−1.6766.9468.33+1.39
Sonnet-4.683.3389.44+6.1179.4480.56+1.12
Flash-3.081.9491.39+9.4496.1196.110.00
Mean69.7873.89+4.1180.2282.06+1.84
02

Subtler perturbations are worse

On cards, mean bias climbs 50.7% → 82.2% as the perturbation shrinks from 80% to 110%. Widening is harder to spot than shrinking.

The same element at all four magnitudes, shown at 1:1 scale beneath the unperturbed neighbour above it. At 80% the gap is obvious; at 110% it is a few pixels.

80%
The target post rendered at 80 percent width, outlined in red, below an unperturbed neighbour.
90% · nearest the baseline
The target post rendered at 90 percent width, outlined in red, below an unperturbed neighbour.
110% · nearest the baseline
The target post rendered at 110 percent width, outlined in red, below an unperturbed neighbour.
120%
The target post rendered at 120 percent width, outlined in red, below an unperturbed neighbour.
Mean bias rate by perturbation magnitudeThe two magnitudes nearest the 100% baseline are the hardest to see — and the most biased.025507510050.769.880%69.388.290%82.287.4110%76.975.6120%Bias rate (%)Perturbation magnitudeCard patterns (width)Text patterns (font-size)
Show the underlying numbers (mean bias rate, %)
Family80%90%110%120%
Cards (width) 50.769.3 82.276.9
Text (font-size) 69.888.2 87.475.6
03

Boundaries hide deviations

Middle elements are flanked by pattern-consistent neighbors on both sides, making them most salient: lowest bias 61.67% vs. 73.83% at either boundary.

The same page with the same 120% perturbation moved to each position. Only the middle one can be compared against a neighbour above and below.

First
The first post in the thread is widened.
Middle
A middle post is widened, flanked by unperturbed posts above and below.
Last
The last post in the thread is widened.
0255075100Card bias rate by position within the repeated patternMiddle-position deviations have a pattern-consistent neighbour on both sides. Lower is better.FirstMiddleLastCodex-5.333.3320.0025.83Opus-4.687.5085.8390.00ChatGPT-5.362.5064.1781.67Sonnet-4.690.0074.1785.83Flash-3.095.8364.1785.83Mean73.8361.6773.83
Show the underlying numbers (accuracy / bias, %)
Model FirstMiddleLast
Acc.BiasAcc.BiasAcc.Bias
Code-specialized
Codex-5.362.5033.3374.1720.0069.1725.83
Opus-4.65.8387.509.1785.834.1790.00
General-purpose
ChatGPT-5.37.5062.5010.8364.176.6781.67
Sonnet-4.63.3390.0013.3374.177.5085.83
Flash-3.03.3395.8329.1764.1710.8385.83
Mean16.5073.8327.3361.6719.6773.83

Reasoning effort

More reasoning, much less bias

Only the two OpenAI models report usage_reasoning_tokens, so this analysis covers ChatGPT-5.3 and Codex-5.3. We bin every example by how many reasoning tokens the model spent on it.

Reasoning effort versus outcomeEach point is one effort bin, placed at the log₂ of its mean reasoning-token count.Marker area grows with the number of examples in the bin.Bias rate (%) — lower is better025507510093.240.839.778.148.140.339.3806 of 1,440 ChatGPT-5.3 answers (56%) use no reasoning at all— and 93.2% of those land on the biased answer.Accuracy (%) — higher is better02550751002.221.321.320.845.647.544.01416642561,024Mean reasoning tokens in bin (log scale)ChatGPT-5.3Codex-5.3
Show the underlying numbers
ModelMean tokensExamplesAccuracyBias
ChatGPT-5.308062.293.2
ChatGPT-5.3~6549821.340.8
ChatGPT-5.3~15013621.339.7
Codex-5.3~9836120.878.1
Codex-5.3~20136045.648.1
Codex-5.3~32236047.540.3
Codex-5.3~61235944.039.3
01

Answering without thinking is answering with the pattern

ChatGPT-5.3 spends zero reasoning tokens on 806 of 1,440 examples (56.0%). Those answers are biased 93.2% of the time and correct only 2.2% of the time.

02

A little deliberation halves the bias

Once reasoning kicks in at ~65 tokens, ChatGPT-5.3's bias drops to 40.8% and accuracy rises to 21.3%. Codex-5.3 falls from 78.1% bias at ~98 tokens to 40.3% at ~322.

03

But it plateaus — and stops paying

Beyond the threshold the curves flatten. Codex-5.3's longest bin (~612 tokens) is worse on accuracy than its ~322-token bin (44.0% vs. 47.5%), while bias barely moves.

Less bias is not the same as more accuracy. Extra deliberation reliably pulls these models away from the reflexive 100% answer — but past a point it redirects them toward a different wrong value rather than toward the pixels. Note also that reasoning length is observed, not controlled: the models choose how much to reason per example, so this is a correlation, not the effect of forcing longer reasoning.

Mechanism

Why do they fail?

We classified all 237 biased responses that contain a free-text rationale using an LLM judge (gpt-5.4-mini, temperature 0), validated against 30 blind hand-labeled traces (29/30 agreement).

26.2%
MODE A

Code-anchored

Reasons only from the HTML and never references the screenshot. The baseline answer is a default, not a visual judgment.

“All other boxes use width:100%, so the blank is 100%.”

59.1%
MODE B

Perceived-consistent

Looks at the screenshot but reports the element as visually matching its neighbors. The deviation is in the pixels but never registers.

“The three buttons appear the same width, so 100% to match others.”

14.8%
MODE C

Observed-then-overrode

Explicitly notes that the element looks different — sometimes computing the right value — then answers the baseline anyway.

“The post extends beyond the container (~120%); 100% is most consistent.”

The bias is mostly perceptual, not deliberate. In ~74% of verbalized biased responses the model demonstrably engages the screenshot — it simply fails to register the deviation (mode B). The dramatic “saw it and discarded it” override (mode C) is real, but rarer and highly model-dependent (45.5% for Opus-4.6 vs. 4.3% for Flash-3.0).

Qualitative evidence

Caught in the act

Models perceive the deviation, say so out loud, and override it anyway.

Screenshot in which the Translators panel is rendered narrower than its sibling panels.
“The Translators card appears to be about 80% of the full width compared to the other cards which span 100%. […] However, examining more carefully […] It's most likely also 100% to match the consistent layout of all four cards.”
Ground truth 80% Answered 100%

(a) Opus-4.6 estimates the width correctly, then talks itself out of it.

Screenshot in which the Message input field is rendered narrower than the fields above it.
“The ‘Message’ field's input is visibly narrower than the input fields above it. […] it spans a significantly smaller portion of the row […] 100% is the most consistent choice despite the visual rendering of the box inside.”
Ground truth 80% Answered 100%

(b) Flash-3.0 names the deviation, then explicitly overrules the pixels.

Interactive

Try it yourself

Each page below contains one element that deviates from its repeated pattern. Can you spot it before you reveal it? Then copy the prompt and see whether your own model follows the pixels or the pattern.

cards/standard/360_card-mid_w-120pct.png
Forum thread in which one post block is rendered wider than the others.

Masked HTML snippet

<div class="post" style="width:100% !important;">
    <div class="posttop">
     <div class="username">
      xlandguy
     </div>
     <div class="date">
      06-14-2012, 12:49 PM
     </div>
    </div>
    <div class="posttext">
     Please see my post HERE (http://forums.offshoreelectrics.com/showthread.php?35318-Gsbuikman-scammed-me-then-closes-threads), thank you.
    </div>
   </div>
<div class="post" style="width:100% !important;">
    <div class="posttop">
     <div class="username">
      Rumdog
     </div>
     <div class="date">
      06-14-2012, 04:23 PM
     </div>
    </div>
    <div class="posttext">
     again...?
    </div>
   </div>
<div class="post" style="width:100% !important;">
    <div class="posttop">
     <div class="username">
      SFC K
     </div>
     <div class="date">
      06-14-2012, 04:28 PM
     </div>
    </div>
    <div class="posttext">
     Did he finally get in touch with you to make you change this? I read it earlier this morning and looked at the pictures again and the way you described the boat and pictures something was up.
    </div>
   </div>
<div class="post" style="width:__ !important;">
    <div class="posttop">
     <div class="username">
      xlandguy
     </div>
     <div class="date">
      06-14-2012, 05:35 PM
     </div>
    </div>
    <div class="posttext">
     Yes, well at first it seemed as though I couldnt get any response. Turns out he was busy doing something, grandma sick.
    </div>
   </div>
<div class="post" style="width:100% !important;">
    <div class="posttop">
     <div class="username">
      wht73
     </div>
     <div class="date">
      06-15-2012, 04:21 PM
     </div>
    </div>
    <div class="posttext">
     I had similar problem with another member and suggested the same thing.  I was rewarded with no reply to suggestion of small partial refund 2x.
     <br>
     <br>
     I feel ya brother.
    </div>
   </div>
<div class="post" style="width:100% !important;">
    <div class="posttop">
     <div class="username">
      ron1950
     </div>
     <div class="date">
      06-17-2012, 12:44 AM
     </div>
    </div>
    <div class="posttext">
     wow miust have really missed something here
    </div>
   </div>
<div class="post" style="width:100% !important;">
    <div class="posttop">
     <div class="username">
      xlandguy
     </div>
     <div class="date">
      06-26-2012, 08:25 PM
     </div>
    </div>
    <div class="posttext">
     wow miust have really missed something here
     <br>
     <br>
     Well you can catch it all right HERE (http://forums.offshoreelectrics.com/showthread.php?35318-Gsbuikman-scammed-me-then-closes-threads).
    </div>
   </div>
One post block is rendered at width: 120%; every sibling is 100%. Ground truth 120%
cards/standard/6998_card-mid_w-80pct.png
Library record page in which one information panel is rendered narrower than the others.

Masked HTML snippet

<li class="list-group-item level-2 panel-color-top" style="width:100% !important;">
          <h4 class="list-group-item-heading">
           Authors
          </h4>
          <ul>
           <li>
            <a>
             Raymond  Frederick Surburg
            </a>
           </li>
           <li>
            <a>
             David P. Scaer
            </a>
           </li>
           <li>
            <a>
             Eugene F. Klug
            </a>
           </li>
           <li>
            <a>
             Harold Herman Buls
            </a>
           </li>
          </ul>
         </li>
<li class="list-group-item level-2 panel-color-top" style="width:100% !important;">
          <h4 class="list-group-item-heading">
           Editors
          </h4>
          <p>
           There are no editors for this item.
          </p>
         </li>
<li class="list-group-item level-2 panel-color-top" style="width:__ !important; position:relative !important; z-index:20 !important;">
          <h4 class="list-group-item-heading">
           Translators
          </h4>
          <p>
           There are no translators for this item.
          </p>
         </li>
<li class="list-group-item level-2 panel-color-top" style="width:100% !important;">
          <h4 class="list-group-item-heading">
           Compilers
          </h4>
          <p>
           There are no compilers for this item.
          </p>
         </li>
One information panel is rendered at width: 80%; every sibling is 100%. Ground truth 80%
texts/standard/60_navtext-first_fs-120pct.png
Landing page whose first navigation item is rendered in a larger font than its siblings.

Masked HTML snippet

<a class="featuresLink" title="Check out other great Tripod features" style="font-size:__ !important;">
         Features
        </a>
<a class="pricingLink" title="Tripod plan comparisons and pricing" style="font-size:100% !important;">
         Pricing
        </a>
<a title="Tripod's Team Blog for the latest Tripod updates" style="font-size:100% !important;">
         Blog
        </a>
<a class="helpLink" title="Help and support for your Tripod and Zeeblio websites" style="font-size:100% !important;">
         Help
        </a>
One nav item is rendered at font-size: 120%; every sibling is 100%. Ground truth 120%
texts/standard/360_navtext-mid_fs-80pct.png
Forum page whose middle breadcrumb item is rendered in a smaller font than its siblings.

Masked HTML snippet

<a style="font-size:100% !important;">
     Offshore Electrics Forums
    </a>
<a style="font-size:100% !important;">
     Swap Shop
    </a>
<a style="font-size:__ !important;">
     Items for Sale
    </a>
<a style="font-size:100% !important;">
     Seller feedback
    </a>
<span class="breadcrumb-current" style="font-size:100% !important;">Not real happy</span>
One breadcrumb item is rendered at font-size: 80%; every sibling is 100%. Ground truth 80%

Prompt

You are doing a visual code fill-in-the-blank task. Given the webpage screenshot and HTML snippet below, fill the blank token __ with ONLY the missing CSS/HTML value. The goal is to predict the masked value to recreate the {pattern} in the webpage design. Return the final answer in JSON format: {"answer":"<value>"}. The blank must be a percentage value divisible by 10.

All 720 instances and 1,440 screenshots are on Hugging Face.

Implications

What this means

Trust coarse layout, verify fine styling

Screenshot-to-code output can be trusted for broad structure, but not for the fine-grained styling that matters in polished front-end work — spacing, sizing, hierarchy.

Page-level metrics hide this

Because the failure restores a plausible value, outputs still score well on global similarity metrics. Localized, controlled edits are needed to expose it.

Verification is cheap

Re-render the generated code and compare the target element's computed CSS against the screenshot. That single check catches the most egregious cases.

BibTeX

@inproceedings{nguyen2026pattern,
  title     = {Pattern Over Pixels: Measuring Pattern Completion Bias
               in Multimodal Code Generation},
  author    = {Nguyen, Khai-Nguyen and Chaparro, Oscar and Mastropaolo, Antonio},
  booktitle = {Proceedings of the 41st IEEE/ACM International Conference on
               Automated Software Engineering (ASE)},
  year      = {2026}
}