RAG Strategies for Natural Language-Based SQL Query and REST API Call Generation
Not on the map. Why?
Abstract (arXiv)
Enterprise software systems commonly expose business functionality through both relational databases and REST APIs. Accessing these interfaces requires specialized technical knowledge, as users must determine whether a request requires a database query or an API operation and understand the corresponding schemas, endpoints, and parameters. This creates demand for natural language interfaces that translate user requests into SQL queries and REST API calls. While large language models (LLMs) show promise for structured code generation, they typically lack reliable knowledge of enterprise-specific schemas, endpoints, and documentation. Retrieval-augmented generation (RAG) addresses this limitation by grounding generation in external documentation. However, prior work largely studies SQL query generation and REST API call generation separately, despite enterprise documentation environments often containing both database schemas and API specifications. We systematically evaluate standard RAG, Self-RAG, and CoRAG across SQL query generation, REST API call generation, and a combined task requiring routing between both operation types. Using SAP Transactional Banking as a realistic enterprise use case, we constructed an execution-validated dataset and compared retrieval strategies under database-only, API-only, and mixed-documentation settings. Retrieval augmentation proved essential for reliable enterprise structured generation, substantially improving performance over a no-retrieval baseline. CoRAG achieved the best results in the combined SQL query and REST API call setting, with statistically significant improvements in exact-match accuracy over standard RAG, primarily driven by stronger SQL query generation under mixed-documentation retrieval conditions. Overall, findings show that retrieval strategy substantially affects structured generation performance under mixed-documentation settings.
Key facts. No citing papers in the map yet (data through 7 Oct 2026). Builds on 24 of its 32 references that are in the map. First posted on arXiv 6 Feb 2026.
Builds on
24 of 32 references.
References · 24
- 2020Retrieval-Augmented Generation for Knowledge-Intensive NLP Taskscited by 9,160
- 2021Evaluating Large Language Models Trained on Codecited by 8,053
- 2023Toolformer: Language Models Can Teach Themselves to Use Toolscited by 4,072
- 2024LiveCodeBench: Holistic and Contamination Free Evaluation of Large Language Models for Codecited by 1,906
- 2023Self-RAG: Learning to Retrieve, Generate, and Critique through Self-Reflectioncited by 1,800
- 2023Gorilla: Large Language Model Connected with Massive APIscited by 1,302
- 2018Spider: A Large-Scale Human-Labeled Dataset for Complex and Cross-Domain Semantic Parsing and Text-to-SQL Taskcited by 1,120
- 2024A Survey on Large Language Models for Code Generationcited by 646
- 2023API-Bank: A Comprehensive Benchmark for Tool-Augmented LLMscited by 574
- 2024Spider 2.0: Evaluating Language Models on Real-World Enterprise Text-to-SQL Workflowscited by 223
- 2024APIGen: Automated Pipeline for Generating Verifiable and Diverse Function-Calling Datasetscited by 188
- 2019CoSQL: A Conversational Text-to-SQL Challenge Towards Cross-Domain Natural Language Interfaces to Databasescited by 180
12 more
- 2022DocPrompting: Generating Code by Retrieving the Docscited by 151
- 2019SParC: Cross-Domain Semantic Parsing in Contextcited by 141
- 2025Chain-of-Retrieval Augmented Generationcited by 48
- 2024NESTFUL: A Benchmark for Evaluating LLMs on Nested Sequences of API Callscited by 45
- 2023Evaluating Cross-Domain Text-to-SQL Models and Benchmarkscited by 32
- 2025Rethinking Chunk Size For Long-Document Retrieval: A Multi-Dataset Analysiscited by 17
- 2025When LLMs Meet API Documentation: Can Retrieval Augmentation Aid Code Generation Just as It Helps Developers?cited by 12
- 2024FANTAstic SEquences and Where to Find Them: Faithful and Efficient API Call Generation through State-tracked Constrained Decoding and Rerankingcited by 5
- 2025Chunk Twice, Embed Once: A Systematic Study of Segmentation and Representation Trade-offs in Chemistry-Aware Retrieval-Augmented Generationcited by 5
- 2021DBTagger: Multi-Task Learning for Keyword Mapping in NLIDBs Using Bi-Directional Recurrent Neural Networkscited by 3
- 2024SEAL: Suite for Evaluating API-use of LLMscited by 2
- 2025Calibrated Trust in Dealing with LLM Hallucinations: A Qualitative Studycited by 2
Built on by
Not cited yet.
Similar, not cited
Close in wording, no citation either way
- 2026CSR-RAG: An Efficient Retrieval System for Text-to-SQL on the Enterprise Scale
- 2024RAG Does Not Work for Enterprises
- 2025Datrics Text2SQL: A Framework for Natural Language to SQL Query Generation
- 2025What to Retrieve for Effective Retrieval-Augmented Code Generation? An Empirical Study and Beyond
- 2024T-RAG: Lessons from the LLM Trenches
- 2026RCL: A Retrieval-Confidence Layer for Detecting Insufficient Context in Enterprise Retrieval-Augmented Code Generation
- 2024Optimizing and Evaluating Enterprise Retrieval-Augmented Generation (RAG): A Content Design Perspective
- 2024Seven Failure Points When Engineering a Retrieval Augmented Generation System