SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2306.05212 · 2023

RETA-LLM: A Retrieval-Augmented Large Language Model Toolkit

arXiv · PDF · Open in the Atlas

Code that ran

8 of 9 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; 0 failures of our instrument; 1 no recorded run), measured 2026-11-23; 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/2306.05212.json · badge: /api/ran/2306.05212.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
ruc-gsai/yulan-ir canonical (classifier label)
classifier basis: census
8 ran · 1 no recorded run
FunctionStatusWhere it lives
check_dir Ran
ran on a synthesized input
ruc-gsai/yulan-ir/RETA-LLM/indexer/index_pipeline.py
code served (permissive licence) · get_code("78804ea9da9def90")
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 os
import tempfile
import shutil

# Create a temporary directory for testing
temp_dir = tempfile.mkdtemp()

# Test case 1: Non-existent directory (should create it and return True)
test_dir_nonexistent = os.path.join(temp_dir, "nonexistent_dir")

ARGS = {
    "dir_path": test_dir_nonexistent
}
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 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
collate_fn Ran
ran on a synthesized input
ruc-gsai/yulan-ir/RETA-LLM/indexer/index_pipeline.py
code served (permissive licence) · get_code("2984bfb9f26dc564")
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 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

torch.manual_seed(0)

# The collate_fn expects a batch parameter which is a list of items
# Each item must have at least 2 elements: [input_ids, attention_mask]
# Both input_ids and attention_masks need to be stackable tensors

# Create sample batch items with tiny tensors
batch_item_1 = (
    torch.randint(0, 100, (4,)),  # input_ids: shape (4,)
    torch.ones(4, dtype=torch.long)  # attention_mask: shape (4,)
)

batch_item_2 = (
    torch.randint(0, 100, (4,)),  # input_ids: shape (4,)
    torch.ones(4, dtype=torch.long)  # attention_mask: shape (4,)
)

# Create batch as a list of tuples
batch = [batch_item_1, batch_item_2]

ARGS = {
    "batch": batch
}
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 tuple, ndim 3, dtype family int — 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
extract_text_embed Ran
ran on a synthesized input
ruc-gsai/yulan-ir/RETA-LLM/dense_model.py
code served (permissive licence) · get_code("081da32a3d9e94a1")
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 torch.nn.functional as F

torch.manual_seed(0)

# Create tiny tensors for testing
batch_size = 2
seq_length = 3
hidden_dim = 4

# last_hidden_state: shape (batch_size, seq_length, hidden_dim)
last_hidden_state = torch.randn(batch_size, seq_length, hidden_dim)

# attention_mask: shape (batch_size, seq_length)
# 1 for tokens to attend to, 0 for padding
attention_mask = torch.ones(batch_size, seq_length)
attention_mask[0, 2] = 0  # mask out last token for first sample

# similarity_metric: either 'ip' or 'cos'
similarity_metric = 'cos'

# pooling: either 'cls' or 'average'
pooling = 'average'

ARGS = {
    'last_hidden_state': last_hidden_state,
    'attention_mask': attention_mask,
    'similarity_metric': similarity_metric,
    'pooling': pooling
}
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
find_date Ran
ran on a synthesized input
ruc-gsai/yulan-ir/RETA-LLM/html2json/html2json.py
code served (permissive licence) · get_code("b612bd2271a6a9cc")
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.

import re

def find_date(list_of_strings):
    date_pattern = '\\d{4}.\\d{2}.\\d{2}'
    for string in list_of_strings:
        if re.search(date_pattern, string):
            l = re.search(date_pattern, string).group()
            l = [l[:4], l[5:7], l[8:10]]
            date = '-'.join(l)
            return date
    return None


ARGS = {
    'list_of_strings': [
        'Meeting on 2023.05.15 at noon',
        'No date here',
        'Another date 2024.12.25 found'
    ]
}
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
load_json_data Ran
ran on a synthesized input
ruc-gsai/yulan-ir/RETA-LLM/indexer/index_pipeline.py
code served (permissive licence) · get_code("879f374a0414d8c3")
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 os
import json
import tempfile
import shutil

# Create a temporary directory with JSON files
temp_dir = tempfile.mkdtemp()

# Create sample JSON files
json_data_1 = {"id": 1, "text": "sample data 1"}
json_data_2 = {"id": 2, "text": "sample data 2"}
json_data_3 = {"id": 3, "text": "sample data 3"}

with open(os.path.join(temp_dir, "file1.json"), "w", encoding="utf-8") as f:
    json.dump(json_data_1, f)

