Skip to content
svgtimestep-loss

Diffusion loss by step

At which noise levels does a diffusion model still struggle to denoise?

Demo data · seed 20261101 · 40 rows · default settings · 640 × 360SVG, lightSVG, darkDemo CSV

How to read it

  1. Read x as how much noise was added: small steps are nearly clean rows, large steps nearly pure noise.
  2. Read y as how far the model's denoising guess is from the truth at that step.
  3. High loss at small steps means the fine detail of the rows isn't learned yet; high loss at large steps is expected for categories.
  1. Callout 1: Small t: fine-detail denoising.
  2. Callout 2: Large t: almost pure noise.
  3. Callout 3: The categories' part.

Watch out

  • The two parts are on different scales (squared error vs KL), so compare each line's shape, not their heights.
  • A flat, low curve can also mean memorization; check the scorecard's distance to closest record.

Defaults

No settings: the chart draws one way.

Pinned in the code

  • Draws the engine's numbers as given (codesplash ↔ codesplashr torch twins); the chart computes nothing statistical.
  • Each point is the loss on the same (up to 256) training rows with fixed shared-stream noise at one step t.
  • The Gaussian part is the mean squared error of the predicted noise; the multinomial part is the KL between the true and predicted reverse steps (−log p(x₀ | x₁) at t = 1).
# Diffusion loss by step — Codesplash Chart Lab (recipe "timestep-loss")
# controls: defaults
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

try:
    import codesplash as cs  # optional: the app's chart theme
except ImportError:
    cs = None
if cs:
    cs.use_codesplash(dark=False)
PALETTE = cs.palette(dark=False)["categorical"] if cs else plt.rcParams["axes.prop_cycle"].by_key()["color"]

df = pd.read_csv("timestep-loss-demo.csv", keep_default_na=False, na_values=[""])  # demo data (only empty cells are missing): Chart Lab → Code → Download demo CSV
df["part"] = pd.Categorical(df["part"].astype("string"), categories=["Gaussian (numbers)", "multinomial (categories)"])

def levels_of(s):
    """Declared level order (categoricals), else order of first appearance."""
    if isinstance(s.dtype, pd.CategoricalDtype):
        return [v for v in s.cat.categories if (s == v).any()]
    return list(dict.fromkeys(s.dropna().astype(str)))
T = "diffusion step t"
V = "loss"
C = "part"
d = df.dropna(subset=[T, V])
fig, ax = plt.subplots(figsize=(8, 4))
for name in levels_of(d[C]):
    s = d[d[C].astype(str) == name].sort_values(T)
    ax.plot(s[T], s[V], marker="o", markersize=3, label=name)
ax.set_ylim(bottom=min(0, d[V].min()))
ax.set_xlabel(f"{T} (more noise →)")
ax.set_ylabel(V)
ax.legend(frameon=False)
plt.show()

Needs pandas, numpy, matplotlib · reads timestep-loss-demo.csv · app theme from the optional codesplash helper