SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2305.02564 · ACL · 2023

RetroMAE-2: Duplex Masked Auto-Encoder For Pre-Training Retrieval-Oriented Language Models

Zheng Liu, Shitao Xiao, Zhao Cao, Yingxia Shao

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 6 have no contract verdict; 0 failures 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/2305.02564.json · badge: /api/ran/2305.02564.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
staoxiao/RetroMAE canonical (classifier label)
classifier basis: census
6 ran · 0 no recorded run
FunctionStatusWhere it lives
read_id Ran
ran on a synthesized input
staoxiao/RetroMAE/src/bi_encoder/faiss_retriever.py
code served (permissive licence) · get_code("8b646294f965fe2a")
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
import os

# Create a temporary file with tab-separated offset and id values
temp_dir = tempfile.mkdtemp()
id_file_path = os.path.join(temp_dir, "test_ids.txt")

with open(id_file_path, 'w') as f:
    f.write("0\tid_001\n")
    f.write("100\tid_002\n")
    f.write("200\tid_003\n")

ARGS = {
    "id_file": id_file_path
}
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
read_mapping_id Ran
ran on a synthesized input
staoxiao/RetroMAE/src/bi_encoder/data.py
code served (permissive licence) · get_code("41d49088046e4038")
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 tempfile
import os

# Create a temporary file with the expected format
with tempfile.NamedTemporaryFile(mode='w', delete=False, suffix='.txt', encoding='utf-8') as f:
    temp_file = f.name
    f.write("id1\t0\n")
    f.write("id2\t42\n")
    f.write("id3\t100\n")

try:
    ARGS = {
        'id_file': temp_file
    }
finally:
    # Note: The file will be cleaned up after the function executes
    pass
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
read_neg_file Ran
ran on a synthesized input
staoxiao/RetroMAE/src/bi_encoder/data.py
code served (permissive licence) · get_code("0db74f850789223f")
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 defaultdict. 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

# Create a temporary file with negative data
temp_file = tempfile.NamedTemporaryFile(mode='w', delete=False, encoding='utf-8', suffix='.txt')
temp_file.write("q1\tdoc1,doc2,doc3\n")
temp_file.write("q2\tdoc4,doc5\n")
temp_file.write("q1\tdoc6\n")
temp_file.close()

neg_file_path = temp_file.name

ARGS = {
    'neg_file': neg_file_path
}
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 defaultdict — a defaultdict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a defaultdict 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
read_train_file Ran
ran on a synthesized input
staoxiao/RetroMAE/src/bi_encoder/data.py
code served (permissive licence) · get_code("dbf7c90691ac3536")
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 tempfile
import os

# Create a temporary training file
temp_dir = tempfile.mkdtemp()
train_file_path = os.path.join(temp_dir, "train.txt")

# Write sample training data in the expected format
# Format: qid\tpos1,pos2,pos3...
with open(train_file_path, 'w', encoding='utf-8') as f:
    f.write("query1\tdoc1,doc2,doc3\n")
    f.write("query2\tdoc4,doc5\n")
    f.write("query3\tdoc6,doc7,doc8,doc9\n")

ARGS = {
    "train_file": train_file_path
}
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 — 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
search_queries Ran
ran on a synthesized input
staoxiao/RetroMAE/src/bi_encoder/faiss_retriever.py
code served (permissive licence) · get_code("d2919b967ea69ff6")
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 tuple, ndim 3, 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
import torch
import torch.nn as nn

torch.manual_seed(0)

