TinyChart: Efficient Chart Understanding with Program-of-Thoughts Learning and Visual Token Merging

Liang Zhang, Anwen Hu, Haiyang Xu, Ming Yan, Yichen Xu, Qin Jin, Ji Zhang, Fei HuangEMNLP 2024

Introduction

Multimodal Large Language Models (MLLMs) have demonstrated remarkable capabilities in general image understanding. However, charts and plots present a distinct set of challenges that traditional MLLMs often struggle to overcome. Charts are dense with information, requiring high-resolution processing to capture small text and fine lines, and they necessitate precise numerical reasoning to interpret data correctly. Historically, addressing these challenges has required scaling models to 13B parameters or more, which increases computational costs and limits deployment flexibility.

TinyChart introduces a paradigm shift by achieving state-of-the-art performance in chart understanding with only 3B parameters. By integrating Visual Token Merging (ToMe) and a Program-of-Thoughts (PoT) learning framework, TinyChart outperforms models four times its size and rivals closed-source giants like GPT-4V.

The Computational and Cognitive Hurdles of Charts

Chart understanding is bottlenecked by two primary factors: visual resolution and reasoning accuracy.

  1. Visual Resolution: Unlike natural images, charts contain critical information in tiny OCR-heavy elements. Standard resolutions (e.g., 224x224 or 336x336) often blur these details, leading to errors. Increasing resolution to 768x768 or higher significantly improves performance but results in a quadratic increase in visual tokens, overwhelming the language model's context window.
  2. Numerical Reasoning: LLMs are notoriously poor at arithmetic. When asked to calculate growth rates or averages from a chart, models often "hallucinate" calculations even if they correctly identify the raw data points.

Methodology: Efficiency and Logic

TinyChart is built upon the TinyLlava architecture, utilizing a SigLIP vision encoder and the Phi-2 language model. To address the aforementioned hurdles, the researchers introduced two core innovations.

Visual Token Merging (ToMe)

Charts often contain significant visual redundancy, such as uniform backgrounds and repetitive grid lines. TinyChart employs a parameter-free Visual Token Merging module within the Vision Transformer (ViT). This module identifies and merges the most similar visual tokens at each layer. By reducing the number of tokens passed to the language model, TinyChart can process high-resolution (768x768) images without the proportional increase in computational overhead. This allows the model to focus its "attention" on information-dense regions like data points and labels.

Program-of-Thoughts (PoT) Learning

To solve the "mental math" problem, TinyChart adopts a Program-of-Thoughts approach. Instead of predicting a final numerical answer directly, the model is trained to generate executable Python code (using the NumPy library). This code serves as a structured reasoning path. The model identifies relevant data from the chart, assigns them to variables, and writes the logic required for the calculation. A Python interpreter then executes this code to produce the final, mathematically accurate result. This offloads the burden of calculation from the neural network to a deterministic execution environment.

Data and Training

The model was trained on a comprehensive multitask collection of 1.36 million samples. A key contribution is the ChartQA-PoT dataset, which contains over 140,000 pairs of questions and corresponding Python code. This dataset was synthesized by using GPT-3.5-turbo to transform standard ChartQA questions into programmatic reasoning tasks based on human-written templates.

In addition to ChartQA-PoT, the training pipeline included standard benchmarks such as PlotQA, DVQA, and OpenCQA for general question answering, as well as Pew and Statista for chart-to-text tasks.

Experimental Results

TinyChart demonstrates that size is not the only determinant of performance. On the ChartQA benchmark, TinyChart-3B achieved an accuracy of 83.60%, significantly higher than the 13B-parameter ChartAst (79.90%) and the 13B-parameter LLaVA-1.5 (38.80%). Notably, it also surpassed the performance of GPT-4V (78.50%).

Beyond accuracy, TinyChart offers substantial efficiency gains. It achieves an inference throughput of 3.14–3.65 iterations per second, roughly double the speed of its 13B-parameter counterparts. On the complex ChartX benchmark, TinyChart maintained its edge, outperforming GPT-4V in QA tasks (33.35 vs 33.04), proving its ability to generalize across diverse and intricate chart formats.

Limitations and Future Directions

Despite its successes, TinyChart faces certain limitations. The authors noted that the model occasionally struggles with spatial estimation when explicit labels or grid lines are absent—for example, estimating the exact value of a bar based solely on its relative height. Furthermore, while the model excels at common chart types, it can struggle with highly complex or rare formats like 3D bar charts. Future work will likely focus on improving spatial grounding and expanding the diversity of the training data to include more specialized visualization formats.

Conclusion

TinyChart represents a significant step forward in efficient multimodal learning. By combining intelligent visual compression with programmatic reasoning, it proves that a 3B-parameter model can achieve and even exceed the performance of much larger models in specialized domains like chart understanding. This opens the door for high-performance, low-latency document and data analysis on a wider range of hardware.

Summary updated

BibTeX
@inproceedings{zhang2024tinychart,
  author = {Liang Zhang and Anwen Hu and Haiyang Xu and Ming Yan and Yichen Xu and Qin Jin and Ji Zhang and Fei Huang},
  title = {{TinyChart: Efficient Chart Understanding with Program-of-Thoughts Learning and Visual Token Merging}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2024},
  doi = {10.18653/v1/2024.emnlp-main.112},
}
Figure