paperbot · PL 论文追踪

全部论文 待读 收藏

P2 LLM-based API Argument Completion with Knowledge-Augmented Prompts

基于知识增强提示的 LLM API 实参补全
ICSE Proceedings of the 2026 IEEE/ACM 48th International Conference on Software Engineering2026匹配度 3/10 · 论文属于LLM与程序语言/开发者工具交叉,但核心任务是API实参补全与提示增强,并非用户关注的静态分析、Agentic程序分析、浮点程序分析或贝叶斯程序分析。它更多是把LLM作为代码补全工具,缺少与形式化验证或程序分析方法的直接关联。引用 1 inbox
Waseem Akram, Yanjie Jiang, Haris Ali Khan, Furqan Jalil, Hui Liu
crossref: 2026-09-12

AI 速览

一句话:用知识图谱对齐检索上下文子图来增强提示,显著提升 LLM 对 API 方法实参的补全精度。

API 方法实参的准确补全是现代软件开发中的难题,现有基于信息检索或语言模型混合程序分析的方法常受静态代码模式和领域知识不足的限制。本文提出 APICopilot:首先针对待补全的 API 调用,从其前序代码构建输入知识图谱(KG),并从相似代码文件集合中构建代表预期调用的目标知识图谱;其次量化两个 KG 之间的结构与语义对齐程度,从目标图中检索相关子图,为上下文学习提供关键的结构上下文;最后将子图融入提示,请求 LLM 推荐 API 实参。在 54,000 个 Java 文件上的评估表明,该方法的精确率、召回率和平均倒数排名(MRR)分别比最先进方法提升 38%、36% 和 23%。

问题
现有 API 实参补全方法依赖静态代码模式与有限领域知识,难以生成准确且贴合上下文的参数推荐。
方法
APICopilot 分别从待补全调用的前序代码和相似代码文件中构建输入与目标知识图谱,量化二者的结构与语义对齐并检索相关子图,将其作为上下文学习材料融入提示以驱动 LLM 推荐实参。
评估
在 54,000 个 Java 文件上进行实验,与最先进方法对比,精确率提升 38%、召回率提升 36%、MRR 提升 23%。
原文摘要(Abstract)

Application Programming Interfaces (APIs) are fundamental to modern software development, yet accurately completing API method arguments remains a challenging task. Existing methods, such as information retrieval and hybrid program analysis with language models, often struggle with static code patterns and limited domain-specific knowledge. To this end, in this paper, we introduce APICopilot, a novel approach that enhances LLM-based API argument completion using dynamically generated, context-rich prompts. First, it creates an input knowledge graph (KG) from the preceding code for the to-be-complete API invocation, and a targeted knowledge graph from a collection of similar code files, both representing the anticipated API call. Second, it quantifies structural and semantic alignment between the two KGs and retrieves relevant subgraphs from the targeted graph. These subgraphs provide crucial structural context for in-context learning, enabling significantly more accurate and context-specific argument completions. Finally, we integrate the subgraphs into prompts and request LLMs to recommend API arguments. Our evaluation results on 54,000 Java files suggest that the proposed approach outperforms the state-of-the-art approach, improving precision, recall, and mean reciprocal rank by 38%, 36% and 23%, respectively.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@inproceedings{paperbot11748,
  title = {LLM-based API Argument Completion with Knowledge-Augmented Prompts},
  author = {Waseem Akram and Yanjie Jiang and Haris Ali Khan and Furqan Jalil and Hui Liu},
  booktitle = {ICSE},
  year = {2026},
  doi = {10.1145/3744916.3773158}
}