SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2209.11888 · NeurIPS · 2022

JPEG Artifact Correction using Denoising Diffusion Restoration Models

Stefano Ermon, Jiaming Song, Bahjat Kawar, Michael Elad

arXiv · PDF · Open in the Atlas

Code that ran

8 of 12 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (1 of them constructed an object rather than computing a result; 2 honoured the contract we drafted, 0 violated it and 1 has no contract verdict; 5 failures of our instrument; 4 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/2209.11888.json · badge: /api/ran/2209.11888.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
bahjat-kawar/ddrm-jpeg canonical (classifier label)
classifier basis: classifier_2025
8 ran · 4 no recorded run
FunctionStatusWhere it lives
LinearDCT Ran
ran on a synthesized input · constructed an object; no result was computed
bahjat-kawar/ddrm-jpeg/functions/denoising.py
code served (permissive licence) · get_code("83de7816bfa9183b")
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, LinearDCT: 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
import numpy as np

torch.manual_seed(0)

ARGS = {
    'in_features': 4,
    'type': 'dct',
    'norm': None,
    'bias': False
}
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 LinearDCT — 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 LinearDCT 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
chroma_subsample Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
bahjat-kawar/ddrm-jpeg/functions/denoising.py
code served (permissive licence) · get_code("53d2d220125f7625")
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 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
import torch.nn as nn

torch.manual_seed(0)

# Create a small tensor with shape (batch=2, channels=4, height=8, width=8)
# The function indexes x[:, 0:1, :, :] and x[:, 1:, ::2, ::2]
# So we need at least 2 channels, and spatial dimensions that can be subsampled
x = torch.randn(2, 4, 8, 8)

ARGS = {
    'x': x
}
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 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
dct Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
bahjat-kawar/ddrm-jpeg/functions/denoising.py
code served (permissive licence) · get_code("a480f97ef83e404c")
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)

# Create a small input tensor for the dct function
# Shape: (2, 4) - batch size 2, signal length 4
x = torch.randn(2, 4, dtype=torch.float32)

# Test with norm=None (default case)
ARGS = {
    'x': x,
    'norm': 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
general_quant_matrix Ran
ran, honoured the contract we drafted
bahjat-kawar/ddrm-jpeg/functions/denoising.py
code served (permissive licence) · get_code("da6285845af0208c")
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 tuple, ndim 2, 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)

ARGS = {
    "qf": 10
}
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 tuple, ndim 2, dtype family float — a tuple 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
idct Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
bahjat-kawar/ddrm-jpeg/functions/denoising.py
code served (permissive licence) · get_code("400de335db9bf7d0")
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 3, dtype family float, shape (2, 3, 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)

# Create a small input tensor for the idct function
# The function operates on the last dimension, so we create a tensor with shape (batch, features, last_dim)
X = torch.randn(2, 3, 4, dtype=torch.float32)

