Skeleton Queries: Retrieving Worked Examples for Chart Reasoning by Computation, Not Content

When a vision-language model fails a chart or diagram math problem, the error analyses agree on the cause. It usually sees the picture well enough but does not know which sequence of operations to carry out. One cheap fix is to hand the model a solved example that needs the same sequence of steps. Finding that example is a retrieval problem, and the standard trick for hard retrieval is generative query expansion: have a language model write out a hypothetical answer, then search with that answer instead of the short original question. We argue this trick is wrong for reasoning problems. A fully written hypothetical solution is expensive to generate. It also matches stored examples on surface content such as topics, entities, titles, and numbers. On public benchmarks that content overlaps heavily with memorized near-duplicates of the test items. The expansion should instead be a skeleton: a twenty-token description of the computation ("read series A at the last year, read series B at the last year, subtract, divide by B"). Search then matches examples by what must be computed rather than by what the chart is about.

Testing this claim requires an evaluation the field lacks: freshly generated chart problems whose ground-truth computation is known exactly. With such problems, "relevant example" has a precise definition (same computation graph) and memorization cannot help. We propose to build that generator. We will use it to measure three things together: how much retrieval with each kind of expansion helps reasoning, how much latency each expansion adds before search begins, and how much of the apparent gain on static benchmarks is leakage.

Core Claim

For multimodal reasoning questions, a short operation-skeleton expansion retrieves worked examples that help as much as or more than a full hypothetical-solution expansion in the style of HyDE, at a small fraction of the pre-retrieval generation cost. Its gains also survive the move from static benchmarks to freshly generated problems, while the gains of full-solution expansion shrink. A secondary claim is that the skeleton can sometimes be read off the model's internal state before any text is generated, which removes the expansion latency entirely.

The motivating evidence comes from four lines of work. MATH-Vision assembles 3,040 competition math problems with diagrams; its GPT-4V error analysis attributes 42.2% of errors to reasoning and 31.9% to visual recognition, so supplying the plan targets the larger failure mode. Plot Twist probes chart understanding with elementary questions and finds that accuracy reaches 79% when the title contains the answer and falls to about 30% when the title is neutral or misleading. Any expansion that copies surface text such as titles will therefore pick up shortcuts. HyDE supplies the method we challenge: generate a fake document and embed it, which lifts TREC DL19 nDCG@10 from 44.5 to 61.3, at the cost of a full generation before search. DyVal and A²RBench supply the evaluation idea and constrain how we design it. DyVal builds reasoning problems from randomly generated directed acyclic graphs, under which static-benchmark leaders like WizardMath-13B score near zero. A²RBench verifies generated tasks by checking that a generated transformation and its inverse cancel, and it reports a 17.7% drop when symbols are remapped. Both work only on text or symbol grids, and the research file names visually grounded dynamic benchmarks as largely unexplored.

Research Program

The first component is a verified chart-problem generator. Each item starts from a randomly sampled computation graph over chart primitives: read the value at a coordinate, take an argmax or argmin, difference, ratio, sum over a range, or compare two series. The generator then samples a data table consistent with the graph and renders the chart with matplotlib. Rendering varies chart type, color, grid lines, and legend placement. Titles are set to one of three conditions: neutral, misleading, or answer-revealing. The question is produced from a template set paraphrased by an LLM, and the gold answer is computed by executing the graph on the table. The generator also writes worked solutions for a separate example bank. Because every item carries its graph, two items count as relevant to each other exactly when their graphs are isomorphic after abstracting away the specific series and coordinates. This gives free relevance labels with no human judgment, which DyVal's text-only graphs could not provide for images. We restrict to charts because rendering and verification are exact there; diagram geometry is left out on purpose.

The second component is a set of expanders that turn an (image, question) pair into a search query. The skeleton expander is the same multimodal model, prompted, and in a second variant lightly fine-tuned on generated pairs, to emit the operation sequence in a fixed small vocabulary. The full-solution expander is HyDE transplanted to this setting: the model writes a complete hypothetical worked solution, including a final number. The probe expander follows Knowing Before Saying, which shows that a small classifier on the hidden state at the last prompt token predicts whether chain-of-thought will succeed with 60–76.4% accuracy. We train a similar classifier to predict the skeleton from that state, so no expansion tokens are generated at all. If this works, it is a cheap stand-in for the continuous-thought compression of CoLaR and MARCOS. Those methods cut reasoning length by over 80% or speed inference 15.7×, but only on text math and without any retrieval interface.

The third component is the retrieval and answering loop. Worked examples are indexed by their skeleton text, their full solution text, and an image-plus-question embedding. The top three retrieved examples are placed in context, as in DCoT. DCoT retrieves from a fixed bank of 80 text demonstrations and reports gains of +2.47% on MM-Bench and +3.0% on ScienceQA. Our bank is large and partly drawn from public chart training data, so it can contain near-duplicates of static test items. That property is what lets us measure leakage. We run open models from the families used in this literature, Qwen2.5-VL and InternVL3, at two sizes each.

