Abstract
The HTP (Hierarchical Table Prompt-based reprogramming) framework transforms Large Language Models (LLMs) into expert data visualization recommenders without altering core model weights. By employing a four-level "soft prompting" strategy, HTP bridges the gap between structured tabular data and the reasoning strengths of LLMs. The framework achieves state-of-the-art performance, significantly outperforming traditional baselines and even surpassing GPT-4 in specific visualization tasks.
Introduction
Automating visualization recommendation—selecting the optimal chart for a given dataset—is a fundamental challenge in data science. Existing solutions typically fall into two categories: rule-based systems, which are often brittle and labor-intensive, and traditional machine learning models, which frequently struggle to capture the multi-level structural relationships within tabular data.
While Large Language Models (LLMs) excel at reasoning, they face a significant "mismatch" when processing structured, numerical tables, as they were primarily designed for unstructured text. Furthermore, fine-tuning massive models for specialized tasks is computationally prohibitive and risks "catastrophic forgetting." HTP addresses this by "reprogramming" a frozen LLM to understand table structures through learned soft prompts.
Methodology
HTP utilizes Prompt-based Reprogramming, where trainable vectors (soft prompts) are prepended to the input data to guide the frozen model's behavior. The framework employs a hierarchical approach with four distinct prompt levels:
- General-level: Captures broad dataset distributions to enhance generalization.
- Instance-level: Employs a vision-based Contrastive Learning approach on chart images to create a "Style Query," mapping table features to visual styles (e.g., "bar-chart-ness").
- Cluster-level: Groups similar tables using K-Means based on statistical features to recognize recurring patterns.
- Column-level: Uses a specialized attention mechanism to preserve the structural relationship between headers and cell values.
The framework uses Bloom (1.1B) as its frozen backbone, demonstrating that even relatively small LLMs can be highly effective when prompted correctly.
Experimental Setup
The researchers utilized two primary data sources for evaluation:
- Plotly Community Feed: A dataset of 116,528 visualization pairs (tables matched with JSON chart specifications) across six chart types.
- Image Dataset: 125,121 chart images collected from the web to train the "Style Query" for the instance-level prompt, providing the LLM with a "perceptual" understanding of visual representations.
Results and Discussion
HTP significantly outperformed existing benchmarks like VizML and KG4Vis across multiple metrics:
- Chart Type Accuracy: HTP achieved 78% accuracy, representing a 22.7% absolute improvement over the previous state-of-the-art.
- Overall Recommendation: In terms of getting both the chart type and axes correct, HTP showed a 32.8% absolute improvement on table-level metrics.
- Comparison with GPT-4: In head-to-head tests, the 1.1B parameter HTP model consistently outperformed GPT-4, particularly in selecting the correct chart type.
Ablation studies (as shown above) confirm that the hierarchical structure is vital; removing components like the column-level prompt (COLP) or the instance-level prompt (INSP) leads to significant performance degradation, highlighting the importance of structural and visual awareness in table-to-visual mapping.
Conclusion and Future Work
HTP demonstrates that specialized soft prompting can effectively repurpose frozen LLMs for complex structured data tasks without the need for expensive fine-tuning. While currently focused on data-encoding (axes and chart types), future work will aim to expand recommendations to include aesthetic choices like colors and fonts, and explore permutation-invariant architectures to improve robustness against table row/column ordering.
Summary updated