SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2025.findings-acl.1384 · ACL Findings · 2025

Accelerating Adaptive Retrieval Augmented Generation via Instruction-Driven Representation Reduction of Retrieval Overlaps

Shunyu Yao, Libo Qin, Zhaokun Wang, Jinyu Guo, Jie Ou, Wenhong Tian, Shuaihong Jiang

Open in the Atlas

Code that ran

9 of 10 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 6 have no contract verdict; 3 failures of our instrument; 1 no recorded run), measured 2026-11-24; 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/2025.findings-acl.1384.json · badge: /api/ran/2025.findings-acl.1384.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
Muennighoff/sgpt canonical (classifier label)
classifier basis: census
9 ran · 1 no recorded run
FunctionStatusWhere it lives
clean_empty_list Ran
ran on a synthesized input
Muennighoff/sgpt/biencoder/beir/io_utils/plugin_io_utils.py
code served (permissive licence) · get_code("eaed9a0a1b28f5d7")
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 int; 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 torch
import torch.nn as nn

torch.manual_seed(0)

# Construct arguments for clean_empty_list function
# The function takes a sequence parameter and checks if it's a non-empty list

# Test case 1: valid non-empty list
sequence_non_empty = [1, 2, 3, 4, 5]

ARGS = {
    "sequence": sequence_non_empty
}
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 list, ndim 1, dtype family int — 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
clean_titles Ran
ran; our contract draft was wrong, not the code
Muennighoff/sgpt/biencoder/beir/beir_dense_retriever.py
code served (permissive licence) · get_code("51678dd4874a6563")
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 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 torch

torch.manual_seed(0)

# Construct a corpus dict with various entries
# Some have titles that are None, some have valid titles, some don't have title key
corpus = {
    'doc1': {
        'title': None,
        'content': 'This is document 1'
    },
    'doc2': {
        'title': 'Valid Title',
        'content': 'This is document 2'
    },
    'doc3': {
        'content': 'This is document 3 without title key'
    },
    'doc4': {
        'title': None,
        'content': 'Another document with None title'
    }
}

ARGS = {
    'corpus': corpus
}
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 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
construct_context Ran
ran on a synthesized input
Muennighoff/sgpt/crossencoder/beir/openai_search_endpoint_functionality.py
code served (permissive licence) · get_code("e127a025512577c4")
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.

query = 'apple orang asdansbdausd'

def construct_context(query, document):
    return '<|endoftext|>{document}\n\n---\n\nThe above passage is related to: {query}'.format(document=document, query=query)

# Setup code
ARGS = {
    'query': 'apple orang asdansbdausd',
    'document': 'This is a document about apples and oranges. Apples are red or green fruits.'
}
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
encode Ran
ran on a synthesized input
Muennighoff/sgpt/crossencoder/beir/sgptce.py
code served (permissive licence) · get_code("2d1973ab0dfda2fd")
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. 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
import numpy as np

class MockTokenizer:
    def __init__(self):
        self.eos_token_id = 50256
    
    def encode(self, text, add_special_tokens=False):
        # Simple mock: convert text to list of token ids based on character count
        return [100 + i for i in range(len(text.split()))]

# Create mock tokenizer
tokenizer = MockTokenizer()

# Create mock requests: list of (continuation, context) tuples
requests = [
    ("hello world", "The quick brown"),
    ("foo bar baz", "context example"),
]

