Abstract
We develop NL2INTERFACE to explore the potential of generating usable interactive multi-visualization interfaces from natural language queries. With NL2INTERFACE, users can directly write natural language queries to automatically generate a fully interactive multi-visualization interface without any extra effort of learning a tool or programming language. Further, users can interact with the interfaces to easily transform the data and quickly see the results in the visualizations.
Introduction
Data exploration typically requires a "precision interface"—a dashboard with widgets like buttons, sliders, and toggles alongside linked visualizations that allow users to slice and dice data. However, building these interfaces is a high-friction task requiring expertise in SQL, visualization design, and UI layout.
While existing "Natural Language to Visualization" (NL2Viz) systems allow users to ask questions and get charts, they are generally limited to producing a single, static visualization per query. They fail to capture the interactive nature of data exploration. For example, if a user asks, "What are the COVID trends in different states?", they don't just want one chart; they likely want an interface where they can select a state or toggle between "cases" and "deaths." NL2INTERFACE aims to automate the creation of these interactive environments directly from a user's intent.
System Architecture and Methodology
The authors propose a three-stage pipeline to move from text to a functional UI, leveraging Large Language Models (LLMs) and a novel intermediate representation.
1. Structurally Parameterized SQL (SPS)
SPS is the paper's core technical contribution. It is an extension of SQL that includes "choice nodes" to represent variations in a query. It uses three main constructs:
- ANY{...}: Choose one option (e.g., cases vs. deaths).
- SUBSET[...]: Choose a group of options.
- OPT{...}: An optional clause (e.g., a filter that can be toggled on or off).
2. LLM-Based Translation
The system uses OpenAI’s Codex (davinci-code-002) to translate natural language into SPS. Because Codex is a powerful few-shot learner, the authors provide it with a small number of example pairs (NL query + SPS) as a prompt, allowing it to learn the custom SPS syntax without explicit fine-tuning.
3. Interface Generation (PI2)
The generated SPS is fed into PI2, an existing system developed by the authors. PI2 analyzes the structure of the SPS and automatically maps the choice nodes to UI elements. For instance, an ANY node might become a radio button, while a spatial filter in an OPT node might be mapped to a "click-to-filter" interaction on a map visualization.
Evaluation and Case Study
The authors tested the system on 12 natural language queries across 3 different databases that the model had not seen during the prompting phase. In preliminary testing, the Codex-backed system correctly translated 8 out of 12 (66.7%) complex natural language queries into accurate, executable SPS.
A COVID-19 dataset was used to demonstrate the system's ability to generate complex, multi-view dashboards. The system successfully generated a multi-visualization dashboard from two sentences: "What are the total covid cases or deaths across all the states in the US? And what are the covid case trends in the US and in different states? And what are the trends in the last 7 or 30 days?" The resulting UI included a choropleth map, a line chart, toggles for time ranges, and buttons to switch metrics.
Key Insights
- The "Parameterized" Breakthrough: Instead of trying to make an LLM design a UI directly, the authors make the LLM generate a template for a family of queries (SPS). This allows a deterministic engine (PI2) to handle the UI layout and widget selection, ensuring the interface is functional and logically sound.
- Visualization as a Widget: One of the most elegant features is mapping query parameters to visualization interactions. If a user asks about "different states," the system doesn't just add a dropdown menu; it can make the map itself interactive, so clicking a state updates the rest of the dashboard.
- Few-Shot Efficiency: The paper demonstrates that LLMs are remarkably adept at learning specialized, domain-specific languages (like SPS) with very few examples, bypassing the need for massive labeled datasets.
Limitations and Future Work
Currently, the system only works if the natural language query corresponds directly to a data transformation. It cannot yet handle "out-of-bounds" queries (e.g., "Make the chart blue") or highly ambiguous requests. Furthermore, performance is sensitive to prompt engineering. Future work includes automatically selecting the best examples for a given query and exploring more interactive ways for users to correct the model's predictions when the generated SPS is slightly off.
Summary updated