paper-with-me

홈 › Papers

Mitigating Errors in LLM-Generated Web API Invocations via Retrieval-Augmented Generation and Constrained Decoding

2026-07-07 · Daniel Maninger, Leon Chemnitz, Jannis Brugger, Tushar Lamba, Amir Molzam Sharifloo, Mira Mezini arxiv

Integration of web APIs is a cornerstone of modern software systems, yet writing correct web API invocation code remains challenging due to complex and evolving API specifications. Although LLMs are increasingly used for code generation, previous work has empirically shown that their ability to generate correct web API integrations is limited. At the same time, mitigation techniques and their effectiveness for this setting remain insufficiently understood. In this paper, we propose and systematically evaluate retrieval-augmented generation (RAG) and constrained decoding (CD) as two complementary approaches to improving LLM-generated web API invocation code. For RAG, we design a retriever that processes OpenAPI specifications and retrieves compact endpoint representations to inject into model prompts. For CD, we introduce an automatic translation from OpenAPI specifications to regex-based constraints enforced during generation. We evaluate both approaches on WAPIIBench's existing synthetic dataset and on a new real-world dataset derived from GitHub repositories. Our results show that RAG reduces hallucinations and improves correctness when generating full API invocations but reduces it when the endpoint is already provided as it encourages the generation of unnecessary parameters. In contrast, CD reliably prevents illegal URLs, HTTP methods, and arguments and substantially improves overall correctness for both starter codes.

📄 PDF Abstract BibTeX arXiv:2607.05936

Code (0)

등록된 구현이 없습니다.

Tasks

Code Generation

Similar Papers 제목 키워드 기반

Understanding and Mitigating Errors of LLM-Generated RTL Code

2025-08-07 · Jiazheng Zhang, Cheng Liu, Long Cheng, Xiaowei Li 외 arxiv

Despite limited success in large language model (LLM)-based register-transfer-level (RTL) code generation, the root causes of errors remain poorly understood. To address this, we conduct a comprehensive error analysis, f…

Code Generation

Loops On Retrieval Augmented Generation (LoRAG)

2024-03-18 · Ayush Thakur, Rashmi Vashisth

This paper presents Loops On Retrieval Augmented Generation (LoRAG), a new framework designed to enhance the quality of retrieval-augmented text generation through the incorporation of an iterative loop mechanism. The ar…

RetrievalRetrieval-augmented GenerationText Generation

AlignRAG: Leveraging Critique Learning for Evidence-Sensitive Retrieval-Augmented Reasoning

2025-04-21 · Jiaqi Wei, Hao Zhou, Xiang Zhang, Di Zhang 외

Retrieval-augmented generation (RAG) has become a widely adopted paradigm for enabling knowledge-grounded large language models (LLMs). However, standard RAG pipelines often fail to ensure that model reasoning remains co…

RAGRetrievalRetrieval-augmented GenerationText Generation

Unraveling and Mitigating Retriever Inconsistencies in Retrieval-Augmented Large Language Models

2024-05-31 · Mingda Li, Xinyu Li, Yifan Chen, Wenfeng Xuan 외

Although Retrieval-Augmented Large Language Models (RALMs) demonstrate their superiority in terms of factuality, they do not consistently outperform the original retrieval-free Language Models (LMs). Our experiments reve…

Open-Domain Question AnsweringQuestion AnsweringRetrieval

On Mitigating Code LLM Hallucinations with API Documentation

2024-07-13 · Nihal Jain, Robert Kwiatkowski, Baishakhi Ray, Murali Krishna Ramanathan 외

In this study, we address the issue of API hallucinations in various software engineering contexts. We introduce CloudAPIBench, a new benchmark designed to measure API hallucination occurrences. CloudAPIBench also provid…

Hallucinationvalid