SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2401.10020 · ICML · 2024

Self-Rewarding Language Models

Kyunghyun Cho, Richard Pang, Jing Xu, Weizhe Yuan, Nyu, Xian Li, Sainbayar Sukhbaatar, Jason Weston

arXiv · PDF · Open in the Atlas

Code that ran

6 of 11 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, 2 violated it and 3 have no contract verdict; 1 failure of our instrument; 5 no recorded run); 1 of them was also run on the host, not in the jail, by the peer-agreement lane that set its level, 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/2401.10020.json · badge: /api/ran/2401.10020.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
lucidrains/self-rewarding-lm-pytorch community (classifier label)
classifier basis not recorded on the link
3 ran · 4 no recorded run
gagan3012/self_rewarding_models community (classifier label)
classifier basis not recorded on the link
3 ran · 1 no recorded run
FunctionStatusWhere it lives
log Ran
ran; our contract draft was wrong, not the code
lucidrains/self-rewarding-lm-pytorch/self_rewarding_lm_pytorch/sampling_utils.py
code served (permissive licence) · get_code("b5472673332de78e")
How it ran

Ran in Syntology's jail on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) 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. The comparison behind this sample's level is a different run: the peer-agreement lane ran it again on the host, not in the jail (report dated 2026-09-05T01:35:34Z). 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

torch.manual_seed(0)

# The function takes a tensor `t` and an optional `eps` parameter
# It clamps the tensor to a minimum value of eps, then takes the log

# Create a small tensor with positive values (log requires positive input)
t = torch.tensor([[0.5, 1.0, 2.0, 0.1],
                   [0.3, 0.8, 1.5, 0.2]], dtype=torch.float32)

ARGS = {
    "t": t,
    "eps": 1e-20
}
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 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
default Ran
ran, violated the contract we drafted
lucidrains/self-rewarding-lm-pytorch/self_rewarding_lm_pytorch/dpo.py
code served (permissive licence) · get_code("99b3563ebc6734ad")
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 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

def exists(v):
    return v is not None

def default(v, d):
    return v if exists(v) else d

# Test case 1: v is not None
v_value = 42
d_value = 100
ARGS = {
    "v": v_value,
    "d": d_value
}
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 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
exists Ran
ran, violated the contract we drafted
lucidrains/self-rewarding-lm-pytorch/self_rewarding_lm_pytorch/dpo.py
code served (permissive licence) · get_code("b7c3487f192e31b7")
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 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 torch

torch.manual_seed(0)

# The function exists(v) simply checks if v is not None
# It takes a single parameter 'v' and returns True if v is not None, False otherwise

# Test with a non-None value
ARGS = {
    "v": 42
}
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 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
fix_prompt Ran
ran on a synthesized input
gagan3012/self_rewarding_models/reward_train.py
code served (permissive licence) · get_code("fd771b0e28e33ab9")
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.

ARGS = {
    "source": "Hello, how are you today?",
    "target": "Bonjour, comment allez-vous aujourd'hui?",
    "dialect": "French"
}
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
prompt_format Ran
ran on a synthesized input
gagan3012/self_rewarding_models/rank_responses.py
code served (permissive licence) · get_code("0e980d2d900070e6")
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 torch.nn as nn

class MockTokenizer:
    def apply_chat_template(self, chat, tokenize=False):
        # Simulate a tokenizer that formats chat messages
        formatted = ""
        for message in chat:
            formatted += f"{message['role']}: {message['content']}\n"
        return formatted

prompt = "What is the capital of France?"
response = "The capital of France is Paris, a beautiful city known for the Eiffel Tower and its rich cultural heritage."
tokenizer = MockTokenizer()

ARGS = {
    "prompt": prompt,
    "response": response,
    "tokenizer": tokenizer
}
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
setup_eft Ran
ran on a synthesized input
gagan3012/self_rewarding_models/data_gen.py
code served (permissive licence) · get_code("8b9058a64b018063")
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 torch

torch.manual_seed(0)

