SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2605.29398 · 2026

GDSD: Reinforcement Learning as Guided Denoiser Self-Distillation for Diffusion Language Models

Xiaohang Tang, Che Liu, Xiaoxiao Xu, Keyue Jiang, Qifang Zhao, Yoon Sangwoong, Ilija Unist, Bogunovic

arXiv · PDF · Open in the Atlas

Code that ran

11 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; 3 honoured the contract we drafted, 1 violated it and 0 have no contract verdict; 7 failures of our instrument; 2 no recorded run), measured 2026-11-23; 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.29398.json · badge: /api/ran/2605.29398.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
GaryBall/GDSD canonical (classifier label)
classifier basis: census
11 ran · 2 no recorded run
FunctionStatusWhere it lives
boxed_in_answer Ran
ran, honoured the contract we drafted
GaryBall/GDSD/gdsd/utils/math500_utils.py
code served (permissive licence) · get_code("5c23d8a8de0a68a7")
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 torch

torch.manual_seed(0)

# Construct arguments for boxed_in_answer function
prompts = [
    "What is 2+2?",
    "Solve for x: x^2 = 4"
]

completions = [
    [{'content': 'The answer is <answer>4</answer> because 2+2=4'}],
    [{'content': 'The solution is <answer>\\boxed{2}</answer> or <answer>\\boxed{-2}</answer>'}]
]

answer = "4"

step = None

ARGS = {
    'prompts': prompts,
    'completions': completions,
    'answer': answer,
    'step': step
}
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 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
compute_approx_kl Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
GaryBall/GDSD/gdsd/trainers/espo_trainer.py
code served (permissive licence) · get_code("773d9371a4bdce62")
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 log probability tensors
# Shape: (2, 4) - batch size 2, 4 log probabilities each
log_probs = torch.randn(2, 4, requires_grad=True)
log_probs_base = torch.randn(2, 4)

# Ensure they are valid log probabilities (negative or zero)
log_probs = torch.clamp(log_probs, max=0)
log_probs_base = torch.clamp(log_probs_base, max=0)

ARGS = {
    'log_probs': log_probs,
    'log_probs_base': log_probs_base,
    'kl_estimator': 'k1'
}
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
dummy_prepare_inputs_for_generation Ran
ran; our contract draft was wrong, not the code
GaryBall/GDSD/gdsd/utils/model_utils.py
code served (permissive licence) · get_code("5ac161f7ca1e4c6e")
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
import torch.nn as nn

torch.manual_seed(0)

# The function takes self (a model instance), input_ids, and **kwargs
# It simply returns a dict with input_ids and any additional kwargs
# So we need to provide minimal arguments

class DummyModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 4)
    
    def dummy_prepare_inputs_for_generation(self, input_ids=None, **kwargs):
        return {'input_ids': input_ids, **kwargs}

# Create instance
model = DummyModel()

# Create small input_ids tensor (batch_size=2, seq_length=4)
input_ids = torch.randint(0, 10, (2, 4))

# Additional kwargs that might be passed
extra_kwargs = {
    'attention_mask': torch.ones((2, 4), dtype=torch.long),
    'token_type_ids': torch.zeros((2, 4), dtype=torch.long),
}

ARGS = {
    'self': model,
    'input_ids': input_ids,
    **extra_kwargs,
}
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
extract_code Ran
ran; our contract draft was wrong, not the code
GaryBall/GDSD/gdsd/rewards.py
code served (permissive licence) · get_code("0f07a2dc4671890b")
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

# The function extracts code blocks from a completion string
# It takes:
# 1. completion: a string that may contain markdown code blocks
# 2. language: the language identifier for the code block (default 'python')

# Create test completions with embedded code blocks
completion_with_python = """
Here is some Python code:

def hello():
    print("world")

And that's it.
"""

completion_with_javascript = """
Here is JavaScript:
javascript
console.log("hello");

"""

completion_no_code = "Just plain text, no code blocks here."

completion_multiple_blocks = """
First block:

x = 1

Second block:

y = 2

"""

# ARGS maps every parameter to a value
ARGS = {
    'completion': completion_with_python,
    'language': 'python'
}
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
get_code_format_reward Ran
ran; our contract draft was wrong, not the code
GaryBall/GDSD/gdsd/rewards.py
code served (permissive licence) · get_code("96a43402b05ef0d4")
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 re
import ast

def get_code_format_reward(language: str='python'):
    pattern = re.compile(f'^(?:(?!```)[\\s\\S])*?```{language}\\n(?:(?!```)[\\s\\S])*?```\\n?$', re.DOTALL)

    def code_format_reward(completions, **kwargs):
        completion_contents = [completion[0]['content'] for completion in completions]
        rewards = []
        for content in completion_contents:
            if not pattern.fullmatch(content):
                rewards.append(0.0)
                continue
            code_blocks = re.findall(f'```{language}\\n(.*?)```', content, re.DOTALL)
            if not code_blocks:
                rewards.append(0.0)
                continue
            code = code_blocks[0].strip()
            try:
                ast.parse(code)
                rewards.append(1.0)
            except SyntaxError:
                rewards.append(0.5)
            except Exception:
                rewards.append(0.0)
        return rewards
    return code_format_reward

# Construct test data for the reward function
# The function expects completions to be a list where each element is a list
# containing dictionaries with 'content' keys

valid_python_code = """```python
x = 1
y = 2
print(x + y)

"""

invalid_syntax_code = """```python
x = 1
y = 2
print(x + y

"""

invalid_format_code = """```python
x = 1
y = 2
print(x + y)

extra text here"""

