SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2107.03006 · 2021

Structured Denoising Diffusion Models in Discrete State-Spaces

Daniel Tarlow, Rianne Van Den Berg, Daniel Johnson, Jonathan Ho, Jacob Austin

arXiv · PDF · Open in the Atlas

Code that ran

5 of 5 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (4 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; 1 failure of our instrument; 0 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/2107.03006.json · badge: /api/ran/2107.03006.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
xiaoiker/meta_dpm community
Papers with Code archive
2 ran · 0 no recorded run
samb-t/unleashing-transformers community
Papers with Code archive
2 ran · 0 no recorded run
HKUNLP/Dream community
Papers with Code archive
1 ran · 0 no recorded run
FunctionStatusWhere it lives
AbsorbingDiffusion Ran
ran on a synthesized input · constructed an object; no result was computed
xiaoiker/meta_dpm/models/absorbing_diffusion.py
code served (permissive licence) · get_code("6a85860b6ec451b5")
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 an instance of its own class, AbsorbingDiffusion: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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
import math

torch.manual_seed(0)

# Create a minimal config object
class H:
    latent_shape = (2, 4, 3, 5)  # (batch, height, width, depth)
    emb_dim = 6
    codebook_size = 8
    n_samples = 2
    batch_size = 2
    total_steps = 10
    loss_type = 'elbo'
    mask_schedule = 'random'

# Create a minimal denoise function that returns logits
class DenoiseFn(nn.Module):
    def __init__(self, codebook_size, emb_dim, latent_shape):
        super().__init__()
        self.codebook_size = codebook_size
        self.emb_dim = emb_dim
        # latent_shape is (batch, height, width, depth)
        self.seq_len = latent_shape[1] * latent_shape[2] * latent_shape[3]
        # Simple linear layer: takes flattened sequence and outputs logits
        self.linear = nn.Linear(self.seq_len + 1, self.seq_len * codebook_size)
    
    def forward(self, x_t, t):
        batch_size = x_t.size(0)
        # x_t is (batch, seq_len) with token indices
        x_flat = x_t.view(batch_size, -1).float()
        # Concatenate time information
        t_emb = t.float().unsqueeze(-1)
        x_with_t = torch.cat([x_flat, t_emb], dim=1)
        # Output logits: (batch, seq_len, codebook_size)
        logits = self.linear(x_with_t)
        logits = logits.view(batch_size, self.seq_len, self.codebook_size)
        return logits

# Create embedding weight matrix
embedding_weight = torch.randn(H.codebook_size, H.emb_dim)

# Create denoise function
denoise_fn = DenoiseFn(H.codebook_size, H.emb_dim, H.latent_shape)

# mask_id is the token ID used for masking
mask_id = 0

# aux_weight parameter
aux_weight = 0.01

ARGS = {
    'H': H,
    'denoise_fn': denoise_fn,
    'mask_id': mask_id,
    'embedding_weight': embedding_weight,
    'aux_weight': aux_weight,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch, tqdm — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type AbsorbingDiffusion — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a AbsorbingDiffusion 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
AbsorbingDiffusion Ran
ran on a synthesized input · constructed an object; no result was computed
samb-t/unleashing-transformers/models/absorbing_diffusion.py
code served (permissive licence) · get_code("5d8c4051aef7ee8e")
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 an instance of its own class, AbsorbingDiffusion: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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
import math

torch.manual_seed(0)

# Create a minimal denoise function that takes (x_t, t) and outputs logits
class DenoiseFn(nn.Module):
    def __init__(self, codebook_size, latent_shape, emb_dim):
        super().__init__()
        # latent_shape is (batch, height, width)
        # We need to output (batch, codebook_size, height*width)
        self.codebook_size = codebook_size
        self.latent_shape = latent_shape
        self.emb_dim = emb_dim
        self.fc = nn.Linear(codebook_size + 1, codebook_size)  # +1 for time embedding
    
    def forward(self, x_t, t):
        # x_t shape: (batch, height*width) with values in [0, codebook_size-1] or mask_id
        # t shape: (batch,) with timestep values
        b = x_t.size(0)
        seq_len = x_t.size(1)
        
        # Create time embedding
        t_emb = t.float().unsqueeze(-1) / 100.0  # Simple time encoding
        t_emb = t_emb.expand(b, seq_len)
        
        # Concatenate one-hot encoded x_t with time embedding
        x_t_float = x_t.float().unsqueeze(-1)
        combined = torch.cat([x_t_float, t_emb.unsqueeze(-1)], dim=-1)
        
        # Output logits over codebook
        logits = self.fc(combined)  # (batch, seq_len, codebook_size)
        return logits

# Create a minimal hyperparameter config
class HyperparamConfig:
    def __init__(self):
        self.latent_shape = (2, 3, 4)  # (batch, height, width) - batch included in shape tuple
        self.emb_dim = 5
        self.codebook_size = 8
        self.n_samples = 2
        self.batch_size = 2
        self.total_steps = 10
        self.loss_type = 'elbo'  # can be 'elbo', 'mlm', or 'reweighted_elbo'
        self.mask_schedule = 'random'  # can be 'random' or 'fixed'

# Create embedding weight
H = HyperparamConfig()
embedding_weight = torch.randn(H.codebook_size, H.emb_dim, requires_grad=False)

# Create denoise function
denoise_fn = DenoiseFn(H.codebook_size, H.latent_shape, H.emb_dim)

# Create mask_id
mask_id = H.codebook_size  # Use an ID outside the normal codebook range

ARGS = {
    'H': H,
    'denoise_fn': denoise_fn,
    'mask_id': mask_id,
    'embedding_weight': embedding_weight,
    'aux_weight': 0.01
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch, tqdm — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type AbsorbingDiffusion — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a AbsorbingDiffusion 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
Sampler Ran
ran on a synthesized input · constructed an object; no result was computed
xiaoiker/meta_dpm/models/absorbing_diffusion.py
code served (permissive licence) · get_code("71964bb493b3fa09")
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 an instance of its own class, Sampler: the run constructed the object and did not call it, so no result was computed. 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 config class H with required attributes
class HyperparamConfig:
    def __init__(self):
        self.latent_shape = (2, 4, 3, 5)  # (batch, h, w, depth) - distinct dimensions
        self.emb_dim = 6
        self.codebook_size = 8
        self.n_samples = 2

H = HyperparamConfig()

# Create embedding weight tensor
# Shape: (codebook_size, emb_dim)
embedding_weight = torch.randn(H.codebook_size, H.emb_dim)

ARGS = {
    'H': H,
    'embedding_weight': embedding_weight,
}
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 Sampler — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a Sampler 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
Sampler Ran
ran on a synthesized input · constructed an object; no result was computed
samb-t/unleashing-transformers/models/absorbing_diffusion.py
code served (permissive licence) · get_code("e7b664d9cbec19fd")
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 an instance of its own class, Sampler: the run constructed the object and did not call it, so no result was computed. 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 config class H with required attributes
class Config:
    def __init__(self):
        self.latent_shape = (2, 4, 5)  # (batch, height, width)
        self.emb_dim = 3
        self.codebook_size = 8
        self.n_samples = 2

H = Config()

# Create embedding_weight tensor
# Shape: (codebook_size, emb_dim)
embedding_weight = torch.randn(H.codebook_size, H.emb_dim)

ARGS = {
    "H": H,
    "embedding_weight": embedding_weight
}
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 Sampler — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a Sampler 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
q_sample Ran
ran; our contract draft was wrong, not the code
HKUNLP/Dream/src/diffllm/gen_utils.py
code served (permissive licence) · get_code("e46586141f8fe8f5")
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 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

torch.manual_seed(0)

# Create small tensors for testing
batch_size = 2
seq_len = 4

# input_ids: token IDs, shape (batch_size, seq_len)
input_ids = torch.tensor([
    [10, 11, 12, 13],
    [20, 21, 22, 23]
], dtype=torch.long)

# maskable_mask: boolean mask indicating which positions can be masked, shape (batch_size, seq_len)
maskable_mask = torch.tensor([
    [True, True, True, False],
    [True, True, False, False]
], dtype=torch.bool)

# mask_token_id: the token ID to use for masking
mask_token_id = 0

# min and max: bounds for sampling t
min_val = 0.0
max_val = 1.0

# eos_token_id: end-of-sequence token ID
eos_token_id = 2

# t: optional pre-computed timesteps, shape (batch_size,)
t = torch.tensor([0.3, 0.7], dtype=torch.float)

# t_mask: optional pre-computed mask, shape (batch_size, seq_len)
t_mask = torch.tensor([
    [True, False, True, False],
    [False, True, False, False]
], dtype=torch.bool)

ARGS = {
    "input_ids": input_ids,
    "maskable_mask": maskable_mask,
    "mask_token_id": mask_token_id,
    "min": min_val,
    "max": max_val,
    "eos_token_id": eos_token_id,
    "t": t,
    "t_mask": t_mask,
}
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 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

Also present in other papers' code

Of 5 samples lifted from this paper's linked repositories, 5 carry a function identity and 0 do not. Of the 4 distinct functions with an identity, 1 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 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
q_sample
brick of this paper's assembly: entry
1 other paper
1 undated
no dated paper among those named
openreview_QrC8OgQyOI
PRISM: Efficient Test-Time Scaling via Hierarchical Search and Self-Verification for Discrete Diffusion Language Models

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

Denoising diffusion probabilistic models (DDPMs) [19] have shown impressive results on image and waveform generation in continuous state spaces. Here, we introduce Discrete Denoising Diffusion Probabilistic Models (D3PMs), diffusionlike generative models for discrete data that generalize the multinomial diffusion model of Hoogeboom et al. [20], by going beyond corruption processes with uniform transition probabilities. This includes corruption with transition matrices that mimic Gaussian kernels in continuous space, matrices based on nearest neighbors in embedding space, and matrices that introduce absorbing states. The third allows us to draw a connection between diffusion models and autoregressive and mask-based generative models. We show that the choice of transition matrix is an important design decision that leads to improved results in image and text domains. We also introduce a new loss function that combines the variational lower bound with an auxiliary cross entropy loss. For text, this model class achieves strong results on character-level text generation while scaling to large vocabularies on LM1B. On the image dataset CIFAR-10, our models approach the sample quality and exceed the log-likelihood of the continuous-space DDPM model.

For agents

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

get_harvested_code_for_paper("2107.03006")
get_code_for_paper("2107.03006")
have("2107.03006")

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

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

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

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

Connect an agent — have() is free.