用语义推理实现可解释的动态API推荐,提升开发效率与可信度。
From Ranking to Reasoning: Explainable Web API Recommendation via Semantic Reasoning
- 基于轻量级大模型,结合特殊起止标记实现变量数量推荐
- 在ProgrammableWeb上准确率领先基线10.89%,且生成高质量解释
- 适合需要透明推荐结果的开发者和低代码平台使用者
Web API 的快速增长使自动化推荐成为高效应用集成的关键。现有方法存在两大局限:一是固定前N名推荐策略无法适应不同复杂度的集成需求;二是缺乏推荐解释,影响透明性与用户信任。为此,我们提出 WAR-R1 框架,融合语义推理与自适应、可变数量的推荐机制。该框架基于轻量级大语言模型,既能生成相关API列表,也能输出自然语言解释。为支持动态推荐规模,引入特殊起始与终止标记,使模型学会何时开始与停止生成。训练分两阶段:先在标注的 mashup-API 语料上进行监督微调,再通过低秩适配的群组相对策略优化(GRPO)进行强化学习,联合优化推荐准确率与推理质量。在 ProgrammableWeb 数据集上的实验表明,WAR-R1 在推荐准确率上相较最先进方法最高提升10.89%,并持续生成语义合理的解释。大量消融实验验证了强化学习、特殊标记设计及整合推理的有效性。
原文摘要 · Abstract (English)
The rapid growth of Web APIs has made automated Web API recommendation essential for efficient mashup development. However, existing approaches suffer from two major limitations: 1) they rely on fixed top-N recommendation strategies that cannot adapt to mashup complexity, and 2) they provide little or no explanation for recommended APIs, limiting transparency and user trust. To address these challenges, we propose WAR-R1, an explainable Web API recommendation framework that integrates semantic reasoning with adaptive, variable-cardinality recommendation. Built on a lightweight large language model (LLM), WAR-R1 generates both a set of relevant APIs and a natural-language justification for each recommendation. To support adaptive recommendation size, we introduce special start and stop tokens that allow the model to learn when to begin and terminate API generation. WAR-R1 is trained in two stages: supervised fine-tuning on an annotated mashup-API corpus, followed by reinforcement learning using Group Relative Policy Optimization (GRPO) with low-rank adaptation to jointly optimize recommendation accuracy and reasoning quality. Experiments on the ProgrammableWeb dataset show that WAR-R1 outperforms state-of-the-art baselines by up to 10.89% in recommendation accuracy while consistently producing high-quality, semantically grounded explanations. Extensive ablation studies validate the effectiveness of reinforcement learning, special token design, and integrated reasoning.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。