The fourth component is a leakage analysis on static benchmarks. We record how often each expander's top retrieval is a near-duplicate of the test item (same chart source or near-identical question). We also record how often the full-solution expander's ungrounded hypothetical answer already equals the gold answer. If that rate clearly exceeds the model's grounded accuracy on fresh items of matched difficulty, it signals memorization.

Baselines

The naive reference point is the same model answering with no retrieval and no chain-of-thought, plus the same model with a plain "think step by step" prompt. Both run on identical items, decoding settings, and answer parsing. Relaxed accuracy counts an answer correct within 5%, the same margin Plot Twist uses.

The strongest existing method on static chart reasoning in the file is Synthesize Step-by-Step. Synthesize Step-by-Step converts charts to tables with DePLOT and trains on sub-questions paired with Python code, and it reports 53.9% accuracy on the human-written ChartQA split, up from 38.2%. We report this number as the static reference. Where we can, we reproduce its table-plus-program pipeline on our generated items, because explicit decomposition is the obvious rival to retrieved worked examples. For MATH-Vision the reference is GPT-4o at 30.39%, as reported by MATH-Vision. On our generated benchmark: no reported result found on Lacuna for any method, so all numbers there come from our own runs.

The strongest retrieval competitor is full-solution expansion in the HyDE style. To keep the comparison fair, the same model generates both expansions, and both use the same encoder, bank, number of retrieved examples, and prompt-tuning budget. The skeleton expander beats it if accuracy on fresh items is at least as high while pre-retrieval tokens and wall-clock time drop several-fold. A second competitor is expansion-free retrieval by image-plus-question embedding. We include a frozen-backbone embedding in the spirit of SLQ, which reaches 67.5 on MMEB by training only small latent query tokens. Its training budget will match the skeleton fine-tuning budget. The key ablation is an oracle skeleton query built from the true graph. This separates "skeleton retrieval helps" from "the model predicts skeletons well". A shuffled-skeleton control checks that gains come from the computation match and not just from adding any examples.

Why not just…?

Why not just prompt for chain-of-thought and skip retrieval? MATH-Vision reports that chain-of-thought helps vision-language models inconsistently and sometimes lowers accuracy, and it adds hundreds of tokens per answer. Our no-retrieval chain-of-thought baseline measures this directly on fresh items. If chain-of-thought alone matches skeleton retrieval at similar total token cost, retrieval adds nothing and we will say so.

Why not just retrieve by image and question embedding, with no expansion? This is the most serious threat, because it has zero expansion latency. Our concern is that embeddings cluster by chart type and topic rather than by computation. The generator tests this exactly: it produces pairs with the same graph rendered as different charts, and pairs with different graphs rendered as near-identical charts. Skeleton-match@k on these pairs settles the question. If embedding retrieval reaches skeleton-match comparable to the skeleton expander, the expansion step is unnecessary. In that case the contribution shrinks to the benchmark and the leakage analysis.

Why not just extract the data table and run text-only expansion? The pipeline would be DePLOT followed by text HyDE. Two pieces of evidence count against it. ChartQA found table-only models fail on questions that refer to visual attributes like "the orange line". GeoSQA found models still fail when diagrams are transcribed into text. We include color- and position-referenced questions in the generator and run this pipeline as a baseline. A table-based skeleton is also a legitimate variant: if it wins, that suggests skeletons should be predicted from tables rather than from pixels.

Why not just deduplicate static benchmarks? Plot Twist and DyVal both show that shortcuts and memorization survive standard curation. Our leakage measurements quantify how much of the retrieval gain on ChartQA and MATH-Vision disappears when we move to fresh items.

Proposed Experiments

The decisive check is a two-by-three comparison: static benchmarks (human-written ChartQA, MATH-Vision) versus freshly generated items, crossed with skeleton, full-solution, and embedding retrieval. The prediction is that full-solution expansion gains more on static data than on fresh data, while skeleton expansion keeps its gain on fresh data. Leakage indicators should account for the gap. A second check reports accuracy under neutral, misleading, and answer-revealing titles and under grid-line perturbations. We expect full-solution expansion to be more sensitive to titles because it copies them into the query. A third check traces accuracy against pre-retrieval latency, measured in tokens and milliseconds on fixed hardware, across the probe, skeleton, and full-solution expanders. This tells us whether the zero-generation probe keeps most of the skeleton's benefit. A fourth check bins fresh items by graph depth, following DyVal's difficulty levels, to see whether retrieved worked examples help more as plans get longer.

The proposal is falsified if full-solution and skeleton expansion degrade equally from static to fresh items, or if embedding retrieval matches skeleton retrieval on graph-isomorphic pairs.