Concept notebookChecking saved investigationReading browser-local route memory before showing a continuation.

Score Matching & Score-Based Generative Models

Learn the score field grad_x log p(x) without normalizing constants. Denoising score matching turns diffusion training into simple regression on noise.

published · difficulty 4/5 · 18 min read

01

01

Intuition

Build the mental picture first so the rest of the page has something to attach to.

PredictName the object in plain language, then predict what should change.Leave with one reusable mental picture before notation appears.

If a probability distribution p(x)p(x)p(x) is a landscape, then logp(x)\log p(x)logp(x) is a height map, and the score

s(x)=xlogp(x)s(x)=\nabla_x \log p(x)s(x)=xlogp(x)

is the vector field that points "uphill" toward higher density.

Score-based generative modeling is the idea: instead of learning p(x)p(x)p(x) directly (which requires a normalizing constant), learn the gradient of the log-density. With estimated time-dependent scores and a specified reverse-time SDE/ODE or Langevin-style sampler, you can move points from noise toward data-like samples.

In Gaussian-noising diffusion parameterizations, predicting noise ϵ\epsilonϵ at each noise level is often equivalent, up to a known scale, to estimating a score.

Section prompt

Copy-only prompts — each action copies a page-grounded prompt to your clipboard. Nothing is sent by this site.

02

02

Math

Translate the story into symbols, assumptions, and a derivation you can inspect.

InspectTrack the same object through the notation and check each symbol.Leave with the invariant the equations preserve.

The score function and score matching

For a non-normalized model pθ(x)=qθ(x)/Z(θ)p_\theta(x)=q_\theta(x)/Z(\theta)pθ(x)=qθ(x)/Z(θ), the data-gradient score ignores the constant Z(θ)Z(\theta)Z(θ):

sθ(x)=xlogpθ(x)=xlogqθ(x),LSM=Epdata[12sθ(x)2+tr(xsθ(x))].\begin{aligned} s_\theta(x) &=\nabla_x\log p_\theta(x) = \nabla_x\log q_\theta(x),\\ \mathcal{L}_{SM} &=\mathbb{E}_{p_{\text{data}}}\left[ \frac{1}{2}\|s_\theta(x)\|^2+\mathrm{tr}(\nabla_x s_\theta(x)) \right]. \end{aligned}sθ(x)LSM=xlogpθ(x)=xlogqθ(x),=Epdata[21sθ(x)2+tr(xsθ(x))].

This avoids evaluating the normalizing constant, but is hard to implement directly because the derivative-based objective still includes the divergence term.

Denoising score matching (diffusion-friendly)

Add Gaussian noise. The conditional target, noise-prediction scale, and reverse-time dynamics share the same learned score field:

x~=x+σϵ,ϵN(0,I),x~logqσ(x~x)=x~xσ2=ϵσ,sθ(x~,σ)ϵθ(x~,σ)σ,dxrev=[f(x,t)g(t)2sθ(x,t)]dt+g(t)dwˉ,dxflow=[f(x,t)12g(t)2sθ(x,t)]dt.\begin{aligned} \tilde x &= x+\sigma\epsilon,\qquad \epsilon\sim\mathcal{N}(0,I),\\ \nabla_{\tilde x}\log q_\sigma(\tilde x\mid x) &=-\frac{\tilde x-x}{\sigma^2}=-\frac{\epsilon}{\sigma},\\ s_\theta(\tilde x,\sigma)&\approx -\frac{\epsilon_\theta(\tilde x,\sigma)}{\sigma},\\ dx_{\text{rev}} &=\left[f(x,t)-g(t)^2s_\theta(x,t)\right]dt+g(t)d\bar w,\\ dx_{\text{flow}} &=\left[f(x,t)-\tfrac{1}{2}g(t)^2s_\theta(x,t)\right]dt. \end{aligned}x~x~logqσ(x~x)sθ(x~,σ)dxrevdxflow=x+σϵ,ϵN(0,I),=σ2x~x=σϵ,σϵθ(x~,σ),=[f(x,t)g(t)2sθ(x,t)]dt+g(t)dwˉ,=[f(x,t)21g(t)2sθ(x,t)]dt.

Denoising score matching trains:

LDSM=Esθ(x~,σ)+ϵ/σ2.\mathcal{L}_{DSM}=\mathbb E\,\big\|s_\theta(\tilde x,\sigma) + \epsilon/\sigma\big\|^2.LDSM=Esθ(x~,σ)+ϵ/σ2.

So predicting noise ϵθ\epsilon_\thetaϵθ is equivalent (up to scaling) to predicting the score:

