NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

LLM4Vis: Explainable Visualization Recommendation using ChatGPT

Lei Wang, Songheng Zhang, Yun Wang, Ee-Peng Lim, Yong Wang

LLM4Vis: Explainable Visualization Recommendation using ChatGPT

Introduction

Selecting the optimal visualization for a given dataset—a task known as visualization recommendation—is a complex challenge that requires synthesizing data types, statistical distributions, and design principles. Traditional approaches generally fall into two categories: rule-based systems and machine learning (ML) models. While rule-based systems offer transparency, they are often rigid and difficult to scale. Conversely, deep learning models can achieve high accuracy but typically operate as "black boxes," requiring massive labeled datasets and failing to provide natural language justifications for their recommendations.

To address these limitations, the authors introduce LLM4Vis, a framework that leverages the reasoning capabilities of Large Language Models (LLMs), specifically ChatGPT, to provide accurate and explainable visualization recommendations. By employing a novel "explanation generation bootstrapping" technique, LLM4Vis achieves state-of-the-art performance in few-shot and zero-shot settings with significantly less training data than traditional models.

Methodology

The LLM4Vis framework processes tabular data through a five-stage pipeline designed to translate statistical features into natural language prompts that an LLM can interpret.

The LLM4Vis pipeline, illustrating (a) the explanation generation bootstrapping process and (b) the inference workflow for a test dataset.
  1. Feature Description: Because LLMs are text-centric, tabular data must be serialized. The system extracts 120 single-column features (e.g., data types, distributions) and 80 cross-column features (e.g., correlations) to provide the model with a comprehensive textual "mental picture" of the dataset.
  2. Demonstration Example Selection: To optimize token usage, the system uses a clustering-based retrieval strategy. It identifies the $K$ most similar labeled examples from a small "retrieval set" to serve as in-context demonstrations.
  3. Explanation Generation Bootstrapping: This core novelty addresses the lack of natural language explanations in existing datasets. Through an iterative process, ChatGPT generates an initial explanation, compares its prediction to the ground truth, and receives "hints" to refine its reasoning until the logic aligns with the correct chart type.
  4. Prompt Construction: The selected examples, their refined explanations, and the target dataset's features are integrated into a structured prompt.
  5. Inference: ChatGPT generates a recommendation score for four primary chart types (Line, Scatter, Bar, Box) along with a natural language justification.

Evaluation and Results

The framework was evaluated using the VizML dataset, a large-scale corpus of dataset-visualization pairs. While baseline models were trained on 5,000 samples, LLM4Vis utilized a minimal retrieval set of only 60 samples (15 per chart type). Performance was measured using the Hits@2 metric, which tracks whether the correct chart type appears in the model's top two recommendations.

Performance comparison (Hits@2) for (a) Zero-Shot and (b) Few-Shot LLM4Vis across various ablation configurations.

LLM4Vis demonstrated remarkable accuracy, achieving an overall 85.7% Hits@2 in the dynamic few-shot setting. This significantly outperformed the best full-sample baseline (a Multi-Layer Perceptron at 78.7%) and the best few-shot baseline (Random Forest at 62.0%). Notably, even in a zero-shot configuration, the model reached 79.3%, surpassing models trained on thousands of samples.

Ablation studies (shown in the figure above) highlight the importance of the various components. For instance, removing explanations (-Ex) or feature descriptions (-Des) leads to a measurable drop in performance, confirming that the model's reasoning capabilities are central to its success.

Discussion and Key Insights

The success of LLM4Vis suggests that LLMs excel at visualization recommendation by applying "common sense" design knowledge—such as recognizing that temporal data is best suited for line charts—rather than just performing statistical pattern matching. The "bootstrapping" phase further demonstrates that LLMs can be used to "self-label" training data, creating high-quality "chain-of-thought" examples that improve final inference.

A key takeaway is the efficiency of in-context learning: LLM4Vis achieved superior results with just 5 demonstration examples compared to an MLP trained on 5,000 samples. This "quality over quantity" approach suggests a paradigm shift for specialized domain tasks where labeled data is scarce.

However, challenges remain. The framework is subject to the token constraints of current LLM APIs, and performance can be sensitive to the order of examples in the prompt. Additionally, the cost and latency of commercial APIs may be higher than local ML models. Future work may involve exploring multimodal models like GPT-4V to incorporate visual chart data and expanding the system to support more complex visualization types.

Summary updated

BibTeX
@inproceedings{wang2023llm,
  author = {Lei Wang and Songheng Zhang and Yun Wang and Ee-Peng Lim and Yong Wang},
  title = {{LLM4Vis: Explainable Visualization Recommendation using ChatGPT}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2023},
  doi = {10.18653/v1/2023.emnlp-industry.64},
}
Figure