From Text to Query: ADQL Generation in Astronomical Archives
Abstract
Astronomical archives expose petabyte-scale observations through the As tronomical Data Query Language (ADQL), the standard query language used by Virtual Observatory services and major missions such as Gaia and Euclid. However, writing valid ADQL queries requires expertise in archive schemas, database systems, and astronomy-specific operators, limiting accessibility for many users. In this work, we investigate natural-language to-ADQL generation using open-weight large language models. We con struct a large-scale dataset derived from real Gaia DR3 archive queries and introduce a benchmark spanning multiple levels of query complexity. We systematically evaluate prompting strategies, schema-aware context, retrieval-augmented generation, and parameter-efficient fine-tuning. Our results show that retrieval and prompt engineering provide only modest gains, while fine-tuning substantially improves executability and execution accuracy. More importantly, we find that schema grounding remains the dominant source of errors, with performance improving dramatically un der oracle schema conditions. These results suggest that future progress in astronomical query generation will depend more on effective schema representations and retrieval mechanisms than on increasing model scale alone.