Identifying & Interactively Refining Ambiguous User Goals for Data Visualization Code Generation

Mert Inan, Anthony Sicilia, Alex Xie, Saujas Vaduguru, Daniel Fried, Malihe Alikhani

TL;DR

This paper tackles the challenge of ambiguity in natural language instructions for data visualization code generation. The authors introduce a novel taxonomy of ambiguity types and metrics to quantify them, demonstrating that pragmatic dialogue strategies significantly improve code accuracy by resolving these ambiguities.

What Problem Does This Paper Address?

Human-AI collaboration, especially in complex tasks like code generation, often falters due to ambiguities in natural language instructions. While AI models can generate code, they may produce outputs that seem correct but don't align with the user's true intent. This is particularly problematic in data visualization, where a single textual description can map to numerous valid code implementations. Existing approaches often focus on model limitations rather than the inherent ambiguity of user requests. This paper aims to bridge this gap by formalizing, identifying, and interactively resolving ambiguities in user goals for data visualization code generation, moving towards a more human-like pair-programming experience.

Methods

The core of this work lies in developing a systematic approach to understanding and resolving ambiguity.

  • Ambiguity Taxonomy: The authors propose a novel taxonomy categorizing ambiguity into three main types:
  • Semantic Ambiguity: Words with multiple interpretations.
  • Presupposition: Instructions that assume default parameter values.
  • Underspecification: Missing or partially described non-default parameter values or functions. This taxonomy is specifically tailored to the data visualization domain, leveraging multimodal contexts (plot and code).

  • Ambiguity Metrics: To quantify these ambiguities, they propose several metrics:

  • Sampling Diversity (SD): Measures uncertainty by counting distinct programs that satisfy a prompt.
  • Repeated Parameter Counting (RPC): Focuses on identifying common function calls and parameters across proposed solutions, aiming to capture presuppositional ambiguity.
  • Optimal Result Gap (ORG): Attempts to directly compute the mathematical definition of ambiguity by comparing the coder's realized uncertainty with the minimum possible uncertainty.
  • LLM-Based Ambiguity Rating (LAR): Prompts a language model to rate ambiguity on a scale, guided by the proposed taxonomy.
  • Self Verification (SV): A traditional baseline for uncertainty estimation.
  • Pragmatic Dialogue Strategies: To resolve identified ambiguities, the paper explores multi-turn dialogue strategies inspired by pragmatic theories:
  • Gricean Cooperativity: Assumes a rational agent aiming for efficient communication.
  • Discourse Representation Theory (DRT): Focuses on coherence relations between utterances.
  • Questions Under Discussion (QUD): Centers on identifying and answering implicit questions. These strategies are implemented using persona-based prompting for LLM-based coders.

Datasets

The primary dataset used is DS-1000, specifically focusing on plotting questions from libraries like Matplotlib and Seaborn. This dataset features natural language prompts, human-written tests, and corresponding plots. The authors annotated 155 plotting questions from DS-1000 to identify ambiguities.

Key Insights and Ideas

  • Ambiguity is Pervasive: Even in datasets designed to be unambiguous, a significant portion (57%) of plotting questions exhibit one or more types of ambiguity.
  • Pragmatics Drive Resolution: Dialogue strategies informed by pragmatic theories (especially cooperative reasoning) are significantly more effective at resolving ambiguities and improving code accuracy than baseline approaches or simple clarification.
  • Dialogue Benefits Ambiguous Cases More: The improvements gained from dialogue are consistently greater for ambiguous prompts compared to non-ambiguous ones, highlighting the targeted benefit of this approach.
  • Metrics Matter: The proposed ambiguity metrics, particularly LAR and ORG, show promise in predicting ambiguity categories, outperforming traditional uncertainty measures like Self-Verification.
  • Persona Matters: Different pragmatic personas (cooperative, discoursive, inquisitive) yield varying degrees of success, with cooperative reasoning often leading to the best outcomes.

Key Results

  • Improved Code Accuracy: Pragmatic dialogue strategies led to substantial improvements in task success, measured by Pass@1 scores. For instance, with reference code, the cooperative persona achieved a Pass@1 score of 79.44%, compared to a baseline of 68.38%.
  • Targeted Ambiguity Resolution: Dialogue-driven improvements were significantly larger for ambiguous cases (e.g., +10-15% Pass@1) than for non-ambiguous cases (e.g., 0-5% Pass@1).
  • Metric Performance: The LAR metric showed the highest predictive power for ambiguity categories, while Self-Verification was the least effective.
  • Ambiguity Distribution: Underspecification was the most prevalent ambiguity type (73.8%), followed by semantic ambiguity (23.8%) and presupposition (11.9%) in the annotated DS-1000 subset.

Limitations and Future Work

  • Human Data Collection: The study relied on automatic metrics and LLM simulations rather than direct human user studies for evaluation, which may not fully capture human-like interaction nuances.
  • LLM Simulation: Using LLMs to simulate dialogue agents might not perfectly replicate how humans would interact, despite efforts to use large models and realistic prompts.
  • Future Work: The authors suggest exploring more sophisticated dialogue systems, developing better evaluation mechanisms, and further investigating how different pragmatic strategies interact with various LLMs and coding tasks. They also highlight the need for more human-centric evaluations to truly assess the impact on collaboration.

Summary updated

BibTeX
@inproceedings{inan2025identifying,
  author = {Mert Inan and Anthony Sicilia and Alex Xie and Saujas Vaduguru and Daniel Fried and Malihe Alikhani},
  title = {{Identifying \& Interactively Refining Ambiguous User Goals for Data Visualization Code Generation}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2025},
}
Figure