TL;DR
This paper introduces "Doc2Chart," a novel framework for automatically generating charts from long documents based on user intent, without requiring pre-selected data or fine-tuning. It addresses the challenge of extracting relevant information from complex documents and selecting appropriate visualizations, outperforming existing methods in chart data accuracy and chart type selection.
What Problem Does This Paper Address?
Creating effective data visualizations from lengthy documents like financial reports or scientific papers is a time-consuming and complex task. While existing methods can generate charts from structured data (like tables) or short text descriptions, they often require manual data selection or extensive task-specific fine-tuning. This makes them impractical for real-world scenarios where users need to extract insights from entire documents based on a high-level intent. The paper tackles the challenge of directly generating charts from raw, long documents, guided by user intent, in a zero-shot setting, ensuring both data accuracy and appropriate chart type selection.
Methods
Doc2Chart employs a multi-stage, unsupervised framework:
- Iterative Data Extraction and Refinement: An LLM first decomposes the user's intent to guide the extraction of relevant information from the document. This extracted data undergoes a validation and refinement process, where it's checked for accuracy, completeness, and relevance. If issues are found, the system iteratively re-extracts or refines the data until a satisfactory level of alignment with the intent and source document is achieved.
- Chart Type Prediction: A heuristic-guided module, leveraging an LLM, analyzes the refined data's structure (e.g., data types, number of points, categories) and the user's intent to recommend the most suitable chart type. This includes providing a justification and confidence score for the choice.
- Code Generation: Finally, an executable chart code (using Matplotlib) is generated based on the extracted data and the selected chart type.
The paper also introduces a novel attribution-based metric, CHARTEVAL, to assess chart data accuracy by tracing generated chart values back to their source tables in the document, avoiding reliance on visual decoding.
Datasets
The authors curated a new dataset consisting of 1,242 <intent, document, chart> tuples. This dataset is derived from:
- Finance: U.S. Securities and Exchange Commission (SEC) 10-K filings.
- Scientific: Academic papers from *ACL conferences (SCIDUET dataset).
This dataset differs from existing ones by using long documents as input, rather than pre-selected tables or short text descriptions. They also mention including plausible chart type variants, increasing the total chart count to 2.2K.
Key Insights and Ideas
- Intent-driven generation from raw documents is feasible: The paper demonstrates that it's possible to generate meaningful charts directly from lengthy, unstructured documents by carefully decomposing intent and iteratively refining extracted data.
- Iterative refinement is crucial for accuracy: The multi-stage extraction and validation process significantly improves the factual correctness of the data used for chart generation, addressing issues like hallucinations and omissions.
- Heuristics enhance chart type selection: Combining LLM capabilities with predefined visualization heuristics leads to more appropriate chart type recommendations, going beyond simple LLM instructions.
- Attribution is key for reliable evaluation: The proposed CHARTEVAL metric offers a more robust way to assess chart data fidelity by grounding it in the source document, which is essential for building trust in AI-generated visualizations.
Key Results
Doc2Chart consistently outperforms baselines in chart data accuracy and chart type selection across four different LLMs (GPT-40, Gemini-2.0, Claude-3.5-Sonnet, and LLaMA-3.1-8B-Instruct). For example, with GPT-40, Doc2Chart achieved 75.18% chart data accuracy, a significant improvement over single-step generation (67.38%) and LLM retrieval with query decomposition (57.09%). Human evaluations also rated Doc2Chart outputs higher than those from baselines across various criteria, including data correctness, completeness, and insightfulness.
Limitations and Future Work
- Vague Intents: User intents can be ambiguous, leading to multiple valid interpretations. The current framework doesn't incorporate dynamic user feedback for clarification.
- Context Window Limitations: Scaling the approach to handle multiple, very long documents simultaneously remains a challenge due to LLM context window limitations.
- Reference-Based Attribution: The current attribution metric is primarily reference-based. Extending it to a reference-free setup is a future direction, though it might face challenges with ambiguous values appearing multiple times in a document.
- LLM Hallucinations: Despite efforts to ensure faithfulness, LLMs can still produce flawed outputs. Future work should explore uncertainty estimation, user-in-the-loop validation, and better safeguards.
- Future Work: The authors suggest extending attribution to specific text spans, developing more flexible evaluation strategies for chart type selection, and exploring interactive mechanisms for user feedback.
Summary updated