NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

RACK: Automatic API Recommendation using Crowdsourced Knowledge

Mohammad Masudur Rahman, Chanchal K. Roy, David LoarXiv 2018

Abstract

Traditional code search engines often fail due to the "vocabulary mismatch" between natural language queries and technical API names. RACK (Recommendation using Crowdsourced Knowledge) addresses this by mining Stack Overflow to build a mapping between human-centric problem descriptions and validated code solutions. By leveraging Keyword-API Co-occurrence and Keyword-Keyword Coherence, RACK achieves a Top-10 recommendation accuracy of nearly 79% for Java classes, significantly outperforming lexical-based search methods.

Introduction: The Vocabulary Mismatch Problem

Software developers spend a significant portion of their time—up to 20%—searching for relevant code snippets and APIs. Standard search engines on platforms like GitHub or Bitbucket primarily rely on lexical similarity, matching query keywords directly to source code identifiers. This approach fails when a developer knows the task (e.g., "Generating MD5 hash") but not the specific API name (e.g., MessageDigest).

A typical Stack Overflow question illustrating a natural language query for MD5 hashing.

This "vocabulary mismatch" creates a barrier to entry for developers unfamiliar with a specific library's naming conventions. RACK bridges this gap by treating crowdsourced knowledge as a translation layer.

Methodology: Crowdsourcing the Rosetta Stone

The RACK framework operates in two distinct phases to translate "human-speak" into functional code:

1. Knowledge Base Construction

The system analyzed over 172,000 Stack Overflow questions and their accepted answers. By extracting keywords from question titles and mapping them to Java API classes found within the <code> tags of successful answers, RACK builds an association database that captures how developers actually describe technical requirements.

An accepted answer on Stack Overflow providing the specific API solution for the MD5 query.

2. Recommendation Heuristics

RACK employs two primary ranking metrics to ensure relevance:

  • Keyword-API Co-occurrence (KAC): Measures the frequency of a keyword appearing in questions solved by a specific API.
  • Keyword-Keyword Coherence (KKC): Evaluates the semantic relationship between multiple keywords in a single query to ensure the recommended API fits the combined context of the search.

Evaluation and Results

The system was evaluated using 150 real-world queries from tutorial sites like KodeJava and Java2s, targeting 2,912 classes from core Java packages.

  • Accuracy: RACK achieved a 78.67% Top-10 accuracy, meaning the correct API was among the first ten results in nearly 80% of cases.
  • Benchmarking: RACK significantly outperformed previous state-of-the-art techniques, which typically reached only ~49% accuracy. This improvement is attributed to RACK's "project-insensitive" nature; it relies on community usage patterns rather than documentation strings.
  • Precision: The system maintained a Mean Average Precision (MAP) of 34.92%, indicating high relevance in the top-ranked results.

Discussion and Conclusion

RACK demonstrates that the "accepted answer" on crowdsourced platforms is a powerful validator for linking human intent to technical implementation. By capturing the vernacular of the developer community, RACK bypasses the limitations of formal documentation.

While highly effective, RACK's performance is currently tied to the popularity of APIs on Stack Overflow, creating a potential bias toward frequently discussed libraries. Future work aims to expand this methodology to other programming languages and integrate it into broader software maintenance tasks like concept location and requirements traceability.

Summary updated

BibTeX
@misc{rahman2018rack,
  author = {Mohammad Masudur Rahman and Chanchal K. Roy and David Lo},
  title = {{RACK: Automatic API Recommendation using Crowdsourced Knowledge}},
  year = {2018},
  eprint = {1807.02953},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1807.02953},
}
Figure