AptMQL-Bench: From Text-to-SQL to Text-to-MQL via Access-Pattern Schema Design and Data-Preserving Migration
Abstract
Document databases such as MongoDB are core infrastructure for modern applications, and natural-language interfaces to them---text-to-MQL---would let non-experts query complex, semi-structured data without mastering the query language. Progress on this task depends on high-quality benchmarks, which are most practically obtained by converting an existing text-to-SQL benchmark to the document setting. Unfortunately, existing efforts rely on heuristics for mechanical conversion: the document schema mirrors the relational foreign-key graph, and each query mirrors its source SQL. As a result in our experiments, these approaches fail to migrate 6 of 21 BIRD databases outright, silently drop up to 25.9\% of rows on others, and yield schemas whose ground-truth queries run over an order of magnitude slower as the data scales. We instead propose a conversion pipeline, driven by coding agents with human-in-the-loop verification, that designs each document schema from expected access patterns and rewrites queries to be MongoDB-native. Applying it to BIRD, we build an access-pattern-based text-to-MQL benchmark (AptMQL-Bench). It includes 21 document-oriented databases, 3,186 natural-language requests, and their associated MQL queries---whose databases are migrated from SQLite without data loss and scale efficiently. The strongest model, Claude Opus 4.5, achieves only 57.38\% accuracy without external knowledge evidence and 70.34\% with it. This indicates that realistic text-to-MQL generation remains challenging.
Create a lesson
Metadata
- Categories
- cs.CL, cs.DB
Related papers
Semantic-aware Decoding for Diverse Text-to-SQL under Schema Ambiguity
Shared title terminologycs.CLYuxuan Jiang, Anna Mitsopoulou, Apostolos Koukouvinis et al.
Trallie: from Free-Form Text to Structured Data with LLMs
Shared title terminologycs.CLVijayasri Iyer, Cristiano De Nobili, Mubashir Hussain Shah et al.
Word-Level Text Unmixing via Evidence-Preserving Ownership Routing with Language Models
Shared title terminologycs.CLJinglin He, Siyang Jiang, Lixing He et al.
Trajectory-Derived Confidence for Reliable, Resource-Aware Clinical Text-to-SQL Agents
Shared title terminologycs.CLMincheol Daniel Song, Joshua Ward, Jake Jung et al.
Beyond Correctness: Resolving Underspecification in Agentic Text-to-SQL
Shared title terminologycs.CLWen-Zhi Li, Yue Gong, Konstantinos Kanellis et al.
Argo-Bench: Evaluating Data Agents on Enterprise-Scale Workflows
Shared title terminologycs.CLGabriel Tomitsuka, Arman Raayatsanati, Emma Xing et al.