Query Carefully: Detecting the Unanswerables in Text-to-SQL Tasks
Jasmin Saxer (1), Isabella Maria Aigner (2), Luise Linzmeier (3), Andreas Weiler (1), Kurt Stockinger (1) ((1) Institute of Computer Science, Zurich University of Applied Sciences, Winterthur, Switzerland, (2) Institute of Medical Virology, University of Zurich, Zurich

TL;DR
This paper introduces Query Carefully, a pipeline that enhances text-to-SQL systems with explicit detection of unanswerable queries, improving reliability and safety in sensitive biomedical contexts.
Contribution
It presents a novel approach combining LLM prompting, explicit rules, and a new dataset for detecting unanswerable questions in biomedical text-to-SQL tasks.
Findings
High unanswerable-detection accuracy (0.8) on OncoMX-NAQ dataset.
Few-shot prompting improves answerable question performance.
Challenges remain in detecting missing-value and ambiguous queries.
Abstract
Text-to-SQL systems allow non-SQL experts to interact with relational databases using natural language. However, their tendency to generate executable SQL for ambiguous, out-of-scope, or unanswerable queries introduces a hidden risk, as outputs may be misinterpreted as correct. This risk is especially serious in biomedical contexts, where precision is critical. We therefore present Query Carefully, a pipeline that integrates LLM-based SQL generation with explicit detection and handling of unanswerable inputs. Building on the OncoMX component of ScienceBenchmark, we construct OncoMX-NAQ (No-Answer Questions), a set of 80 no-answer questions spanning 8 categories (non-SQL, out-of-schema/domain, and multiple ambiguity types). Our approach employs llama3.3:70b with schema-aware prompts, explicit No-Answer Rules (NAR), and few-shot examples drawn from both answerable and unanswerable…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsBiomedical Text Mining and Ontologies · Topic Modeling · Scientific Computing and Data Management
