The missing constant
A probability model can tell us which observations look plausible without giving us its density in a form that is easy to normalize.
That distinction matters. Suppose a model assigns an unnormalized score
The corresponding density is
The energy is easy to evaluate. The integral may be impossible to compute in a high-dimensional space. Maximum likelihood appears to require it anyway.
Hyvärinen’s 2005 paper proposes a different target for continuous-valued data: match the slope of the model’s log-density to the slope of the data distribution. The slope is called the score.
Compare local gradients, not absolute density heights. A constant multiplier disappears when we take a derivative.
This article follows the paper’s central theorem, then makes its three demonstrations tangible: a one-dimensional score field, the integration-by-parts objective, and the independent-component analysis example.
Why the normalizer gets in the way
Given observations , maximum likelihood maximizes
The first term is a sample average. The second term is an integral over every possible value of .
For a one-dimensional toy model, we can still draw the shape and its local slope. Move the model parameters in the panel below. The curve’s shape changes locally, while its normalization would change globally.
The paper’s proposal is not to approximate . It is to choose an objective whose derivatives never contain in the first place.
What this method assumes
Score matching in this paper is defined for smooth densities over . The boundary terms used in the proof must vanish, and the relevant expectations must be finite. Discrete variables and nonsmooth boundaries need different treatment.
Match the score, not the density
Let the data density be and define its score
For the model, write
Because and does not depend on ,
The unknown normalizer has vanished. Hyvärinen defines the population objective as the expected squared distance between these vector fields:
At the correct model, the two arrows agree almost everywhere and . We do not observe directly, though. The next step removes it without estimating a density.
In one dimension, the score is just a slope. Positive means “move right toward greater density”; negative means “move left.” In many dimensions, it is a vector pointing uphill in log-density.
The integration-by-parts trick
Expand the squared distance and ignore the term that depends only on the data:
The cross-term seems to require the unknown data score. But for each coordinate, partial integration turns it into a derivative of the model score:
Therefore the usable objective is
The data density appears only through an expectation, which becomes a sample average. No data-score estimator. No partition-function integral.
The identity is exact under the paper’s regularity conditions. It is not a Monte Carlo approximation to the normalizer.
From Gaussians to independent components
The paper first checks score matching on a multivariate Gaussian. For
the model score is . Minimizing the sample objective recovers the sample mean and inverse sample covariance, exactly as maximum likelihood does in this special case.
The more revealing example is independent component analysis (ICA). A linear mixture hides independent sources:
The estimator searches for rows whose projections behave like independent components. With a logistic component model, the score uses a saturating nonlinearity such as .
Why this example matters
The normalization constant is known in the basic ICA setup, so score matching is not needed merely to make the example computable. It is a controlled demonstration that the objective can recover the generative structure and remain useful when the component score is slightly misspecified.
A practical recipe
For a smooth unnormalized model :
- Differentiate with respect to the data coordinates to get .
- Differentiate each score coordinate once more with respect to its matching coordinate.
- Evaluate
- Minimize the sample objective, remembering that optimization can still have local minima.
The paper proves local consistency under its assumptions: as the sample size grows, the empirical objective approaches the population objective, and the true parameter is the unique global minimizer when the model is identifiable.
This does not mean every optimizer finds the right basin, nor that every modern energy-based model satisfies the assumptions automatically. It means the objective itself is statistically well-founded in the setting analyzed by the paper.
The takeaway
Score matching changes the question.
Instead of asking, “How much probability mass does this model assign after normalization?”, it asks, “Does the local geometry of this model point in the same direction as the data distribution?”
That change removes the partition function from the estimator. A difficult global integral becomes a sample average of local derivatives:
Hyvärinen’s result is compact, but its lesson is broad: when absolute values are hard to calibrate, gradients can still carry enough information to learn the shape.
Read the source
Aapo Hyvärinen. “Estimation of Non-Normalized Statistical Models by Score Matching.” Journal of Machine Learning Research, 6(24):695–709, 2005. Original PDF · JMLR entry