sθ(x~,σ)ϵθ(x~,σ)σ.s_\theta(\tilde x,\sigma) \approx -\frac{\epsilon_\theta(\tilde x,\sigma)}{\sigma}.sθ(x~,σ)σϵθ(x~,σ).

The conditional DSM target x~logq(x~x)\nabla_{\tilde x}\log q(\tilde x\mid x)x~logq(x~x) is the label for one known clean source; the marginal score field x~logpσ(x~)\nabla_{\tilde x}\log p_\sigma(\tilde x)x~logpσ(x~) averages over possible clean sources.

Section prompt

Copy-only prompts — each action copies a page-grounded prompt to your clipboard. Nothing is sent by this site.

03

03

Code

Keep the implementation aligned with the notation so the algorithm is legible.

TraceMatch variables to symbols before reading the implementation.Leave with a runnable witness for the math.
import numpy as np

rng = np.random.default_rng(0)
x = rng.normal(loc=1.5, scale=1.0, size=(5,))
sigma = 0.7
eps = rng.standard_normal(x.shape)
xt = x + sigma * eps

score_from_eps = -eps / sigma
score_from_xt = -(xt - x) / (sigma**2)  # same quantity

print("x:  ", np.round(x, 3))
print("xt: ", np.round(xt, 3))
print("max|diff|:", float(np.max(np.abs(score_from_eps - score_from_xt))))
Section prompt

Copy-only prompts — each action copies a page-grounded prompt to your clipboard. Nothing is sent by this site.

04

04

Interactive Demo

Use direct manipulation to connect the explanation to a moving system.

ManipulateChange one control and predict the visible response before reveal.Leave with the observed invariant or a repaired model.

Live Concept Demo

Explore Score Matching & Score-Based Generative Models

The stage is code-native and interactive. Use it to test the explanation against the mechanism.

difficulty 4/5graduatecode-aligned
Demo inquiry checkpoint

Manipulate one control and predict the visible change.

01Choose lensTrace a quantity
02ObserveDemo state pending
03GroundName the equation, invariant, or control that explains it.
04CarryNext: Flow Matching & Rectified Flows

Choose what to inspect in Score Matching & Score-Based Generative Models. This shared fallback is an observation guide, not evidence of learning.

Loading interactive demo...

Use the demo to see the score field and how diffusion "noise prediction" corresponds to a scaled score estimate.

Section prompt

Copy-only prompts — each action copies a page-grounded prompt to your clipboard. Nothing is sent by this site.

4/4 sections ready

Concept: Score Matching & Score-Based Generative Models

What is the smallest example that makes Score Matching & Score-Based Generative Models click without losing the math?

BeforeMaximum LikelihoodNow4/4 sections readyTryManipulate one control and predict the visible change.NextFlow Matching & Rectified Flows
Object contextGenerative Models
ConceptLearner lens

Score Matching & Score-Based Generative Models

What is the smallest example that makes Score Matching & Score-Based Generative Models click without losing the math?

Mode questionCan I say the mechanism back in one sentence before I reveal anything?

Start with the prediction checkpoint, then compare the reveal to the mental model.

Take this move

Study modes

Keep the object fixed; change the lens.

Route back through the notebook

Carry the same object through intuition, math, code, and demo.

4/4 sections ready
Carry inMaximum Likelihood

Bring the mental model from Maximum Likelihood; this page will reuse it instead of restarting from zero.

Work hereScore Matching & Score-Based Generative Models

Learn the score field grad_x log p(x) without normalizing constants. Denoising score matching turns diffusion training into simple regression on noise.

Carry outFlow Matching & Rectified Flows

The next edge should feel earned: use the demo prediction here before following Flow Matching & Rectified Flows.

After The First Pass

Turn the concept into an inspected object.

The lower panels are one second act: keep the object fixed, inspect it visually, check source boundaries, practice transfer, then attach the research question.
ConceptScore Matching & Score-Based Generative ModelsGenerative Models

Mechanism Storyboard

See the idea move before the page explains it

Learn the score field grad_x log p(x) without normalizing constants. Denoising score matching turns diffusion training into simple regression on noise.

Demo notes open01 / Intuition
Editorial generative-model illustration of noisy samples and score-vector fields pointing back toward high-density structure.
Prediction lens

Start with the picture, metaphor, or geometric mechanism.

Commit first

Before reading further, choose the kind of change Score Matching & Score-Based Generative Models should make visible.

Visual Inquiry

Make the image answer a mathematical question

Learn the score field grad_x log p(x) without normalizing constants. Denoising score matching turns diffusion training into simple regression on noise.

