LLM 4 V is: Explainable Visualization Recommendation using C hat GPT (2023)

Abstract: Data visualization is a powerful tool for exploring and communicating insights in various domains. To automate visualization choice for datasets, a task known as visualization recommendation has been proposed. Various machine-learning-based approaches have been developed for this purpose, but they often require a large corpus of dataset-visualization pairs for training and lack natural explanations for their results. To address this research gap, we propose LLM4Vis, a novel ChatGPT-based prompting approach to perform visualization recommendation and return human-like explanations using very few demonstration examples. Our approach involves feature description, demonstration example selection, explanation generation, demonstration example construction, and inference steps. To obtain demonstration examples with high-quality explanations, we propose a new explanation generation bootstrapping to iteratively refine generated explanations by considering the previous generation and template-based hint. Evaluations on the VizML dataset show that LLM4Vis outperforms or performs similarly to supervised learning models like Random Forest, Decision Tree, and MLP, in both few-shot and zero-shot settings. The qualitative evaluation also shows the effectiveness of explanations generated by LLM4Vis.

## introduction data visualization is a powerful tool for exploring data, communicating insights, and making informed decisions across various domains, such as business, scientific research, social media and journalism @xcite . however, creating effective visualizations requires familiarity with data and visualization tools, which can take much time and effort @xcite . a task that automates the choice of visualization for an input dataset, also known as visualization recommendation, has been proposed. so far, visualization recommendation works can be categorized into rule-based and machine learning-based approaches @xcite @xcite . rule-based approach @xcite @xcite leverages data characteristics and visualization principles to predict visualizations, but suffers from the limited expressibility and generalizability of rules. machine learningbased approach @xcite @xcite learns machine learning (ml) or deep learning (dl) models from dataset-visualization pairs and these models can offer greater recommendation accuracy and scalability. existing ml/dl models, however, often need a large corpus of dataset-visualization pairs in their training and they could not provide explanations for the recommendation results. recently, a machine learning-based work, kg4vis @xcite , leverages knowledge graphs to achieve explainable visualization recommendation. nevertheless, kg4vis still requires supervised learning using a large data corpus and its explanations are generated based on predefined templates, which constrain the naturalness and flexibility of explanations. recently, large language models (llms) such as chatgpt @xcite and @xcite have demonstrated strong reasoning abilities using in-context learning @xcite @xcite . the key idea behind this is to use analogical exemplars for learning @xcite . through in-context learning, llms can effectively perform complex tasks, including but not limited to mathematical reasoning @xcite , visual question answering @xcite , and tabular classification @xcite without supervised learning. by prompting the pretrained llm to perform tasks using in-context learning, we avoid the overheads of parameter updates when adapting the llm to a new task. inspired by the excellent performance of chat-gpt on natural language tasks @xcite @xcite @xcite , we explore the possibility of leveraging chatgpt for explainable visualization recommendation. specifically, we propose llm4vis, a novel chatgpt-based in-context learning approach for visualization recommendation with natural human-like explanations by learning from very few dataset-visualization pairs. llm4vis consists of several key steps: feature description, demonstration example selection, explanation generation bootstrapping, prompt construtction, and inference for explainable visualization recommendation. firstly, feature description is used to quantitatively represent the characteristics of tabular datasets, which makes it easier to analyze and comprehend tabular datasets using chatgpt. demonstration example selection is then employed to prevent the input length from exceeding the maximum length of chatgpt by retrieving k nearest labeled data examples. next, we propose a new iterative refinement strategy in terms of the previous generation and hint to obtain a more high-quality recommendation explanation and a score of each visualization type before prompt construction. finally, the constructed prompt is used to guide chatgpt to recommend visualization types for a test tabular dataset while providing recommendation scores and human-like explanations. we evaluate the visualization recommendations of llm4vis by comparing its accuracy of visualization with strong machine learning-based baselines from visml @xcite like decision trees, random forests, and mlp. the visualization recommendation results demonstrate that llm4vis outperforms all the baselines in few-shot and full-sample training settings. furthermore, the evaluations conducted by llm and humans show that the generated explanation of the test data example matches the predicted score. our contributions are summarized below: prior studies on automatic visualization recommendation approaches can be categorized into two groups: unexplainable visualization recommendation approaches and explainable visualization approaches @xcite . unexplainable visualization recommendation approaches, including data2vis @xcite , vizml @xcite , and table2chart @xcite , can recommend suitable visualizations for an input dataset, but cannot provide the reasoning behind the recommendation to users, making them black box methods. explainable visualization recommendation approaches provide explanations for their recommendation results, enhancing transparency and user confidence in the recommendations. most rely on human-defined rules, such as show me @xcite and voyager @xcite . but rule-based approaches are often time-consuming and resource-intensive, and require visualization experts' manual specifications. to address such limitations, @xcite proposed a knowledge graph-based recommendation method (kg4vis) that learns the rules from existing visualization instances. to provide human-like explanations, this paper proposes to leverage chat-gpt to recommend appropriate visualizations.