# Define ARGS dict with all parameters
ARGS = {
    'X': X,
    'norm': 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 3, dtype family float, shape (2, 3, 4) — shape (2, 3, 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
quantization_matrix Ran
ran, honoured the contract we drafted
bahjat-kawar/ddrm-jpeg/functions/denoising.py
code served (permissive licence) · get_code("5c29fc50bc4b62ae")
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 tuple, ndim 2, 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)

ARGS = {
    "qf": 25
}
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 tuple, ndim 2, dtype family float — a tuple 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
torch_rgb2ycbcr Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
bahjat-kawar/ddrm-jpeg/functions/denoising.py
code served (permissive licence) · get_code("d6921cde0083f064")
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 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

torch.manual_seed(0)

# The function expects x to be a tensor that:
# - Has at least 4 dimensions (based on transpose operations on dims 1,2,3)
# - Dimension 1 should be size 3 (RGB channels, based on the matrix multiplication)
# - Should be a valid torch tensor on CPU

# Create a small RGB image tensor
# Shape: (batch=2, channels=3, height=4, width=5)
x = torch.randn(2, 3, 4, 5)

ARGS = {
    "x": x
}
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 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
torch_ycbcr2rgb Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
bahjat-kawar/ddrm-jpeg/functions/denoising.py
code served (permissive licence) · get_code("1a97ae3490446b38")
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 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

torch.manual_seed(0)

# The function expects a tensor x with shape (batch, channels, height, width)
# where channels = 3 (YCbCr format: Y, Cb, Cr)
# The function performs:
# 1. Accesses x[:, 1:] to subtract 128 from Cb and Cr channels
# 2. Uses torch.tensordot with dims=([1], [1]) to contract on channel dimension
# 3. Transposes dimensions 3, 2 then 2, 1

# Create a small YCbCr tensor: batch=2, channels=3, height=4, width=5
x = torch.randn(2, 3, 4, 5)

ARGS = {
    'x': x
}
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 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
apply_linear_2d Not yet run
unverified (harvested, no recorded run)
bahjat-kawar/ddrm-jpeg/functions/denoising.py
code served (permissive licence) · get_code("42feee19aa225758")
How it ran

no invocation recorded.

dct1 Not yet run
unverified (harvested, no recorded run)
bahjat-kawar/ddrm-jpeg/functions/denoising.py
code served (permissive licence) · get_code("9e1d374e9bf8e1fa")
How it ran

no invocation recorded.

idct1 Not yet run
unverified (harvested, no recorded run)
bahjat-kawar/ddrm-jpeg/functions/denoising.py
code served (permissive licence) · get_code("3db7b46e31fd839b")
How it ran

no invocation recorded.

jpeg_steps Not yet run
unverified (harvested, no recorded run)
bahjat-kawar/ddrm-jpeg/functions/denoising.py
code served (permissive licence) · get_code("1344948a13004f5f")
How it ran

no invocation recorded.

Also present in other papers' code

Of 12 samples lifted from this paper's linked repositories, 12 carry a function identity and 0 do not. Of the 12 distinct functions with an identity, 8 are also present in other papers whose code we hold (4 with at least one paper dated earlier, 0 the same month, 7 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
idct1
brick of this paper's assembly: helper
10 other papers
2 dated earlier, 8 later
2011.04823 (2020-11)
Language Through a Prism: A Spectral Approach for Multiscale Language Representations
2105.08997 (2021-05)
When Deep Classifiers Agree: Analyzing Correlations between Learning Order and Image Statistics
2306.12685 (2023-06)
Rethinking the Backward Propagation for Adversarial Transferability
and 7 more not named here
dct
brick of this paper's assembly: helper
7 other papers
1 dated earlier, 6 later
2206.13397 (2022-06)
Generative Modelling With Inverse Heat Dissipation
2306.00288 (2023-06)
Training-free Neural Architecture Search for RNNs and Transformers
2309.03350 (2023-09)
Relay Diffusion: Unifying diffusion process across resolutions for image synthesis
and 4 more not named here
idct
brick of this paper's assembly: helper
2 other papers
1 dated earlier, 1 later
2206.13397 (2022-06)
Generative Modelling With Inverse Heat Dissipation
2510.08273 (2025-10)
One Stone with Two Birds: A Null-Text-Null Frequency-Aware Diffusion Models for Text-Guided Image Inpainting
LinearDCT
brick of this paper's assembly: helper
1 other paper
1 dated earlier
2011.04823 (2020-11)
Language Through a Prism: A Spectral Approach for Multiscale Language Representations
chroma_subsample
brick of this paper's assembly: helper
1 other paper
1 later · 1 only as an assembly brick
2502.03686 (2025-02)
Variational Control for Guidance in Diffusion Models
dct1
brick of this paper's assembly: helper
1 other paper
1 later
2601.04791 (2026-01)
Measurement-Consistent Langevin Corrector for Stabilizing Latent Diffusion Inverse Problem Solvers
torch_rgb2ycbcr
brick of this paper's assembly: helper
1 other paper
1 later · 1 only as an assembly brick
2502.03686 (2025-02)
Variational Control for Guidance in Diffusion Models
torch_ycbcr2rgb
brick of this paper's assembly: helper
1 other paper
1 later · 1 only as an assembly brick
2502.03686 (2025-02)
Variational Control for Guidance in Diffusion 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-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

Diffusion models can be used as learned priors for solving various inverse problems. However, most existing approaches are restricted to linear inverse problems, limiting their applicability to more general cases. In this paper, we build upon Denoising Diffusion Restoration Models (DDRM) and propose a method for solving some non-linear inverse problems. We leverage the pseudo-inverse operator used in DDRM and generalize this concept for other measurement operators, which allows us to use pre-trained unconditional diffusion models for applications such as JPEG artifact correction. We empirically demonstrate the effectiveness of our approach across various quality factors, attaining performance levels that are on par with state-of-the-art methods trained specifically for the JPEG restoration task. Our code is available at https://github.com/bahjat-kawar/ddrm-jpeg. QF = 5 QF = 2 * Equal contribution. NeurIPS 2022 Workshop on Score-Based Methods.

For agents

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

get_harvested_code_for_paper("2209.11888")
get_code_for_paper("2209.11888")
have("2209.11888")

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

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

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

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

Connect an agent — have() is free.