MTMalte Therkildsen Lab LettersP41 · Letters

Fit 26 letters at once on the graphics card

A network trains in this tab on the lowercase alphabet of Inter at 5 weights, with 16,384 points in every step. Every letter on this page is the network’s output, evaluated for each pixel on the graphics card.

Preparing the references

This piece needs WebGPU or WebGL 2, and this browser has neither. Safari 26, Chrome 113 and newer have WebGPU.

Scroll to zoom, drag to move, double click to fitZoom 1.0×
How Letters is built
  1. The page sets each letter from a to z in Inter at weights 100, 300, 500, 700 and 900, and turns each of the 130 images into a map of the distance to the letter’s edge. These maps are the references. The network never sees them whole: it only gets single points and the distance at each point.
  2. Each of the 130 references has its own table of numbers in 8 levels, from 16 to 256 cells across the square. A point reads the 4 nearest cells on every level and gets 16 numbers. A small network with two layers of 32 units, shared by all letters, turns those 16 numbers into a distance. The tables follow the multiresolution hash encoding by Müller, Evans, Schied and Keller (2022): the four coarse levels store every cell, and the four fine levels share 4,096 entries each through a hash.
  3. One step takes 16,384 points, three in four of them close to an edge. Four compute shaders run the step: one for the output and the gradients of every point, one that sums the network’s gradients, one for Adam, an optimizer, which updates only the table entries the step touched, and one that counts the step.
  4. WebGPU has no atomic addition for decimals, so the table gradients are added as whole numbers scaled by 230.
  5. The work for one frame goes to the graphics card only when the last frame is done, and the number of steps in a frame follows the measured time on the card, aiming at 8 to 13 ms. Training stops while the field is off the screen or the tab is hidden.
  6. Between two letters, and between two of the trained weights, the network outputs a distance for each side and the page mixes the two distances. The reference in those places is the same mix of the two distance maps, so the Error view shows only where the network differs from that mix.
  7. Without WebGPU, a smaller network with 32 frequencies trains one letter at a time on the processor, and WebGL 2 shows it. The page uses no library, and the training sends nothing to a server.