Small vision-language models, meaning models that read an image and answer questions about it in text, often misread diagrams. They invent axis values, miss a point where two lines meet, or confuse which segment a label names. Then they reason correctly from the wrong picture. We propose having the model first write a short drawing program, for example Matplotlib code, that reproduces the diagram as it understands it. The program is executed, and the rendered drawing is compared with the original image by a fixed, non-learned image-matching routine. That routine reports which drawn elements fail to line up and which parts of the original went undrawn. The model repairs only the flagged lines of code and keeps an edit only if the mismatch shrinks. The model then answers the question by computing over the verified program instead of over its own impression of the pixels.
This matters because the evidence on where multimodal models fail is split. Much of that failure is perceptual, and a model cannot catch it by rereading its own reasoning. MATH-Vision attributes 31.9% of GPT-4V errors to misrecognition and 42.2% to reasoning. CodePercept finds that, across 4B to 32B scales, scaling perception pays off more than scaling reasoning. Plot Twist shows that chart accuracy falls from 79% to about 30% once answer-revealing titles are removed. A redraw-and-compare loop gives a small model something it currently lacks: an outside check on its own reading of the image that does not depend on its own eyes.
Core Claim
For a 7B–8B vision-language model, feedback from redrawing the diagram should buy more accuracy per unit of test-time compute than text self-critique, tool-assisted critique, or extra samples. The condition is that the comparison is deterministic and localized to individual drawing primitives. We expect the gain to be concentrated in the perception share of errors. The loop also makes that share measurable: every final answer comes with a scene program and a residual mismatch score, so a wrong answer from a well-matched program is a reasoning error by construction.
The closest work is ChartIR, and it differs in two ways. ChartIR iteratively renders chart code and compares it with a reference chart. Its goal is reproduction on Plot2Code and ChartMimic, not answering questions, and it has the model itself describe the differences. Plot Twist's fragility results suggest that is exactly the step a small model does badly. We instead make the difference signal non-learned and tied to specific lines of code, and we use the verified program as the substrate for reasoning.
How This Relates to Prior Work
Three lines of work motivate the proposal by exposing the gap. MATH-Vision and Plot Twist document misreading. GeoSQA shows that even perfect human transcriptions of diagrams leave text models near chance. This is a constraint on our claim: fixing perception cannot fix everything, and we treat the reasoning share as out of scope except where the verified program allows direct computation.
Several papers supply the method. EvoVLM shows that an 8B model improves sharply once it sees its candidate curve overlaid on the data. It stays within one-dimensional time series, and the model judges the overlay itself. DSR maps Lean compiler errors to subtrees of an operator tree so a 7B model can repair locally, outperforming 32B models on ProofNet. We borrow that idea of error localization, with pixel mismatch per primitive playing the role of compiler errors. CodePercept supplies image-to-code training data (ICC-1M, one million image-caption-code triplets) and a single-pass perception model. We add the test-time loop it lacks.
Several papers constrain the design. Yan et al. report that compiler-feedback refinement plateaus after 2–3 rounds and can cycle. BR-RM finds that reflection beyond two turns makes models hallucinate flaws. Following Fang et al., we therefore cap iterations and roll back any edit that increases mismatch.
Finally, several papers are competitors rather than components. Agent0-VL already puts code execution inside both a solver and a verifier at 7B/8B scale, with confidence-gated local patching. But it uses the sandbox as a calculator and cropper and never checks a reconstruction against the image. MMC refines chain-of-thought with a critic trained by tree search, so its checks remain linguistic. VDebugger and De-fine debug visual programs using text traces or a queried vision model, and neither verifies an explicit scene model against pixels.
Research Program
The system has three stages that share one 7B–8B backbone, starting from Qwen2.5-VL-7B.
In the first stage, the model writes a scene program. We fine-tune on ICC-1M through the Qwen-CodePercept code so that the model writes code in a restricted, primitive-per-line style: points, segments, circles, arcs, text labels, bars, axis ticks. Each primitive carries a stable identifier, so every drawn pixel can be traced to exactly one line of code.
In the second stage, the program is checked and repaired. The program is rendered and aligned to the original image by an affine fit on edge maps. We then compute a per-primitive score. Let $E$ be the set of edge pixels in the original image and $R_p$ the rendered pixels of primitive $p$. The precision score for primitive $p$ is
$$ s_p = \frac{|\{x \in R_p : d(x, E) \le \tau\}|}{|R_p|}, $$
where $d(x,E)$ is the distance from pixel $x$ to the nearest original edge pixel and $\tau$ is a small tolerance of a few pixels. Original edge regions that no primitive covers are grouped into "missing" blobs. Primitives with low $s_p$, together with any missing blobs, are handed to the model along with an image crop of each flagged region and the offending lines of code. The model rewrites only those lines. The total mismatch is recall loss plus the summed $(1-s_p)$, and a rewrite is kept only if total mismatch falls. This guarantees a monotone perceptual objective and at most three rounds. For text labels and tick values, the check compares the rendered glyph region with the original region at the same location, so reading an axis wrong shows up as a localized mismatch.
In the third stage, the model reasons over the verified program. It answers by writing a second, solver program that imports the scene program's objects. For charts this means computing over the reconstructed data values. For geometry it means combining the diagram's structure, taken from the verified program (which points lie on which lines, which lines intersect), with the numeric givens stated in the problem text, because competition figures are not drawn to scale. Where the text fully determines the configuration, the answer can be computed numerically.
The analysis output is an error decomposition that needs no human labeling. A wrong answer whose final mismatch falls below a threshold counts as a reasoning failure. A wrong answer with high residual mismatch counts as a perception failure. We validate this automatic labeling against MATH-Vision's human error categories on a sample of problems.
Baselines
The naive reference point is the same Qwen2.5-VL-7B answering directly and with chain-of-thought. MATH-Vision reports that chain-of-thought sometimes hurts, so both are needed. For scale context, GPT-4o scores 30.39% accuracy on MATH-Vision against 68.82% for humans (MATH-Vision).
The single-pass reference is our own stage one followed directly by stage three, with no repair. This is essentially CodePercept-style perception feeding a program-based solver. It isolates whether iteration matters at all.
The strongest existing competitor is Agent0-VL-8B (Agent0-VL), because it is the only small-model system that already combines code execution, a verifier, and local repair on MathVision, MathVista, and ChartQA. The file reports only that it improves 12.5% on average over Qwen2.5-VL-7B across seven benchmarks and outperforms GPT-4o on MathVista and ChartQA. No per-benchmark number was found on Lacuna for Agent0-VL on MATH-Vision or ChartQA, so we will rerun its released checkpoint under our protocol. The second strong competitor is MMC (MMC), which raises Qwen2-VL-7B on MathVista from 58.2% to 68.1% after four refinement steps. That is the reported figure to beat for iterative refinement on MathVista, and we will also rerun it on our backbone if its critic is available. For ChartQA, the reference is MatCha with LAMENDA-generated reasoning data at 72.6% relaxed accuracy overall and 53.9% on the human-written split (Synthesize Step-by-Step).
Fairness is enforced by matching test-time compute. Every iterative method, and a best-of-N self-consistency baseline, gets the same budget of generated tokens and the same number of sandbox executions per question. Any method we fine-tune gets the same data budget, meaning ICC-1M plus no benchmark training data.
Two ablations isolate the key ingredient. The first replaces the deterministic per-primitive mismatch with a ChartIR-style difference description written by the model itself after viewing both images. The second keeps the deterministic score but hands the model a single global number instead of localized primitives, which is EvoVLM-like global feedback.
Beating the field means the following. The full system must exceed Agent0-VL and compute-matched best-of-N on MATH-Vision and on the ChartQA human split. It must exceed both ablations by a margin larger than seed variance. And on Chart101 it must show the largest relative gain, since that benchmark is almost purely perceptual.
Why not just…?
Why not just sample many answers and take a majority vote? This is the most serious threat. If misreadings are random rather than systematic, voting fixes them cheaply. Plot Twist's results argue that they are systematic: removing titles collapses accuracy across models, and ChartLlama scores 4.2% on scatter-plot coordinates. Such errors should recur across samples. The compute-matched best-of-N baseline settles this directly. If it matches the full system on Chart101 and the ChartQA human split, the proposal's main claim is false.
Why not just let the model compare the two images itself, as ChartIR does? It is simpler and needs no alignment code. But it asks a small model to perform the very fine-grained comparison that Plot Twist shows it cannot do, and ChartIR's Qwen2-VL gain on Plot2Code was modest (3.12 to 3.54). The first ablation tests this head on. If self-described differences match the deterministic score, the pixel-checking component is unnecessary and we would say so.
Why not just use Agent0-VL-style tools, such as cropping, zooming, and a calculator, inside a trained verifier? Cropping raises effective resolution but still leaves the judgment to the model's own perception. Redrawing gives a check whose ground truth is the image itself. Agent0-VL also needs roughly 200k teacher-distilled trajectories plus reinforcement learning, whereas our loop runs at test time on a perception model trained without benchmark data. We run it as the main baseline, and we also test whether adding our redraw check on top of Agent0-VL helps. That would show the two approaches are complementary rather than redundant.
Why not just use a larger model? GPT-4o at 30.39% on MATH-Vision, and about 18% on transformation geometry, shows that scale leaves the gap open. We report GPT-4o direct accuracy on the same subsets purely as context.
Proposed Experiments
The main evaluation uses the geometry-heavy MATH-Vision disciplines, where diagram structure carries the problem, together with MathVista, ChartQA with both splits reported, Chart101 using its 5%-tolerance range accuracy and collective accuracy, and CodePercept's STEM2Code-Eval for reconstruction fidelity. No reported scores were found on Lacuna for STEM2Code-Eval, so we will generate our own.
Four checks decide the outcome. The first is the Chart101 gain relative to the ChartQA gain. Because Chart101 has no textual shortcuts, a real perceptual fix should help most there. The second is whether final mismatch predicts correctness. If low-mismatch programs are not more often right, the check is not measuring what matters. The third is how MATH-Vision failures shift between categories. Perception-labeled errors should fall while reasoning-labeled errors stay roughly constant, which would give a direct, instrumented answer to the MATH-Vision versus CodePercept disagreement. The fourth is the accuracy-versus-iteration curve under rollback, which should be monotone with gains saturating by round two or three, in contrast to the cycling that Yan et al. report for unguarded loops.
The proposal fails if compute-matched best-of-N or the model-judged comparison ablation comes within noise of the full system. It also fails if reconstruction gains on STEM2Code-Eval do not translate into answer accuracy. That outcome would mean reading the diagram correctly is not the bottleneck for small models, contrary to CodePercept's scaling result.
References
- Measuring Multimodal Mathematical Reasoning with MATH-Vision Dataset
- CodePercept: Code-Grounded Visual STEM Perception for MLLMs
- Plot Twist: Multimodal Models Don't Comprehend Simple Chart Details
- Improved Iterative Refinement for Chart-to-Code Generation via Structured Instruction
- GeoSQA: A Benchmark for Scenario-based Question Answering in the Geography Domain at High School Level
- EvoVLM: Multimodal Evolutionary Feedback for Visual Symbolic Regression
- Decompose, Structure, and Repair: A Neuro-Symbolic Framework for Autoformalization via Operator Trees
- CodeTransOcean: A Comprehensive Multilingual Benchmark for Code Translation
- Think Twice: Branch-and-Rethink Reasoning Reward Model
- MEIC: Re-thinking RTL Debug Automation using LLMs
- Agent0-VL: Exploring Self-Evolving Agent for Tool-Integrated Vision-Language Reasoning
- MMC: Iterative Refinement of VLM Reasoning via MCTS-based Multimodal Critique
- VDebugger: Harnessing Execution Feedback for Debugging Visual Programs
- De-fine: Decomposing and Refining Visual Programs with Auto-Feedback
- Synthesize Step-by-Step: Tools, Templates and LLMs as Data Generators for Reasoning-Based Chart VQA