SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · Xia_Rectified_Diffusion_Guidance_for_Conditional_Generation_CVPR_2025_paper · CVPR · 2025

Rectified Diffusion Guidance for Conditional Generation

Yujun Shen, Yong-Jin Liu, Nan Xue, Ran Yi, Tieliang Gong, Mengfei Xia

Open in the Atlas

Code that ran

7 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; 1 honoured the contract we drafted, 1 violated it and 0 have 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/Xia_Rectified_Diffusion_Guidance_for_Conditional_Generation_CVPR_2025_paper.json · badge: /api/ran/Xia_Rectified_Diffusion_Guidance_for_Conditional_Generation_CVPR_2025_paper.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
thuxmf/recfg canonical (classifier label)
classifier basis: census
7 ran · 4 no recorded run
FunctionStatusWhere it lives
const_like Ran
ran; our contract draft was wrong, not the code
thuxmf/recfg/torch_utils/misc.py
pointer only (licence: MIT); the stored copy get_code serves, from xfetus/fetal-ultrasound-edm2, is pointer only (licence: NONE) · get_code("f2514403e004d82b")
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 xfetus/fetal-ultrasound-edm2, 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.

constant Ran
ran; our contract draft was wrong, not the code
thuxmf/recfg/torch_utils/misc.py
pointer only (licence: MIT); the stored copy get_code serves, from xfetus/fetal-ultrasound-edm2, is pointer only (licence: NONE) · get_code("6d32f9cf6f29b386")
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 xfetus/fetal-ultrasound-edm2, 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.

edm_sampler Ran
ran; our contract draft was wrong, not the code
thuxmf/recfg/generate_images.py
code served (permissive licence) · get_code("53d8885663cb864c")
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 torch.nn as nn
import numpy as np

torch.manual_seed(0)

# Define a minimal network that accepts (x, t, labels) and returns a denoised tensor
class DummyNet(nn.Module):
    def __init__(self, x_dim=4):
        super().__init__()
        self.linear = nn.Linear(x_dim + 1 + 3, x_dim)  # x_dim + t + labels
    
    def forward(self, x, t, labels):
        # x: [batch, x_dim]
        # t: scalar or tensor
        # labels: [batch, 3] or None
        batch_size = x.shape[0]
        
        # Flatten t to a scalar if needed
        if isinstance(t, torch.Tensor):
            t_scalar = t.item() if t.numel() == 1 else t
        else:
            t_scalar = t
        
        t_expanded = torch.ones(batch_size, 1, device=x.device) * t_scalar
        
        if labels is not None:
            combined = torch.cat([x, t_expanded, labels], dim=1)
        else:
            combined = torch.cat([x, t_expanded], dim=1)
        
        return self.linear(combined)

# Create tiny test tensors and models
batch_size = 2
x_dim = 4
label_dim = 3

# Noise tensor: [batch_size, x_dim]
noise = torch.randn(batch_size, x_dim)

# Labels tensor: [batch_size, label_dim]
labels = torch.randn(batch_size, label_dim)

# Create networks
net = DummyNet(x_dim=x_dim)
gnet = DummyNet(x_dim=x_dim)

# Coefficients tensor for guidance
coeffs = torch.randn(32)  # num_steps

ARGS = {
    'net': net,
    'noise': noise,
    'labels': labels,
    'gnet': gnet,
    'num_steps': 32,
    'sigma_min': 0.002,
    'sigma_max': 80,
    'rho': 7,
    'guidance': 1.5,
    'coeffs': coeffs,
    'S_churn': 0,
    'S_min': 0,
    'S_max': float('inf'),
    'S_noise': 1,
    'dtype': torch.float32,
    'randn_like': torch.randn_like,
}
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
format_time Ran
ran; our contract draft was wrong, not the code
thuxmf/recfg/dnnlib/util.py
pointer only (licence: MIT); the stored copy get_code serves, from xfetus/fetal-ultrasound-edm2, is pointer only (licence: NONE) · get_code("863886ae28872158")
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 xfetus/fetal-ultrasound-edm2, 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.

format_time_brief Ran
ran; our contract draft was wrong, not the code
thuxmf/recfg/dnnlib/util.py
pointer only (licence: MIT); the stored copy get_code serves, from xfetus/fetal-ultrasound-edm2, is pointer only (licence: NONE) · get_code("cf4282fe49551c8c")
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 xfetus/fetal-ultrasound-edm2, 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.

parse_int_list Ran
ran, honoured the contract we drafted
thuxmf/recfg/generate_images.py
pointer only (licence: MIT); the stored copy get_code serves, from newbeeer/stf, is pointer only (licence: NONE) · get_code("cacd4f6ec202d9b4")
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 newbeeer/stf, 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.

tuple_product Ran
ran, violated the contract we drafted
thuxmf/recfg/dnnlib/util.py
pointer only (licence: MIT); the stored copy get_code serves, from xfetus/fetal-ultrasound-edm2, is pointer only (licence: NONE) · get_code("d0955d86500b69a3")
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 xfetus/fetal-ultrasound-edm2, 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.

all_reduce Not yet run
unverified (harvested, no recorded run)
thuxmf/recfg/calculate_lookup.py
code served (permissive licence) · get_code("2464220d4d3059cc")
How it ran

no invocation recorded.

edm2_sampler Not yet run
unverified (harvested, no recorded run)
thuxmf/recfg/calculate_lookup.py
code served (permissive licence) · get_code("bdeaefed5585d60c")
How it ran

no invocation recorded.

