SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2310.01045 · ICLR · 2024

Tool-Augmented Reward Modeling

Lei Li, Ningyu Zhang, Yu, Yekun Chai, Shuohuan Wang, Sun Hao, Hua Wu

arXiv · PDF · Open in the Atlas

Code that ran

8 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; 3 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 5 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/2310.01045.json · badge: /api/ran/2310.01045.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
ernie-research/Tool-Augmented-Reward-Model canonical (classifier label)
classifier basis: census
8 ran · 0 no recorded run
FunctionStatusWhere it lives
accuracy Ran
ran, honoured the contract we drafted
ernie-research/Tool-Augmented-Reward-Model/src/utils/metrics.py
code served (permissive licence) · get_code("9dcc5fa4456cb611")
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 float64, ndim 0, 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

# The accuracy function takes two parameters: labels and preds
# Both are used as np.array() inputs and compared element-wise
# They need to be array-like with the same length

labels = [0, 1, 1, 0, 1]
preds = [0, 1, 0, 0, 1]

ARGS = {
    "labels": labels,
    "preds": preds,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float64, ndim 0, dtype family float — no output shape is stated: observe_signature.py recorded float ndim 0, which disagrees with the fixture run
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
f1 Ran
ran, honoured the contract we drafted
ernie-research/Tool-Augmented-Reward-Model/src/utils/metrics.py
code served (permissive licence) · get_code("d67b636c4fd9e6cb")
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 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 numpy as np

# Construct arguments for f1 function
# The function expects:
# - actual: array of true labels
# - predicted: array of predicted labels
# - label: the specific label class to compute f1-score for

np.random.seed(0)

# Create small sample arrays with integer labels (0, 1, 2)
actual = np.array([0, 1, 1, 2, 0, 1, 2, 2])
predicted = np.array([0, 1, 2, 2, 0, 1, 1, 2])
label = 1

ARGS = {
    "actual": actual,
    "predicted": predicted,
    "label": label
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, 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
f1_micro Ran
ran, honoured the contract we drafted
ernie-research/Tool-Augmented-Reward-Model/src/utils/metrics.py
code served (permissive licence) · get_code("f1c93b84d284b1f3")
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 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 numpy as np

# Analyze the function f1_micro:
# - It takes `actual` and `predicted` parameters
# - Both are used with np.unique() and passed to f1()
# - f1() uses them with == and != operators and np.sum()
# - These should be numpy arrays of class labels

# Create small sample data
np.random.seed(0)

# actual: true labels (small array with multiple classes)
actual = np.array([0, 1, 2, 0, 1, 2, 0, 1])

# predicted: predicted labels (same shape as actual)
predicted = np.array([0, 1, 1, 0, 2, 2, 0, 1])

ARGS = {
    "actual": actual,
    "predicted": predicted,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, 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
load_json Ran
ran; our contract draft was wrong, not the code
ernie-research/Tool-Augmented-Reward-Model/src/utils/file_utils.py
code served (permissive licence) · get_code("593e5e4d03d4d4df")
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 json
import tempfile
import os

# Create a temporary JSON file with valid content
temp_dir = tempfile.mkdtemp()
json_file_path = os.path.join(temp_dir, "test.json")

# Write a valid JSON file
test_data = {
    "key1": "value1",
    "key2": [1, 2, 3],
    "key3": {"nested": "object"}
}

with open(json_file_path, 'w') as f:
    json.dump(test_data, f)

# Define arguments for load_json function
ARGS = {
    "path": json_file_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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_json_data_by_line Ran
ran; our contract draft was wrong, not the code
ernie-research/Tool-Augmented-Reward-Model/src/utils/file_utils.py
code served (permissive licence) · get_code("7722d7f62a54c7a3")
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 json
import tempfile
import os

# Create a temporary file with JSONL data
temp_dir = tempfile.mkdtemp()
temp_file = os.path.join(temp_dir, "test_data.jsonl")

# Write sample JSONL data
sample_data = [
    {"id": 1, "text": "hello world"},
    {"id": 2, "text": "foo bar"},
    {"id": 3, "text": "test data"}
]

with open(temp_file, 'w') as f:
    for item in sample_data:
        f.write(json.dumps(item) + '\n')

# Define ARGS with the path to the temporary file
ARGS = {
    "path": temp_file
}
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
load_txt Ran
ran; our contract draft was wrong, not the code
ernie-research/Tool-Augmented-Reward-Model/src/utils/file_utils.py
code served (permissive licence) · get_code("8d0b0bc9b4468955")
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 text file with some content
temp_dir = tempfile.mkdtemp()
temp_file = os.path.join(temp_dir, "test.txt")

with open(temp_file, 'w') as f:
    f.write("line one\n")
    f.write("line two\n")
    f.write("line three\n")

ARGS = {
    "path": temp_file
}
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
parse_actions Ran
ran; our contract draft was wrong, not the code
ernie-research/Tool-Augmented-Reward-Model/generate_themis.py
code served (permissive licence) · get_code("5eaa07139072b193")
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 AgentAction. 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
from dataclasses import dataclass
from typing import NamedTuple, Union

@dataclass
class AgentAction:
    """Agent's action to take."""
    tool: str
    tool_input: Union[str, dict]
    log: str

class AgentFinish(NamedTuple):
    """Agent's return value."""
    return_values: dict
    log: str

@dataclass
class AgentWork:
    work: str
    log: str

def parse_actions(text):
    FINAL_ANSWER_ACTION = 'Finished'
    WORK_ACTION = 'Work:'
    WORK_START_ACTION = '<start_work>'
    includes_answer = FINAL_ANSWER_ACTION in text
    include_work = WORK_ACTION in text or WORK_START_ACTION in text
    regex = 'Action\\s*\\d*\\s*:[\\s]*(.*?)[\\s]*Action\\s*\\d*\\s*Input\\s*\\d*\\s*:[\\s]*(.*)'
    action_match = re.search(regex, text, re.DOTALL)
    if action_match:
        action = action_match.group(1).strip()
        action_input = action_match.group(2)
        tool_input = action_input.strip(' ')
        if tool_input.startswith('SELECT ') is False:
            tool_input = tool_input.strip('"')
        return AgentAction(action, tool_input, text)
    elif include_work:
        work = re.sub('<start_work>|Work:', '', text).strip()
        return AgentWork(work, text)
    elif includes_answer:
        return AgentFinish({'output': text.split(FINAL_ANSWER_ACTION)[-1].strip()}, text)
    else:
        return None

# Test case 1: Text with Action and Action Input pattern
text_1 = "Action 1: search_tool Action 1 Input 1: query_string"

# Test case 2: Text with Work action
text_2 = "Work: processing some data"

# Test case 3: Text with Finished (answer)
text_3 = "Finished The final answer is complete"

# Test case 4: Text with start_work tag
text_4 = "<start_work> doing some work here"

# Test case 5: Text with none of the patterns
text_5 = "Just some random text"

ARGS = {
    "text": text_1
}
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 AgentAction — a AgentAction output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a AgentAction 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
parse_stop_part Ran
ran; our contract draft was wrong, not the code
ernie-research/Tool-Augmented-Reward-Model/generate_themis.py
code served (permissive licence) · get_code("4226aae6e9d94b97")
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 parse_stop_part(generation_tokens):
    if '<start_observation>' in generation_tokens:
        return generation_tokens[:generation_tokens.index('<start_observation>')]
    stops = ['\nObservation:', '\n\tObservation:']
    for stop in stops:
        action_math = re.search(stop, generation_tokens)
        if action_math:
            return generation_tokens[:action_math.span()[0]]
    return generation_tokens


# Test case 1: with <start_observation> token
test_1 = "This is some text <start_observation> and more text"

# Test case 2: with \nObservation: stop sequence
test_2 = "Action: do something\nObservation: result here"

# Test case 3: with \n\tObservation: stop sequence
test_3 = "Action: do something\n\tObservation: result here"

# Test case 4: no stop sequences
test_4 = "Just some regular text without any stops"

ARGS = {
    "generation_tokens": test_1
}
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

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, 1 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 1 later) and 7 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
load_json 3 other papers
3 later
2402.14874 (2024-02)
Distillation Contrastive Decoding: Improving LLMs Reasoning with Contrastive Decoding and Distillation
2407.09099 (2024-07)
Music Proofreading with RefinPaint: Where and How to Modify Compositions given Context
2511.00117 (2025-11)
DCcluster-Opt: Benchmarking Dynamic Multi-Objective Optimization for Geo-Distributed Data Center Workloads

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

Reward modeling (a.k.a., preference modeling) is instrumental for aligning large language models with human preferences, particularly within the context of reinforcement learning from human feedback (RLHF). While conventional reward models (RMs) have exhibited remarkable scalability, they oft struggle with fundamental functionality such as arithmetic computation, code execution, and factual lookup. In this paper, we propose a tool-augmented preference modeling approach, named Themis, to address these limitations by empowering RMs with access to external environments, including calculators and search engines. This approach not only fosters synergy between tool utilization and reward grading but also enhances interpretive capacity and scoring reliability. Our study delves into the integration of external tools into RMs, enabling them to interact with diverse external sources and construct task-specific tool engagement and reasoning traces in an autoregressive manner. We validate our approach across a wide range of domains, incorporating seven distinct external tools. Our experimental results demonstrate a noteworthy overall improvement of 17.7% across eight tasks in preference ranking. Furthermore, our approach outperforms Gopher 280B by 7.3% on TruthfulQA task in zero-shot evaluation. In human evaluations, RLHF trained with Themis attains an average win rate of 32% when compared to baselines across four distinct tasks. Additionally, we provide a comprehensive collection of tool-related RM datasets, incorporating data from seven distinct tool APIs, totaling 15,000 instances. We have made the code, data, and model checkpoints publicly available to facilitate and inspire further research advancements 1 .

For agents

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

get_harvested_code_for_paper("2310.01045")
get_code_for_paper("2310.01045")
have("2310.01045")

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

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

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

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

Connect an agent — have() is free.