SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2403.17031 · 2024

The N+ Implementation Details of RLHF with PPO: A Case Study on TL;DR Summarization

arXiv · PDF · Open in the Atlas

Code that ran

8 of 13 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; 2 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 6 failures of our instrument; 5 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/2403.17031.json · badge: /api/ran/2403.17031.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
vwxyzjn/summarize_from_feedback_details canonical (classifier label)
classifier basis: census
8 ran · 5 no recorded run
FunctionStatusWhere it lives
ceil_div Ran
ran, honoured the contract we drafted
vwxyzjn/summarize_from_feedback_details/summarize_from_feedback_details/tldr_dataset.py
code served (permissive licence) · get_code("f99955c55f25123e")
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)

# ceil_div takes two parameters: a and b
# It performs ceiling division: (a - 1) // b + 1
# Both parameters should be integers

ARGS = {
    "a": 10,
    "b": 3
}
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
first_true_indices Ran
ran, honoured the contract we drafted
vwxyzjn/summarize_from_feedback_details/summarize_from_feedback_details/dpo.py
code served (permissive licence) · get_code("579f0202bb30e003")
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 1, dtype family int, shape (2,) 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)

# Create a small 2D boolean tensor (batch_size=2, sequence_length=4)
# This will test the function's ability to find the first True in each row
bools = torch.tensor([
    [False, False, True, False],
    [False, True, False, False]
], dtype=torch.bool)

ARGS = {
    "bools": bools,
    "dtype": torch.long
}
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 1, dtype family int, shape (2,) — shape (2,) 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
forward Ran
ran; our contract draft was wrong, not the code
vwxyzjn/summarize_from_feedback_details/summarize_from_feedback_details/dpo.py
code served (permissive licence) · get_code("1f9a50a3becd157e")
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. 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)

# Create a minimal tokenizer stand-in
class MinimalTokenizer:
    def __init__(self):
        self.pad_token_id = 0

tokenizer = MinimalTokenizer()

# Create a minimal model that outputs logits
class MinimalModel(nn.Module):
    def __init__(self, vocab_size=10, hidden_dim=4, seq_len=5):
        super().__init__()
        self.embedding = nn.Embedding(vocab_size, hidden_dim)
        self.linear = nn.Linear(hidden_dim, vocab_size)
        self.vocab_size = vocab_size
        self.seq_len = seq_len
    
    def forward(self, input_ids, attention_mask, return_dict=True):
        # input_ids shape: (batch_size, seq_len)
        embedded = self.embedding(input_ids)  # (batch_size, seq_len, hidden_dim)
        logits = self.linear(embedded)  # (batch_size, seq_len, vocab_size)
        
        class Output:
            def __init__(self, logits):
                self.logits = logits
        
        return Output(logits)

model = MinimalModel(vocab_size=10, hidden_dim=4, seq_len=5)

# Create query_responses: batch_size=2 (chosen + rejected pairs)
# Shape: (4, 5) - 4 sequences, 5 tokens each (2 chosen, 2 rejected)
query_responses = torch.tensor([
    [1, 2, 3, 4, 0],
    [2, 3, 1, 0, 0],
    [1, 1, 2, 3, 0],
    [3, 2, 1, 4, 0]
], dtype=torch.long)

# Create labels: same shape as query_responses
labels = torch.tensor([
    [1, 2, 3, 4, 0],
    [2, 3, 1, 0, 0],
    [1, 1, 2, 3, 0],
    [3, 2, 1, 4, 0]
], dtype=torch.long)

ARGS = {
    "model": model,
    "query_responses": query_responses,
    "labels": labels,
    "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 tuple — a tuple 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
generate Ran
ran; our contract draft was wrong, not the code
vwxyzjn/summarize_from_feedback_details/summarize_from_feedback_details/dpo.py
code served (permissive licence) · get_code("51062aca9db3f84c")
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 int, shape (2, 8) 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)

# Stand-in tokenizer with pad_token_id
class SimpleTokenizer:
    def __init__(self, pad_token_id=0):
        self.pad_token_id = pad_token_id

# Stand-in generation config
class SimpleGenerationConfig:
    def __init__(self):
        self.max_new_tokens = 5
        self.do_sample = False