is_persistent Not yet run
unverified (harvested, no recorded run)
thuxmf/recfg/torch_utils/persistence.py
pointer only (licence: MIT); the stored copy get_code serves, from AMAP-ML/DCW, is pointer only (licence: NOASSERTION) · get_code("e8b31ffccfa05efc")
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 AMAP-ML/DCW, and GitHub could not classify the licence of that repository (NOASSERTION). 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. No invocation recorded.

pinned_buf Not yet run
unverified (harvested, no recorded run)
thuxmf/recfg/torch_utils/misc.py
pointer only (licence: MIT); the stored copy get_code serves, from xfetus/fetal-ultrasound-edm2, is pointer only (licence: NONE) · get_code("3e8b4a53ca71135e")
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 xfetus/fetal-ultrasound-edm2, 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. 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 (6 with at least one paper dated earlier, 0 the same month, 8 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
format_time 73 other papers
50 dated earlier, 8 later, 14 same year, order not determinable, 1 undated
2004.00049 (2020-04)
In-Domain GAN Inversion for Real Image Editing
2004.11660 (2020-04)
Disentangled and Controllable Face Image Generation via 3D Imitative-Contrastive Learning
2108.00946 (2021-08)
StyleGAN-NADA: CLIP-Guided Domain Adaptation of Image Generators
and 70 more not named here
format_time_brief 68 other papers
45 dated earlier, 8 later, 14 same year, order not determinable, 1 undated
2108.00946 (2021-08)
StyleGAN-NADA: CLIP-Guided Domain Adaptation of Image Generators
2202.00273 (2022-02)
StyleGAN-XL: Scaling StyleGAN to Large Diverse Datasets
2206.07695 (2022-06)
VoxGRAF: Fast 3D-Aware Image Synthesis with Sparse Voxel Grids
and 65 more not named here
parse_int_list 37 other papers
26 dated earlier, 5 later, 6 same year, order not determinable
2206.00364 (2022-06)
Elucidating the Design Space of Diffusion-Based Generative Models
2302.00670 (2023-02)
Stable Target Field for Reduced Variance Score Estimation in Diffusion Models
2302.04265 (2023-02)
PFGM++: Unlocking the Potential of Physics-Inspired Generative Models
and 34 more not named here
constant 26 other papers
14 dated earlier, 4 later, 8 same year, order not determinable
2306.06991 (2023-06)
Fast Diffusion Model
2308.15321 (2023-08)
Elucidating the Exposure Bias in Diffusion Models
2309.03350 (2023-09)
Relay Diffusion: Unifying diffusion process across resolutions for image synthesis
and 23 more not named here
is_persistent 20 other papers
12 dated earlier, 3 later, 5 same year, order not determinable
2306.06991 (2023-06)
Fast Diffusion Model
2308.15321 (2023-08)
Elucidating the Exposure Bias in Diffusion Models
2309.03350 (2023-09)
Relay Diffusion: Unifying diffusion process across resolutions for image synthesis
and 17 more not named here
tuple_product 8 other papers
5 dated earlier, 1 later, 2 same year, order not determinable
2004.00049 (2020-04)
In-Domain GAN Inversion for Real Image Editing
2004.11660 (2020-04)
Disentangled and Controllable Face Image Generation via 3D Imitative-Contrastive Learning
2310.11440 (2023-10)
EvalCrafter: Benchmarking and Evaluating Large Video Generation Models
and 5 more not named here
const_like 5 other papers
1 later, 4 same year, order not determinable
2505.07447 (2025-05)
Unified Continuous Generative Models
2506.14605 (2025-06)
Unsupervised Imaging Inverse Problems with Diffusion Distribution Matching
2508.04122 (2025-08)
Conditional Latent Diffusion Models for Zero-Shot Instance Segmentation
and 2 more not named here
pinned_buf 2 other papers
1 later, 1 same year, order not determinable
2509.16447 (2025-09)
Local Mechanisms of Compositional Generalization in Conditional Diffusion
2608.05471 (2026-08)
A Foundational EDM2-Based Generative Model for High-Resolution Synthetic Fetal Ultrasound Imaging from Open Datasets

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

Classifier-Free Guidance (CFG), which combines the conditional and unconditional score functions with two coefficients summing to one, serves as a practical technique for diffusion model sampling. Theoretically, however, denoising with CFG cannot be expressed as a reciprocal diffusion process, which may consequently leave some hidden risks during use. In this work, we revisit the theory behind CFG and rigorously confirm that the improper configuration of the combination coefficients (i.e., the widely used summing-to-one version) brings about expectation shift of the generative distribution. To rectify this issue, we propose ReCFG 1 with a relaxation on the guidance coefficients such that denoising with ReCFG strictly aligns with the diffusion theory. We further show that our approach enjoys a closed-form solution given the guidance strength. That way, the rectified coefficients can be readily pre-computed via traversing the observed data, leaving the sampling speed barely affected. Empirical evidence on real-world data demonstrate the compatibility of our post-hoc design with existing state-of-the-art diffusion models, including both class-conditioned ones (e.g., EDM2 on ImageNet) and text-conditioned ones (e.g., SD3 on CC12M), without any retraining. Code is available at https://github.com/thuxmf/recfg.

For agents

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

get_harvested_code_for_paper("Xia_Rectified_Diffusion_Guidance_for_Conditional_Generation_CVPR_2025_paper")
get_code_for_paper("Xia_Rectified_Diffusion_Guidance_for_Conditional_Generation_CVPR_2025_paper")
have("Xia_Rectified_Diffusion_Guidance_for_Conditional_Generation_CVPR_2025_paper")

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

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

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

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

Connect an agent — have() is free.