One-Hot Is a Choice

The default encoding of class labels is not a neutral container. It is a specific geometry, and it makes a specific claim.

The routine decision

Take a text classification problem: classes, one encoder, one head. You encode each class as a one-hot vector: a in position , zeros elsewhere. Then you train against it. The decision is sensible, it is what everyone does, and it is almost never described as a decision.

But it is a map. It sends the label set into , and the image is a particular configuration of points. Worth asking which one.

One-hot, centred, is a regular simplex

Write for the -th standard basis vector and centre the set over its own mean:

The inner products come out immediately:

So the Gram matrix has everywhere on the diagonal and everywhere off it. Two consequences, and they are the whole point:

Every label sits at the same distance from the centroid. The diagonal is constant, so for all . No class is more central than any other.

Every pair of labels sits at the same distance from every other pair. For ,

Constant, independent of which pair. That configuration is the regular simplex: points, all pairwise distances equal. It lives in the -dimensional hyperplane .

Info

Centring is a change of origin, not a change of geometry. A decoder that scores a prediction by its distance to each class point sees only differences between class points, and differences are invariant to translation. So the one-hot code and its centred version are the same object as far as the decision rule is concerned.

The extra coordinate is the familiar bookkeeping oddity: one-hot has columns while the simplex it defines has rank . The component along is common to all points and cancels in every difference.

What equidistance asserts

Equal distances are not an absence of a claim. They are a claim: no pair of classes is a priori more confusable than any other pair.

A topic corpus makes the cost of that claim concrete. The 20 Newsgroups collection (Lang, 1995) is a standard text-classification benchmark. Its twenty classes are Usenet discussion groups, topic-based forums that predate the web, and its labels are the group names themselves. Take three of them:

comp.sys.ibm.pc.hardware
comp.sys.mac.hardware
soc.religion.christian

The first two are near neighbours in any reasonable sense, and the corpus says so out loud: they share the prefix comp.sys, because Usenet names are dotted paths and the naming scheme is a declared hierarchy. The third sits under a different top-level branch entirely, and is far from both. The default target says all three are at distance from one another.

One-hot compared with an informative label geometry On the left, three class points at equal distances from one another and from the centroid: the centred one-hot code. On the right, the same three classes placed so that the two hardware groups are near neighbours and religion is far from both. (a) one-hot, centred (b) an informative geometry religion.christian ibm.pc.hardware mac.hardware every pair at the same distance ibm.pc.hardware mac.hardware religion.christian two near neighbours, one far from both
Three 20 Newsgroups labels under two geometries, abbreviated here to their distinguishing tails: in full they are comp.sys.ibm.pc.hardware, comp.sys.mac.hardware and soc.religion.christian. In (a) the dashed circle is the set of points equidistant from the centroid, and all three classes sit on it. The centred one-hot code has equal radii and equal pairwise distances, so no pair is closer than any other, including the two that share the comp.sys prefix. In (b) the two hardware groups share a region and the religion group is far from both. Schematic: positions are drawn, not measured.

That is not obviously wrong. Confusing the two hardware groups may cost exactly as much as confusing either with religion. That depends on the application, not on the corpus. But it is a position, it was taken by default, and a position taken by default is worth at least identifying as one.

The same shape, arrived at from three directions

What makes the simplex interesting is that it does not only appear as the accident of a convenient encoding. Three separate literatures converge on it, for reasons that have nothing to do with each other.

LiteratureHow the simplex enters
Neural collapseThe terminal phase of training drives class means to a simplex equiangular tight frame, an emergent attractor rather than a design (Papyan, Han & Donoho, 2020)
Frozen classifier headsThe last layer is fixed to an equiangular frame in advance, and training the head turns out to be largely unnecessary (Hoffer, Hubara & Soudry, 2018; Yang et al., 2022)
Hyperspherical prototypesClass prototypes are spread on a sphere by maximising minimum separation, which in the unconstrained case is the same configuration (Mettes, van der Pol & Snoek, 2019)

One community finds it at the end of optimisation, one puts it in at the start, one derives it from a packing argument. And the one-hot target has been sitting there the whole time, being it by construction. The relation between class encoding and the collapse geometry is itself an active question (Massion, Makhlouf & Massart, 2026).

If it is a map, why this map

Nothing forces the equidistance. You can use fewer than dimensions. You can place classes at unequal distances, so that labels the decoder already confuses share a region of the space at no extra cost. Several standard designs already do exactly this:

  • Zero-shot and label-embedding classifiers embed the class names with a text encoder and use those embeddings as the output space (Palatucci et al., 2009; Akata et al., 2015).
  • Error-correcting output codes assign each class a binary codeword, deliberately far apart in Hamming distance (Dietterich & Bakiri, 1995).
  • Hierarchical methods inject a declared taxonomy so that errors within a branch cost less than errors across branches (Bertinetto et al., 2020).

Each of these puts information into the labels before any training happens. The natural question is what that information buys, and the natural obstacle is that there is no unit in which to answer.

Before the unit, though, there is a prior problem: the information going into a label space comes in two kinds, and they are not the same kind. That is the next article.


References