4/4 stages readyDemo notes connected
Prediction

Which visible object should carry the first intuition?

Commit first

Pick the cue that should make Score Matching & Score-Based Generative Models easier to reason about before the page gives the answer.

Source Grounding

Canonical references for the mechanism on this page.

Object - ConceptScore Matching & Score-Based Generative ModelsQuestion

What is the smallest example that makes Score Matching & Score-Based Generative Models click without losing the math?

concept:generative-models/score-matching
Boundary

sources: hyvarinen-2005-score-matching, vincent-2011-denoising-score, song-2020-score-sde

Check

Open the closest source note before trusting the local explanation.

Evidence

3 selected-object sources shown first; 3 references total.

Next move

Audit the claim boundary, then ask from the same selected object.

selected object source · paper · 2005Estimation of Non-Normalized Statistical Models by Score MatchingHyvarinen
Located CF editorial boundary

Introduces score matching for models where the normalizing constant is intractable.

Used here as

Hyvarinen supports score matching for continuous non-normalized models because the data score removes Z(theta). Vincent supports the Gaussian DSM target (x-x_tilde)/sigma^2 and DSM/SM equ...

Caveat

Checks the score, Gaussian conditional DSM label under x_tilde=x+sigma epsilon, and estimated-score reverse SDE/probability-flow ODE bridge. Does not claim exact solvers, conditional labe...

Open source
selected object source · paper · 2011A Connection Between Score Matching and Denoising AutoencodersVincent
Located CF editorial boundary

Grounds denoising score matching as learning to recover clean structure from noisy samples; publisher DOI is 10.1162/NECO_a_00142.

Used here as

Hyvarinen supports score matching for continuous non-normalized models because the data score removes Z(theta). Vincent supports the Gaussian DSM target (x-x_tilde)/sigma^2 and DSM/SM equ...

Caveat

Checks the score, Gaussian conditional DSM label under x_tilde=x+sigma epsilon, and estimated-score reverse SDE/probability-flow ODE bridge. Does not claim exact solvers, conditional labe...

Open source
selected object source · paper · 2020Score-Based Generative Modeling through Stochastic Differential EquationsSong et al.
Located CF editorial boundary

Connects learned score fields to reverse-time stochastic dynamics for generation.

Used here as

Hyvarinen supports score matching for continuous non-normalized models because the data score removes Z(theta). Vincent supports the Gaussian DSM target (x-x_tilde)/sigma^2 and DSM/SM equ...

Caveat

Checks the score, Gaussian conditional DSM label under x_tilde=x+sigma epsilon, and estimated-score reverse SDE/probability-flow ODE bridge. Does not claim exact solvers, conditional labe...

Open source

Claim Review

Learn the score field grad_x log p(x) without normalizing constants. Denoising score matching turns diffusion training into simple regression on noise.

Object - ConceptScore Matching & Score-Based Generative ModelsQuestion

What is the smallest example that makes Score Matching & Score-Based Generative Models click without losing the math?

concept:generative-models/score-matching
Boundary

sources: hyvarinen-2005-score-matching, vincent-2011-denoising-score, song-2020-score-sde

Check

Treat every claim as provisional until source support and a local witness agree.

Evidence

1 structured claim check on this concept.

Next move

Run the prediction or practice transfer before asking for a grounded review.

1 CF editorial source-scope review recorded

Publisher-side editorial review is not independent replication. Claims without it still need exact source-support review. 3 references and 3 local witnesses are available for inspection.

Score matching fits a model score grad_x log p_theta(x) while avoiding the normalizing constant; under Gaussian corruption x_tilde=x+sigma epsilon, the conditional denoising target is -(x_tilde-x)/sigma^2=-epsilon/sigma; estimated time-dependent scores can drive reverse-time SDE/ODE sampling dynamics.
Used here as

Hyvarinen supports score matching for continuous non-normalized models because the data score removes Z(theta). Vincent supports the Gaussian DSM target (x-x_tilde)/sigma^2 and DSM/SM equivalence. Song suppo...

