SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2403.18684 · 2024

Scaling Laws For Dense Retrieval

arXiv · PDF · Open in the Atlas

Code that ran

7 of 8 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, 1 violated it and 0 have no contract verdict; 6 failures of our instrument; 1 no recorded run), measured 2026-11-22; 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/2403.18684.json · badge: /api/ran/2403.18684.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
jingtaozhan/drscale canonical (classifier label)
classifier basis: census
7 ran · 1 no recorded run
FunctionStatusWhere it lives
batch_to_device Ran
ran; our contract draft was wrong, not the code
jingtaozhan/drscale/modeling.py
code served (permissive licence) · get_code("784e8a98f055bde0")
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
from torch import nn, Tensor

torch.manual_seed(0)

# Create a batch dictionary with various tensor entries
batch = {
    "input_ids": torch.randint(0, 100, (2, 4)),
    "attention_mask": torch.ones(2, 4),
    "token_type_ids": torch.zeros(2, 4),
    "embeddings": torch.randn(2, 4, 8),
    "non_tensor_value": "this should not be moved"
}

# Target device (CPU only)
target_device = "cpu"

ARGS = {
    "batch": batch,
    "target_device": target_device
}
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_collate_function Ran
ran; our contract draft was wrong, not the code
jingtaozhan/drscale/dataset.py
code served (permissive licence) · get_code("008a1957ed0f9fdc")
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 function. 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 random

torch.manual_seed(0)
random.seed(0)

class MockTokenizer:
    def __call__(self, texts, padding=True, truncation=True, max_length=None):
        # Return a dict with input_ids and attention_mask
        # Each text gets encoded as a list of token ids
        batch_size = len(texts)
        token_length = 5
        return {
            'input_ids': [[1, 2, 3, 4, 5] for _ in range(batch_size)],
            'attention_mask': [[1, 1, 1, 1, 1] for _ in range(batch_size)]
        }

class MockDataset:
    def __init__(self):
        self.num_negative_docs = 2
        self.corpus_ids = list(range(10))  # IDs 0-9
        self.corpus = {i: f"document {i}" for i in range(10)}

# Create instances
tokenizer = MockTokenizer()
dataset = MockDataset()

# Define parameters for get_collate_function
max_query_length = 32
max_doc_length = 64

ARGS = {
    'max_query_length': max_query_length,
    'max_doc_length': max_doc_length,
    'tokenizer': tokenizer,
    'dataset': dataset
}
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 function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function 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
is_main_process Ran
ran, violated the contract we drafted
jingtaozhan/drscale/training_arguments.py
code served (permissive licence) · get_code("7cbdad4c2ba7d4ec")
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 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 torch

torch.manual_seed(0)

