CoChat

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

Chen, Jingyi, Chen, Songqiang, Cao, Jialun, Shen, Jiasi, Cheung, Shing-Chi · 2026 · ACM Transactions on Software Engineering and Methodology

The DOI matches its Crossref record; 49 of the 52 references it cites were found in a registry or an index, and 3 are not checked yet.

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…

Overview

Integrity signals

Registry

Crossref · 10.1145/3821424

Cites

49 of 52 references verified0 citation errors · 0 not checkable

Statistics

Recomputing p-values needs the paper’s full text.

Verification

Claims the paper makes

This paper’s full text isn’t openly available, so its claims and self-check weren’t run. The registry and citation checks still apply.

Citations

Cites

Show all 52 references

Research works printed but not linked: 19

  1. Orlando Marquez Ayala and Patrice Béchard. 2024. Generating a Low-code Complete Workflow via Task Decomposition and RAG. arXiv preprint arXiv:2412.00239 (2024). · arXiv
  2. 10.1145/3626772.3657834 · DOI · Paper page
  3. Avik Dutta, Mukul Singh, Gust Verbruggen, Sumit Gulwani, and Vu Le. 2024. RAR: Retrieval-augmented retrieval for code generation in low resource languages. In Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing, EMNLP 2024, Miami, FL, USA, November 12-16, 2024. Association for Computational Linguistics, 21506–21515.
  4. 10.48550/arxiv.2407.09726 · arXiv · doi:10.48550/arxiv.2407.09726
  5. Yuhang Lai, Chengxi Li, Yiming Wang, Tianyi Zhang, Ruiqi Zhong, Luke Zettlemoyer, Wen-Tau Yih, Daniel Fried, Sida I. Wang, and Tao Yu. 2023. DS-1000: A Natural and Reliable Benchmark for Data Science Code Generation. In International Conference on Machine Learning, ICML 2023, 23-29 July 2023, Honolulu, Hawaii, USA (Proceedings of Machine Learning Research, Vol. 202). PMLR, 18319–18345.
  6. Daniel Lenton, Fabio Pardo, Fabian Falck, Stephen James, and Ronald Clark. 2021. Ivy: Templated Deep Learning for Inter-Framework Portability. CoRR abs/2102.02886 (2021). arXiv:2102.02886 · arXiv
  7. 10.5555/3495724.3496517 · doi:10.5555/3495724.3496517
  8. Rui Li, Qi Liu, Liyang He, Zheng Zhang, Hao Zhang, Shengyu Ye, Junyu Lu, and Zhenya Huang. 2024. Optimizing Code Retrieval: High-Quality and Scalable Dataset Annotation through Large Language Models. In Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing, EMNLP 2024, Miami, FL, USA, November 12-16, 2024. Association for Computational Linguistics, 2053–2065.
  9. Arvind Neelakantan and Tao Xu et al. 2022. Text and Code Embeddings by Contrastive Pre-Training. CoRR abs/2201.10005 (2022). arXiv:2201.10005 · arXiv
  10. Jiho Shin, Reem Aleithan, Hadi Hemmati, and Song Wang. 2024. Retrieval-Augmented Test Generation: How Far Are We? arXiv preprint arXiv:2409.12682 (2024). · arXiv
  11. Hongjin Su, Shuyang Jiang, Yuhang Lai, Haoyuan Wu, Boao Shi, Che Liu, Qian Liu, and Tao Yu. 2024. Arks: Active retrieval in knowledge soup for code generation. arXiv preprint arXiv:2402.12317 (2024). · arXiv
  12. Hanzhuo Tan, Qi Luo, Ling Jiang, Zizheng Zhan, Jing Li, Haotian Zhang, and Yuqun Zhang. 2024. Prompt-based code completion via multi-retrieval augmented generation. arXiv preprint arXiv:2405.07530 (2024). · arXiv
  13. Yizhong Wang, Hamish Ivison, Pradeep Dasigi, Jack Hessel, Tushar Khot, Khyathi Raghavi Chandu, David Wadden, Kelsey MacMillan, Noah A. Smith, Iz Beltagy, and Hannaneh Hajishirzi. 2023. How Far Can Camels Go? Exploring the State of Instruction Tuning on Open Resources. In Advances in Neural Information Processing Systems 36: Annual Conference on Neural Information Processing Systems 2023, NeurIPS 2023, New Orleans, LA, USA, December 10 - 16, 2023.
  14. Peng Xu, Wei Ping, Xianchao Wu, Lawrence McAfee, Chen Zhu, Zihan Liu, Sandeep Subramanian, Evelina Bakhturina, Mohammad Shoeybi, and Bryan Catanzaro. 2023. Retrieval meets long context large language models. In The Twelfth International Conference on Learning Representations.
  15. 10.48550/arxiv.2501.13742 · arXiv · doi:10.48550/arxiv.2501.13742
  16. Fengji Zhang, Bei Chen, Yue Zhang, Jacky Keung, Jin Liu, Daoguang Zan, Yi Mao, Jian-Guang Lou, and Weizhu Chen. 2023. Repocoder: Repository-level code completion through iterative retrieval and generation. arXiv preprint arXiv:2303.12570 (2023). · arXiv
  17. 10.48550/arxiv.2411.19463 · arXiv · doi:10.48550/arxiv.2411.19463
  18. Shuyan Zhou, Uri Alon, Frank F. Xu, Zhengbao Jiang, and Graham Neubig. 2023. DocPrompting: Generating Code by Retrieving the Docs. In The Eleventh International Conference on Learning Representations, ICLR 2023, Kigali, Rwanda, May 1-5, 2023. OpenReview.net.
  19. 10.48550/arxiv.2408.13204 · DOI

