Skip to main content
QUICK REVIEW

[Paper Review] Chat2VIS: Generating Data Visualisations via Natural Language using ChatGPT, Codex and GPT-3 Large Language Models

Paula Maddigan, Teo Sušnjak|arXiv (Cornell University)|Feb 4, 2023
Topic ModelingComputer Science24 citations
TL;DR

Chat2VIS uses GPT-3, Codex, and ChatGPT with carefully designed prompts to convert free-form natural language queries into Python scripts that render data visualisations, demonstrating end-to-end NL2VIS via LLMs.

ABSTRACT

The field of data visualisation has long aimed to devise solutions for generating visualisations directly from natural language text. Research in Natural Language Interfaces (NLIs) has contributed towards the development of such techniques. However, the implementation of workable NLIs has always been challenging due to the inherent ambiguity of natural language, as well as in consequence of unclear and poorly written user queries which pose problems for existing language models in discerning user intent. Instead of pursuing the usual path of developing new iterations of language models, this study uniquely proposes leveraging the advancements in pre-trained large language models (LLMs) such as ChatGPT and GPT-3 to convert free-form natural language directly into code for appropriate visualisations. This paper presents a novel system, Chat2VIS, which takes advantage of the capabilities of LLMs and demonstrates how, with effective prompt engineering, the complex problem of language understanding can be solved more efficiently, resulting in simpler and more accurate end-to-end solutions than prior approaches. Chat2VIS shows that LLMs together with the proposed prompts offer a reliable approach to rendering visualisations from natural language queries, even when queries are highly misspecified and underspecified. This solution also presents a significant reduction in costs for the development of NLI systems, while attaining greater visualisation inference abilities compared to traditional NLP approaches that use hand-crafted grammar rules and tailored models. This study also presents how LLM prompts can be constructed in a way that preserves data security and privacy while being generalisable to different datasets. This work compares the performance of GPT-3, Codex and ChatGPT across a number of case studies and contrasts the performances with prior studies.

Motivation & Objective

  • Demonstrate end-to-end NL2VIS by converting free-form natural language into visualisations via large language models.
  • Evaluate and compare GPT-3 variants and ChatGPT in generating correct visualisations from NL prompts.
  • Show how prompt engineering can enable robust visualisation generation even with misspecified or underspecified queries.
  • Assess data privacy considerations and generalisability across datasets.

Proposed method

  • Use three OpenAI LLMs (text-davinci-003, code-davinci-002, and ChatGPT 4) to generate Python scripts from NL prompts.
  • Construct two-part prompts (Description Prompt and Code Prompt) to describe the dataset and guide code generation.
  • Combine the prompts and submit to the LLMs with fixed API settings (temperature 0, max_tokens 500, stop at plt.show()).
  • Render generated Python scripts in a Streamlit-based NL interface and allow user refinement of NL queries and chart types.
  • Refine scripts by inserting the Code Prompt at the start and optionally editing to remove unnecessary instructions before rendering.

Experimental results

Research questions

  • RQ1RQ1: Do current LLMs support accurate end-to-end generation of visualisations from NL?
  • RQ2RQ2: How can LLMs be effectively leveraged to elicit correct and appropriately rendered charts?
  • RQ3RQ3: Which LLMs perform more robustly to NL prompts and how do they compare to state-of-the-art approaches?
  • RQ4RQ4: What are the limitations of using LLMs for NL2VIS and future research directions?

Key findings

  • LLMs can effectively support end-to-end NL2VIS with appropriate prompts, offering efficiency and potential cost savings.
  • Prompt engineering with Description and Code prompts enables accurate chart rendering across multiple LLMs.
  • GPT-3, Codex, and ChatGPT show similar performance across case studies, with some model-specific differences in chart choices.
  • Misspecified and underspecified NL prompts are handled robustly by LLMs, though aesthetic and consistency issues remain.
  • The approach reduces the need for hand-crafted symbolic NLP solutions and highlights data-privacy-friendly prompt design.
  • Results are demonstrated across six case studies with five datasets, including comparisons to NL4DV and ADVISor.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.