SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2110.03611 · ICLR · 2022

Adversarial Retriever-Ranker for dense text retrieval

Weizhu Chen, Yeyun Gong, Nan Duan, Yelong Shen, Hang Zhang, Jiancheng Lv

arXiv · PDF · Open in the Atlas

Code that ran

3 of 4 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 3 failures of our instrument; 1 no recorded run), measured 2026-11-23; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2110.03611.json · badge: /api/ran/2110.03611.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
microsoft/AR2 canonical (classifier label)
classifier basis: classifier_2025
3 ran · 1 no recorded run
FunctionStatusWhere it lives
compute_loss Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
microsoft/AR2/AR2/model/models.py
code served (permissive licence) · get_code("1df81ea9d2da7b70")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned Tensor, ndim 0, dtype family float; no output shape is stated. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
from torch.nn import CrossEntropyLoss

torch.manual_seed(0)

# Parameters based on function signature and usage:
# N = batch size (number of questions)
# M = number of candidate passages
# The function reshapes tensors to (N*M, -1) and processes them

N = 2
M = 3
seq_len = 4  # sequence length for start/end positions and logits

# start_positions: shape (N, M, 1) -> reshaped to (N*M, 1)
start_positions = torch.randint(0, seq_len, (N, M, 1), dtype=torch.long)

# end_positions: shape (N, M, 1) -> reshaped to (N*M, 1)
end_positions = torch.randint(0, seq_len, (N, M, 1), dtype=torch.long)

# answer_mask: shape (N, M, 1) -> reshaped to (N*M, 1)
# Used as float mask for multiplication
answer_mask = torch.randint(0, 2, (N, M, 1), dtype=torch.long)

# start_logits: shape (N*M, seq_len) before reshape, so input is (N, M, seq_len)
start_logits = torch.randn(N, M, seq_len)

# end_logits: shape (N*M, seq_len) before reshape, so input is (N, M, seq_len)
end_logits = torch.randn(N, M, seq_len)

# relevance_logits: shape (N*M,) before reshape to (N, M), so input is (N, M)
relevance_logits = torch.randn(N, M)

ARGS = {
    "start_positions": start_positions,
    "end_positions": end_positions,
    "answer_mask": answer_mask,
    "start_logits": start_logits,
    "end_logits": end_logits,
    "relevance_logits": relevance_logits,
    "N": N,
    "M": M,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 0, dtype family float — no output shape is stated: observe_signature.py could not observe it (call:AssertionError)
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
dot_product_scores Ran
ran; our contract draft was wrong, not the code
microsoft/AR2/AR2/model/models.py
code served (permissive licence) · get_code("bf4fb435a6b6eb85")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned Tensor, ndim 2, dtype family float, shape (2, 3) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# q_vectors: query vectors, shape (batch_size, embedding_dim)
q_vectors = torch.randn(2, 4)

# ctx_vectors: context vectors, shape (num_contexts, embedding_dim)
ctx_vectors = torch.randn(3, 4)

ARGS = {
    "q_vectors": q_vectors,
    "ctx_vectors": ctx_vectors,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 3) — shape (2, 3) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
load_data Ran
ran; our contract draft was wrong, not the code
microsoft/AR2/AR2/utils/prepare_ce_data.py
code served (permissive licence) · get_code("3c0bc1acb98fd458")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import json
import tempfile
import os

# Create a temporary JSON file with sample data
temp_dir = tempfile.mkdtemp()
data_path = os.path.join(temp_dir, "test_data.json")

# Create sample data matching the expected structure
sample_data = [
    {
        "question": "What is the capital of France?",
        "ctxs": [
            {"text": "Paris is the capital of France", "title": "France"},
            {"text": "France is in Europe", "title": "Geography"}
        ]
    },
    {
        "question": "What is 2+2?",
        "ctxs": [
            {"text": "2+2 equals 4", "title": "Math"}
        ]
    }
]

# Write the sample data to the temporary file
with open(data_path, 'w', encoding='utf-8') as fout:
    json.dump(sample_data, fout)

# Define ARGS with the required parameter
ARGS = {
    'data_path': data_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
tqdm — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
read_train_pos Not yet run
unverified (harvested, no recorded run)
microsoft/AR2/AR2/utils/prepare_ce_data.py
code served (permissive licence) · get_code("ff049d81c99cb397")
How it ran

no invocation recorded.

Also present in other papers' code

Of 4 samples lifted from this paper's linked repositories, 4 carry a function identity and 0 do not. Of the 4 distinct functions with an identity, 2 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 2 later) and 2 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
compute_loss 5 other papers
1 dated earlier, 4 later
2109.04014 (2021-09)
Weakly-Supervised Visual-Retriever-Reader for Knowledge-based Question Answering
2205.09843 (2022-05)
Table Retrieval May Not Necessitate Table-specific Model Design
2024.findings-acl.708 (2024 (year only))
Analyze, Generate and Refine: Query Expansion with LLMs for Zero-Shot Open-Domain QA
and 2 more not named here
dot_product_scores 1 other paper
1 later
2506.21579 (2025-06)
LLM2Rec: Large Language Models Are Powerful Embedding Models for Sequential Recommendation

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Current dense text retrieval models face two typical challenges. First, they adopt a siamese dual-encoder architecture to encode queries and documents independently for fast indexing and searching, while neglecting the finer-grained termwise interactions. This results in a sub-optimal recall performance. Second, their model training highly relies on a negative sampling technique to build up the negative documents in their contrastive losses. To address these challenges, we present Adversarial Retriever-Ranker (AR2), which consists of a dual-encoder retriever plus a cross-encoder ranker. The two models are jointly optimized according to a minimax adversarial objective: the retriever learns to retrieve negative documents to cheat the ranker, while the ranker learns to rank a collection of candidates including both the ground-truth and the retrieved ones, as well as providing progressive direct feedback to the dual-encoder retriever. Through this adversarial game, the retriever gradually produces harder negative documents to train a better ranker, whereas the cross-encoder ranker provides progressive feedback to improve retriever. We evaluate AR2 on three benchmarks. Experimental results show that AR2 consistently and significantly outperforms existing dense retriever methods and achieves new state-of-the-art results on all of them. This includes the improvements on Natural Questions R@5 to 77.9% (+2.1%), TriviaQA R@5 to 78.2% (+1.4%), and MS-MARCO MRR@10 to 39.5% (+1.3%). Code and models are available at https://github.com/microsoft/AR2.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2110.03611")
get_code_for_paper("2110.03611")
have("2110.03611")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2110.03611.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2110.03611.svg)](https://syntology.ai/paper/2110.03611)

Connect an agent — have() is free.