SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2502.03373 · 2025

Demystifying Long Chain-of-Thought Reasoning in LLMs

arXiv · PDF · Open in the Atlas

Code that ran

6 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; 0 honoured the contract we drafted, 0 violated it and 4 have no contract verdict; 2 failures of our instrument; 2 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/2502.03373.json · badge: /api/ran/2502.03373.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
eddycmu/demystify-long-cot canonical (classifier label)
classifier basis not recorded on the link
6 ran · 2 no recorded run
FunctionStatusWhere it lives
compute_approx_kl Ran
ran on a synthesized input
eddycmu/demystify-long-cot/openrlhf/openrlhf/models/utils.py
code served (permissive licence) · get_code("b6035617946dd129")
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

torch.manual_seed(0)

# Create small tensors for log probabilities
# batch_size=2, num_actions=4
log_probs = torch.randn(2, 4)
log_probs_base = torch.randn(2, 4)

# Create action mask (optional parameter)
# Same shape as log_probs
action_mask = torch.ones(2, 4)

ARGS = {
    "log_probs": log_probs,
    "log_probs_base": log_probs_base,
    "action_mask": action_mask,
    "use_kl_estimator_k3": False,
}
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
compute_reward Ran
ran on a synthesized input
eddycmu/demystify-long-cot/openrlhf/openrlhf/models/utils.py
code served (permissive licence) · get_code("1db73767f2ebd35e")
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 numpy as np

torch.manual_seed(0)

# Test case 1: action_mask is not None, r is 1D
batch_size = 2
seq_len = 4
hidden_dim = 3

r_1d = torch.tensor([1.0, 2.0])
kl_1d = torch.randn(batch_size, seq_len)
action_mask_1d = torch.ones(batch_size, seq_len)
action_mask_1d[0, 2:] = 0
action_mask_1d[1, 3:] = 0

ARGS = {
    "r": r_1d,
    "kl_coef": 0.1,
    "kl": kl_1d,
    "action_mask": action_mask_1d,
    "num_actions": None,
    "reward_clip_range": None,
}
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 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
get_shingles Ran
ran on a synthesized input
eddycmu/demystify-long-cot/minhash/find_similar_strings.py
code served (permissive licence) · get_code("5be0d1b8e71bbd1e")
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 set. 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 get_shingles(text, shingle_size=3):
    """
    Create a set of shingles (overlapping groups of words) from the input text.
    Lower-case the text and remove punctuation.
    """
    text = re.sub('\\W+', ' ', text.lower())
    tokens = text.split()
    if len(tokens) < shingle_size:
        return set(tokens)
    return set((' '.join(tokens[i:i + shingle_size] for i in range(len(tokens) - shingle_size + 1))))

ARGS = {
    "text": "The quick brown fox jumps over the lazy dog",
    "shingle_size": 3
}
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 set — a set output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a set 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
log_probs_from_logits Ran
ran; our contract draft was wrong, not the code
eddycmu/demystify-long-cot/openrlhf/openrlhf/models/utils.py
code served (permissive licence) · get_code("959df7824bf09cc1")
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 Tensor, ndim 1, dtype family float, 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
import torch.nn.functional as F

torch.manual_seed(0)

# Create small tensors for testing
# logits: shape (batch_size, num_classes) = (2, 4)
logits = torch.randn(2, 4)

# labels: shape (batch_size,) with class indices in range [0, num_classes)
labels = torch.tensor([0, 2])

ARGS = {
    "logits": logits,
    "labels": labels,
}
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 1, dtype family float, 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
sanitize_filename Ran
ran on a synthesized input
eddycmu/demystify-long-cot/minhash/find_similar_strings.py
code served (permissive licence) · get_code("edc77f8288a52828")
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 sanitize_filename(s):
    """Sanitize a string to be used as a file/directory name."""
    return re.sub('[^A-Za-z0-9]+', '_', s).strip('_')

ARGS = {
    's': 'hello@world#file-name.txt'
}
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
strip_sequence Ran
ran; our contract draft was wrong, not the code
eddycmu/demystify-long-cot/openrlhf/openrlhf/cli/serve_rm.py
code served (permissive licence) · get_code("ca3514c46a1261d7")
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 strip_sequence(text, pad_token, eos_token):
    pad_token_escaped = re.escape(pad_token)
    eos_token_escaped = re.escape(eos_token)
    pattern = f'^({eos_token_escaped}|{pad_token_escaped})+'
    text = re.sub(pattern, '', text)
    pattern = f'({eos_token_escaped}|{pad_token_escaped})+$'
    text = re.sub(pattern, '', text)
    return text

