SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2102.09672 · 2021

Improved Denoising Diffusion Probabilistic Models

Alex Nichol, Prafulla Dhariwal

arXiv · PDF · Open in the Atlas

Code that ran

9 of 11 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; 4 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 5 failures of our instrument; 2 no recorded run), measured 2026-11-21; 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/2102.09672.json · badge: /api/ran/2102.09672.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
g4vrel/DDPM reimplementation (classifier label)
classifier basis: classifier_2025
4 ran · 0 no recorded run
luping-liu/PNDM extension (classifier label)
classifier basis: classifier_2025
3 ran · 0 no recorded run
YHL04/ddpm reimplementation (classifier label)
classifier basis: classifier_2025
2 ran · 0 no recorded run
plai-group/flexible-video-diffusion-modeling extension (classifier label)
classifier basis: classifier_2025
0 ran · 2 no recorded run
FunctionStatusWhere it lives
betas_for_alpha_bar Ran
ran, honoured the contract we drafted
g4vrel/DDPM/diffusion.py
code served (permissive licence) · get_code("7eb19b2d745af94f")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned ndarray, ndim 1, dtype family float, shape (10,) 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 numpy as np

def alpha_bar_cosine(t):
    """Cosine schedule for alpha_bar"""
    return np.cos((t + 0.008) / 1.008 * np.pi / 2) ** 2

ARGS = {
    "num_diffusion_timesteps": 10,
    "alpha_bar": alpha_bar_cosine,
    "max_beta": 0.999
}
Setup block drafted by
a language model, Claude Sonnet 4.5, prompt python_fixture_v1
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 1, dtype family float, shape (10,) — shape (10,) 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
choose_method Ran
ran; our contract draft was wrong, not the code
luping-liu/PNDM/runner/method.py
code served (permissive licence) · get_code("5261641d9240757c")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) 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 as th
import torch.nn as nn

th.manual_seed(0)

# The choose_method function takes a single parameter 'name' and returns a function
# We need to provide a valid name string

ARGS = {
    'name': 'DDIM'
}
Setup block drafted by
a language model, Claude Sonnet 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 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
compute_alpha Ran
ran; our contract draft was wrong, not the code
g4vrel/DDPM/sample.py
code served (permissive licence) · get_code("9215fb189fbfb9f4")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned Tensor, ndim 4, dtype family float, shape (2, 1, 1, 1) 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)

# beta should be a 1D tensor representing beta values for diffusion timesteps
# Let's use 10 timesteps
num_timesteps = 10
beta = torch.linspace(0.0001, 0.02, num_timesteps)

# t should be a 1D tensor of indices into the timesteps
# Let's use batch size 2
batch_size = 2
t = torch.randint(0, num_timesteps, (batch_size,))

ARGS = {
    'beta': beta,
    't': t
}
Setup block drafted by
a language model, Claude Sonnet 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 4, dtype family float, shape (2, 1, 1, 1) — shape (2, 1, 1, 1) 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
cosine_beta_schedule Ran
ran, honoured the contract we drafted
YHL04/ddpm/ddpm.py
code served (permissive licence) · get_code("16240e26bc3e0d99")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned Tensor, ndim 1, dtype family float, shape (10,) as a later run recorded it. 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, 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 math

torch.manual_seed(0)

ARGS = {
    'timesteps': 10,
    's': 0.008,
    'beta_max': 0.999,
    'device': 'cpu'
}
Setup block drafted by
a language model, Claude Sonnet 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 (10,) — shape (10,) 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
ext Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
g4vrel/DDPM/diffusion.py
code served (permissive licence) · get_code("97aabd2621b6733c")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned Tensor, ndim 4, dtype family float, shape (2, 1, 1, 1) 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)

# The function expects x to be a tensor with shape (b,) where b is the batch dimension
# It will rearrange it to (b, 1, 1, 1)
x = torch.randn(2)

ARGS = {
    'x': x
}
Setup block drafted by
a language model, Claude Sonnet 4.5, prompt python_fixture_v1
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 4, dtype family float, shape (2, 1, 1, 1) — shape (2, 1, 1, 1) 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
gen_fon Ran
ran; our contract draft was wrong, not the code
luping-liu/PNDM/runner/method.py
code served (permissive licence) · get_code("b84ad5937455cbb4")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned Tensor, ndim 4, dtype family float, shape (2, 3, 4, 5) 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)

# Create a simple model that takes img and t as inputs
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.conv = nn.Conv2d(3, 3, 1)
    
    def forward(self, img, t):
        # Model should return noise with same shape as img
        return self.conv(img)

# Setup parameters
batch_size = 2
channels = 3
height = 4
width = 5
num_timesteps = 10

# Create img tensor
img = torch.randn(batch_size, channels, height, width)

# Create timestep tensors
t = torch.tensor([5.0, 6.0])
t_next = torch.tensor([3.0, 4.0])

# Create model
model = SimpleModel()

# Create alphas_cump - needs to be indexed by t.long() + 1
# So it needs at least max(t) + 2 elements
alphas_cump = torch.linspace(0.9999, 0.0001, num_timesteps)

# Create ets list - can be empty or have some deltas
# Testing with empty list (len <= 2) to trigger the else branch
ets = []