# Minimal LM backbone that implements generate method
class SimpleLMBackbone(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 4)
    
    def generate(self, input_ids, attention_mask, generation_config, return_dict_in_generate=False):
        # Mock generate: return sequences of shape (batch_size, original_length + new_tokens)
        batch_size = input_ids.shape[0]
        context_length = input_ids.shape[1]
        new_length = 3  # Generate 3 new tokens
        
        # Create output sequences
        generated = torch.randint(1, 10, (batch_size, context_length + new_length))
        
        # Return object with sequences attribute
        class Output:
            def __init__(self, sequences):
                self.sequences = sequences
        
        return Output(generated)

# Create instances
tokenizer = SimpleTokenizer(pad_token_id=0)
generation_config = SimpleGenerationConfig()
lm_backbone = SimpleLMBackbone()

# Create queries tensor: batch_size=2, sequence_length=5, with some padding
queries = torch.tensor([
    [1, 2, 3, 0, 0],
    [4, 5, 0, 0, 0]
])

ARGS = {
    'lm_backbone': lm_backbone,
    'queries': queries,
    'tokenizer': tokenizer,
    'generation_config': generation_config
}
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 int, shape (2, 8) — shape (2, 8) 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
layer_init Ran
ran; our contract draft was wrong, not the code
vwxyzjn/summarize_from_feedback_details/summarize_from_feedback_details/ppo.py
code served (permissive licence) · get_code("9ad5922df265477f")
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 Linear. 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 numpy as np
import torch
import torch.nn as nn

torch.manual_seed(0)

# Create a small linear layer with weight and bias attributes
# This is what layer_init expects to modify
layer = nn.Linear(in_features=3, out_features=4)

ARGS = {
    "layer": layer,
    "std": np.sqrt(2),
    "bias_const": 0.0
}
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 Linear — a Linear output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Linear 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
masked_mean Ran
ran; our contract draft was wrong, not the code
vwxyzjn/summarize_from_feedback_details/summarize_from_feedback_details/ppo.py
code served (permissive licence) · get_code("16655f3447355899")
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 numpy as np

torch.manual_seed(0)

# Create small tensors for testing masked_mean
values = torch.randn(2, 4)  # batch_size=2, dim=4
mask = torch.ones(2, 4)  # same shape as values
mask[0, 1] = 0  # mask out one element to make masking meaningful
mask[1, 2:] = 0  # mask out more elements

# Test with axis=None (reduce all dimensions)
axis = None

ARGS = {
    "values": values,
    "mask": mask,
    "axis": axis
}
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 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
masked_var Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
vwxyzjn/summarize_from_feedback_details/summarize_from_feedback_details/ppo.py
code served (permissive licence) · get_code("3a136e5f5a8047ac")
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

torch.manual_seed(0)

# Create small tensors for masked_var function
# values: a tensor of values
# mask: a binary mask tensor (same shape as values)

values = torch.randn(2, 4)  # shape (2, 4)
mask = torch.ones(2, 4)     # shape (2, 4), all ones (all values included)

ARGS = {
    'values': values,
    'mask': mask,
    'unbiased': True,
}
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
truncate_response Ran
ran; our contract draft was wrong, not the code
vwxyzjn/summarize_from_feedback_details/summarize_from_feedback_details/sft.py
code served (permissive licence) · get_code("e2429ac73eafe86e")
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 int, 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

torch.manual_seed(0)

class MockTokenizer:
    def __init__(self):
        self.pad_token_id = 0

class MockArgs:
    def __init__(self):
        self.truncate_token_id = 50256

# Create small test tensors
batch_size = 2
seq_len = 4

# responses: shape (batch_size, seq_len) with token IDs
# Include at least one occurrence of truncate_token_id (50256) in one row
responses = torch.tensor([
    [100, 101, 50256, 102],
    [200, 201, 202, 203]
], dtype=torch.long)

args = MockArgs()
tokenizer = MockTokenizer()

ARGS = {
    "args": args,
    "tokenizer": tokenizer,
    "responses": responses
}
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 int, 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
check_rm_agree Not yet run
unverified (harvested, no recorded run)
vwxyzjn/summarize_from_feedback_details/eval/analyze_rm.py
code served (permissive licence) · get_code("5c6b0419c48c8511")
How it ran

