Beyond Retrieval: A Multitask Benchmark and Model for Code Search

Siqiao Xue, Zihan Liao, Jin Qin, Ziyin Zhang, Yixiang Mu, Fan Zhou, Hang YuarXiv 2026

TL;DR

The paper introduces CoREB, a new multitask code search benchmark designed to evaluate the entire retrieve-and-rerank pipeline while eliminating data contamination and label noise. Alongside the benchmark, the authors release CoREB-Reranker, a fine-tuned model that consistently improves code search performance across multiple programming languages and tasks where standard rerankers fail.

What Problem Does This Paper Address?

Modern code search pipelines—which power developer tools and AI coding agents like SWE-agent or Cursor—rarely rely on a single step. They typically use a fast embedding model for first-stage retrieval, followed by a downstream reranker to fine-tune the results.

However, existing code retrieval benchmarks suffer from four major flaws:

  1. Missing Reranking Support: They only evaluate the initial embedding stage.
  2. Data Contamination: Popular datasets like CodeSearchNet have been heavily used in model pre-training, artificially inflating evaluation scores.
  3. Label Noise: Human annotations in code datasets are notoriously noisy (e.g., ~51% mislabeled pairs in CosQA), and many tasks rely on simplistic docstring matching rather than real-world developer queries.
  4. Degenerate Relevance Structure: Most benchmarks use binary (hit-or-miss) metrics with exactly one relevant document per query, failing to reflect the multi-solution reality of software engineering.

Methods

To overcome these limitations, the authors developed a rigorous pipeline to build CoREB and its companion reranker:

  • Counterfactual Rewriting: Instead of scraping public repositories, they took competitive programming problems from LiveCodeBench and used GPT-o1 to rewrite them. This alters the surface-level text (variable names, narrative framing) to bypass model memorization while keeping the underlying algorithmic logic identical.
  • Programmatic Verification: To eliminate human error, relevance labels are determined by executing code candidates against test suites. If the code passes the test oracles, it is programmatically verified as correct.
  • Graded Relevance Scheme: CoREB uses a three-level scoring system: Relevance=2 for verified correct solutions, Relevance=1 for superficially plausible but incorrect "hard negatives" (e.g., failed code solutions), and Unjudged for easy negatives.
  • CoREB-Reranker: The authors fine-tuned a Qwen3-Reranker-4B model using LoRA on a balanced 3.1M-sample corpus containing explicit hard negatives. They used a "model soup" technique (averaging weights of different training runs) to ensure robust performance.
Figure 2: Benchmark construction pipeline. Each step is detailed in the corresponding paragraph below.

Datasets

The paper introduces the CoREB benchmark, split into two timed releases to mitigate future data leakage: v202602 and v202603.

  • It aggregates 5,087 queries across three main tasks: text-to-code, code-to-text, and code-to-code.
  • It spans five programming languages: Python, Java, C++, Ruby, and Go.

The CoREB-Reranker was trained on a mixture of CoREB v202602, CodeSearchNet, APPS, CosQA, and CodeFeedback.

Figure 1: Aggregated query distribution across both COREB releases (5,087 queries total). Percentages <8% are shown outside with leader lines. Per-release breakdowns are in Figure 11.

Key Insights and Ideas

  • The "Surface-Level" Illusion: Counterfactual rewriting revealed that frontier models partially memorize benchmark problems. When problem descriptions were rewritten without changing the logic, Gemini 3 Flash saw a consistent drop in its code-solving ability (Pass@1), proving that data leakage skews standard evaluations.
Figure 3: Pass@1 change (pp) after rewriting for Gemini 3 Flash across two releases cover- ing different contest windows.
  • Domain Specialization Beats Scale: Smaller, code-specialized embedding models routinely outperform massive general-purpose models. For instance, a 0.5B parameter code-trained model outperformed an 8B general-purpose encoder by over 12 points overall, proving highly parameter-efficient.
  • The Short-Query Collapse: While models perform well on long, detailed problem descriptions, they completely collapse when faced with short, keyword-style queries (averaging ~19 tokens)—the exact format real developers use. Every tested model dropped to near-zero performance on these queries.
  • Reranking is High-Stakes and Asymmetric: Off-the-shelf rerankers are highly volatile. A reranker that helps on a code-to-code task might severely degrade performance on a code-to-text task. No baseline reranker achieved net-positive results across all tasks, highlighting the need for domain-specific fine-tuning.

Key Results

The authors evaluated eleven embedding models and five rerankers on CoREB v202603:

  • Retrieval: Google's closed-API GemEmb-2 achieved the highest overall retrieval score (0.637 nDCG@10), while C2LLM-7B was the strongest open-weight model.
  • Task Difficulty: Code-to-text proved to be the easiest task, while text-to-code was the most challenging.
Figure 4: nDCG@k at k∈{1, 5, 10} per task, av- eraged over all eleven models on v202603. Code- to-text saturates early; text-to-code and code-to- code grow more steeply with k.
  • Reranking: While standard rerankers degraded performance on text-heavy tasks, CoREB-Reranker was the only model to achieve consistent, net-positive gains across all three retrieval directions when paired with the C2LLM-7B retriever.

Limitations and Future Work

The authors note several boundaries to their current work:

  • Scope of Code: The corpus is drawn entirely from competitive programming, meaning it may not perfectly mirror enterprise software architectures or library-dependent code bases.
  • Language Coverage: It is restricted to five major languages, leaving lower-resource languages (like Rust or Kotlin) unexamined.
  • Query Realism: Queries are LLM-generated from problem statements rather than harvested from real developer search logs.
  • Static Evaluation: The benchmark evaluates single-turn, offline search, leaving interactive or multi-turn conversational code search for future iterations.

Summary updated

BibTeX
@misc{xue2026beyond,
  author = {Siqiao Xue and Zihan Liao and Jin Qin and Ziyin Zhang and Yixiang Mu and Fan Zhou and Hang Yu},
  title = {{Beyond Retrieval: A Multitask Benchmark and Model for Code Search}},
  year = {2026},
  eprint = {2605.04615},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2605.04615},
}
Figure