SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2505.12260 · ICLR · 2025

LightRetriever: A LLM-based Text Retrieval Architecture with Extremely Faster Query Inference

Ming Zhou, Songlin Hu, Guangyuan Ma, Yongliang Ma, Xuanrui Gou, Zhenpeng Su

arXiv · PDF · Open in the Atlas

Code that ran

10 of 11 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 8 have no contract verdict; 2 failures of our instrument; 1 no recorded run), measured 2026-11-24; 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/2505.12260.json · badge: /api/ran/2505.12260.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
caskcsg/lightretriever canonical (classifier label)
classifier basis not recorded on the link
10 ran · 1 no recorded run
FunctionStatusWhere it lives
dcg_score Ran
ran; our contract draft was wrong, not the code
caskcsg/lightretriever/src/lightretriever/finetune/metrics.py
code served (permissive licence) · get_code("43e79e8e0904d5d8")
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 float64, 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 numpy as np

# Construct valid arguments for dcg_score function
# The function expects:
# - y_true: array of true relevance labels (binary or graded)
# - y_score: array of predicted scores
# - k: number of top results to consider (default 10)

# Create small sample data
np.random.seed(0)

# y_true: binary relevance labels (0 or 1), shape (15,)
y_true = np.array([1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0])

# y_score: predicted scores, shape (15,)
y_score = np.array([0.9, 0.2, 0.8, 0.7, 0.3, 0.85, 0.1, 0.15, 0.75, 0.95, 0.05, 0.88, 0.12, 0.92, 0.08])

# k: number of top results to evaluate
k = 10

ARGS = {
    "y_true": y_true,
    "y_score": y_score,
    "k": k
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float64, 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
find_closest_power_of_2 Ran
ran on a synthesized input
caskcsg/lightretriever/src/lightretriever/trainer.py
code served (permissive licence) · get_code("97574ff51cffea4e")
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 int, ndim 0, dtype family int, 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 torch

ARGS = {
    "n": 16
}
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 int, ndim 0, dtype family int, 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_cosine_schedule_with_warmup_minlr Ran
ran on a synthesized input
caskcsg/lightretriever/src/lightretriever/scheduler.py
code served (permissive licence) · get_code("d091bfa8194ca89f")
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 LambdaLR. 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 torch.nn as nn
from torch.optim import SGD

torch.manual_seed(0)

# Create a simple model with parameters
model = nn.Linear(4, 3)

# Create an optimizer
optimizer = SGD(model.parameters(), lr=0.1)

# Define arguments for get_cosine_schedule_with_warmup_minlr
ARGS = {
    "optimizer": optimizer,
    "num_warmup_steps": 100,
    "num_training_steps": 1000,
    "num_cycles": 0.5,
    "last_epoch": -1,
    "min_lr_ratio": 0.0
}
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 LambdaLR — a LambdaLR output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a LambdaLR 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
get_linear_schedule_with_warmup_minlr Ran
ran on a synthesized input
caskcsg/lightretriever/src/lightretriever/scheduler.py
code served (permissive licence) · get_code("9aaa2ddc83faa93d")
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 LambdaLR. 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 torch.nn as nn
from torch.optim import SGD

torch.manual_seed(0)

# Create a minimal model with parameters to optimize
model = nn.Linear(4, 3)

# Create an optimizer for the model
optimizer = SGD(model.parameters(), lr=0.1)

# Define arguments for the function
ARGS = {
    "optimizer": optimizer,
    "num_warmup_steps": 100,
    "num_training_steps": 1000,
    "last_epoch": -1,
    "min_lr_ratio": 0.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 LambdaLR — a LambdaLR output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a LambdaLR 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
get_reg_weight_scaling_factor Ran
ran on a synthesized input
caskcsg/lightretriever/src/lightretriever/scheduler.py
code served (permissive licence) · get_code("7ec8ad33274123d1")
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 float, 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 math

# Define ARGS with all parameters for get_reg_weight_scaling_factor
ARGS = {
    "current_step": 5,
    "num_warmup_steps": 10,
    "num_reg_steps": 100,
    "min_reg_ratio": 0.1,
    "reg_type": "quadratic"
}
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 float, 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
mean_eos_pooling Ran
ran on a synthesized input
caskcsg/lightretriever/src/lightretriever/finetune/dense_pooling.py
code served (permissive licence) · get_code("cd3a8d8e0d35ed6b")
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 Tensor, ndim 2, dtype family float, shape (2, 4) 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)

batch_size = 2
seq_len = 3
hidden_size = 4
eos_id = 50256

# Create last_hidden_states: [batch_size, seq_len, hidden_size]
last_hidden_states = torch.randn(batch_size, seq_len, hidden_size, dtype=torch.float32)

# Create input_ids: [batch_size, seq_len]
# Make sure at least one position has eos_id in each sequence
input_ids = torch.tensor([
    [100, 200, eos_id],
    [300, eos_id, 400]
], dtype=torch.long)

# Create attention_mask: [batch_size, seq_len]
attention_mask = torch.tensor([
    [1, 1, 1],
    [1, 1, 1]
], dtype=torch.long)

ARGS = {
    "last_hidden_states": last_hidden_states,
    "input_ids": input_ids,
    "attention_mask": attention_mask,
    "eos_id": eos_id,
}
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 Tensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) 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
mrr_score Ran
ran on a synthesized input
caskcsg/lightretriever/src/lightretriever/finetune/metrics.py
code served (permissive licence) · get_code("c1933bf46ff5c9b6")
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 float64, ndim 0, 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 numpy as np

# Construct valid arguments for mrr_score function
# The function computes Mean Reciprocal Rank score

