mlsanityData to 14 Oct 2026

Compositional API Recommendation for Library-Oriented Code Generation

arXiv 2402.19431 ↗First posted 29 Feb 2024cs.SE cs.AI cs.CLcited by 10

Not on the map. Why?

Abstract (arXiv)

Large language models (LLMs) have achieved exceptional performance in code generation. However, the performance remains unsatisfactory in generating library-oriented code, especially for the libraries not present in the training data of LLMs. Previous work utilizes API recommendation technology to help LLMs use libraries: it retrieves APIs related to the user requirements, then leverages them as context to prompt LLMs. However, developmental requirements can be coarse-grained, requiring a combination of multiple fine-grained APIs. This granularity inconsistency makes API recommendation a challenging task. To address this, we propose CAPIR (Compositional API Recommendation), which adopts a "divide-and-conquer" strategy to recommend APIs for coarse-grained requirements. Specifically, CAPIR employs an LLM-based Decomposer to break down a coarse-grained task description into several detailed subtasks. Then, CAPIR applies an embedding-based Retriever to identify relevant APIs corresponding to each subtask. Moreover, CAPIR leverages an LLM-based Reranker to filter out redundant APIs and provides the final recommendation. To facilitate the evaluation of API recommendation methods on coarse-grained requirements, we present two challenging benchmarks, RAPID (Recommend APIs based on Documentation) and LOCG (Library-Oriented Code Generation). Experimental results on these benchmarks, demonstrate the effectiveness of CAPIR in comparison to existing baselines. Specifically, on RAPID's Torchdata-AR dataset, compared to the state-of-the-art API recommendation approach, CAPIR improves recall@5 from 18.7% to 43.2% and precision@5 from 15.5% to 37.1%. On LOCG's Torchdata-Code dataset, compared to code generation without API recommendation, CAPIR improves pass@100 from 16.0% to 28.0%.

Key facts. Cited by 10 papers in the map (data through 14 Oct 2026). Builds on 19 of its 47 references that are in the map. First posted on arXiv 29 Feb 2024.

Builds on

19 of 47 references.

References · 19

  1. 2020Language Models are Few-Shot Learnerscited by 32,419
  2. 2022Chain-of-Thought Prompting Elicits Reasoning in Large Language Modelscited by 12,459
  3. 2022Large Language Models are Zero-Shot Reasonerscited by 4,374
  4. 2018UMAP: Uniform Manifold Approximation and Projection for Dimension Reductioncited by 2,898
  5. 2022Making Large Language Models Better Reasoners with Step-Aware Verifiercited by 233
  6. 2022Grounded Copilot: How Programmers Interact with Code-Generating Modelscited by 218
  7. 2018Learning to Mine Aligned Code and Natural Language Pairs from Stack Overflowcited by 165
  8. 2022DocPrompting: Generating Code by Retrieving the Docscited by 153
  9. 2022Execution-Based Evaluation for Open-Domain Code Generationcited by 91
  10. 2022Coder Reviewer Reranking for Code Generationcited by 84
  11. 2023How Do In-Context Examples Affect Compositional Generalization?cited by 51
  12. 2016Deep API Learningcited by 41
7 more
  1. 2022Code Generation Tools (Almost) for Free? A Study of Few-Shot, Pre-Trained Language Models on Codecited by 39
  2. 2023Automatic Code Summarization via ChatGPT: How Far Are We?cited by 34
  3. 2021Revisiting, Benchmarking and Exploring API Recommendation: How Far Are We?cited by 21
  4. 2018RACK: Automatic API Recommendation using Crowdsourced Knowledgecited by 12
  5. 2015SWIM: Synthesizing What I Meancited by 10
  6. 2021PyART: Python API Recommendation in Real-Timecited by 6
  7. 2023Source Code Recommender Systems: The Practitioners' Perspectivecited by 2

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2024: 3; 2025: 5; 2026: 2.

10 papers.