Which bar is the model talking about? ChartLens explained
Put a bar chart in front of a multimodal LLM and ask in how many countries the number of import documents in 2005 is above the 2005 average across countries. It answers “3” in a full sentence, instantly, and with total confidence. Now ask yourself how you would check that. You would have to read six bars, compute a mean, and count. The model did none of that visibly. If it misread one bar, the text would look exactly the same.
Text LLMs got a partial fix for this years ago: citations. Make the model point at its source and a human can verify the claim in seconds. Charts never had an equivalent. Our ACL 2025 paper, ChartLens: Fine-grained Visual Attribution in Charts, with Puneet Mathur, Nedim Lipka, Franck Dernoncourt, Ryan Rossi, and Dinesh Manocha, gives charts their citations: the specific bars, points, or pie sectors that an answer rests on.
The idea in one picture
Walkthrough: the documents-per-shipment chart
The running example is Figure 1 of the paper, a PlotQA-style chart of the number of documents required per shipment to import goods, for six countries in 2005, 2006, and 2007. I redraw it below so each stage can be shown on the same bars.
1. A chart, a question, and someone's answer
The input (chart \(c\) plus response \(v\)) is the image and a question-answer pair. The answer could come from any system, a chart QA model or a person; ChartLens does not regenerate it. The job is to return the set of chart regions that justify “3”, and it has to be relevant (every region matters), complete (nothing needed is missing), and precise (nothing extra).
2. Find every bar
Before any language model is involved, classical vision finds the candidates. We binarize the image with Otsu thresholding on both RGB and HSV, invert if the background is dark, extract contours, and split each contour by unique pixel value so a group of touching bars separates into three. Solidity and area thresholds drop stray shapes. Because these heuristics are brittle on low-contrast charts and can pick up grid lines or labels, we sample \(n\) points inside each candidate and hand them to the Segment Anything Model (SAM), which returns a tight mask per bar and only weak masks for grid lines and text, so those fall away. For this chart the result is eighteen masks.
3. Stamp a label on each element
Each mask gets an alphanumeric label drawn directly on the image, following set-of-marks (SoM) prompting. Reading left to right, Algeria’s three bars become 1, 2, 3, Angola’s 4, 5, 6, and so on through Australia’s 16, 17, 18. From here on the model never has to name a position in pixels; it names a label, and we already know which mask that label points to.
4. The model checks the answer against the chart
The marked image goes to the MLLM (GPT-4o in our experiments) with a prompt that explains what chart attribution is, gives a few textual examples of question, answer, and attribution, and asks for chain-of-thought reasoning in two steps. Step one is validation: is the answer consistent with the chart? For our question the model has to read the six 2005 bars, take their mean, and count how many exceed it.
5. The model names the marks that support it
Step two is attribution: which labeled elements support the answer? The model returns 1, 4, and 16, the 2005 bars for Algeria, Angola, and Australia. We map those labels back to their SAM masks and highlight them. The reader’s verification problem has shrunk from “read this chart” to “count these three bars”, and the count matches the answer.
6. The same pipeline on a wrong answer
Now the second question from Figure 1: “In which year did Armenia have the maximum number of documents required per shipment to import goods?” with the answer 2006. Armenia’s bars read 6, 6, 8, so the maximum is 2007, and the validation step flags the response as inconsistent. The attribution still grounds the answer to the bar it depends on, Armenia’s 2006 bar (mark 14), and one glance shows it is not the tallest of the three. That is what a chart-response misalignment looks like when it is made visible.
Under the hood
| Symbol | Meaning |
|---|---|
| \(c \in \mathcal{C}\) | A chart image, \(c = \mathcal{I}^{w \times h \times 3}\) |
| \(v \in \mathcal{R}_c\) | A response associated with chart \(c\) (a question and its answer) |
| \(\mathcal{A}_{c,v}\) | The attribution set: chart regions that support \(v\) |
| \(a_i\) | One region, corresponding to an element of \(c\) (bar, sector, point, line segment) |
| \(f\) | The attribution function ChartLens implements |
| \(n\) | Number of points sampled per candidate as SAM prompts |
| \(D, G\) | Detected regions (after IoU matching) and ground-truth regions |
The task is post-hoc fine-grained visual attribution for charts. Given a chart and a response, produce
\[\mathcal{A}_{c,v} = \{a_1, a_2, \ldots, a_n\}\]where each \(a_i\) is a distinct chart element that supports \(v\), subject to relevance (each \(a_i\) bears on \(v\)), completeness (\(\mathcal{A}_{c,v}\) covers all the evidence needed to justify \(v\)), and precision (no irrelevant parts of the chart). The whole method is a mapping
\[f : (c, v) \mapsto \mathcal{A}_{c,v}\]and the design question is how to make an MLLM implement \(f\) when it cannot reliably output coordinates. ChartLens answers by turning region selection into label selection: the candidate set of elements is computed by segmentation, and the model chooses a subset of labels.
Mark generation. Bars follow the pipeline in step 2. Pie charts take the largest contour of the binarized image, fit its minimum enclosing circle, unroll the pie along the radial axis into a strip, and detect complete edges in that strip as sector boundaries, which map back to slices. Both then pass through SAM with sampled point prompts (facebook/sam-vit-large). Lines are thin, overlapping, and intersecting, so contour heuristics do not apply; we use LineFormer, a transformer-based line extractor, and divide each recovered line into equally spaced segments along its horizontal extent so that a point on a line has a mark to refer to.
Attribution prompt. The prompt has three parts: a description of chart attribution, few-shot textual examples of question-answer pairs with their attributions, and an instruction to reason step by step through validation (is the QA pair consistent with the chart?) and then attribution (which labeled elements support the answer?). For line charts the model returns pairs of marked points between which the attributed span lies; those pairs are treated as bounding-box corners.
Scoring. For bars and sectors, a predicted region counts as a match if it overlaps a ground-truth region at \(\text{IoU} \geq 0.9\). With \(D\) the matched detections and \(G\) the ground truth,
\[P = \frac{|D \cap G|}{|D|}, \qquad R = \frac{|D \cap G|}{|G|}, \qquad F1 = \frac{2 \cdot P \cdot R}{P + R}.\]Lines are scored by detection rate (the fraction of ground-truth points covered, a recall-like measure) and by the percentage of the chart’s area the attribution covers, because a method can reach high detection by painting most of the chart.
ChartVA-Eval. To measure any of this we built a benchmark of 1,244 queries over three subsets. ChartVA-AITQA renders synthetic charts from airline SEC-filing tables (301 queries, 203 bar and 98 line charts, one attribution each). ChartVA-PlotQA uses synthetic scientific charts from World Bank Open Data, Open Government Data, and the Global Terrorism Database (595 queries, 396 bar and 199 line charts, 2.4 attributions on average, up to 12). ChartVA-ChartQA uses real charts from Statista, Pew Research, Our World in Data, and OECD, with pie charts oversampled (348 queries: 121 bar, 109 pie, 118 line). For the last two, GPT-4o drafted attributions from the underlying tables with template-specific prompts, and three annotators verified relevance and completeness with Cohen’s kappa of 0.89 and 0.84.
What the numbers say
Baselines are zero-shot GPT-4o bounding-box prompting, Kosmos-2, and LISA; ChartLens uses GPT-4o as its MLLM.
| Method | Bar: AITQA F1 | Bar: PlotQA F1 | Bar: ChartQA F1 | Pie: ChartQA F1 |
|---|---|---|---|---|
| Zero-shot GPT-4o | 22.77 | 3.30 | 7.75 | 7.17 |
| Kosmos-2 | 0.51 | 1.01 | 3.13 | 11.70 |
| LISA | 1.62 | 0.34 | 1.01 | 2.41 |
| ChartLens | 69.28 | 34.65 | 64.14 | 48.56 |
On line charts ChartLens covers 59.14%, 51.84%, and 77.8% of ground-truth points on the three subsets while flagging 1.25%, 9.98%, and 5.34% of the chart area; LISA and Kosmos-2 reach high detection mainly by covering 27% to 63% of the chart, so ChartLens uses 3 to 50 times less area. Across chart types this is a 26-66% improvement in fine-grained attribution over the baselines. Qualitatively, GPT-4o tries to be specific but cannot localize through text coordinates, and LISA and Kosmos-2 return generic components such as the whole pie regardless of the question.
Try it
- Paper page: /papers/chartlens/
- arXiv: 2505.19360
- Code and the ChartVA-Eval benchmark: github.com/MananSuri27/ChartLens
- ACL Anthology: 2025.acl-long.1094