ARGS = {
    'text': '[PAD][EOS]hello world[PAD][EOS]',
    'pad_token': '[PAD]',
    'eos_token': '[EOS]'
}
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
convert_ring_attn_params Not yet run
unverified (harvested, no recorded run)
eddycmu/demystify-long-cot/openrlhf/openrlhf/models/ring_attn_utils.py
code served (permissive licence) · get_code("d66f259aaf6cd9c7")
How it ran

no invocation recorded.

reset_ring_attn_position_ids Not yet run
unverified (harvested, no recorded run)
eddycmu/demystify-long-cot/openrlhf/openrlhf/models/ring_attn_utils.py
code served (permissive licence) · get_code("e93117d99aa6b210")
How it ran

no invocation recorded.

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, 4 are also present in other papers whose code we hold (4 with at least one paper dated earlier, 2 the same month, 4 later) and 4 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
reset_ring_attn_position_ids 15 other papers
4 dated earlier, 1 the same month, 10 later
2306.00398 (2023-06)
Preference-grounded Token-level Guidance for Language Model Fine-tuning
2402.09345 (2024-02)
InfoRM: Mitigating Reward Hacking in RLHF via Information-Theoretic Reward Modeling
2404.18922 (2024-04)
DPO Meets PPO: Reinforced Token Optimization for RLHF
and 12 more not named here
convert_ring_attn_params 9 other papers
4 dated earlier, 5 later
2306.00398 (2023-06)
Preference-grounded Token-level Guidance for Language Model Fine-tuning
2402.09345 (2024-02)
InfoRM: Mitigating Reward Hacking in RLHF via Information-Theoretic Reward Modeling
2404.18922 (2024-04)
DPO Meets PPO: Reinforced Token Optimization for RLHF
and 6 more not named here
log_probs_from_logits 8 other papers
5 dated earlier, 3 later
2306.00398 (2023-06)
Preference-grounded Token-level Guidance for Language Model Fine-tuning
2404.18922 (2024-04)
DPO Meets PPO: Reinforced Token Optimization for RLHF
2410.20749 (2024-10)
Matryoshka Pilot: Learning to Drive Black-Box LLMs with LLMs
and 5 more not named here
strip_sequence 5 other papers
1 dated earlier, 1 the same month, 3 later
2402.09345 (2024-02)
InfoRM: Mitigating Reward Hacking in RLHF via Information-Theoretic Reward Modeling
2502.18968 (2025-02)
Know You First and Be You Better: Modeling Human-Like User Simulators via Implicit Profiles
2504.07912 (2025-04)
Echo Chamber: RL Post-training Amplifies Behaviors Learned in Pretraining
and 2 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

Scaling inference compute enhances reasoning in large language models (LLMs), with long chains-of-thought (CoTs) enabling strategies like backtracking and error correction. Reinforcement learning (RL) has emerged as a crucial method for developing these capabilities, yet the conditions under which long CoTs emerge remain unclear, and RL training requires careful design choices. In this study, we systematically investigate the mechanics of long CoT reasoning, identifying the key factors that enable models to generate long CoT trajectories. Through extensive supervised fine-tuning (SFT) and RL experiments, we present four main findings: (1) While SFT is not strictly necessary, it simplifies training and improves efficiency; (2) Reasoning capabilities tend to emerge with increased training compute, but their development is not guaranteed, making reward shaping crucial for stabilizing CoT length growth; (3) Scaling verifiable reward signals is critical for RL. We find that leveraging noisy, web-extracted solutions with filtering mechanisms shows strong potential, particularly for out-of-distribution (OOD) tasks such as STEM reasoning; and (4) Core abilities like error correction are inherently present in base models, but incentivizing these skills effectively for complex tasks via RL demands significant compute, and measuring their emergence requires a nuanced approach. These insights provide practical guidance for optimizing training strategies to enhance long CoT reasoning in LLMs. Our code is available at: https://github.com/eddycmu/demystify-long-cot.

For agents

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

get_harvested_code_for_paper("2502.03373")
get_code_for_paper("2502.03373")
have("2502.03373")

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

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

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

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

Connect an agent — have() is free.