Local witness
Equation 1
sθ(x)=xlogpθ(x)=xlogqθ(x),LSM=Epdata[12sθ(x)2+tr(xsθ(x))].\begin{aligned} s_\theta(x) &=\nabla_x\log p_\theta(x) = \nabla_x\log q_\theta(x),\\ \mathcal{L}_{SM} &=\mathbb{E}_{p_{\text{data}}}\left[ \frac{1}{2}\|s_\theta(x)\|^2+\mathrm{tr}(\nabla_x s_\theta(x)) \right]. \end{aligned}
Equation 2
x~=x+σϵ,ϵN(0,I),x~logqσ(x~x)=x~xσ2=ϵσ,sθ(x~,σ)ϵθ(x~,σ)σ,dxrev=[f(x,t)g(t)2sθ(x,t)]dt+g(t)dwˉ,dxflow=[f(x,t)12g(t)2sθ(x,t)]dt.\begin{aligned} \tilde x &= x+\sigma\epsilon,\qquad \epsilon\sim\mathcal{N}(0,I),\\ \nabla_{\tilde x}\log q_\sigma(\tilde x\mid x) &=-\frac{\tilde x-x}{\sigma^2}=-\frac{\epsilon}{\sigma},\\ s_\theta(\tilde x,\sigma)&\approx -\frac{\epsilon_\theta(\tilde x,\sigma)}{\sigma},\\ dx_{\text{rev}} &=\left[f(x,t)-g(t)^2s_\theta(x,t)\right]dt+g(t)d\bar w,\\ dx_{\text{flow}} &=\left[f(x,t)-\tfrac{1}{2}g(t)^2s_\theta(x,t)\right]dt. \end{aligned}
Caveat

Checks the score, Gaussian conditional DSM label under x_tilde=x+sigma epsilon, and estimated-score reverse SDE/probability-flow ODE bridge. Does not claim exact solvers, conditional labels equal marginal sc...

Review stateCF editorial source-scope reviewClaim metadata: source checkedPublisher-side editorial review only; not independent replication. Check caveats and exact source scope.

Hyvarinen supports non-normalized score matching: the data-gradient score removes Z(theta) and the implicit objective uses squared score plus divergence terms. Vincent supports the Gaussian conditional DSM target (x-x_tilde)/sigma^2 = -epsilon/sigma and DSM/SM equivalence. Song supports estimated time-dependent scores in reverse SDE sampling and probability-flow ODEs. Local math, code, and demo align with this bounded mechanism without pre-reveal target leakage.

Reviewer: codex+oracle+codex-5.3; reviewed 2026-05-08

Practice notebook

Use the idea, then test it somewhere new

Learn the score field grad_x log p(x) without normalizing constants. Denoising score matching turns diffusion training into simple regression on noise.

AttemptNo learning claim inferred
Object - ConceptScore Matching & Score-Based Generative ModelsQuestion

What is the smallest example that makes Score Matching & Score-Based Generative Models click without losing the math?

concept:generative-models/score-matching
Boundary

sources: hyvarinen-2005-score-matching, vincent-2011-denoising-score, song-2020-score-sde

Check

Use one state from Score Matching & Score-Based Generative Models to explain what changes, why it changes, and which assumption the explanation needs.

Evidence

No learner move yet; no learning state is inferred.

Next move

Write first, use only the help you need, then try a new case without it.

Explain

Use one state from Score Matching & Score-Based Generative Models to explain what changes, why it changes, and which assumption the explanation needs.

Hint 1

Reveal when your model needs a nudge.

Hint 2

Reveal when your model needs a nudge.

Hint 3

Reveal when your model needs a nudge.

Grounded object roomClose
Selected object routeAsk from this object; carry one invariant back.sources: hyvarinen-2005-score-matching, vincent-2011-denoising-score, song-2020-score-sde
  1. ObjectConceptScore Matching & Score-Based Generative Models
  2. PredictBefore revealScore Matching & Score-Based Generative Models prediction
  3. WitnessCompare codeScore Matching & Score-Based Generative Models code witness 1
  4. RoomAsk groundedChecking local snapshot
ConceptScore Matching & Score-Based Generative ModelsGenerative Models

Research Room

Attach the question to an exact object

Pick the concept, equation, source, code witness, claim, misconception, or demo state before asking for help. The handoff stays grounded to that object.
Next local actionNo local draft saved yet

Open the draft below to save one note and next action in this browser.

conceptGenerative Models

Score Matching & Score-Based Generative Models

Anchored question

What is the smallest example that makes Score Matching & Score-Based Generative Models click without losing the math?

Source boundaryInspect source ids: hyvarinen-2005-score-matching, vincent-2011-denoising-score, song-2020-score-sdeStable content-object key attached
Role lenses for this object

These are fixed, deterministic perspectives derived from the selected object. They do not represent people, community contributions, or independent review.

Learner evidence requestAsk what would make "Score Matching & Score-Based Generative Models" feel predictable rather than familiar.
Assumption

Source ids hyvarinen-2005-score-matching, vincent-2011-denoising-score, song-2020-score-sde must support the exact object, not just the surrounding topic.

Source-checking summary