no invocation recorded.

get_reward Not yet run
unverified (harvested, no recorded run)
vwxyzjn/summarize_from_feedback_details/summarize_from_feedback_details/reward.py
code served (permissive licence) · get_code("c64a8d32a7ed56ca")
How it ran

no invocation recorded.

get_rm_agree_data Not yet run
unverified (harvested, no recorded run)
vwxyzjn/summarize_from_feedback_details/eval/analyze_rm.py
code served (permissive licence) · get_code("724d57837e39392a")
How it ran

no invocation recorded.

llm_judge Not yet run
unverified (harvested, no recorded run)
vwxyzjn/summarize_from_feedback_details/eval/oai2.py
code served (permissive licence) · get_code("1cb57f8078b45d84")
How it ran

no invocation recorded.

process_query Not yet run
unverified (harvested, no recorded run)
vwxyzjn/summarize_from_feedback_details/summarize_from_feedback_details/tldr_dataset.py
code served (permissive licence) · get_code("3dcde3c8b6d6c204")
How it ran

no invocation recorded.

Also present in other papers' code

Of 13 samples lifted from this paper's linked repositories, 13 carry a function identity and 0 do not. Of the 13 distinct functions with an identity, 10 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 10 later) and 3 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
layer_init 4 other papers
4 later
2404.08495 (2024-04)
Dataset Reset Policy Optimization for RLHF
2404.16767 (2024-04)
REBEL: Reinforcement Learning via Regressing Relative Rewards
2410.18870 (2024-10)
End-to-end Training for Recommendation with Language-based User Profiles
and 1 more not named here
first_true_indices 3 other papers
3 later
2404.16767 (2024-04)
REBEL: Reinforcement Learning via Regressing Relative Rewards
2410.04612 (2024-10)
Regressing the Relative Future: Efficient Policy Optimization for Multi-turn RLHF
2503.13538 (2025-03)
From Demonstrations to Rewards: Alignment Without Explicit Human Preferences
generate 2 other papers
2 later
2404.16767 (2024-04)
REBEL: Reinforcement Learning via Regressing Relative Rewards
2503.13538 (2025-03)
From Demonstrations to Rewards: Alignment Without Explicit Human Preferences
ceil_div 1 other paper
1 later
2503.13538 (2025-03)
From Demonstrations to Rewards: Alignment Without Explicit Human Preferences
forward 1 other paper
1 later
2503.13538 (2025-03)
From Demonstrations to Rewards: Alignment Without Explicit Human Preferences
get_reward 1 other paper
1 later
2503.13538 (2025-03)
From Demonstrations to Rewards: Alignment Without Explicit Human Preferences
masked_mean 1 other paper
1 later
2503.13538 (2025-03)
From Demonstrations to Rewards: Alignment Without Explicit Human Preferences
masked_var 1 other paper
1 later
2503.13538 (2025-03)
From Demonstrations to Rewards: Alignment Without Explicit Human Preferences
process_query 1 other paper
1 later
2503.13538 (2025-03)
From Demonstrations to Rewards: Alignment Without Explicit Human Preferences
truncate_response 1 other paper
1 later
2503.13538 (2025-03)
From Demonstrations to Rewards: Alignment Without Explicit Human Preferences

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

This work is the first to openly reproduce the Reinforcement Learning from Human Feedback (RLHF) scaling behaviors reported in OpenAI's seminal TL;DR summarization work. We create an RLHF pipeline from scratch, enumerate over 20 key implementation details, and share key insights during the reproduction. Our RLHF-trained Pythia models demonstrate significant gains in response quality that scale with model size, with our 2.8B, 6.9B models outperforming OpenAI's released 1.3B checkpoint. We publicly release the trained model checkpoints and code to facilitate further research and accelerate progress in the field (\url{https://github.com/vwxyzjn/summarize_from_feedback_details}).

For agents

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

get_harvested_code_for_paper("2403.17031")
get_code_for_paper("2403.17031")
have("2403.17031")

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

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

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

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

Connect an agent — have() is free.