ARGS = {
    'img': img,
    't': t,
    't_next': t_next,
    'model': model,
    'alphas_cump': alphas_cump,
    'ets': ets
}
Setup block drafted by
a language model, Claude Sonnet 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 4, dtype family float, shape (2, 3, 4, 5) — shape (2, 3, 4, 5) 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
gen_pflow Ran
ran; our contract draft was wrong, not the code
luping-liu/PNDM/runner/method.py
code served (permissive licence) · get_code("5a415ade18521d1a")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned Tensor, ndim 4, dtype family float, shape (2, 3, 8, 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 as th
import torch.nn as nn

th.manual_seed(0)

class StandInModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.conv = nn.Conv2d(3, 3, 1)
    
    def forward(self, img, t):
        # img shape: (n, 3, 8, 8)
        # t shape: (n,)
        # Returns same shape as img
        return self.conv(img)

n = 2
img = th.randn(n, 3, 8, 8)
t = 0.5
t_next = 0.4
model = StandInModel()
betas = th.tensor([0.0001, 0.02])
total_step = 1000

ARGS = {
    'img': img,
    't': t,
    't_next': t_next,
    'model': model,
    'betas': betas,
    'total_step': total_step
}
Setup block drafted by
a language model, Claude Sonnet 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 4, dtype family float, shape (2, 3, 8, 8) — shape (2, 3, 8, 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
get_betas Ran
ran, honoured the contract we drafted
g4vrel/DDPM/diffusion.py
code served (permissive licence) · get_code("fab86763be9d382c")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned ndarray, ndim 1, dtype family float, shape (50,) 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 math
import numpy as np

# The function get_betas takes two parameters:
# 1. scheduler_type: a string that is either 'linear' or 'cosine'
# 2. timesteps: an integer representing the number of diffusion timesteps

ARGS = {
    'scheduler_type': 'linear',
    'timesteps': 50
}
Setup block drafted by
a language model, Claude Sonnet 4.5, prompt python_fixture_v1
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 1, dtype family float, shape (50,) — shape (50,) 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
linear_beta_schedule Ran
ran, honoured the contract we drafted
YHL04/ddpm/ddpm.py
code served (permissive licence) · get_code("412c5c40339e2941")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned Tensor, ndim 1, dtype family float, shape (10,) as a later run recorded it. 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, 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)

ARGS = {
    'timesteps': 10,
    'beta_start': 0.0001,
    'beta_end': 0.02,
    'device': 'cpu'
}
Setup block drafted by
a language model, Claude Sonnet 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 (10,) — shape (10,) 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_adaptive_hierarchy_n_level Not yet run
unverified (harvested, no recorded run)
plai-group/flexible-video-diffusion-modeling/improved_diffusion/sampling_schemes.py
code served (permissive licence) · get_code("667c10845e9b4fce")
How it ran

no invocation recorded.

get_hierarchy_n_level Not yet run
unverified (harvested, no recorded run)
plai-group/flexible-video-diffusion-modeling/improved_diffusion/sampling_schemes.py
code served (permissive licence) · get_code("16222780c0751c86")
How it ran

no invocation recorded.

Also present in other papers' code

Of 11 samples lifted from this paper's linked repositories, 11 carry a function identity and 0 do not. Of the 11 distinct functions with an identity, 8 are also present in other papers whose code we hold (5 with at least one paper dated earlier, 0 the same month, 7 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
betas_for_alpha_bar 92 other papers
2 dated earlier, 90 later · 3 only as an assembly brick
2006.11239 (2020-06)
Denoising Diffusion Probabilistic Models
2010.02502 (2020-10)
Denoising Diffusion Implicit Models
2108.02938 (2021-08)
ILVR: Conditioning Method for Denoising Diffusion Probabilistic Models
and 89 more not named here
compute_alpha 23 other papers
1 dated earlier, 22 later · 6 only as an assembly brick
2010.02502 (2020-10)
Denoising Diffusion Implicit Models
2106.06819 (2021-06)
D2C: Diffusion-Denoising Models for Few-shot Conditional Generation
2206.02262 (2022-06)
Diffusion-GAN: Training GANs with Diffusion
and 20 more not named here
ext 2 other papers
1 dated earlier, 1 later · 1 only as an assembly brick
2006.11239 (2020-06)
Denoising Diffusion Probabilistic Models
2207.12598 (2022-07)
Classifier-Free Diffusion Guidance
get_betas 2 other papers
1 dated earlier, 1 later · 1 only as an assembly brick
2006.11239 (2020-06)
Denoising Diffusion Probabilistic Models
2207.12598 (2022-07)
Classifier-Free Diffusion Guidance
choose_method 1 other paper
1 later
2202.09778 (2022-02)
Pseudo Numerical Methods for Diffusion Models on Manifolds
cosine_beta_schedule 1 other paper
1 dated earlier
2006.11239 (2020-06)
Denoising Diffusion Probabilistic Models
gen_fon 1 other paper
1 later
2202.09778 (2022-02)
Pseudo Numerical Methods for Diffusion Models on Manifolds
gen_pflow 1 other paper
1 later
2202.09778 (2022-02)
Pseudo Numerical Methods for Diffusion Models on Manifolds

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

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 (DDPM) are a class of generative models which have recently been shown to produce excellent samples. We show that with a few simple modifications, DDPMs can also achieve competitive loglikelihoods while maintaining high sample quality. Additionally, we find that learning variances of the reverse diffusion process allows sampling with an order of magnitude fewer forward passes with a negligible difference in sample quality, which is important for the practical deployment of these models. We additionally use precision and recall to compare how well DDPMs and GANs cover the target distribution. Finally, we show that the sample quality and likelihood of these models scale smoothly with model capacity and training compute, making them easily scalable. We release our code at https://github.com/ openai/improved-diffusion.

For agents

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

get_harvested_code_for_paper("2102.09672")
get_code_for_paper("2102.09672")
have("2102.09672")

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

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

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

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

Connect an agent — have() is free.