ARGS = {
    'sample': {
        'chosen': [
            {
                'role': 'user',
                'content': 'What is the capital of France?'
            },
            {
                'role': 'assistant',
                'content': 'The capital of France is Paris, a major city located in the north-central part of the country.'
            }
        ],
        'score_chosen': 5
    }
}
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 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
alternate_messages Not yet run
unverified (harvested, no recorded run)
gagan3012/self_rewarding_models/data_gen.py
code served (permissive licence) · get_code("55edf480b3f62cac")
How it ran

no invocation recorded.

always Not yet run
unverified (harvested, no recorded run)
lucidrains/self-rewarding-lm-pytorch/self_rewarding_lm_pytorch/mocks.py
code served (permissive licence) · get_code("291c6f7cd3e538f1")
How it ran

no invocation recorded.

create_mock_dataset Not yet run
unverified (harvested, no recorded run)
lucidrains/self-rewarding-lm-pytorch/self_rewarding_lm_pytorch/mocks.py
code served (permissive licence) · get_code("3429aba36f0d19cc")
How it ran

no invocation recorded.

find_variables_from_jinja_template Not yet run
unverified (harvested, no recorded run)
lucidrains/self-rewarding-lm-pytorch/self_rewarding_lm_pytorch/self_rewarding_lm_pytorch.py
code served (permissive licence) · get_code("7eeab84522869fee")
How it ran

no invocation recorded.

prompt_mask_from_len Not yet run
unverified (harvested, no recorded run)
lucidrains/self-rewarding-lm-pytorch/self_rewarding_lm_pytorch/spin.py
code served (permissive licence) · get_code("60cc0acbbea98eb4")
How it ran

no invocation recorded.

Also present in other papers' code

Of 11 samples lifted from this paper's linked repositories, 11 carry a function identity and 0 do not. Of the 11 distinct functions with an identity, 3 are also present in other papers whose code we hold (3 with at least one paper dated earlier, 3 the same month, 3 later) and 8 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
exists 27 other papers
9 dated earlier, 2 the same month, 15 later, 1 same year, order not determinable · 3 only as an assembly brick
1810.00825 (2018-10)
Set Transformer: A Framework for Attention-based Permutation-Invariant Neural Networks
2006.15055 (2020-06)
Object-Centric Learning with Slot Attention
2010.10241 (2020-10)
BYOL works even without batch statistics
and 24 more not named here
log 22 other papers
13 dated earlier, 1 the same month, 8 later · 9 only as an assembly brick
1611.07004 (2016-11)
Image-to-Image Translation with Conditional Adversarial Networks
1907.05242 (2019-07)
Large Memory Layers with Product Keys
2203.07852 (2022-03)
Block-Recurrent Transformers
and 19 more not named here
default 21 other papers
6 dated earlier, 2 the same month, 13 later · 1 only as an assembly brick
2006.15055 (2020-06)
Object-Centric Learning with Slot Attention
2110.00218 (2021-10)
On the Importance of Gradients for Detecting Distributional Shifts in the Wild
2309.02612 (2023-09)
Music Source Separation with Band-Split RoPE Transformer
and 18 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

We posit that to achieve superhuman agents, future models require superhuman feedback in order to provide an adequate training signal. Current approaches commonly train reward models from human preferences, which may then be bottlenecked by human performance level, and secondly these separate frozen reward models cannot then learn to improve during LLM training. In this work, we study Self-Rewarding Language Models, where the language model itself is used via LLM-as-a-Judge prompting to provide its own rewards during training. We show that during Iterative DPO training that not only does instruction following ability improve, but also the ability to provide high-quality rewards to itself. Fine-tuning Llama 2 70B on three iterations of our approach yields a model that outperforms many existing systems on the AlpacaEval 2.0 leaderboard, including Claude 2, Gemini Pro, and GPT-4 0613. While there is much left still to explore, this work opens the door to the possibility of models that can continually improve in both axes.

For agents

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

get_harvested_code_for_paper("2401.10020")
get_code_for_paper("2401.10020")
have("2401.10020")

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

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

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

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

Connect an agent — have() is free.