Cited by

Metadata

Authors
Chen, J., Chen, S., Cao, J., Shen, J., & Cheung, S.-C.
Affiliations
  • The Hong Kong University of Science and Technology, China and Guangzhou HKUST Fok Ying Tung Research Institute, China
  • Hong Kong University of Science and Technology (HK)
Venue
ACM Transactions on Software Engineering and Methodology
Published
2026-06-25
ISSN
  • 1049-331X (ISSN-L)
  • 1557-7392
OpenAlex
W7165880231
Cited by
3
References
39
Citations by year
2026: 3
FWCI
25.52
Type
journal article
Language
en
Open access
closed
Locations
  • ACM Transactions on Software Engineering and Methodology (publishedVersion)
  • Rare & Special e-Zone (The Hong Kong University of Science and Technology) (submittedVersion)
Topics
  • Physical Sciences › Computer Science › Information Systems › Software Engineering Research
  • Physical Sciences › Computer Science › Artificial Intelligence › Topic Modeling
  • Physical Sciences › Computer Science › Information Systems › Software Engineering Techniques and Practices
Keywords
retrieval-augmented generation, API documentation, large language models, code generation, Python library, code examples, documentation quality

About these checks

Registry, retraction, Cites and statistics results are computed, not judged, with one exception: a printed reference that no index lists is read once by a model before it counts as a citation error. Claims are extracted by a model and kept only when their quote appears verbatim in the text; each cited source is then checked, with a model’s help, for whether it says what the claim relies on. Those verdicts can be wrong — read the claim’s quote and the cited source before relying on one.

Statistics and arithmetic are recomputed, not judged.

Confidence bands are shown only for fields calibrated on our annotated test set. None is calibrated yet, so no band is shown.

What counts as a claim ›How we measure confidence ›How we check this ›

Are you an author, or do you see a problem with this page? Request a review

Data sources

Bibliographic data: Semantic Scholar, OpenAlex, Crossref.

Contains information from the Semantic Scholar Academic Graph Datasets, made available under the ODC Attribution License (ODC-BY 1.0).

Semantic Scholar’s data is described in: Kinney, R., et al. (2023). The Semantic Scholar Open Data Platform. arXiv:2301.10140.