On this page
The von Mises–Fisher Distribution
A mathematical introduction to directional data, Bessel-function asymptotics, and stable normalization on the hypersphere.
Directional data arise whenever orientation matters more than magnitude. A wind direction, a point on the globe, and a normalized embedding are all unit vectors: their lengths have been fixed, so the information lies in where they point. This is especially useful in high dimensions—for example, with normalized LLM embeddings—where magnitude may be sensitive to scale or preprocessing, while direction can capture semantic similarity.
The von Mises–Fisher distribution, usually abbreviated vMF, is a natural model for such data. It plays a role on the sphere similar to that of an isotropic Gaussian in Euclidean space: one parameter specifies the preferred direction, and another controls how tightly observations gather around it.
This post develops the density, its normalization constant, the relevant Bessel-function asymptotics, and a numerically stable way to evaluate the log density.
1. Geometry and Density
Let
be the unit sphere in -dimensional Euclidean space. The sphere itself has dimension : for example, is the unit circle and is the familiar sphere in three-dimensional space.
For , the vMF density with mean direction and concentration is
Because both vectors have unit length,
where is the angle between them. The density is therefore proportional to . This gives the two parameters a direct geometric interpretation:
- points toward the mode of the distribution.
- controls angular concentration. At , every direction is equally likely; as grows, the density becomes more concentrated around .
For , the normalization constant is
where is the modified Bessel function of the first kind of order . At , is defined by its continuous limit, derived in the small-concentration section below. This constant is the technically difficult part of the density: it makes the density integrate to one, but it also requires care when is very small or very large.
2. Why the Bessel Function Matters
Let
The modified Bessel function of the first kind has the series expansion
The Bessel function appears because normalizing the vMF density requires integrating an exponential of cosine similarity over an entire sphere. For computation, the important point is not the full series itself but how it behaves at the two extremes of .
Small Concentration:
When is small, the first term of the series dominates:
Substituting this approximation into the normalization constant gives
where
is the surface area of . Since as well,
Thus, the vMF distribution converges to the uniform distribution on the sphere. Intuitively, when vanishes, the model loses its preferred direction.
Large Concentration:
For fixed and large ,
This exponential growth explains why direct numerical evaluation can overflow. It also reveals the local shape of the vMF density. Near the mean direction, is small, so
Locally, the angular deviation therefore looks Gaussian, with a typical scale of order . Large means a narrow cap around .
Scientific libraries commonly avoid the overflow in by evaluating the scaled Bessel function
which remains representable even when itself is enormous. Its large- behavior is
3. The Log-Normalization Constant
Probability calculations are usually performed in log space. With ,
For large , use
to obtain the stable expression
At very small , the terms and both become problematic even though their difference has a finite limit. In that regime, use
or a small- expansion around it. The two regimes address different numerical failures: the small- formula avoids cancellation and undefined logarithms, while the scaled Bessel function prevents overflow at large .
4. Deriving the Normalization Constant
It remains to show why the stated is correct. Define the unnormalized integral
Rotational symmetry allows us to align with the first coordinate axis. Writing , the remaining coordinates form a copy of , and the surface element contributes . Hence
where
The modified Bessel function has the integral representation
Set , so that . Rearranging the integral representation and substituting the sphere area gives
Therefore
which is the required normalization constant.
5. The Main Picture
The vMF distribution is built from a simple geometric score, , and a nontrivial normalization constant. The geometry explains the model: chooses a direction and controls angular spread. The Bessel function supplies the exact normalization, its asymptotics recover the uniform and highly concentrated limits, and its scaled form makes the density practical to evaluate numerically.