JA EN
LearnTraining & Alignment
·★ MEMBER·PAPER·13 min read

Paper Walkthrough: It Takes Two to Match — Co-Evolving Both Sides of Retrieval with RL

A paper that rebuilds the first stage of search by having two LLMs write keywords — one for queries, one for items — and training them in alternation until their vocabularies meet. Explained from scratch.

ModalitytextTaskfine-tuning

It Takes Two to Match: Co-Evolving Generative Retriever with Reinforcement Learning

Primary source — what this article is built on

undefined2026-09-01undefined2026-09-04same month

It Takes Two to Match: Co-Evolving Generative Retriever with Reinforcement LearningRunpeng Dai, Kaili Huang, Changsung Kang et al. · 2026-09-01 · v1arXiv:2609.00638Paper page·PDF
undefined

Retrieval is the first stage of modern search and advertising systems, selecting a candidate set from a large item universe for downstream ranking and auction. Recent work increasingly leverages LLMs to improve retrieval through query expansion, data synthesis, and retrieval-feedback training. However, the generative component is typically used for query-side augmentation, while final matching is still delegated to a downstream retriever. We introduce CoGR, a retrieval framework that instead trains LLMs to directly construct retrieval representations on both query and item sides. Each generator produces a compact set of keywords, which are matched directly through an inverted index, preserving compatibility with existing keyword-based retrieval infrastructure. CoGR uses a two-stage training pipeline. Supervised fine-tuning first establishes an aligned keyword space, after which co-evolving reinforcement learning alternately optimizes the query- and item-side generators with GRPO against the opposite side's frozen index. Both sides optimize the same query-to-item retrieval $F_1$ objective: the query side receives retrieval $F_1$ directly, while the item side receives a counterfactual marginal reward measuring the change in query-side $F_1$ caused by its generated keywords. Across 10 representative sparse, dense, and generative baselines, CoGR achieves the best performance on both an internal APP Marketplace dataset and the public WANDS benchmark, improving $F_1$ over the strongest baseline by $10.9\%$ and $36.1\%$, respectively. Further analysis shows stable co-evolution and increasingly aligned query--item keyword spaces over training.


Whatever the first stage drops is gone for good

The paper is "It Takes Two to Match: Co-Evolving Generative Retriever with Reinforcement Learning" (arXiv:2609.00638, by Runpeng Dai, Kaili Huang, Changsung Kang and Ciya Liao, posted 2026-09-01).

Here is what it claims, up front. Retrieval — the first stage of search and advertising systems — narrows a huge item universe down to a candidate set for downstream ranking and auction. Recent work has been pouring LLMs into this stage through query expansion, data synthesis and retrieval-feedback training, but the generative component is almost always used to augment the query side while the actual matching is still handed off to a separate downstream retriever. The paper's system, CoGR, instead trains LLMs to build the retrieval representation itself on both sides: each generator emits a compact set of keywords, and matching happens directly through an inverted index. Training runs in two stages. Supervised fine-tuning (SFT) first establishes an aligned keyword space; then co-evolving reinforcement learning alternately optimizes the query- and item-side generators with GRPO against the opposite side's frozen index. Both sides chase the same query-to-item retrieval F1F_1: the query side receives that F1F_1 directly, while the item side receives a counterfactual marginal reward measuring how much its generated keywords moved the query-side F1F_1. Against 10 representative sparse, dense and generative baselines, CoGR wins on both an internal APP Marketplace dataset and the public WANDS benchmark, improving F1F_1 over the strongest baseline by 10.9%10.9\% and 36.1%36.1\% respectively (Abstract).

Why does this stage matter so much? Because, as the paper puts it, its errors are largely irreversible (§1). An item that isn't retrieved can't be rescued by any downstream model, however clever. Push too many irrelevant items through and you simply load up the next stage. Cast wide but land precise — that recall/precision tension is the job of stage one.

An analogy: make both the job ad and the résumé use the same words

Keyword retrieval is job matching. The employer writes required skills into the posting; the candidate writes owned skills into the résumé. Share a word, and you meet.

In practice the posting says "front-end" and the résumé says "React." The substance lines up, the strings don't, and the two never find each other.

The usual fix is to leave résumés alone and expand the posting's vocabulary. CoGR's move is to rewrite both documents — and not once. Each side is rewritten repeatedly, in alternation, guided by how many matches the last rewrite actually produced. That is what the title's It Takes Two is pointing at.

What came before, and the axis this paper shifts

The paper sorts prior work into three families (§1, §5):

On top of these came LLM-based query expansion, pseudo-document generation, and eventually methods like DeepRetrieval that train an LLM from downstream retrieval-metric rewards. The paper's observation is that nearly all of them train one side only, usually the query side (§1). CoGR changes that: train both, and let the generated keywords be the index. A side benefit it emphasizes is compatibility — keyword output drops straight into existing keyword-based retrieval infrastructure.

The contrast with dense retrieval is easier to feel than to read. Drag a query through a cloud of document vectors below: dense retrieval ranks by a continuous distance, whereas keyword matching is a hard yes/no on whether a string appears.

FIG 1Dense retrieval ranks by proximity. CoGR builds its candidate set from generated words that either overlap or don't

Mechanism 1: matching is just set overlap

Before the training story, pin down what retrieval is here. A query-side generator GqG^q and an item-side generator GiG^i emit keyword sets Sq=Gq(q)S_q = G^q(q) and Si=Gi(i)S_i = G^i(i). The retrieved set is defined as (§2.1):

Iret(q)={i:(Sq{q})(Si{i})}I_{\mathrm{ret}}(q)=\{\, i : (S_q \cup \{q\}) \cap (S_i \cup \{i\}) \neq \varnothing \,\}
(1)

In words: take the bag holding the query itself plus its generated keywords, take the bag holding the item itself plus its generated keywords, and admit the item if the two bags share at least one element. That's it. (\cap is intersection, \varnothing the empty set, so "intersection isn't empty" means "at least one overlap.")

That gives a candidate set but no ordering, so the paper treats each side's keyword set as a bag of words and ranks the retrieved items by BM25 (§2.1). CoGR's novelty is entirely in how candidates are produced; the ranking function stays classical.

One more intuition to hold onto. The similarity dense retrieval uses is an inner product, which grows as two vectors point the same way. Keyword overlap is that quantity crushed down to 0 or 1.

FIG 2Dense similarity varies smoothly; keyword matching is the extreme case where it collapses to "overlap / no overlap"

If you want the embedding side of this story, see Embeddings from scratch; for how retrieval plugs into generation, see RAG fundamentals.

Start RL cold and the two sides speak different languages: zero matches, zero reward, no gradient to learn from. Phase 1 exists to hand RL an aligned starting point (§2.2). The recipe is refreshingly plain:

What's behind this

§

Members-only from here

371 walkthroughs, 26 textbook chapters, 48 student units and 6 close readings — all included for $4.99/mo, with three new explainers every day. Cancel any time; access runs to the end of the period.

Already a member? Sign in to keep reading

References

  1. Runpeng Dai, Kaili Huang, Changsung Kang, Ciya Liao. (2026-09-01) It Takes Two to Match: Co-Evolving Generative Retriever with Reinforcement Learning. arXiv:2609.00638Paper page·PDF

This article is written from the source paper above. Where they differ, the original is authoritative.

Comments

Sign in to comment