Querying an astronomical database using large language models: the ALeRCE text-to-SQL system
This work addresses the high barrier posed by SQL-based querying of astronomical databases for non-expert users. The authors propose a large language model (LLM)-driven text-to-SQL system enabling natural language queries over the ALeRCE database. Their approach employs a four-module, stepwise generation framework—comprising schema linking, query classification, prompt decomposition, and self-correction—which substantially outperforms end-to-end baselines and significantly reduces execution errors. Evaluation on 110 annotated samples across 13 LLMs demonstrates strong performance: on models such as Claude Opus 4.6, exact match rates for row and column identifiers reach 0.97 and 0.94, respectively, for simple queries, while maintaining robustness on complex queries.