ARGS = {
    "requests": requests,
    "tokenizer": tokenizer,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list — a list output has no array shape of its own; none is 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
get_gpus_max_memory Ran
ran; our contract draft was wrong, not the code
Muennighoff/sgpt/crossencoder/beir/sgptce.py
pointer only (licence: MIT); the stored copy get_code serves, from tianyi-lab/moe-embedding, is pointer only (licence: NONE) · get_code("aecadcaa2ac48b1b")
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 tianyi-lab/moe-embedding, 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.

group Ran
ran; our contract draft was wrong, not the code
Muennighoff/sgpt/crossencoder/beir/sgptce.py
pointer only (licence: MIT); the stored copy get_code serves, from hdong920/griffin, is pointer only (licence: NONE) · get_code("359c35fdcd7a0ee5")
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 hdong920/griffin, 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.

search Ran
ran on a synthesized input
Muennighoff/sgpt/crossencoder/beir/openai_search_endpoint_functionality.py
code served (permissive licence) · get_code("28d1ad439bb312af")
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.

import openai
from unittest.mock import Mock, patch

# Mock the openai.Completion.create to avoid actual API calls
def mock_completion_create(model, prompt, temperature, top_p, max_tokens, logprobs, n, echo):
    """Mock OpenAI completion that returns structured response"""
    # Create mock responses for each prompt
    choices = []
    for idx, p in enumerate(prompt):
        choice = {
            'index': idx,
            'logprobs': {
                'token_logprobs': [-0.5, -0.3, -0.2, -0.1, -0.4] * 2,  # Enough log probs
                'text_offset': [0, 5, 10, 15, 20, 25, 30, 35, 40, 45]  # text offsets
            }
        }
        choices.append(choice)
    
    return {'choices': choices}

# Patch openai.Completion.create before defining ARGS
with patch('openai.Completion.create', side_effect=mock_completion_create):
    pass

# Define the arguments for search function
query_arg = 'apple orange test'
documents_arg = ['test1', 'asdklgjnasdv', 'banana', 'lord lollipop']
engine_arg = 'text-davinci-003'

# Patch openai.Completion.create globally
openai.Completion.create = mock_completion_create

ARGS = {
    'query': query_arg,
    'documents': documents_arg,
    'engine': engine_arg
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
openai — 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
truncate_text_list Ran
ran on a synthesized input
Muennighoff/sgpt/biencoder/beir/io_utils/plugin_io_utils.py
code served (permissive licence) · get_code("1f5035a7756ee25c")
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.

import torch

# Define a small list of strings with varying lengths
text_list = [
    "This is a short text.",
    "This is a much longer text that exceeds the default truncation limit and should be truncated with the ellipsis marker added to the end.",
    "Medium length text here.",
    "A" * 200,  # Very long string
]

# Define the number of characters to truncate to
num_characters = 140

# Create the ARGS dictionary with all parameters
ARGS = {
    "text_list": text_list,
    "num_characters": num_characters,
}
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 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
unique_list Ran
ran on a synthesized input
Muennighoff/sgpt/biencoder/beir/io_utils/plugin_io_utils.py
code served (permissive licence) · get_code("ac188a47ad7d4d9a")
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 int; 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 torch
import numpy as np

# Set seed for reproducibility
torch.manual_seed(0)

# The function takes a sequence (list) and returns a list with unique elements
# ordered by appearance. Let's construct test cases.

# Test case 1: List with duplicate integers
sequence_1 = [1, 2, 3, 2, 4, 1, 5, 3]

# Test case 2: List with strings
sequence_2 = ["apple", "banana", "apple", "cherry", "banana"]

# Test case 3: List with mixed types (that are hashable)
sequence_3 = [1, "a", 2, "a", 1, 3]

# Test case 4: List with tuples (hashable)
sequence_4 = [(1, 2), (3, 4), (1, 2), (5, 6)]

# Test case 5: Empty list
sequence_5 = []

# Test case 6: List with no duplicates
sequence_6 = [10, 20, 30, 40]

# Choose one sequence for the ARGS dict
# Using sequence_1 as the primary test case
ARGS = {
    "sequence": [1, 2, 3, 2, 4, 1, 5, 3]
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — 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 int — 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_score Not yet run
unverified (harvested, no recorded run)
Muennighoff/sgpt/crossencoder/beir/openai_search_endpoint_functionality.py
code served (permissive licence) · get_code("e71e0d710acd1e64")
How it ran

no invocation recorded.

Also present in other papers' code

Of 10 samples lifted from this paper's linked repositories, 10 carry a function identity and 0 do not. Of the 10 distinct functions with an identity, 3 are also present in other papers whose code we hold (3 with at least one paper dated earlier, 0 the same month, 1 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
group 8 other papers
8 dated earlier
2110.04374 (2021-10)
A Few More Examples May Be Worth Billions of Parameters
2303.17003 (2023-03)
Evaluating GPT-3.5 and GPT-4 Models on Brazilian University Admission Exams
2305.14493 (2023-05)
Do prompt positions really matter?
and 5 more not named here
get_gpus_max_memory 4 other papers
3 dated earlier, 1 later
2402.09906 (2024-02)
Generative Representational Instruction Tuning
2408.09121 (2024-08)
Selective Prompt Anchoring for Code Generation
2410.10814 (2024-10)
Your Mixture-of-Experts LLM Is Secretly an Embedding Model For Free
and 1 more not named here
clean_titles 1 other paper
1 dated earlier
2202.08904 (2022-02)
SGPT: GPT Sentence Embeddings for Semantic Search

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

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-augmented generation (RAG) has emerged as a pivotal method for expanding the knowledge of large language models. To handle complex queries more effectively, researchers developed Adaptive-RAG (A-RAG) to enhance the generated quality through multiple interactions with external knowledge bases. Despite its effectiveness, A-RAG exacerbates the pre-existing efficiency challenges inherent in RAG, which are attributable to its reliance on multiple iterations of generation. Existing A-RAG approaches process all retrieved contents from scratch. However, they ignore the situation where there is a significant overlap in the content of the retrieval results across rounds. The overlapping content is redundantly represented, which leads to a large proportion of repeated computations, thus affecting the overall efficiency. To address this issue, this paper introduces a model-agnostic approach that can be generally applied to A-RAG methods, which is dedicated to reducing the redundant representation process caused by the overlapping of retrieval results. Specifically, we use cache access and parallel generation to speed up the prefilling and decoding stages respectively. Additionally, we also propose an instruction-driven module to further guide the model to more effectively attend to each part of the content in a more suitable way for LLMs. Experiments show that our approach achieves 2.79 and 2.33 times significant acceleration on average for prefilling and decoding respectively while maintaining equal generation quality.

For agents

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

get_harvested_code_for_paper("2025.findings-acl.1384")
get_code_for_paper("2025.findings-acl.1384")
have("2025.findings-acl.1384")

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

curl https://syntology.ai/api/ran/2025.findings-acl.1384.json

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

[![Syntology run record](https://syntology.ai/api/ran/2025.findings-acl.1384.svg)](https://syntology.ai/paper/2025.findings-acl.1384)

Connect an agent — have() is free.