SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2305.17331 · ACL · 2023

Augmentation-Adapted Retriever Improves Generalization of Language Models as Generic Plug-In

Chenyan Xiong, Zhiyuan Liu, Zichun Yu, Shi Yu

arXiv · PDF · Open in the Atlas

Code that ran

9 of 11 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (1 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 2 violated it and 5 have no contract verdict; 2 failures of our instrument; 2 no recorded run), measured 2026-11-21; 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/2305.17331.json · badge: /api/ran/2305.17331.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
OpenMatch/Augmentation-Adapted-Retriever canonical (classifier label)
classifier basis: census
7 ran · 0 no recorded run
openai/chatgpt-retrieval-plugin canonical (classifier label)
classifier basis: census
0 ran · 2 no recorded run
ruc-nlpir/flashrag community
Papers with Code archive
2 ran · 0 no recorded run
FunctionStatusWhere it lives
BaseRetriever Ran
ran on a synthesized input · constructed an object; no result was computed
ruc-nlpir/flashrag/flashrag/retriever/retriever.py
code served (permissive licence) · get_code("a682282c07342f6e")
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, through the batch API) and returned an instance of its own class, BaseRetriever: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type 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 numpy as np
import json
import os
import tempfile

class MockReranker:
    """Mock reranker for testing."""
    def rerank(self, query, documents):
        return documents

def get_reranker(config):
    """Mock function to get reranker."""
    return MockReranker()

# Create temporary directory for cache and save paths
temp_dir = tempfile.mkdtemp()
cache_file = os.path.join(temp_dir, 'retrieval_cache.json')

# Pre-populate cache file
initial_cache = {
    "query1": [
        {"contents": "doc1", "title": "Title 1", "text": "Text 1", "score": 0.95},
        {"contents": "doc2", "title": "Title 2", "text": "Text 2", "score": 0.87}
    ]
}
with open(cache_file, 'w') as f:
    json.dump(initial_cache, f)

config = {
    'retrieval_method': 'bm25',
    'retrieval_topk': 5,
    'index_path': os.path.join(temp_dir, 'index.pkl'),
    'corpus_path': os.path.join(temp_dir, 'corpus.json'),
    'save_retrieval_cache': True,
    'use_retrieval_cache': True,
    'retrieval_cache_path': cache_file,
    'use_reranker': False,
    'silent_retrieval': False,
    'save_dir': temp_dir,
}

