When Retrieval Augmentation Meets API Documentation: Can LLMs Code with Less-Common Libraries?

Retrieval-augmented generation (RAG) has increasingly shown its power in extending large language models’ (LLMs’) capability beyond their pre-trained knowledge. Existing works showed that RAG can help with software development tasks such as code generation and test generation. Yet, the effectiveness of adapting LLMs to their unfamiliar, less-common or fast-evolving library APIs using RAG remains unknown. To bridge this gap, we take an initial step to study this unexplored yet practical setting – when developers code with an unfamiliar library, they often refer to its API documentation; likewise, when LLMs are allowed to look up API documentation of their unfamiliar libraries via RAG, to what extent can LLMs be advanced? To mimic such a setting, we select four less-common open-source Python libraries with a total of 1017 eligible APIs. We study the factors that affect the effectiveness of using the documentation of less-common libraries as additional knowledge for retrieval and generation. Our study yields interesting findings: (1) RAG helps improve LLMs’ performance by 83% \(\sim\) 220%. (2) Example code contributes the most to advancing LLMs, compared to the descriptive texts and parameter lists in the API documentation. (3) LLMs could sometimes tolerate mild noises (typos in description or incorrect parameters) by referencing their pre-trained knowledge or document context. Based on the findings, we advocate that developers pay more attention to the quality and diversity of code examples in the API documentation. The study sheds light on the future low-code software development workflows with LLMs.

Authors

Institutions

Publication Details

Journal
ACM Transactions on Software Engineering and Methodology
Published
2026-06-25
DOI
https://doi.org/10.1145/3821424
Primary Topic
Topic Modeling
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

When Retrieval Augmentation Meets API Documentation: Can LLMs Code with Less-Common Libraries?

Jiasi Shen, Shing-Chi Cheung, Jun Chen, Jialun Cao et al.
ACM Transactions on Software Engineering and Methodology
Topic Modeling
article

When Retrieval Augmentation Meets API Documentation: Can LLMs Code with Less-Common Libraries?

Jiasi Shen, Shing-Chi Cheung, Jun Chen, Jialun Cao, Songqiang Chen
article en

Abstract

Retrieval-augmented generation (RAG) has increasingly shown its power in extending large language models’ (LLMs’) capability beyond their pre-trained knowledge. Existing works showed that RAG can help with software development tasks such as code generation and test generation. Yet, the effectiveness of adapting LLMs to their unfamiliar, less-common or fast-evolving library APIs using RAG remains unknown. To bridge this gap, we take an initial step to study this unexplored yet practical setting – when developers code with an unfamiliar library, they often refer to its API documentation; likewise, when LLMs are allowed to look up API documentation of their unfamiliar libraries via RAG, to what extent can LLMs be advanced? To mimic such a setting, we select four less-common open-source Python libraries with a total of 1017 eligible APIs. We study the factors that affect the effectiveness of using the documentation of less-common libraries as additional knowledge for retrieval and generation. Our study yields interesting findings: (1) RAG helps improve LLMs’ performance by 83% \(\sim\) 220%. (2) Example code contributes the most to advancing LLMs, compared to the descriptive texts and parameter lists in the API documentation. (3) LLMs could sometimes tolerate mild noises (typos in description or incorrect parameters) by referencing their pre-trained knowledge or document context. Based on the findings, we advocate that developers pay more attention to the quality and diversity of code examples in the API documentation. The study sheds light on the future low-code software development workflows with LLMs.

ACM Transactions on Software Engineering and Methodology
Hong Kong University of Science and Technology (HK), Guangzhou HKUST Fok Ying Tung Research Institute (CN)
Openalex Percentile: Top 4%
Topic Modeling
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.