← closedloop

Tsallis entropy, one dial at a time

by Kleyton da Costa ·

  • research
  • science

Most of the statistics in modern machine learning (softmax, cross-entropy, the Gaussian, the KL divergence) descends from one quantity, the Shannon entropy S=−∑ipiln⁡piS = -\sum_i p_i \ln p_i, and from one assumption hidden inside it: that information is additive. In 1988 Constantino Tsallis proposed a one-parameter generalisation,

Sq(p)=1−∑ipi qq−1,lim⁡q→1Sq(p)=−∑ipiln⁡pi.S_q(p) = \frac{1 - \sum_i p_i^{\,q}}{q - 1}, \qquad \lim_{q \to 1} S_q(p) = -\sum_i p_i \ln p_i .

The entropic index qq is a dial. Values q<1q < 1 give more weight to rare events and q>1q > 1 to frequent ones, and at q=1q = 1 everything collapses back to the standard theory. This note follows our perspective paper, Perspectives on Tsallis Statistics for Artificial Intelligence, and keeps only the essentials.

Binary Tsallis entropy for several q
Entropy of a coin for four values of q. Every curve peaks at the fair coin, where S_q = ln_q 2; q changes how steeply uncertainty is rewarded.

Non-additive, so that it can be extensive

For two independent systems the Tsallis entropy does not simply add:

Sq(A∪B)=Sq(A)+Sq(B)+(1−q) Sq(A) Sq(B).S_q(A \cup B) = S_q(A) + S_q(B) + (1 - q)\, S_q(A)\, S_q(B).

This looks like a defect until one separates two properties that are easy to conflate. Additivity belongs to the entropy functional. Extensivity, S(N)∝NS(N) \propto N, belongs to a physical system. They coincide only when the parts are weakly correlated. If strong correlations make the number of accessible states grow as a power law, W(N)∝NρW(N) \propto N^{\rho}, then the Shannon entropy ln⁡W\ln W grows only logarithmically, while Sq=ln⁡qWS_q = \ln_q W is extensive for exactly one index, q∗=1−1/ρq^\ast = 1 - 1/\rho.

Extensivity ratio for W = N squared
With W = N², only q* = 1/2 gives an entropy per element that converges; Shannon (q = 1) vanishes and q = 0.2 diverges.

The q-algebra

The theory rests on a deformed logarithm and its inverse,

ln⁡qx=x1−q−11−q,exp⁡q(x)=[ 1+(1−q) x ]+11−q,\ln_q x = \frac{x^{1-q} - 1}{1 - q}, \qquad \exp_q(x) = \big[\,1 + (1-q)\,x\,\big]_+^{\frac{1}{1-q}},

where [y]+=max⁡(y,0)[y]_+ = \max(y, 0). That small bracket, the Tsallis cut-off, carries most of the consequences. For q<1q < 1 the q-exponential reaches exactly zero at a finite point, which is the source of sparsity. For q>1q > 1 it decays as a power law, which is the source of heavy tails. Maximising SqS_q under normalisation and an energy constraint replaces the Boltzmann weight e−βεe^{-\beta \varepsilon} by exp⁡q(−βε)\exp_q(-\beta \varepsilon).

The q-exponential on linear and log scales
The q-exponential. Below q = 1 it hits zero exactly; above, it keeps a power-law tail that the exponential (straight black line on the right) cannot match.

q-Gaussians

Maximising SqS_q at fixed (generalised) variance gives the q-Gaussian, Gq(x)∝exp⁡q(−βx2)G_q(x) \propto \exp_q(-\beta x^2), a single family that moves continuously between familiar distributions:

qq distribution tails
<1< 1 compact support none
11 Gaussian light
(1,3)(1, 3) Student-tt, ν=3−qq−1\nu = \frac{3 - q}{q - 1} power law
22 Cauchy power law

The variance is finite only for q<5/3q < 5/3. Just as the Gaussian is the limit of sums of independent variables, q-Gaussians are the limits of sums of strongly correlated ones (the q-central limit theorem). Many models that are called "robust" or "heavy-tailed" are q-Gaussian models in disguise.

q-Gaussian densities and their tails
q-Gaussians normalised to unit peak. The log scale (right) separates the Gaussian's parabolic decay from the power-law tails of q > 1.

Where q comes from

Where does the value of qq come from? Superstatistics gives the clearest answer. Suppose a system is locally Boltzmann, p(ε∣β)∝e−βεp(\varepsilon \mid \beta) \propto e^{-\beta \varepsilon}, but its inverse temperature β\beta fluctuates slowly from place to place. If β\beta is gamma-distributed, the average is exactly a q-exponential, with

q=1+Var⁡β⟨β⟩2.q = 1 + \frac{\operatorname{Var}\beta}{\langle \beta \rangle^{2}} .

So q−1q - 1 measures heterogeneity. Machine learning is full of such mixtures: mini-batches sample different local losses, dropout and ensembles average over parameters, and mixture-of-experts layers combine components working at different scales.

Averaging Boltzmann factors over fluctuating temperatures
Each grey line is a Boltzmann factor at its own temperature. Their average (orange) is not exponential: it is a q-exponential with q = 1.5, set by the spread of β.

Sparse attention is a Tsallis softmax

The softmax solves an entropy-regularised problem, softmax⁡(z)=arg⁡max⁡p∈Δ p⊤z+H(p)\operatorname{softmax}(z) = \arg\max_{p \in \Delta}\, p^\top z + H(p). Shannon entropy is infinitely steep at the edge of the simplex, so every option keeps some probability. Swapping HH for the Tsallis entropy gives α-entmax, with α\alpha playing the role of qq:

α-entmax(z)=arg⁡max⁡p∈Δ  p⊤z+Sα(p).\alpha\text{-entmax}(z) = \arg\max_{p \in \Delta}\; p^\top z + S_\alpha(p).

At α=1\alpha = 1 this is the softmax and at α=2\alpha = 2 it is sparsemax. In between, α=1.5\alpha = 1.5 is a popular differentiable compromise.1 Because of the cut-off, low-scoring options get exactly zero weight, so the model commits to a small and readable support.

Softmax, 1.5-entmax and sparsemax on the same scores
The same eight scores mapped to attention weights. Raising α from 1 to 2 moves from a dense softmax to a sparse selection; open circles mark exact zeros.

The q-dial

The same move recurs across AI. Take a Boltzmann–Gibbs–Shannon object, deform it by qq, and you get a continuum whose endpoint at q=1q = 1 is the standard method:

area at q=1q = 1 moving qq away from 1
attention, outputs softmax α-entmax: exactly sparse weights
reinforcement Shannon max-ent (SAC) Tsallis max-ent: tunable, near-greedy policies
generative models Gaussian prior q-Gaussian: heavy tails, outlier robustness
losses cross-entropy q-cross-entropy: robust to noisy labels
optimisation Gaussian search steps q-Gaussian steps: long jumps out of local minima

Two observations follow. First, the deformation is backward-compatible, so a well-chosen qq cannot do worse than the standard baseline. Second, deep networks already show the signatures of nonextensive statistics: their weight spectra and gradient noise are heavy-tailed, just as the q-CLT and superstatistics predict. That is the case for treating qq as a learnable inductive bias, fitted to the data, rather than a constant inherited from physics.

Footnotes

  1. The entmax literature normalises the regulariser as Sα(p)/αS_\alpha(p)/\alpha, which only rescales the scores; the figure uses that convention. ↩