ARGS = {
    'config': config
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type BaseRetriever — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a BaseRetriever output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
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
convert_numpy Ran
ran; our contract draft was wrong, not the code
ruc-nlpir/flashrag/flashrag/retriever/retriever.py
code served (permissive licence) · get_code("bab8ba3f385d2ae7")
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, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type 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 numpy as np
from typing import Dict, Any, Union, List

# Create test data with various numpy types
np_array_2d = np.array([[1, 2, 3], [4, 5, 6]])
np_array_1d = np.array([7, 8, 9])
np_int32 = np.int32(42)
np_float32 = np.float32(3.14)
np_float64 = np.float64(2.718)
np_int64 = np.int64(100)

# Build a nested structure with mixed types
nested_dict = {
    "simple_int": 10,
    "simple_str": "hello",
    "numpy_array_2d": np_array_2d,
    "numpy_array_1d": np_array_1d,
    "numpy_int32": np_int32,
    "numpy_float32": np_float32,
    "nested": {
        "float64": np_float64,
        "int64": np_int64,
        "list_with_arrays": [np_array_1d, np_int32, "text"]
    }
}

nested_list = [
    np_array_2d,
    {"key": np_float32},
    [np_int64, "string", 42],
    np_float64
]

ARGS = {
    "obj": nested_dict
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
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
fill_template Ran
ran on a synthesized input
OpenMatch/Augmentation-Adapted-Retriever/src/Retriever/utils.py
code served (permissive licence) · get_code("d6bb2b70f0c01eb0")
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, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type 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 warnings
from typing import Dict, List

def find_all_markers(template: str):
    """
    Find all markers' names (quoted in "<>") in a template.
    """
    markers = []
    start = 0
    while True:
        start = template.find('<', start)
        if start == -1:
            break
        end = template.find('>', start)
        if end == -1:
            break
        markers.append(template[start + 1:end])
        start = end + 1
    return markers

def fill_template(template: str, data: Dict, markers: List[str]=None, allow_not_found: bool=False):
    """
    Fill a template with data.
    """
    if markers is None:
        markers = find_all_markers(template)
    for marker in markers:
        marker_hierarchy = marker.split('.')
        found = True
        content = data
        for marker_level in marker_hierarchy:
            content = content.get(marker_level, None)
            if content is None:
                found = False
                break
        if not found:
            if allow_not_found:
                warnings.warn("Marker '{}' not found in data. Replacing it with an empty string.".format(marker), RuntimeWarning)
                content = ''
            else:
                raise ValueError("Cannot find the marker '{}' in the data".format(marker))
        template = template.replace('<{}>'.format(marker), str(content))
    return template


# Setup code
template_simple = "Hello <name>, your score is <score>"
data_simple = {
    "name": "Alice",
    "score": 95
}

template_nested = "User <user.first_name> <user.last_name> has <user.profile.role>"
data_nested = {
    "user": {
        "first_name": "Bob",
        "last_name": "Smith",
        "profile": {
            "role": "admin"
        }
    }
}

template_missing = "Value: <exists>, Missing: <missing>"
data_missing = {
    "exists": "found"
}

ARGS = {
    "template": template_simple,
    "data": data_simple,
    "markers": None,
    "allow_not_found": False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
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
find_all_markers Ran
ran on a synthesized input
OpenMatch/Augmentation-Adapted-Retriever/src/Retriever/utils.py
code served (permissive licence) · get_code("caca62e96a19b300")
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, through the batch API) 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.

# Setup code for find_all_markers function

ARGS = {
    "template": "Hello <name>, you have <count> messages from <sender>."
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — 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
get_idx Ran
ran on a synthesized input
OpenMatch/Augmentation-Adapted-Retriever/src/Retriever/dataset/inference_dataset.py
code served (permissive licence) · get_code("5648464c24fcb9de")
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, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type 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

# Define ARGS with a dict object that has various id field options
ARGS = {
    'obj': {
        '_id': 12345
    }
}

# Also test that the function works with alternative id fields
# by demonstrating valid inputs:
test_obj_1 = {'_id': 'example_id_1'}
test_obj_2 = {'id': 'example_id_2'}
test_obj_3 = {'text_id': 'example_id_3'}
test_obj_4 = {'_id': None, 'id': 'fallback_id'}
test_obj_5 = {}  # No id fields

# The main ARGS dictionary for function execution
ARGS = {
    'obj': test_obj_1
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
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
has_answers Ran
ran, violated the contract we drafted
OpenMatch/Augmentation-Adapted-Retriever/src/Retriever/qa_utils.py
pointer only (licence: MIT); the stored copy get_code serves, from cxcscmu/longembeddinganalysis, is pointer only (licence: NONE) · get_code("b46a95cff9bf41b5")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from cxcscmu/longembeddinganalysis, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

load_beir_qrels Ran
ran on a synthesized input
OpenMatch/Augmentation-Adapted-Retriever/src/Retriever/dataset/beir_dataset.py
code served (permissive licence) · get_code("3d25cb3600eef8dc")
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, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type 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 csv
import tempfile
import os

# Create a temporary TSV file with BEIR qrels format
temp_dir = tempfile.mkdtemp()
qrels_file = os.path.join(temp_dir, "qrels.tsv")

# Write sample qrels data
with open(qrels_file, 'w', newline='') as f:
    writer = csv.DictWriter(f, fieldnames=['query-id', 'corpus-id', 'score'], delimiter='\t')
    writer.writeheader()
    writer.writerow({'query-id': 'q1', 'corpus-id': 'doc1', 'score': '1'})
    writer.writerow({'query-id': 'q1', 'corpus-id': 'doc2', 'score': '0'})
    writer.writerow({'query-id': 'q2', 'corpus-id': 'doc3', 'score': '2'})
    writer.writerow({'query-id': 'q2', 'corpus-id': 'doc1', 'score': '1'})

ARGS = {
    'qrels_file': qrels_file
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
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_from_trec Ran
ran; our contract draft was wrong, not the code
OpenMatch/Augmentation-Adapted-Retriever/src/Retriever/utils.py
pointer only (licence: MIT); the stored copy get_code serves, from cxcscmu/longembeddinganalysis, is pointer only (licence: NONE) · get_code("8d2e5d58238cd53f")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from cxcscmu/longembeddinganalysis, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

regex_match Ran
ran, violated the contract we drafted
OpenMatch/Augmentation-Adapted-Retriever/src/Retriever/qa_utils.py
code served (permissive licence) · get_code("93b0eef32604c3f7")
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 bool, ndim 0, dtype family float, shape () 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 re

# The function regex_match takes two parameters:
# 1. text: a string to search within
# 2. pattern: a regex pattern string to compile and search for

ARGS = {
    "text": "The quick brown fox jumps over the lazy dog. This is a test string with multiple lines.\nSecond line here.",
    "pattern": r"quick.*fox"
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type bool, ndim 0, dtype family float, shape () — shape () 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
get_chat_completion Not yet run
unverified (harvested, no recorded run)
openai/chatgpt-retrieval-plugin/services/openai.py
code served (permissive licence) · get_code("1368abdb3d44d09f")
How it ran

no invocation recorded.

get_embeddings Not yet run
unverified (harvested, no recorded run)
openai/chatgpt-retrieval-plugin/services/openai.py
code served (permissive licence) · get_code("b009eb83df585f1c")
How it ran

no invocation recorded.

Also present in other papers' code

Of 11 samples lifted from this paper's linked repositories, 11 carry a function identity and 0 do not. Of the 11 distinct functions with an identity, 4 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 4 the same month, 3 later) and 7 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
regex_match 6 other papers
2 dated earlier, 1 the same month, 2 later, 1 same year, order not determinable
2101.00294 (2021-01)
Reader-Guided Passage Reranking for Open-Domain Question Answering
2102.10073 (2021-02)
Pyserini: An Easy-to-Use Python Toolkit to Support Replicable IR Research with Sparse and Dense Representations
2023.findings-acl.734 (2023 (year only))
Structure-Aware Language Model Pretraining Improves Dense Retrieval on Structured Data
and 3 more not named here
has_answers 3 other papers
1 the same month, 1 later, 1 same year, order not determinable
2023.findings-acl.734 (2023 (year only))
Structure-Aware Language Model Pretraining Improves Dense Retrieval on Structured Data
2305.19912 (2023-05)
Structure-Aware Language Model Pretraining Improves Dense Retrieval on Structured Data
2404.04163 (2024-04)
Dwell in the Beginning: How Language Models Embed Long Documents for Dense Retrieval
load_from_trec 3 other papers
1 the same month, 1 later, 1 same year, order not determinable
2023.findings-acl.734 (2023 (year only))
Structure-Aware Language Model Pretraining Improves Dense Retrieval on Structured Data
2305.19912 (2023-05)
Structure-Aware Language Model Pretraining Improves Dense Retrieval on Structured Data
2404.04163 (2024-04)
Dwell in the Beginning: How Language Models Embed Long Documents for Dense Retrieval
load_beir_qrels 2 other papers
1 the same month, 1 same year, order not determinable
2023.findings-acl.734 (2023 (year only))
Structure-Aware Language Model Pretraining Improves Dense Retrieval on Structured Data
2305.19912 (2023-05)
Structure-Aware Language Model Pretraining Improves Dense Retrieval on Structured Data

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-21.

Repositories linked to this paper

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

Abstract

Retrieval augmentation can aid language models (LMs) in knowledge-intensive tasks by supplying them with external information. Prior works on retrieval augmentation usually jointly fine-tune the retriever and the LM, making them closely coupled. In this paper, we explore the scheme of generic retrieval plug-in: the retriever is to assist target LMs that may not be known beforehand or are unable to be fine-tuned together. To retrieve useful documents for unseen target LMs, we propose augmentation-adapted retriever (AAR), which learns LM's preferences obtained from a known source LM. Experiments on the MMLU and PopQA datasets demonstrate that our AAR trained with a small source LM is able to significantly improve the zero-shot generalization of larger target LMs ranging from 250M Flan-T5 to 175B InstructGPT. Further analysis indicates that the preferences of different LMs overlap, enabling AAR trained with a single source LM to serve as a generic plug-in for various target LMs. Our code is open-sourced at https://github.com/OpenMatch/Augmentation-Adapted-Retriever.

For agents

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

get_harvested_code_for_paper("2305.17331")
get_code_for_paper("2305.17331")
have("2305.17331")

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

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

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

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

Connect an agent — have() is free.