Language models that fix their own code usually get feedback as text: an error message, a failed assertion, or a dump of variable values. Human programmers, especially novices, often debug better when they can watch the program run, with arrays drawn as rows of boxes, pointers as arrows, and loop iterations as successive frames. This proposal asks whether a vision-language model (a model that reads images as well as text) repairs buggy programs more reliably when its execution feedback arrives as rendered pictures of program state over time. The comparison is against the same information written out as text. The question is sharp because text traces break down in two documented ways. They grow too long to fit when loops run many times, and they force the model to track individual characters and indices through a tokenizer that splits strings into arbitrary chunks.
The core bet is that pictures are not magic, and any gain from them must be shown to come from the picture itself and not from the choice of what to show. We therefore build a single structured trace object for each failing run. We render it three ways: as compact text, as an image of that same text, and as a diagram filmstrip. All three have matched token budgets. We then test a specific, falsifiable prediction. The diagram advantage should be near zero on short straight-line programs. It should grow with the number of executed steps and with the share of index-level and string operations. If the advantage does not follow this pattern, the case for visual execution feedback in automated repair is weak, and that is worth knowing too.
Where this sits
Execution-grounded repair is well established, and every system in it reads text. LDB splits a program into basic blocks and shows the model variable values before and after each block on a failing test. TraceFixer feeds the model actual intermediate states alongside desired ones. Teaching Large Language Models to Self-Debug uses unit-test results, self-explanations and simulated traces. OpenCodeInterpreter loops on interpreter output. These papers motivate the proposal by showing that intermediate state beats terminal pass/fail feedback; LDB's own comparison found function-level feedback too coarse. They also share the representation we want to test against. We reuse LDB's block-level state capture as the content source and change only how that content is presented.
Two text-trace training papers constrain the design. StepCodeReasoner trains a model to predict intermediate states via inserted print statements. To keep sequences manageable it bans these anchors inside loops and caps traces at 10 lines. Code Execution as Grounded Supervision for LLM Reasoning converts debugger logs into natural-language reasoning for fine-tuning. Both show that grounded traces help. Both also expose the length problem we target, and neither runs an interactive repair loop. CRUXEval supplies the motivating weakness: models struggle to simulate execution mentally, partly because sub-word tokens obscure character-level operations.
The closest multimodal work stops short of seeing execution. VDebugger debugs vision-calling programs from textual variable values and names multimodal inspection of intermediate outputs as future work. IterCAD repairs CAD programs over several turns without rendering intermediate geometry, and also lists that as future work. In both cases the program's output is already visual, so rendering it is the obvious next step. Our question is different. We ask whether rendering ordinary, non-visual program execution helps, a setting where the picture is a chosen encoding and not the native output.
On the human side, TraceDiff filtered student traces down to the point where they diverged from a synthesized correct program and showed that point in Python Tutor. Students fixed more bugs that way than with standard execution views. That result cuts both ways for us. It could be the visualization that helped, or it could be the filtering, and our design separates the two. AutoFigure supplies a method lesson we reuse: plan a structured blueprint first, then render it, to avoid layout hallucination. Here the blueprint is the execution trace object itself, so rendering is deterministic and cannot invent state.
Core Claim
For a fixed vision-language model and a fixed budget of input tokens, a filmstrip of rendered program states should yield higher repair success than the same states serialized as text. The filmstrip shows data structures with explicit cell indices, a time axis across loop iterations, and changed cells highlighted. The advantage should increase monotonically with trace length and with the density of indexing and string operations. It should vanish on short traces. The reasoning behind the prediction is that text cost grows linearly with steps × variables, while a fixed-resolution image costs a constant number of visual tokens. Explicit indexed cells also sidestep the tokenizer's fragmentation of strings.
Research Program
The first component is a renderer. It takes the trace object (variables, heap objects, call stack, per-step snapshots captured LDB-style) and produces three forms. The first is a Python-Tutor-like frame per selected step showing lists as indexed cell rows, dicts as tables, references as arrows, and the stack as nested boxes. The second is a summary chart with one row per variable and time across the columns, colour-coded by change. The third is a highlight overlay marking cells that changed since the previous frame. When a loop runs too long, frames are chosen by a fixed rule: the first and last iterations, iterations where the control path changes, and evenly spaced iterations in between. That same selection rule is applied to every text condition, so "what is shown" is held constant.
The second component is the repair loop. The model sees the problem, the code, the failing test, and the feedback in one of the conditions. It proposes a patch, the patch is executed, and the loop repeats up to a turn cap. We record whether the bug is fixed, which line the model blames, how many turns it takes, and how many tokens it consumes. We run one open vision-language model of roughly 7 to 8 billion parameters and one closed frontier model, both of which accept text and images. This lets every condition use the same weights.
The third component is a stratified evaluation set, described under Proposed Experiments.
Baselines
The naive reference is repair from the failing test alone: the problem, the code, the assertion, and its traceback, with no intermediate state. This is the function-level feedback that LDB found too coarse. It sets the floor, and it tells us how much any trace helps before modality enters.
The strongest existing method is LDB with the same backbone. It uses textual basic-block states, block-by-block verification, and regeneration of buggy blocks, with LDB's own prompts and the same turn cap. The published figures are a gain of 9.1% on HumanEval and 8.4% on MBPP for GPT-3.5 LDB, and 95.1% Pass@1 on HumanEval when combined with a Reflexion generator. That last number shows HumanEval is too saturated to separate conditions, which is why we stratify toward harder, longer-running programs. On fresh competitive problems, LiveCodeBench reports GPT-4-Turbo self-repair rising from 24.5% to 36.9% with feedback. On CodeNet, TraceFixer reports 63% top-1 with a trained model. We cite TraceFixer as a reference point only, since its setup differs. Beating LDB means a statistically reliable improvement in repair success on the long-trace buckets of our set, under matched turns and total input tokens, without loss on short traces.
The key ablation is the information-matched structured text trace. It serializes the identical trace object, with the same selected frames, the same changed-cell marks written inline, and the same index annotations, as a compact table at the same token budget as the image. When text exceeds the budget it is truncated from the middle, mirroring what text systems must do. We also give it a generous variant with the full text trace up to the context limit, so that we are not handicapping text.
A second ablation renders that exact text table as an image. It keeps pixels but removes diagram structure, which separates "visual tokens are cheaper" from "diagrams are easier to reason over." A third ablation shows only the final state as a single frame, without the filmstrip, to test whether the temporal sequence matters.
Finally, we run best-of-N sampling from the naive condition, with N chosen to equal the total tokens spent by the filmstrip loop. This addresses the worry that any gain is just extra compute.
Why not just…?
Why not just give the model a well-designed compact text trace? This is the real threat, and the experiments are built around it. TraceDiff's human result may come from filtering rather than drawing, and a model reading a tidy table of selected states with explicit indices may do as well as one reading a picture. The information-matched text condition settles it directly. If it ties the filmstrip in every bucket, we will report that the value lies in state selection and index annotation, and recommend text. We would then redirect the work toward the selection rule, which is still a useful contribution because text systems like StepCodeReasoner currently avoid loops entirely.
Why not just let the model reason through execution in its head with chain-of-thought or self-debugging? CRUXEval reports that chain-of-thought reduced execution-prediction accuracy for smaller models. LDB attributes repair failures to hallucinated intermediate values when execution is simulated mentally. Our self-debug-style condition with simulated traces will be included anyway, run with the same backbone, so this is measured rather than assumed.
Why not just sample more candidates? Self-Debug found a single-candidate debugging loop matching baselines that sampled many times more programs. That finding was on text feedback and older models, so we include compute-matched best-of-N. If best-of-N matches the filmstrip loop on long-trace buckets, the visual loop is not worth its rendering cost.
Why not just train a text model to internalize execution, as StepCodeReasoner does? That approach is strong at predicting outputs. However, it currently excludes loops and caps traces at 10 lines, which is exactly the regime we target, and it predicts behaviour rather than repairing code. If its weights are available we will plug it in as the text-trace reader inside the LDB loop. A positive result for it on long traces would argue for training over rendering.
Proposed Experiments
The evaluation set has four sources. The first is bugged versions of CRUXEval programs, with single-statement mutations whose failing traces are short (3 to 13 lines). This is the bucket where we predict no visual advantage. The second is model-generated failing attempts on LiveCodeBench problems, which give real bugs on fresh problems. The third is TraceFixer's CodeNet and TheAlgorithms bugs together with its 20 real GitHub bugs. The fourth is a stratum of loop-heavy and array- or string-index-heavy LiveCodeBench failures. Every item is bucketed by the number of executed steps on the failing test and by the fraction of steps that perform indexing or string operations. A frozen held-out hidden test suite decides whether a repair counts as correct, so a model cannot pass by overfitting the visible failing test.
The metrics are repair success within the turn cap, turns to first fix, total input and output tokens, and fault-localization accuracy. Localization counts as correct when the line the model blames matches the line changed by the reference fix. We use localization in addition to pass rate because it isolates whether the model understood the trace.
The decisive check is the interaction between condition and trace length. The claim survives only if three things hold. The filmstrip must beat information-matched text by a margin that grows across length buckets. It must also beat rendered-text-as-image, showing that diagram structure and not just image tokens carries the gain. And it must beat the final-frame-only ablation, showing that the temporal sequence matters.
A second check targets the tokenizer explanation. Within the long-trace buckets, the advantage should concentrate in high-index and high-string-operation programs. If it instead appears uniformly, the explanation is token compression alone.
A third check guards against the result holding for only one model: the same qualitative pattern must appear in both the open and the closed backbone.
References
- Debug like a Human: A Large Language Model Debugger via Verifying Runtime Execution Step by Step
- TraceFixer: Execution Trace-Driven Program Repair
- Teaching Large Language Models to Self-Debug
- OpenCodeInterpreter: Integrating Code Generation with Execution and Refinement
- StepCodeReasoner: Aligning Code Reasoning with Stepwise Execution Traces via Reinforcement Learning
- Code Execution as Grounded Supervision for LLM Reasoning
- CRUXEval: A Benchmark for Code Reasoning, Understanding and Execution
- VDebugger: Harnessing Execution Feedback for Debugging Visual Programs
- IterCAD: Iterative Program Repair for CAD Code Generation from Orthographic Views
- TraceDiff: Debugging unexpected code behavior using trace divergences
- AutoFigure: Generating and Refining Publication-Ready Scientific Illustrations
- LiveCodeBench: Holistic and Contamination Free Evaluation of Large Language Models for Code