class MockRetriever(nn.Module):
    def __init__(self, num_passages=10, embedding_dim=4):
        super().__init__()
        self.num_passages = num_passages
        self.embedding_dim = embedding_dim
        # Mock embeddings for passages
        self.passage_embeddings = torch.randn(num_passages, embedding_dim)
    
    def batch_search(self, q_reps, depth, batch_size):
        """
        Returns all_scores and all_indices for batch search.
        q_reps: tensor of shape (num_queries, embedding_dim)
        depth: number of top results per query
        batch_size: batch size for processing
        """
        num_queries = q_reps.shape[0]
        all_scores = []
        all_indices = []
        
        for i in range(0, num_queries, batch_size):
            batch = q_reps[i:i+batch_size]
            # Simple dot product similarity
            scores = torch.matmul(batch, self.passage_embeddings.t())
            topk_scores, topk_indices = torch.topk(scores, min(depth, self.num_passages), dim=1)
            all_scores.append(topk_scores)
            all_indices.append(topk_indices)
        
        all_scores = torch.cat(all_scores, dim=0)
        all_indices = torch.cat(all_indices, dim=0)
        return all_scores.numpy(), all_indices.numpy()
    
    def search(self, q_reps, depth):
        """
        Returns all_scores and all_indices for full search.
        """
        scores = torch.matmul(q_reps, self.passage_embeddings.t())
        topk_scores, topk_indices = torch.topk(scores, min(depth, self.num_passages), dim=1)
        return topk_scores.numpy(), topk_indices.numpy()

# Create retriever
retriever = MockRetriever(num_passages=10, embedding_dim=4)

# Query representations: 2 queries, 4 dimensions
q_reps = torch.randn(2, 4)

# Passage lookup: maps indices to passage identifiers
p_lookup = {i: f"passage_{i}" for i in range(10)}

# Depth: number of top results to retrieve per query
depth = 3

# Batch size
batch_size = 2

ARGS = {
    "retriever": retriever,
    "q_reps": q_reps,
    "p_lookup": p_lookup,
    "depth": depth,
    "batch_size": batch_size,
}
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 tuple, ndim 3, dtype family float — a tuple 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
to_dict Ran
ran on a synthesized input
staoxiao/RetroMAE/src/colbert/arguments.py
code served (permissive licence) · get_code("26f423cdf9e4ed58")
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.

from dataclasses import dataclass, field
from enum import Enum

class ColorEnum(Enum):
    RED = "red"
    BLUE = "blue"

class SizeEnum(Enum):
    SMALL = "small"
    LARGE = "large"

@dataclass
class SampleArgs:
    name: str = "test"
    color: ColorEnum = ColorEnum.RED
    sizes: list = field(default_factory=lambda: [SizeEnum.SMALL, SizeEnum.LARGE])
    api_token: str = "secret123"
    regular_token: str = "public456"
    count: int = 42

ARGS = {
    "args": SampleArgs(
        name="example",
        color=ColorEnum.BLUE,
        sizes=[SizeEnum.SMALL, SizeEnum.LARGE],
        api_token="hidden_secret",
        regular_token="visible_value",
        count=100
    )
}
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

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, 0 are also present in other papers whose code we hold (0 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.

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

To better support information retrieval tasks such as web search and open-domain question answering, growing effort is made to develop retrieval-oriented language models, e.g., RetroMAE (Xiao et al., 2022b) and many others (Gao and Callan, 2021; Wang et al., 2021a). Most of the existing works focus on improving the semantic representation capability for the contextualized embedding of the [CLS] token. However, recent study shows that the ordinary tokens besides [CLS] may provide extra information, which help to produce a better representation effect (Lin et al., 2022). As such, it's necessary to extend the current methods where all contextualized embeddings can be jointly pre-trained for the retrieval tasks. In this work, we propose a novel pre-training method called Duplex Masked Auto-Encoder, a.k.a. DupMAE. It is designed to improve the quality of semantic representation where all contextualized embeddings of the pre-trained model can be leveraged. It takes advantage of two complementary auto-encoding tasks: one reconstructs the input sentence with the [CLS] embedding; the other one predicts the bagof-words feature of the input sentence with the ordinary tokens' embeddings. The two tasks are jointly conducted to train a unified encoder, where the whole contextualized embeddings are aggregated in a compact way to produce the final semantic representation. DupMAE is simple but empirically competitive: it substantially improves the pre-trained model's representation capability and transferability, where superior retrieval performances can be achieved on popular benchmarks, like MS MARCO and BEIR. Our code is released at: https://github.com/staoxiao/RetroMAE.

For agents

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

get_harvested_code_for_paper("2305.02564")
get_code_for_paper("2305.02564")
have("2305.02564")

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

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

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

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

Connect an agent — have() is free.