WAR-Re: Web API Recommendation with Semantic Reasoning

Zishuo Xu, Dezhong Yao, Yao Wan · DOI

Introduction

In modern software development, "mashups"—applications that integrate multiple Web APIs to provide complex functionality—are ubiquitous. However, as the number of available APIs has exploded (over 24,000 on ProgrammableWeb alone), developers face a "combinatorial explosion" when trying to find the right tools for their specific needs.

Existing recommendation systems suffer from two major flaws. First, they often use fixed cardinality, providing a "Top-N" list regardless of whether a project is a simple tool or a complex platform. Second, they suffer from a lack of transparency, outputting ranked lists without explanation. This "black-box" approach breeds distrust and slows down the integration process.

WAR-Re (Web API Recommendation with Semantic Reasoning) addresses these issues by providing a tailored number of APIs accompanied by clear, natural-language justifications for every suggestion.

Overview of the WAR-Re recommendation process, showing how user requirements are transformed into specific API suggestions with reasoning.

Methodology

WAR-Re is built on a TinyLlama backbone and utilizes a unique two-stage training pipeline to ensure both recommendation accuracy and semantic clarity. The framework moves beyond simple ranking to provide functional reasoning for each suggested API.

The three-step training pipeline for WAR-Re: (1) Dataset Annotation via LLMs, (2) First Stage Supervised Fine-Tuning, and (3) Second Stage Reinforcement Learning using GRPO.

1. Dataset Annotation

Historical data often lacks the "why" behind API selection. To bridge this gap, the authors used DeepSeek-R1 to "back-fill" the ProgrammableWeb dataset with high-quality rationales. This process explains the functional link between mashup requirements and specific API features, creating a reasoning-aware training corpus.

2. Stage 1: Supervised Fine-Tuning (SFT)

The model is trained to predict a sequence containing the mashup description, recommended APIs, and reasoning. By introducing special start and stop tokens (e.g., <API_start>, <API_stop>), the model learns exactly when to stop recommending APIs based on the query complexity, effectively solving the fixed-cardinality problem.

3. Stage 2: Reinforcement Learning (GRPO)

To further refine the model, the authors employed Group Relative Policy Optimization (GRPO). This RL stage uses a custom reward function that balances Recommendation Quality (using metrics like F1 and NDCG) and Reasoning Quality, ensuring the generated explanations actually match the recommended APIs.

Experimental Evaluation

The study utilizes the ProgrammableWeb dataset, consisting of 8,217 mashups and 1,647 distinct APIs. The data was split 3:1:1 for training, validation, and testing, and evaluated using traditional accuracy metrics alongside new metrics for reasoning precision and recall.

Key Results

WAR-Re significantly outperformed state-of-the-art baselines like BERT-CM and LLMAR:

  • Accuracy Boost: It achieved a 19.56% improvement in Precision@1 and a 21.59% improvement in Recall@1 over the best baseline.
  • Variable Output: Under greedy decoding, the model generated an average of 1.79 APIs per mashup, closely matching the ground truth average of 2.09.
  • High-Quality Logic: Qualitative evaluations showed that over 87% of recommendations were accompanied by valid rationales, with an average Reasoning Score of 0.790 (out of 1.0) as judged by GPT-4.

Conclusion and Future Work

WAR-Re demonstrates that requiring a model to "explain itself" acts as a powerful regularizer, improving recommendation accuracy while building developer trust. By treating the recommendation list as a sequence with a defined end-token, the model successfully adapts to the complexity of user requests.

Future work will focus on scaling the underlying model beyond TinyLlama and integrating real-time developer feedback to move toward online learning systems within IDE environments.

Summary updated

BibTeX
@inproceedings{xu2026war,
  author = {Zishuo Xu and Dezhong Yao and Yao Wan},
  title = {{WAR-Re: Web API Recommendation with Semantic Reasoning}},
  booktitle = {ICDCS},
  year = {2026},
  doi = {10.1109/2575-8411.2026.00137},
}
Figure