with open(os.path.join(temp_dir, "file2.json"), "w", encoding="utf-8") as f:
    json.dump(json_data_2, f)

with open(os.path.join(temp_dir, "file3.json"), "w", encoding="utf-8") as f:
    json.dump(json_data_3, f)

ARGS = {
    "data_dir": temp_dir
}
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_corpus Ran
ran on a synthesized input
ruc-gsai/yulan-ir/RETA-LLM/indexer/train_dam_module.py
code served (permissive licence) · get_code("f3a020ae6e1e35b7")
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 gzip file with valid corpus data
temp_dir = tempfile.mkdtemp()
gzip_file_path = os.path.join(temp_dir, 'test_corpus.txt.gz')

import gzip
with gzip.open(gzip_file_path, 'wt') as f:
    f.write('id1\tThis is sample text one\n')
    f.write('id2\tThis is sample text two\n')
    f.write('id3\tThis is sample text three\n')

ARGS = {
    'file_path': gzip_file_path,
    'verbose': False,
}
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 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
split_data Ran
ran on a synthesized input
ruc-gsai/yulan-ir/WebBrain/generator/run_model_train.py
code served (permissive licence) · get_code("c08f5ba85345acb7")
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 2, 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
import math

# Create a temporary directory and file for testing
temp_dir = tempfile.mkdtemp()
train_file = os.path.join(temp_dir, "train.txt")

# Write some sample data to the file
sample_data = ["line 1\n", "line 2\n", "line 3\n", "line 4\n", "line 5\n"]
with open(train_file, 'w', encoding='utf8') as f:
    f.writelines(sample_data)

# Create a simple args object
class Args:
    def __init__(self):
        self.data_dir = temp_dir + "/"
        self.train_data_name = "train.txt"
        self.world_size = 2

ARGS = {"args": Args()}
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 2, 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
train_step Ran
ran on a synthesized input
ruc-gsai/yulan-ir/WebBrain/generator/run_model_train.py
code served (permissive licence) · get_code("3b820c3547a5622d")
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 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
import torch.nn as nn

torch.manual_seed(0)

class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, train_data):
        # The function expects forward to return gen_loss
        # train_data is a dict with keys that have been moved to device
        # Return a scalar tensor as loss
        x = train_data['input']
        return torch.tensor(0.5)

class Args:
    def __init__(self):
        self.device = 'cpu'

model = SimpleModel()

train_data = {
    'input': torch.randn(2, 4),
    'target': torch.randn(2, 3),
    'mask': torch.ones(2, 1)
}

args = Args()

ARGS = {
    'model': model,
    'train_data': train_data,
    'args': args
}
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 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
chatgpt_response Not yet run
unverified (harvested, no recorded run)
ruc-gsai/yulan-ir/RETA-LLM/system/model_response.py
code served (permissive licence) · get_code("a4addd3396de2f5a")
How it ran

no invocation recorded.

Also present in other papers' code

Of 9 samples lifted from this paper's linked repositories, 9 carry a function identity and 0 do not. Of the 9 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 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.

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

Repositories linked to this paper

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

Abstract

Although Large Language Models (LLMs) have demonstrated extraordinary capabilities in many domains, they still have a tendency to hallucinate and generate fictitious responses to user requests. This problem can be alleviated by augmenting LLMs with information retrieval (IR) systems (also known as retrieval-augmented LLMs). Applying this strategy, LLMs can generate more factual texts in response to user input according to the relevant content retrieved by IR systems from external corpora as references. In addition, by incorporating external knowledge, retrieval-augmented LLMs can answer in-domain questions that cannot be answered by solely relying on the world knowledge stored in parameters. To support research in this area and facilitate the development of retrieval-augmented LLM systems, we develop RETA-LLM, a {RET}reival-{A}ugmented LLM toolkit. In RETA-LLM, we create a complete pipeline to help researchers and users build their customized in-domain LLM-based systems. Compared with previous retrieval-augmented LLM systems, RETA-LLM provides more plug-and-play modules to support better interaction between IR systems and LLMs, including {request rewriting, document retrieval, passage extraction, answer generation, and fact checking} modules. Our toolkit is publicly available at https://github.com/RUC-GSAI/YuLan-IR/tree/main/RETA-LLM.

For agents

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

get_harvested_code_for_paper("2306.05212")
get_code_for_paper("2306.05212")
have("2306.05212")

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

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

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

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

Connect an agent — have() is free.