SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2407.05563 · ACL · 2024

LLMBox: A Comprehensive Library for Large Language Models

Junyi Li, Ji-Rong Wen, Yuhao Wang, Jie Chen, Kun Zhou, Wayne Zhao, Tianyi Tang, Yingqian Min, Zican Dong, Yushuo Chen, Geyang Guo, Bowen Zheng, and 13 more

arXiv · PDF · Open in the Atlas

Code that ran

11 of 16 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; 3 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 8 failures of our instrument; 5 no recorded run), measured 2026-11-22; 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/2407.05563.json · badge: /api/ran/2407.05563.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
RUCAIBox/LLMBox canonical (classifier label)
classifier basis: census
11 ran · 5 no recorded run
FunctionStatusWhere it lives
add_space Ran
ran; our contract draft was wrong, not the code
RUCAIBox/LLMBox/utilization/chat_templates.py
code served (permissive licence) · get_code("bf88ec5fec6d05ae")
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 torch

torch.manual_seed(0)

# Simple test cases for add_space function
msg1 = "hello"
context1 = "world"
auto_leading_space1 = True
no_space_between1 = True
starts1 = ["(", "["]
ends1 = [")", "]"]

msg2 = "(test)"
context2 = "word"
auto_leading_space2 = True
no_space_between2 = True
starts2 = ["("]
ends2 = [")"]

msg3 = "text"
context3 = "prefix "
auto_leading_space3 = False
no_space_between3 = False
starts3 = None
ends3 = None

msg4 = ""
context4 = "nonempty"
auto_leading_space4 = True
no_space_between4 = True
starts4 = []
ends4 = []

# Select one set of arguments for execution
ARGS = {
    "msg": "hello",
    "context": "world",
    "auto_leading_space": True,
    "no_space_between": True,
    "starts": ["(", "["],
    "ends": [")", "]"]
}
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 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
calc_memory_usage Ran
ran, honoured the contract we drafted
RUCAIBox/LLMBox/training/gpu_calculator.py
code served (permissive licence) · get_code("2f328cd8f4cae4d7")
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 torch
import numpy as np

torch.manual_seed(0)

ARGS = {
    'parameters_num': 7_000_000_000,
    'bytes_per_parameter': 2,
    'lora_parameters_num': 1_000_000,
    'zero_config': 'z3',
    'gpu_num': 2,
    'batch_size': 1,
    'seq_length': 2048,
    'layer_num': 32,
    'hidden_size': 4096,
    'vocab_size': 32000,
}
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 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
collator Ran
ran; our contract draft was wrong, not the code
RUCAIBox/LLMBox/training/ppo.py
code served (permissive licence) · get_code("bda36ad0c44dbd74")
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 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 collator function takes a list of dictionaries and groups values by key
# It expects data to be a list where each element is a dict with the same keys

# Create sample data - a list of dicts with consistent keys
data = [
    {
        "input_ids": torch.tensor([1, 2, 3, 4]),
        "attention_mask": torch.tensor([1, 1, 1, 0]),
        "labels": 0
    },
    {
        "input_ids": torch.tensor([5, 6, 7, 8]),
        "attention_mask": torch.tensor([1, 1, 1, 1]),
        "labels": 1
    }
]