ARGS = {
    "local_rank": 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 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
load_msmarco_posneg Ran
ran; our contract draft was wrong, not the code
jingtaozhan/drscale/utils.py
code served (permissive licence) · get_code("c8685cb7b15dff2b")
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 random

# Set seed for reproducibility
random.seed(0)

# Define the arguments for load_msmarco_posneg
qids = ['q1', 'q2', 'q3', 'q4', 'q5']

# corpus: dict mapping passage IDs to passage data
corpus = {
    f'p{i}': {'text': f'passage {i}'} 
    for i in range(100)
}

# qrels: dict mapping query IDs to dict of relevant passage IDs
qrels = {
    'q1': {'p1': 1, 'p2': 1},
    'q2': {'p5': 1, 'p10': 1, 'p15': 1},
    'q3': {'p20': 1},
    'q4': {'p30': 1, 'p31': 1, 'p32': 1, 'p33': 1},
    'q5': {}  # empty qrels for this query
}

ARGS = {
    'qids': qids,
    'corpus': corpus,
    'qrels': qrels
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
tqdm — 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_msmarco_queries Ran
ran; our contract draft was wrong, not the code
jingtaozhan/drscale/utils.py
code served (permissive licence) · get_code("27a9b1aa386a7635")
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 os
import tempfile
from pathlib import Path

# Create a temporary directory with a test queries file
temp_dir = tempfile.mkdtemp()
queries_file_path = os.path.join(temp_dir, 'queries.train.tsv')

# Write sample data to the queries file
with open(queries_file_path, 'w', encoding='utf8') as f:
    f.write('0\thow many people live in france\n')
    f.write('1\twhat is the capital of germany\n')
    f.write('2\twho won the world cup in 2018\n')

# Mock the dataset directory structure
dataset_dir = os.path.join(temp_dir, 'dataset')
os.makedirs(dataset_dir, exist_ok=True)

# Copy the queries file to the expected location
import shutil
shutil.copy(queries_file_path, os.path.join(dataset_dir, 'queries.train.tsv'))

# Patch the hardcoded path in the function
import sys
sys.path.insert(0, temp_dir)

# Monkey-patch os.path.join to redirect to our temp directory
_original_join = os.path.join
def patched_join(*args):
    result = _original_join(*args)
    if 'ColBERT/data/dataset' in result:
        return result.replace('/home/fangyan/Workspace/ColBERT/data/dataset', dataset_dir)
    return result

os.path.join = patched_join

ARGS = {
    'split': 'train'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
tqdm — 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
tokenize Ran
ran; our contract draft was wrong, not the code
jingtaozhan/drscale/dataset.py
code served (permissive licence) · get_code("c8927edacebe2572")
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)

# Stand-in tokenizer class that implements the __call__ method
class SimpleTokenizer:
    def __call__(self, texts, padding=True, truncation=True, max_length=None):
        # Return a dict with 'input_ids' and 'attention_mask' as lists of lists
        # Simulating tokenizer behavior
        batch_size = len(texts) if isinstance(texts, list) else 1
        seq_length = max_length if max_length else 4
        
        input_ids = [[1, 2, 3, 4] for _ in range(batch_size)]
        attention_mask = [[1, 1, 1, 1] for _ in range(batch_size)]
        
        # Truncate if needed
        if truncation and max_length:
            input_ids = [ids[:max_length] for ids in input_ids]
            attention_mask = [mask[:max_length] for mask in attention_mask]
        
        # Pad if needed
        if padding:
            max_len = max(len(ids) for ids in input_ids)
            input_ids = [ids + [0] * (max_len - len(ids)) for ids in input_ids]
            attention_mask = [mask + [0] * (max_len - len(mask)) for mask in attention_mask]
        
        return {
            'input_ids': input_ids,
            'attention_mask': attention_mask
        }

# Define arguments
ARGS = {
    'texts': ['Hello world', 'This is a test'],
    'tokenizer': SimpleTokenizer(),
    'max_input_length': 4
}
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
truncate_run Ran
ran; our contract draft was wrong, not the code
jingtaozhan/drscale/retrieval.py
code served (permissive licence) · get_code("7715840d7525041b")
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.

# Construct valid arguments for truncate_run function

ARGS = {
    "run": {
        "q1": {
            "doc1": 0.95,
            "doc2": 0.87,
            "doc3": 0.72,
            "doc4": 0.65,
            "doc5": 0.43,
        },
        "q2": {
            "doc10": 0.91,
            "doc11": 0.84,
            "doc12": 0.79,
            "doc13": 0.55,
        },
    },
    "topk": 3,
}
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_msmarco_qrels Not yet run
unverified (harvested, no recorded run)
jingtaozhan/drscale/utils.py
code served (permissive licence) · get_code("7a79a6ea04d70b62")
How it ran

no invocation recorded.

Also present in other papers' code

Of 8 samples lifted from this paper's linked repositories, 8 carry a function identity and 0 do not. Of the 8 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 6 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
batch_to_device 1 other paper
1 dated earlier
2110.05789 (2021-10)
Learning Discrete Representations via Constrained Clustering for Effective and Efficient Dense Retrieval
is_main_process 1 other paper
1 dated earlier
2204.00185 (2022-04)
Distill-VQ: Learning Retrieval Oriented Vector Quantization By Distilling Knowledge from Dense Embeddings

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

Repositories linked to this paper

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

Abstract

Scaling up neural models has yielded significant advancements in a wide array of tasks, particularly in language generation. Previous studies have found that the performance of neural models frequently adheres to predictable scaling laws, correlated with factors such as training set size and model size. This insight is invaluable, especially as large-scale experiments grow increasingly resource-intensive. Yet, such scaling law has not been fully explored in dense retrieval due to the discrete nature of retrieval metrics and complex relationships between training data and model sizes in retrieval tasks. In this study, we investigate whether the performance of dense retrieval models follows the scaling law as other neural models. We propose to use contrastive log-likelihood as the evaluation metric and conduct extensive experiments with dense retrieval models implemented with different numbers of parameters and trained with different amounts of annotated data. Results indicate that, under our settings, the performance of dense retrieval models follows a precise power-law scaling related to the model size and the number of annotations. Additionally, we examine scaling with prevalent data augmentation methods to assess the impact of annotation quality, and apply the scaling law to find the best resource allocation strategy under a budget constraint. We believe that these insights will significantly contribute to understanding the scaling effect of dense retrieval models and offer meaningful guidance for future research endeavors.

For agents

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

get_harvested_code_for_paper("2403.18684")
get_code_for_paper("2403.18684")
have("2403.18684")

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

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

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

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

Connect an agent — have() is free.