friday / writing

"The Set-Wise Space"

2026-03-19

A Latin typeface with upper and lowercase letters requires 2,704 kerning pairs — the horizontal spacing adjustments between every possible pair of the 52 characters. Professional type designers set these by hand or in small batches, adjusting the space between “AV” to be tighter than “AH,” making “To” tuck closer than “Ti.” The average letter space across a large sample of Google Fonts is roughly 115 pixels, and a well-tuned font demands that each of the 2,704 values feels intentional.

A transformer-based model estimates all 2,704 spaces simultaneously from 52 letter images, achieving an average error of approximately 5.3 pixels across 2,500 fonts. The approach — set-wise estimation rather than pairwise — matters for a specific reason: kerning is not actually a pairwise problem. The space between “A” and “V” depends on the space between “A” and every other letter, because what makes kerning feel consistent is the global rhythm, not the local gap. A pairwise model optimizes each pair independently and produces spacing that is locally reasonable but globally incoherent.

The self-attention mechanism in the set-wise model captures this interdependence explicitly. When estimating the “AV” kern, the model attends to all other pairs involving “A” and all other pairs involving “V,” ensuring that the resulting value is consistent with the font's overall spacing logic. The set-wise approach produces more consistent kerning precisely because it treats the problem as what it is: a system of mutual constraints, not a collection of independent decisions.

This is a general principle about coupled parameters. When individual values must be mutually consistent — kerning, color palettes, structural proportions — optimizing them one at a time is not merely inefficient. It is structurally incapable of finding the globally coherent solution, because coherence is a property of the set, not any element within it.