ARGS = {
    "data": data
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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
createConcretizingPrompt Ran
ran; our contract draft was wrong, not the code
RUCAIBox/LLMBox/training/evol_instruct.py
code served (permissive licence) · get_code("32761717f4267410")
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 torch

def createConcretizingPrompt(instruction):
    base_instruction_depth = "I want you act as a Prompt Rewriter.\r\n Your objective is to rewrite a given prompt into a more complex version to make those famous AI systems (e.g., chatgpt and GPT4) a bit harder to handle.\r\n But the rewritten prompt must be reasonable and must be understood and responded by humans.\r\n Your rewriting cannot omit the non-text parts such as the table and code in #The Given Prompt#:. Also, please do not omit the input in #The Given Prompt#. \r\n You SHOULD complicate the given prompt using the following method: \r\n{} \r\nYou should try your best not to make the #Rewritten Prompt# become verbose, #Rewritten Prompt# can only add 10 to 20 words into #The Given Prompt#. \r\n'#The Given Prompt#', '#Rewritten Prompt#', 'given prompt' and 'rewritten prompt' are not allowed to appear in #Rewritten Prompt#\r\n#The Given Prompt#: \r\n {} \r\n#Rewritten Prompt#:\r\n"
    prompt = base_instruction_depth.format('Please replace general concepts with more specific concepts.', instruction)
    return prompt

# Define test instruction
test_instruction = "Summarize the main themes in the following text about artificial intelligence and machine learning advancements."

ARGS = {
    'instruction': test_instruction
}
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 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
createConstraintsPrompt Ran
ran; our contract draft was wrong, not the code
RUCAIBox/LLMBox/training/evol_instruct.py
code served (permissive licence) · get_code("a0db2434164b1d6f")
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 torch

# Analyze the function: it takes 'instruction' parameter (a string)
# and calls base_instruction_depth.format() with it
# The function uses string formatting, so instruction needs to be a string

# Create a simple instruction string as the argument
instruction = "Explain the concept of machine learning in simple terms."

ARGS = {
    "instruction": instruction
}
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 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
createDeepenPrompt Ran
ran; our contract draft was wrong, not the code
RUCAIBox/LLMBox/training/evol_instruct.py
code served (permissive licence) · get_code("5fe7e49d31fcd44c")
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 torch
import numpy as np

# The function takes a single parameter 'instruction' which is a string
# Looking at the function body, it simply formats the string into base_instruction_depth
# and returns the result. So instruction needs to be a string.

instruction = "How can I improve my writing skills?"

ARGS = {
    "instruction": instruction
}
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 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
get_bytes_per_parameter Ran
ran, honoured the contract we drafted
RUCAIBox/LLMBox/training/gpu_calculator.py
code served (permissive licence) · get_code("75719be4140d6dc0")
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 torch
import numpy as np

ARGS = {
    'model_dtype': 'bf16'
}
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 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
get_gpu_memory_size Ran
ran, honoured the contract we drafted
RUCAIBox/LLMBox/training/gpu_calculator.py
code served (permissive licence) · get_code("d427424187e39701")
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
import numpy as np

torch.manual_seed(0)

ARGS = {
    'gpu_name': 'A100'
}
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 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
logit_bias_to_logits_processors Ran
ran; our contract draft was wrong, not the code
RUCAIBox/LLMBox/utilization/model_enum.py
code served (permissive licence) · get_code("200d3fa78c34d9cc")
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 torch

torch.manual_seed(0)

# The function takes a logit_bias dict and returns a list of callables
# The logit_bias dict typically maps token IDs to bias values
# Looking at the function body, it just creates a logits_processor function
# and returns it in a list. The logit_bias dict is not actually used in the
# provided implementation, but we should still provide a realistic example.

logit_bias = {
    0: 10.0,
    1: -5.0,
    2: 2.5,
    100: -10.0
}

ARGS = {
    "logit_bias": logit_bias
}
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 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
register_model Ran
ran; our contract draft was wrong, not the code
RUCAIBox/LLMBox/utilization/load_model.py
code served (permissive licence) · get_code("60dbaac6aae8f7ed")
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 torch.nn as nn

torch.manual_seed(0)

# The function register_model takes a model_backend parameter
# Looking at the function body, it uses model_backend as a key in LOAD_REGISTERY dict
# and pairs it with a decorator function. The parameter should be a string identifier
# for the model backend.

model_backend = "pytorch_model"

ARGS = {
    "model_backend": model_backend
}
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
smart_space Ran
ran; our contract draft was wrong, not the code
RUCAIBox/LLMBox/utilization/chat_templates.py
code served (permissive licence) · get_code("c54aba1d5bde8bc7")
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 torch
import numpy as np

# Analyze what smart_space needs:
# - parts: List[Tuple[str, bool]] - list of tuples with string and boolean
# - auto_leading_space: bool
# - no_space_between: bool
# - seq: List[str] - should be a dict-like object with keys for token types

# Create a minimal seq dict that contains the keys the function looks for
seq = {
    'system_start': '<system>',
    'system_end': '</system>',
    'user_start': '<user>',
    'user_end': '</user>',
    'assistant_start': '<assistant>',
    'assistant_end': '</assistant>',
    'bos_token': '<bos>'
}

# Create parts - list of tuples with (string, bool)
parts = [
    ('Hello', True),
    ('world', False),
    ('test', True),
]

# Set up other parameters
auto_leading_space = True
no_space_between = True

ARGS = {
    'parts': parts,
    'auto_leading_space': auto_leading_space,
    'no_space_between': no_space_between,
    'seq': seq
}
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 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
build_dataset Not yet run
unverified (harvested, no recorded run)
RUCAIBox/LLMBox/training/ppo.py
code served (permissive licence) · get_code("c53aa72d3d68339b")
How it ran

no invocation recorded.

get_c4 Not yet run
unverified (harvested, no recorded run)
RUCAIBox/LLMBox/training/gptq.py
code served (permissive licence) · get_code("3a8ad8ccd4b56839")
How it ran

no invocation recorded.

get_data Not yet run
unverified (harvested, no recorded run)
RUCAIBox/LLMBox/training/dpo.py
code served (permissive licence) · get_code("d3cfff3ea527f4a2")
How it ran

no invocation recorded.

load_anthropic Not yet run
unverified (harvested, no recorded run)
RUCAIBox/LLMBox/utilization/load_model.py
code served (permissive licence) · get_code("0153072d00d03602")
How it ran

no invocation recorded.

load_openai Not yet run
unverified (harvested, no recorded run)
RUCAIBox/LLMBox/utilization/load_model.py
code served (permissive licence) · get_code("76c36d01434e80a7")
How it ran

no invocation recorded.

Also present in other papers' code

Of 16 samples lifted from this paper's linked repositories, 16 carry a function identity and 0 do not. Of the 16 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 15 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
collator 9 other papers
8 dated earlier, 1 later
1909.08593 (2019-09)
Fine-Tuning Language Models from Human Preferences
2204.07705 (2022-04)
SUPER-NATURALINSTRUCTIONS: Generalization via Declarative Instructions on 1600+ NLP Tasks
2304.08177 (2023-04)
Efficient and Effective Text Encoding for Chinese LLaMA and Alpaca
and 6 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

To facilitate the research on large language models (LLMs), this paper presents a comprehensive and unified library, LLMBox, to ease the development, use, and evaluation of LLMs. This library is featured with three main merits: (1) a unified data interface that supports the flexible implementation of various training strategies, (2) a comprehensive evaluation that covers extensive tasks, datasets, and models, and (3) more practical consideration, especially on user-friendliness and efficiency. With our library, users can easily reproduce existing methods, train new models, and conduct comprehensive performance comparisons. To rigorously test LLMBox, we conduct extensive experiments in a diverse coverage of evaluation settings, and experimental results demonstrate the effectiveness and efficiency of our library in supporting various implementations related to LLMs. The detailed introduction and usage guidance can be found at https://github.com/RUCAIBox/LLMBox. * Co-leading the project. † Equal Contribution. Ordered by name.

For agents

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

get_harvested_code_for_paper("2407.05563")
get_code_for_paper("2407.05563")
have("2407.05563")

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

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

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

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

Connect an agent — have() is free.