SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2212.10496 · 2022

Precise Zero-Shot Dense Retrieval without Relevance Labels

arXiv · PDF · Open in the Atlas

Code that ran

6 of 6 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 5 have no contract verdict; 1 failure of our instrument; 0 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/2212.10496.json · badge: /api/ran/2212.10496.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
snexus/llm-search community (classifier label)
classifier basis not recorded on the link
6 ran · 0 no recorded run
FunctionStatusWhere it lives
chunker Ran
ran; our contract draft was wrong, not the code
snexus/llm-search/src/llmsearch/chroma.py
code served (permissive licence) · get_code("ec7977b6ec96dce1")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned generator. 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

torch.manual_seed(0)

# The function chunker takes a sequence and a size, and yields chunks of that size
# seq: any sequence (list, string, tensor, etc.)
# size: integer representing chunk size

# Let's create a simple list as the sequence
seq = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
size = 3

ARGS = {
    'seq': seq,
    'size': size
}
Setup block drafted by
a language model, Claude Sonnet 4.5, prompt python_fixture_v1
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type generator — a generator output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a generator 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_hyde_chain Ran
ran on a synthesized input
snexus/llm-search/src/llmsearch/utils.py
code served (permissive licence) · get_code("48e7ff42c7ce96b7")
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 RunnableSequence. 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 unittest.mock import Mock
from langchain_core.output_parsers.string import StrOutputParser
from langchain_core.prompts import PromptTemplate

torch.manual_seed(0)

# Create a minimal LLM mock that can be called in a chain
class MockLLM:
    def invoke(self, input_dict):
        return "This is a generated hypothesis document based on the question."
    
    def __call__(self, x):
        return self.invoke(x)

# Create a minimal config object with the required nested structure
class HyDEConfig:
    pass

class SemanticSearchConfig:
    def __init__(self):
        self.hyde = HyDEConfig()
        self.hyde.hyde_prompt = "Given the question '{question}', generate a hypothetical document that would answer it:"

class Config:
    def __init__(self):
        self.semantic_search = SemanticSearchConfig()

config = Config()
llm_model = MockLLM()

ARGS = {
    'config': config,
    'llm_model': llm_model
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
langchain_core, loguru, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type RunnableSequence — a RunnableSequence output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a RunnableSequence 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_local_session Ran
ran on a synthesized input
snexus/llm-search/src/llmsearch/database/config.py
code served (permissive licence) · get_code("b635b7084e0c8258")
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 DBSettings. 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 tempfile
import os
from collections import namedtuple
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker

DBSettings = namedtuple('DBSettings', 'SessionLocal engine')

def get_local_session(db_path: str) -> DBSettings:
    sql_alchemy_database_url = f'sqlite:///{db_path}'
    engine = create_engine(sql_alchemy_database_url, connect_args={'check_same_thread': False})
    SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
    return DBSettings(SessionLocal=SessionLocal, engine=engine)

# Create a temporary directory and database path
temp_dir = tempfile.gettempdir()
db_path = os.path.join(temp_dir, 'test_database.db')

ARGS = {
    'db_path': db_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
sqlalchemy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type DBSettings — a DBSettings output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a DBSettings output the recorded ndim 1 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_multiquery_chain Ran
ran on a synthesized input
snexus/llm-search/src/llmsearch/utils.py
code served (permissive licence) · get_code("cfd064d592f53275")
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 RunnableSequence. 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.

from langchain_core.output_parsers.string import StrOutputParser
from langchain_core.prompts import PromptTemplate
from langchain_core.runnables.base import RunnableSequence
from unittest.mock import Mock, MagicMock

# Create a mock LLM model
llm_model = Mock()
llm_model.invoke = Mock(return_value="alternative question 1\nalternative question 2")

# Create a config object with the required nested structure
config = Mock()
config.semantic_search = Mock()
config.semantic_search.multiquery = Mock()
config.semantic_search.multiquery.multiquery_prompt = (
    "You are an AI assistant. Generate {n_versions} alternative versions "
    "of the following question to retrieve diverse results:\n\n"
    "Question: {question}\n\n"
    "Alternative questions:"
)

ARGS = {
    "config": config,
    "llm_model": llm_model,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
langchain_core, loguru — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type RunnableSequence — a RunnableSequence output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a RunnableSequence 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_document_labels Ran
ran on a synthesized input
snexus/llm-search/src/llmsearch/embeddings.py
code served (permissive licence) · get_code("f446ea3bd6d6135d")
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 tempfile
from pathlib import Path

# Create a temporary file with some label data
with tempfile.NamedTemporaryFile(mode='w', suffix='.txt', delete=False, encoding='utf-8') as f:
    f.write("label1\n")
    f.write("label2\n")
    f.write("label3\n")
    temp_path = Path(f.name)

ARGS = {
    "path": temp_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
loguru — 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
load_yaml_file Ran
ran on a synthesized input
snexus/llm-search/src/llmsearch/config.py
code served (permissive licence) · get_code("cb568e26896d5126")
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 io
import yaml
import tempfile
import os

# Create a temporary YAML file with valid content
yaml_content = """
model:
  name: test_model
  layers: 3
training:
  batch_size: 32
  epochs: 10
"""

# Create a temporary file
temp_file = tempfile.NamedTemporaryFile(mode='w', suffix='.yaml', delete=False, encoding='utf-8')
temp_file.write(yaml_content)
temp_file.close()

# Test case 1: Pass file path as string
config_file_path = temp_file.name

# Test case 2: Create a file-like object (BytesIO)
config_bytesio = io.BytesIO(yaml_content.encode('utf-8'))

ARGS = {
    'config': config_file_path
}

# Cleanup will happen after execution
import atexit
atexit.register(lambda: os.unlink(temp_file.name))
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
loguru, yaml — 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

Also present in other papers' code

Of 6 samples lifted from this paper's linked repositories, 6 carry a function identity and 0 do not. Of the 6 distinct functions with an identity, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 1 later) and 5 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
chunker 7 other papers
4 dated earlier, 3 later
1507.05717 (2015-07)
An End-to-End Trainable Neural Network for Image-based Sequence Recognition and Its Application to Scene Text Recognition
1702.07825 (2017-02)
Deep Voice: Real-time Neural Text-to-Speech
1902.00613 (2019-02)
Understanding Composition of Word Embeddings via Tensor Decomposition
and 4 more not named here

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

While dense retrieval has been shown effective and efficient across tasks and languages, it remains difficult to create effective fully zero-shot dense retrieval systems when no relevance label is available. In this paper, we recognize the difficulty of zero-shot learning and encoding relevance. Instead, we propose to pivot through Hypothetical Document Embeddings~(HyDE). Given a query, HyDE first zero-shot instructs an instruction-following language model (e.g. InstructGPT) to generate a hypothetical document. The document captures relevance patterns but is unreal and may contain false details. Then, an unsupervised contrastively learned encoder~(e.g. Contriever) encodes the document into an embedding vector. This vector identifies a neighborhood in the corpus embedding space, where similar real documents are retrieved based on vector similarity. This second step ground the generated document to the actual corpus, with the encoder's dense bottleneck filtering out the incorrect details. Our experiments show that HyDE significantly outperforms the state-of-the-art unsupervised dense retriever Contriever and shows strong performance comparable to fine-tuned retrievers, across various tasks (e.g. web search, QA, fact verification) and languages~(e.g. sw, ko, ja).

For agents

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

get_harvested_code_for_paper("2212.10496")
get_code_for_paper("2212.10496")
have("2212.10496")

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

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

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

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

Connect an agent — have() is free.