completions = [
    [[{'content': valid_python_code}]],
    [[{'content': invalid_syntax_code}]],
    [[{'content': invalid_format_code}]],
]

ARGS = {
    'language': 'python'
}
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 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
is_equiv Ran
ran, violated the contract we drafted
GaryBall/GDSD/gdsd/utils/math500_utils.py
code served (permissive licence) · get_code("b2845803d938cb26")
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.

# Analyzing the function is_equiv
# It takes two string parameters (str1, str2) and an optional verbose boolean
# The function processes strings through strip_string and compares them
# No torch/numpy/scipy needed - this is pure string processing

ARGS = {
    "str1": "\\frac{1}{2}",
    "str2": "0.5",
    "verbose": False
}
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_code_conversation Ran
ran; our contract draft was wrong, not the code
GaryBall/GDSD/gdsd/data_utils.py
code served (permissive licence) · get_code("8268ac93c7808b81")
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
import numpy as np

torch.manual_seed(0)

# Construct the example dict that the function expects
example = {
    'question': 'Write a function that adds two numbers.',
    'test_cases': ['def test_add():\n    assert add(2, 3) == 5']
}

ARGS = {
    'example': example
}
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 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
remove_boxed Ran
ran; our contract draft was wrong, not the code
GaryBall/GDSD/gdsd/utils/math500_utils.py
code served (permissive licence) · get_code("e4d5a8bc57ae4499")
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

torch.manual_seed(0)

ARGS = {
    's': '\\boxed{42}'
}
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
run_single_test Ran
ran, honoured the contract we drafted
GaryBall/GDSD/gdsd/utils/local_sandbox.py
code served (permissive licence) · get_code("2b84adae31d26dc5")
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 torch.nn as nn
import numpy as np

torch.manual_seed(0)

# Create a simple function as a string that the test will execute
func_code = """
def sample_function(x):
    return x + 1
"""

# Create a simple test as a string that verifies the function works
test_code = """
result = sample_function(5)
assert result == 6, f"Expected 6, got {result}"
"""

ARGS = {
    "func": func_code,
    "test": test_code
}
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
run_single_test_against_program_helper Ran
ran, honoured the contract we drafted
GaryBall/GDSD/gdsd/utils/local_sandbox.py
code served (permissive licence) · get_code("86bd416f8d3d9e07")
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 multiprocessing
from ctypes import c_int

torch.manual_seed(0)

# The function takes two string parameters: func and test
# func: a string containing Python code to be executed
# test: a string containing test code to be executed

# Create simple valid Python code strings
func_code = """
def add(a, b):
    return a + b

result = add(2, 3)
"""

test_code = """
assert result == 5, "Addition failed"
"""

ARGS = {
    'func': func_code,
    'test': test_code
}
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 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
split_tensor_dict Ran
ran; our contract draft was wrong, not the code
GaryBall/GDSD/gdsd/trainers/espo_trainer.py
code served (permissive licence) · get_code("23e33cf487ecdf91")
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 torch

torch.manual_seed(0)

# Create a tensor dictionary with a mix of tensors and None values
tensor_dict = {
    "embeddings": torch.randn(8, 4),  # batch_size=8, dim=4
    "logits": torch.randn(8, 3),      # batch_size=8, different dim=3
    "attention": torch.randn(8, 5),   # batch_size=8, different dim=5
    "metadata": None,                  # None value (should be copied as-is)
    "mask_seeds": [1, 2, 3, 4],       # list value (should be copied as-is)
}

num_chunks = 2

ARGS = {
    "tensor_dict": tensor_dict,
    "num_chunks": num_chunks,
}
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 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
code_reward Not yet run
unverified (harvested, no recorded run)
GaryBall/GDSD/gdsd/rewards.py
code served (permissive licence) · get_code("57c8964d40fed7a7")
How it ran

no invocation recorded.

local_execute Not yet run
unverified (harvested, no recorded run)
GaryBall/GDSD/gdsd/utils/local_sandbox.py
code served (permissive licence) · get_code("2dc0cf9cedea3958")
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, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 13 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.

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-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Reinforcement learning (RL) can be used to improve the policy (denoiser) of diffusion large language models (dLLMs), while being hindered by the intractability of the policy likelihood. A dominant and efficient family of methods replaces the likelihood in standard RL with its evidence lower bound (ELBO), estimated from randomly masked sequences. Despite being well aligned with pre-training, these approaches introduce bias through training-inference mismatch by using the ELBO as a likelihood surrogate, which can degrade performance. In this work, we propose Guided Denoiser Self-Distillation (GDSD) to directly distill the denoiser of dLLMs from an advantage-guided self-teacher, derived from the closed-form optimum of reverse-KL regularized RL. GDSD matches the dLLM's denoiser logits to the teacher's via a normalization-free objective, which reduces RL to likelihood-free self-distillation and thus bypasses the TIM biases. Recent ELBObased methods emerge as instances of applying different distillation divergences, but with diagnosable pathologies that GDSD avoids. On planning, math, and coding benchmarks with LLaDA-8B and Dream-7B, GDSD consistently outperforms prior state-of-the-art ELBO-based methods with a more stable training reward dynamics, achieving test-accuracy improvements of up to +19.6%. These results suggest that direct denoiser self-distillation, without relying on an ELBO likelihood surrogate, can provide a more stable and effective RL procedure for dLLMs. Code is available at https://github.com/GaryBall/GDSD.

For agents

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

get_harvested_code_for_paper("2605.29398")
get_code_for_paper("2605.29398")
have("2605.29398")

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

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

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

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

Connect an agent — have() is free.