# y_true: binary labels indicating relevant items
y_true = np.array([1, 0, 1, 0, 1, 0, 0, 1, 0, 1], dtype=int)

# y_score: relevance scores for ranking
y_score = np.array([0.9, 0.2, 0.8, 0.1, 0.85, 0.15, 0.05, 0.95, 0.3, 0.7], dtype=float)

# k: parameter for slicing in argsort (step size)
k = 10

ARGS = {
    'y_true': y_true,
    'y_score': y_score,
    'k': k
}
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 float64, ndim 0, dtype family float — no output shape is stated: observe_signature.py recorded float ndim 0, which disagrees with the fixture run
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
ndcg_score Ran
ran; our contract draft was wrong, not the code
caskcsg/lightretriever/src/lightretriever/finetune/metrics.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from xuan-zw/lkpnr, is pointer only (licence: NONE) · get_code("aaa4cece9f41ea15")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from xuan-zw/lkpnr, 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.

pooling Ran
ran on a synthesized input
caskcsg/lightretriever/src/lightretriever/finetune/dense_pooling.py
code served (permissive licence) · get_code("028d8766e22f9773")
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 Tensor, ndim 2, dtype family float, shape (2, 4) 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
import numpy as np

torch.manual_seed(0)

# Define tensors for the pooling function
batch_size = 2
sequence_length = 3
hidden_dim = 4
num_layers = 4

# Create last_hidden tensor (batch_size, sequence_length, hidden_dim)
last_hidden = torch.randn(batch_size, sequence_length, hidden_dim)

# Create hidden_states tuple with multiple layers (num_layers, batch_size, sequence_length, hidden_dim)
hidden_states = tuple(
    torch.randn(batch_size, sequence_length, hidden_dim) 
    for _ in range(num_layers)
)

# Create attention_mask (batch_size, sequence_length) with valid token positions
attention_mask = torch.tensor([
    [1, 1, 1],  # all tokens are valid
    [1, 1, 0]   # last token is padding
], dtype=torch.float32)

# Define pooling strategy to test
pooling_strategy = 'mean'

ARGS = {
    'last_hidden': last_hidden,
    'hidden_states': hidden_states,
    'attention_mask': attention_mask,
    'pooling_strategy': pooling_strategy
}
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 Tensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) 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
rewrite_logs Ran
ran on a synthesized input
caskcsg/lightretriever/src/lightretriever/trainer.py
code served (permissive licence) · get_code("d14a93abddd46c17")
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 torch

torch.manual_seed(0)

# The function rewrite_logs takes a dictionary and rewrites keys based on prefixes
# It checks for:
# 1. Keys starting with 'eval_' -> rewrite to 'eval/'
# 2. Keys starting with 'test_' -> rewrite to 'test/'
# 3. Keys containing special strings like 'α', 'loss_per_group', 'channel', 'overlap', 'spr_stats', 'sparse_top_basis', 'mrl' -> keep as is
# 4. All other keys -> prefix with 'train/'

# Create a comprehensive test dictionary with various key types
d = {
    'eval_loss': 0.5,
    'eval_accuracy': 0.95,
    'test_loss': 0.6,
    'test_accuracy': 0.92,
    'loss_per_group': [0.1, 0.2, 0.3],
    'channel_mean': 0.4,
    'overlap_score': 0.7,
    'spr_stats': {'mean': 0.5, 'std': 0.1},
    'sparse_top_basis': [[1, 2], [3, 4]],
    'mrl_value': 100,
    'α_param': 0.001,
    'learning_rate': 0.001,
    'momentum': 0.9,
    'weight_decay': 1e-4,
    'batch_loss': torch.tensor([0.1, 0.2, 0.3, 0.4]),
}

ARGS = {
    'd': d,
}
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 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
get_lm_head Not yet run
unverified (harvested, no recorded run)
caskcsg/lightretriever/src/lightretriever/finetune/modeling_hybrid.py
code served (permissive licence) · get_code("8795573bc2983705")
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, 2 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 0 the same month, 0 later) and 9 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
dcg_score 5 other papers
5 dated earlier
2105.02605 (2021-05)
GraphFormers: GNN-nested Transformers for Representation Learning on Textual Graph
2109.05446 (2021-09)
Efficient-FedRec: Efficient Federated Learning Framework for Privacy-Preserving News Recommendation
2205.10282 (2022-05)
Heterformer: Transformer-based Deep Node Representation Learning on Heterogeneous Text-Rich Networks
and 2 more not named here
ndcg_score 2 other papers
2 dated earlier
2109.05446 (2021-09)
Efficient-FedRec: Efficient Federated Learning Framework for Privacy-Preserving News Recommendation
2308.12028 (2023-08)
LKPNR: LLM and KG for Personalized News Recommendation Framework

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

Large Language Models (LLMs)-based text retrieval retrieves documents relevant to search queries based on vector similarities. Documents are pre-encoded offline, while queries arrive in real-time, necessitating an efficient online query encoder. Although LLMs significantly enhance retrieval capabilities, serving deeply parameterized LLMs slows down query inference throughput and increases demands for online deployment resources. In this paper, we propose LightRetriever, a novel LLM-based retriever with extremely lightweight query encoders. Our method retains a full-sized LLM for document encoding, but reduces the workload of query encoding to no more than an embedding lookup. Compared to serving a full LLM on an A800 GPU, our method achieves over 1000x speedup in query encoding and over 10× increase in end-to-end retrieval throughput. Extensive experiments on large-scale retrieval benchmarks show that LightRetriever generalizes well across diverse tasks, maintaining an average of 95% retrieval performance.

For agents

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

get_harvested_code_for_paper("2505.12260")
get_code_for_paper("2505.12260")
have("2505.12260")

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

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

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

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

Connect an agent — have() is free.