← Latest papers
💻 computer science

Pattern over Pixels: Measuring Pattern Completion Bias in Multimodal Code Generation

This paper introduces a benchmark demonstrating that multimodal large language models exhibit a strong pattern completion bias when converting webpage screenshots to code, frequently overriding visually perturbed elements with repeated UI patterns even when they possess the reasoning capability to identify the anomalies.

Original authors: Khai-Nguyen Nguyen, Oscar Chaparro, Antonio Mastropaolo

Published 2026-08-05
📖 4 min read☕ Coffee break read

Original authors: Khai-Nguyen Nguyen, Oscar Chaparro, Antonio Mastropaolo

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine you are teaching a robot to paint a picture based on a photo you show it. You give the robot a camera and a set of instructions: "Look at this photo and draw exactly what you see." In the world of computer science, this is called "multimodal" learning, where a computer uses both its "eyes" (to see images) and its "brain" (to understand text and code). Recently, these robots have gotten very good at looking at screenshots of websites and writing the computer code (HTML and CSS) needed to rebuild them. It's like showing a robot a photo of a house and having it instantly write the blueprint to build it. But here's the tricky part: robots are also great at guessing patterns. If you show them a row of identical red balls, and then one blue ball, they might guess the last one is red too, just because "red" is the pattern they expect. This paper asks a scary question: when a robot sees a website, does it actually look at the pixels, or does it just guess based on what it thinks should be there?

The researchers behind this study, Khai-Nguyen Nguyen, Oscar Chaparro, and Antonio Mastropaolo, decided to test this by playing a game of "spot the difference" with some of the smartest AI robots available. They built a special test called "Pattern2Code." Imagine a webpage filled with a stack of identical cards, like a deck of playing cards. The researchers took one card and secretly made it slightly wider or changed the font size of the text on it. Then, they showed the screenshot of this slightly "broken" deck to five different AI models and asked them to write the code for the width or font size of that one weird card. The catch? The code they were given to look at showed that all the other cards were the same size, creating a strong pattern.

The results were a bit like watching a magician who knows the trick but chooses to do it anyway. The AI models were surprisingly bad at ignoring the pattern. When the "weird" card was a big, obvious change (like a card that was 20% wider), the best AI got it right about 69% of the time. But when the change was tiny and subtle (like a font size that was just a little bigger), the models almost completely gave up on looking at the picture. Instead, they just wrote code saying "everything is 100%," matching the pattern, even though the picture clearly showed something different. In fact, for the subtle text changes, the models were wrong more than 80% of the time, blindly following the pattern instead of the visual evidence.

The study found that this "pattern blindness" gets worse when the picture is harder to see clearly. If the researchers added visual "noise" (like random gray blocks) over the image, the models got even more confused and stuck to the pattern. They also found that if the weird card was in the middle of the row, surrounded by normal cards, it was easier for the AI to spot. But if it was at the very edge, the AI was more likely to miss it. Interestingly, even when the AI models did write down in their "thought process" that they saw the weird card and calculated the correct size, they often ignored their own math and changed their answer to match the pattern anyway. It's as if the robot saw the blue ball, thought "that's blue," but then said, "Wait, everyone else is red, so I'll say it's red too."

The researchers conclude that while these AI tools are amazing for getting the general shape of a website right, they cannot be trusted to get the tiny, precise details correct without a human double-checking their work. The more subtle the detail, the more likely the AI is to "hallucinate" a pattern that isn't there. This suggests that for now, we should treat AI-generated code as a rough draft that needs a careful human eye to catch the small mistakes that the robot is too eager to ignore.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →