SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2605.05040 · 2026

Preference-Based Self-Distillation: Beyond KL Matching via Reward Regularization

Xin Yu, Yingchen Yu, Lingzhou Xue, Yiwen Zhang, Liuchen Liao, Qinzhen Guo

arXiv · PDF · Open in the Atlas

Code that ran

7 of 7 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 0 have no contract verdict; 5 failures of our instrument; 0 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/2605.05040.json · badge: /api/ran/2605.05040.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
LucasXinYu/PBSD canonical (classifier label)
classifier basis: census
7 ran · 0 no recorded run
FunctionStatusWhere it lives
extract_boxed_answer Ran
ran; our contract draft was wrong, not the code
LucasXinYu/PBSD/eval/evaluate_math.py
pointer only (licence: MIT); the stored copy get_code serves, from ZJU-REAL/TTPO, is pointer only (licence: NONE) · get_code("b1030fc6426aa14c")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from ZJU-REAL/TTPO, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

extract_boxed_answer Ran
ran; our contract draft was wrong, not the code
LucasXinYu/PBSD/verify_utils.py
code served (permissive licence) · get_code("d1e73ab2175498fb")
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 extract_boxed_answer takes a single parameter: text (a string)
# It searches for \boxed{...} patterns in the text, handling nested braces
# and skipping content before </think> if present

ARGS = {
    "text": "Some math problem\n\\boxed{\\frac{1}{2}}\nMore text"
}
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_action_part Ran
ran; our contract draft was wrong, not the code
LucasXinYu/PBSD/eval/evaluate_tooluse.py
code served (permissive licence) · get_code("30a1e08307f69b84")
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 ast

# The function takes a single parameter: text (str)
# It processes the text to extract Action and Action Input parts
# It handles two cases:
# 1. Text starting with '[{' containing "'Action'" - parses as literal_eval
# 2. Text containing 'Action:' - finds and returns from that point
# 3. Otherwise returns the stripped text

# Create test cases for different branches

# Case 1: Dictionary list format with Action and Action_Input
text_dict_format = "[{'Action': 'search', 'Action_Input': '{\"query\": \"python\"}'}]"

# Case 2: Simple Action: format
text_action_format = "Some prefix text\nAction: search\nAction Input: {\"query\": \"test\"}"

# Case 3: Empty text
text_empty = ""

# Case 4: Plain text without Action
text_plain = "This is just some plain text"

# We'll use case 2 as the primary test case since it's most general
ARGS = {
    "text": "Some reasoning here\nAction: search\nAction Input: {\"query\": \"example\"}"
}
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
grade_tooluse Ran
ran, violated the contract we drafted
LucasXinYu/PBSD/eval/evaluate_tooluse.py
code served (permissive licence) · get_code("1a6bcf11778ee258")
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 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
import re

ARGS = {
    'predicted': 'Action: search\nAction Input: {"query": "python tutorial"}',
    'ground_truth': 'Action: search\nAction Input: {"query": "python tutorial"}'
}
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 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
is_tooluse_correct Ran
ran, violated the contract we drafted
LucasXinYu/PBSD/verify_utils.py
code served (permissive licence) · get_code("81c459e24198be8f")
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 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 re

def _get_action_part(text):
    if not text:
        return ''
    idx = text.find('Action:')
    return text[idx:].strip() if idx != -1 else text.strip()

def is_tooluse_correct(completion, ground_truth):
    """Return True iff the completion's action string contains the gold action.

    Mirrors ``grpo_train.reward_tooluse``.
    """
    pred_norm = re.sub('\\s+', '', _get_action_part(completion)).lower()
    gt_norm = re.sub('\\s+', '', _get_action_part(ground_truth)).lower()
    return bool(gt_norm) and gt_norm in pred_norm


ARGS = {
    "completion": "Here is my response. Action: call_function(arg1, arg2)",
    "ground_truth": "Action: call_function(arg1, arg2)"
}
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 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
make_format_fn Ran
ran; our contract draft was wrong, not the code
LucasXinYu/PBSD/sft_train.py
code served (permissive licence) · get_code("9b030bebf19b010e")
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

class MockTokenizer:
    """Minimal tokenizer with apply_chat_template method."""
    def apply_chat_template(self, messages, tokenize=False):
        """Converts messages to formatted text."""
        result = ""
        for msg in messages:
            role = msg['role']
            content = msg['content']
            result += f"[{role}]: {content}\n"
        return result.strip()

ARGS = {
    'tokenizer': MockTokenizer(),
    'dataset_name': 'math_problem',
}
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
make_format_prompt Ran
ran; our contract draft was wrong, not the code
LucasXinYu/PBSD/grpo_train.py
code served (permissive licence) · get_code("0371fc478c38b443")
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 numpy as np
from unittest.mock import Mock

torch.manual_seed(0)

# Create a mock tokenizer that has the apply_chat_template method
class MockTokenizer:
    def apply_chat_template(self, messages, tokenize=False, add_generation_prompt=False):
        # Simple mock implementation: concatenate message contents
        result = ""
        for msg in messages:
            result += f"[{msg['role']}]: {msg['content']}\n"
        if add_generation_prompt:
            result += "[assistant]: "
        return result

# Create tokenizer instance
tokenizer = MockTokenizer()

ARGS = {
    'tokenizer': tokenizer,
    'dataset_name': 'standard_dataset'
}
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 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

Also present in other papers' code

Of 7 samples lifted from this paper's linked repositories, 7 carry a function identity and 0 do not. Of the 7 distinct functions with an identity, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 1 the same month, 1 later) and 6 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
extract_boxed_answer 5 other papers
1 dated earlier, 1 the same month, 3 later
2601.18734 (2026-01)
Self-Distilled Reasoner: On-Policy Self-Distillation for Large Language Models
2605.21606 (2026-05)
When Are Teacher Tokens Reliable? Position-Weighted On-Policy Self-Distillation for Reasoning
2606.23104 (2026-06)
ReNIO: Reweighting Negative Trajectory Importance for LLM On-Policy Distillation
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

On-policy distillation is an efficient alternative to reinforcement learning, offering dense token-level training signals. However, its reliance on a stronger external teacher has driven recent work on on-policy self-distillation, where the same model serves as both teacher and student under different prompt contexts. Yet, existing self-distillation methods largely reduce learning to KL matching toward the context-augmented teacher model. This approach often suffers from training instability and can degrade reasoning performance over time. Moreover, selfdistillation from the same model with prompt augmentation lacks the exploratory diversity provided by a genuine external teacher. To address these limitations, we move beyond fixed-teacher KL matching and propose Preference-Based Self-Distillation (PBSD), which revisits on-policy self-distillation through a rewardregularized perspective. Instead of directly matching the teacher distribution, we derive a reward-regularized objective whose analytic optimum is a rewardreweighted teacher distribution, yielding a target policy that improves over the original teacher under this objective. Practically, PBSD optimizes preference gaps between teacher and student samples while maintaining on-policy student sampling. We support this framework with a local statistical analysis of the induced preferencelearning problem, clarifying when contextual self-distillation can provide more favorable comparison geometry than external-teacher distillation in our setting. Experiments on mathematical reasoning and tool-use benchmarks across multiple model scales demonstrate that PBSD consistently achieves the strongest average performance among comparable baselines, showing improved training stability over prior self-distillation baselines while preserving token efficiency. Code is available at github.com/LucasXinYu/PBSD.

For agents

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

get_harvested_code_for_paper("2605.05040")
get_code_for_paper("2605.05040")
have("2605.05040")

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

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

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

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

Connect an agent — have() is free.