liveBook · Manning

Random rotation

As explained in Quantization and Fast Inference

A random rotation is an orthogonal transformation selected randomly to change the coordinate orientation of numerical vectors.

Random rotation redistributes a normalized vector’s coordinates without changing its length or angles. In TurboQuant, multiplying by a random orthogonal matrix makes each rotated coordinate follow a predictable distribution, so one precomputed scalar quantizer can be used across input vectors. section 7.5

For each KV-cache vector, the procedure is:

  • Normalize by the vector’s L2 norm, rotate with the orthogonal matrix, then quantize each coordinate independently. section 7.5

How Quantization and Fast Inference covers it

How deep it goes
Explains orthogonality, the resulting coordinate distribution, and the quantization role, then shows matrix construction in PyTorch.
Examples
Uses a 128-dimensional attention-head vector and a card-shuffling analogy to illustrate coordinate redistribution.
What you can do after
Apply it by generating an orthogonal matrix with seeded PyTorch QR decomposition and rotating normalized vectors.
How it connects
Connects orthogonal transformations to vector quantization, scalar quantization, and KV-cache compression.

Also explained in

Compare how 2 books explain random rotation →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Quantization and Fast Inference. The section links point to the parts of the book it draws on.