TL;DR
Large Language Models (LLMs) often fail at data querying because they silently make assumptions about ambiguous questions—a behavior the authors call Underspecified Decision Completion (UDC). By introducing a diagnostic protocol called Grounded Code Generation (GCG), researchers discovered that the primary bottleneck isn't a model's inability to use clarification, but its failure to recognize that a question needs to be asked in the first place.
What Problem Does This Paper Address?
When you ask a system, "Which districts had the most withdrawals?", the question is inherently ambiguous. Does "most" mean the highest count of withdrawal events or the highest total amount?
Current LLMs used for natural-language-to-code tasks (like generating Pandas or SQL) often "hallucinate" a specific interpretation without checking with the user. If the resulting code is wrong, it’s hard to tell why: Did the model miss the ambiguity? Did it lack the data to resolve it? Or did it just write buggy code?
This paper identifies this silent assumption-making as Underspecified Decision Completion (UDC). The authors aim to decompose the code generation process to find exactly where these "decision gaps" occur.
Methods
The researchers propose Grounded Code Generation (GCG), a three-phase diagnostic protocol designed to isolate failures:
- Phase 1: Assumption Elicitation: Before writing any code, the model must list the "execution decisions" it considers unresolved. It generates clarification questions based on five "coverage dimensions": Data Reference, Business Rules, Execution Methods, Result Contracts, and Boundary Guards.
- Phase 2: Evidence Grounding: An "oracle" (simulating a user or a database check) provides plain-language answers to the model’s questions.
- Phase 3: Grounded Synthesis: The model generates the final code using the original prompt, its own questions, and the provided answers.
By separating these steps, the authors can attribute errors to specific phases. For example, if a model still fails after Phase 3, but never asked the right question in Phase 1, the error is a "Phase 1 Missed Gap."
Datasets
The study evaluates twelve different LLMs on BIRD-Pandas, a benchmark for translating natural language questions into Python/Pandas code across 11 different databases. The models tested include members of the Qwen and Llama families, as well as frontier models like Gemini-3.1-Pro and GPT-5.4-mini.
Key Insights and Ideas
- The "Recognition" Bottleneck: The most significant finding is that models are generally good at incorporating answers once they have them. The real struggle is recall—recognizing which parts of a prompt are underspecified.
- Precision vs. Recall: Models have high precision (the questions they do ask are usually relevant) but low recall (they miss many critical ambiguities).
- Complexity Breeds Omission: As the required program becomes more complex (more operations), the rate of missed decisions increases. A longer reference program provides more opportunities for a model to "miss" a necessary clarification.
- Structured Guidance is Key: Simply asking a model to "be careful" isn't enough. Prompting models to explicitly check the five "coverage dimensions" (like tie-handling or null-value rules) significantly improved their ability to surface ambiguities compared to free-form prompting.
Key Results
The GCG protocol improved execution accuracy across all twelve models tested.
- Accuracy Gains: For the top-performing model, Gemini-3.1-Pro, overall accuracy jumped from 72.36% (direct generation) to 81.68% using GCG.
- Error Attribution: In a deep dive of four representative models, Phase 1 Missed Gaps accounted for the largest share of remaining failures (between 38.6% and 72.2%).
- The "Asking but Missing" Pattern: Even when models asked multiple questions, they often bypassed the specific decision that ultimately caused the program to deviate from the reference (as seen in Figure 1).
Limitations and Future Work
- Oracle Dependency: Phase 2 currently uses an "idealized" oracle that always provides correct, reference-consistent information. Real-world users are often inconsistent or provide "noisy" answers.
- Benchmark Scope: The study is limited to the BIRD-Pandas benchmark. While the GCG protocol is generalizable, its effectiveness on other tasks (like Text-to-SQL or general software engineering) remains to be seen.
- Cost and Latency: For "thinking" models, GCG roughly doubles the latency of direct generation because it requires an extra reasoning pass in Phase 1.
- Future Direction: The authors suggest that future work should focus on improving the "recognition" capabilities of models—training them specifically to identify when a prompt leaves execution decisions open.
Summary updated