Treat this as a mechanism object: connect the definition to one equation, code witness, or demo before broadening the discussion.

Proposed experiment

Ask the learner to perturb one representation, then check whether the same invariant survives in math, code, and demo.

Next action

The learner can state the mechanism in their own words

Evidence4 checks
PredictionChecking carried observation
ActionReady for one action
AILearner handoff ready
Open source object
01PredictionChecking browser-local route memory
02EvidenceChecking for a carried observation
03BoundaryInspect source ids: hyvarinen-2005-score-matching, vincent-2011-denoising-score, song-2020-score-sde
04Next moveSave one next action
Local action draftNo local draft saved yetExpand only when ready to capture one local next action
Local action draft

This draft stays locally in this browser for concept:generative-models/score-matching.

No local draft saved.
Evidence to inspect
  • Source ids to inspect: hyvarinen-2005-score-matching, vincent-2011-denoising-score, song-2020-score-sde
  • Definition, prerequisite, and contrast concept links
  • The equation or code witness that makes the concept operational
  • One demo state that shows the invariant instead of a slogan
What would resolve this
  • The learner can state the mechanism in their own words
  • The learner can name the prerequisite that would repair confusion
  • The learner can predict how the mechanism changes under one perturbation
Object-attached AI handoff

I am working in Continuous Function's research reading room. Object: concept - Score Matching & Score-Based Generative Models Object key: concept:generative-models/score-matching Context: Generative Models Anchor id: concept/concept-notebook/generative-models/score-matching Open question: What is the smallest example that makes Score Matching & Score-Based Generative Models click without losing the math? Evidence to inspect: - Source ids to inspect: hyvarinen-2005-score-matching, vincent-2011-denoising-score, song-2020-score-sde - Definition, prerequisite, and contrast concept links - The equation or code witness that makes the concept operational - One demo state that shows the invariant instead of a slogan Deterministic role lenses for this object: - Boundary: fixed perspectives, not people, community contributions, or independent review - Source-checking summary: Treat this as a mechanism object: connect the definition to one equation, code witness, or demo before broadening the discussion. - Proposed experiment: Ask the learner to perturb one representation, then check whether the same invariant survives in math, code, and demo. - Teach/transfer move: Turn the mechanism into one sentence that predicts a neighboring concept. - Assumptions: - Source ids hyvarinen-2005-score-matching, vincent-2011-denoising-score, song-2020-score-sde must support the exact object, not just the surrounding topic. - The stable content-object key lets local drafts, prompts, and route memory attach without changing the source page. - The concept explanation is local atlas prose until checked against its math, code, and source support. - Prerequisite gaps should become a repair route, not a reason to leave the object vague. - Role-lens requests: - Learner: ask for "Ask what would make "Score Matching & Score-Based Generative Models" feel predictable rather than familiar." | assumption: Source ids hyvarinen-2005-score-matching, vincent-2011-denoising-score, song-2020-score-sde must support the exact object, not just the surrounding topic. | next action: The learner can state the mechanism in their own words - Researcher: ask for "Source ids to inspect: hyvarinen-2005-score-matching, vincent-2011-denoising-score, song-2020-score-sde" | assumption: The stable content-object key lets local drafts, prompts, and route memory attach without changing the source page. | next action: The learner can name the prerequisite that would repair confusion - Experimenter: ask for "Choose one variable or condition to perturb before asking for an explanation." | assumption: The concept explanation is local atlas prose until checked against its math, code, and source support. | next action: The learner can predict how the mechanism changes under one perturbation - Professor: ask for "Find the smallest transferable rule a learner could reuse without the AI." | assumption: Prerequisite gaps should become a repair route, not a reason to leave the object vague. | next action: Teach or transfer: Turn the mechanism into one sentence that predicts a neighboring concept. What would resolve this: - The learner can state the mechanism in their own words - The learner can name the prerequisite that would repair confusion - The learner can predict how the mechanism changes under one perturbation Answer as a careful research tutor: stay source-grounded, separate verified evidence from assumptions, name the relevant math objects, and end with one next action. Current deterministic role lens for this object: - Role lens: Learner - Evidence request: Ask what would make "Score Matching & Score-Based Generative Models" feel predictable rather than familiar. - Assumption to keep visible: Source ids hyvarinen-2005-score-matching, vincent-2011-denoising-score, song-2020-score-sde must support the exact object, not just the surrounding topic. - Proposed experiment: Ask the learner to perturb one representation, then check whether the same invariant survives in math, code, and demo. - Next action: The learner can state the mechanism in their own words

concept/concept-notebook/generative-models/score-matching concept:generative-models/score-matching