SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2404.07724 · NeurIPS · 2024

Applying Guidance in a Limited Interval Improves Sample and Distribution Quality in Diffusion Models

Tuomas Kynkäänniemi

arXiv · PDF · Open in the Atlas

Code that ran

5 of 7 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, 0 violated it and 0 have no contract verdict; 4 failures of our instrument; 2 no recorded run), measured 2026-11-23; 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/2404.07724.json · badge: /api/ran/2404.07724.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
kynkaat/guidance-interval canonical (classifier label)
classifier basis: census
5 ran · 2 no recorded run
FunctionStatusWhere it lives
compute_fid Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
kynkaat/guidance-interval/metrics/frechet_inception_distance.py
code served (permissive licence) · get_code("4f8bb5961682a237")
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 float64, ndim 0, 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 numpy as np
import scipy.linalg

# Set random seed for reproducibility
np.random.seed(42)

# Define feature dimension and batch sizes
feature_dim = 4
batch_size_gen = 2
batch_size_ref = 3

# Generate random features for generated samples
# Shape: (batch_size, feature_dim)
gen_features = np.random.randn(batch_size_gen, feature_dim).astype(np.float32)

# Compute reference statistics from reference features
# Generate reference features
ref_features = np.random.randn(batch_size_ref, feature_dim).astype(np.float32)
mu_ref = np.mean(ref_features, axis=0)
sigma_ref = np.cov(ref_features, rowvar=False)

ARGS = {
    "gen_features": gen_features,
    "mu_ref": mu_ref,
    "sigma_ref": sigma_ref,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float64, ndim 0, dtype family float — no output shape is stated: observe_signature.py recorded float ndim 0, which disagrees with the fixture run
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
count_images_in_zip Ran
ran, honoured the contract we drafted
kynkaat/guidance-interval/utils.py
code served (permissive licence) · get_code("7778f5836023c242")
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 zipfile
import tempfile
import os

# Create a temporary zip file with some PNG files for testing
temp_dir = tempfile.mkdtemp()
zip_path = os.path.join(temp_dir, "test_images.zip")

# Create a zip file with PNG files
with zipfile.ZipFile(zip_path, 'w') as zf:
    zf.writestr("image1.png", b"fake png data 1")
    zf.writestr("image2.png", b"fake png data 2")
    zf.writestr("image3.png", b"fake png data 3")
    zf.writestr("notanimage.txt", b"text file")
    zf.writestr("subdir/image4.png", b"fake png data 4")

ARGS = {
    "zip_path": zip_path
}
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 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
decode_latents Ran
ran; our contract draft was wrong, not the code
kynkaat/guidance-interval/sampling/sample_images.py
code served (permissive licence) · get_code("20795df1064e5659")
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 ndarray, ndim 4, dtype family int, shape (2, 3, 512, 512) 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 numpy as np
import torch
import torch.nn as nn

torch.manual_seed(0)

class MockVAE(nn.Module):
    """Minimal VAE decoder that takes latents and returns decoded images."""
    def __init__(self):
        super().__init__()
    
    def decode(self, latent_batch):
        """Mock decode method that returns a dict with 'sample' key."""
        # latent_batch shape: (batch_size, 4, H, W)
        # Return mock decoded images in range [0, 1]
        batch_size = latent_batch.shape[0]
        # Output shape: (batch_size, 3, 512, 512)
        decoded = torch.rand(batch_size, 3, 512, 512, device=latent_batch.device)
        return {'sample': decoded}

# Create small denoised latents tensor
# Shape: (2, 4, 64, 64) - 2 samples, 4 channels, 64x64 latent space
denoised_latents = torch.randn(2, 4, 64, 64)

# Create mock VAE
vae = MockVAE()

ARGS = {
    'denoised_latents': denoised_latents,
    'vae': vae,
    'batch_size': 8,
    'img_channels': 3,
    'resolution': 512,
    'device': torch.device('cpu')
}
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 ndarray, ndim 4, dtype family int, shape (2, 3, 512, 512) — shape (2, 3, 512, 512) 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
kynkaat/guidance-interval/dnnlib/util.py
code served (permissive licence) · get_code("674eca7b9e1b6439")
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 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 numpy as np
from typing import Union

# Test with various time values
ARGS = {
    "seconds": 3661.7  # 1 hour, 1 minute, 1.7 seconds - tests rounding and all format branches
}
Setup block drafted by
a language model, Claude Haiku 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 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
format_time_brief Ran
ran; our contract draft was wrong, not the code
kynkaat/guidance-interval/dnnlib/util.py
code served (permissive licence) · get_code("32af001972a0699f")
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 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 numpy as np
from typing import Union

# Test with various time values
ARGS = {
    "seconds": 45.7  # A float value that will be rounded to 46 seconds
}
Setup block drafted by
a language model, Claude Haiku 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 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
ask_yes_no Not yet run
unverified (harvested, no recorded run)
kynkaat/guidance-interval/dnnlib/util.py
code served (permissive licence) · get_code("9d31d2c4cd16bb2d")
How it ran

no invocation recorded.

edm_sampler Not yet run
unverified (harvested, no recorded run)
kynkaat/guidance-interval/sampling/edm_sampler.py
code served (permissive licence) · get_code("a1b475ef1c3f3263")
How it ran

no invocation recorded.

Also present in other papers' code

Of 7 samples lifted from this paper's linked repositories, 7 carry a function identity and 0 do not. Of the 7 distinct functions with an identity, 3 are also present in other papers whose code we hold (3 with at least one paper dated earlier, 0 the same month, 3 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
format_time 73 other papers
31 dated earlier, 41 later, 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
ask_yes_no 69 other papers
31 dated earlier, 37 later, 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 66 more not named here
format_time_brief 68 other papers
27 dated earlier, 40 later, 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

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

Guidance is a crucial technique for extracting the best performance out of imagegenerating diffusion models. Traditionally, a constant guidance weight has been applied throughout the sampling chain of an image. We show that guidance is clearly harmful toward the beginning of the chain (high noise levels), largely unnecessary toward the end (low noise levels), and only beneficial in the middle. We thus restrict it to a specific range of noise levels, improving both the inference speed and result quality. This limited guidance interval improves the record FID in ImageNet-512 significantly, from 1.81 to 1.40. We show that it is quantitatively and qualitatively beneficial across different sampler parameters, network architectures, and datasets, including the large-scale setting of Stable Diffusion XL. We thus suggest exposing the guidance interval as a hyperparameter in all diffusion models that use guidance.

For agents

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

get_harvested_code_for_paper("2404.07724")
get_code_for_paper("2404.07724")
have("2404.07724")

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

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

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

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

Connect an agent — have() is free.