Knowledge-Driven Reasoning for Compatible and Interpretable API Recommendation via Teacher LLM Distillation

API recommendation is a crucial task in code intelligence, aiming to suggest suitable APIs for programming queries. Recent efforts have integrated Large Language Models (LLMs) into this task. However, these methods overlook the compatibility between recommended APIs and fail to fully utilize the factual knowledge of APIs. Moreover, these prompting-only methods are limited by the insufficient domain-specific knowledge of LLMs. In this article, we propose a novel fine-tuning method, KDRAR, designed to leverage knowledge-driven reasoning with LLMs for compatible and interpretable API recommendation. To fully utilize the factual knowledge, we introduce a dual matching strategy that leverages both function descriptions and keyword matching to retrieve candidate APIs. To handle compatibility, we translate compatibility information into descriptive knowledge, which is integrated into the recommendation process. Furthermore, we adopt a distilled fine-tuning strategy: a student LLM is trained via distillation from a teacher LLM to perform step-by-step reasoning for enhanced recommendation and explanation. By considering both function matching and compatibility information, the knowledge-driven reasoning not only improves API recommendation accuracy but also provides reasonable explanations for the recommendations. Experimental results show that our method significantly outperforms baseline methods on API recommendation tasks across multiple API domains.

Authors

Institutions

Publication Details

Journal
ACM Transactions on Information Systems
Published
2025-10-14
DOI
https://doi.org/10.1145/3771772
Citations
12
Primary Topic
Semantic Web and Ontologies
Type
article
Field-Weighted Citation Impact
29.77
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Knowledge-Driven Reasoning for Compatible and Interpretable API Recommendation via Teacher LLM Distillation

Haipeng Dai, Xiaolong Xu, Wanchun Dou, Rong Gu et al.
12 citations
ACM Transactions on Information Systems
Semantic Web and Ontologies
29.77
article

Knowledge-Driven Reasoning for Compatible and Interpretable API Recommendation via Teacher LLM Distillation

Haipeng Dai, Xiaolong Xu, Wanchun Dou, Rong Gu, Lianyong Qi, Xuyun Zhang, Hong-Ya Xiang, Chunhua Hu, Jinyun Xie
article en
12 citations

Abstract

API recommendation is a crucial task in code intelligence, aiming to suggest suitable APIs for programming queries. Recent efforts have integrated Large Language Models (LLMs) into this task. However, these methods overlook the compatibility between recommended APIs and fail to fully utilize the factual knowledge of APIs. Moreover, these prompting-only methods are limited by the insufficient domain-specific knowledge of LLMs. In this article, we propose a novel fine-tuning method, KDRAR, designed to leverage knowledge-driven reasoning with LLMs for compatible and interpretable API recommendation. To fully utilize the factual knowledge, we introduce a dual matching strategy that leverages both function descriptions and keyword matching to retrieve candidate APIs. To handle compatibility, we translate compatibility information into descriptive knowledge, which is integrated into the recommendation process. Furthermore, we adopt a distilled fine-tuning strategy: a student LLM is trained via distillation from a teacher LLM to perform step-by-step reasoning for enhanced recommendation and explanation. By considering both function matching and compatibility information, the knowledge-driven reasoning not only improves API recommendation accuracy but also provides reasonable explanations for the recommendations. Experimental results show that our method significantly outperforms baseline methods on API recommendation tasks across multiple API domains.

ACM Transactions on Information SystemsVol. 44(1)
Nanjing University of Information Science and Technology (CN), Nanjing University of Science and Technology (CN), Beijing Institute of Big Data Research (CN), China University of Petroleum, East China (CN), Hunan University of Technology (CN), Nanjing University (CN), Macquarie University (AU)
Openalex Percentile: Top 0%
Semantic Web and Ontologies
29.77
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.