Rosetta Stone · 26 of 30
Transpose
Operator: it does something
In plain English
Flip a matrix across its diagonal: rows become columns. A column vector becomes a row vector . The point is bookkeeping: multiplies a row by a column and produces a single number (the dot product), while produces a whole matrix. In (attention), transposing lines up every query with every key. The is an operation, not an exponent.
As code
const A = [[1, 2, 3],
[4, 5, 6]]; // 2×3
const AT = A[0].map((_, j) => A.map((row) => row[j]));
// [[1,4],[2,5],[3,6]] // 3×2See it
What it means, field by field
Matrix transpose; symmetric matrices satisfy A = Aᵀ.
QKᵀ in attention; Wᵀ in tied embeddings and in backpropagation’s backward pass.
Rotation matrices satisfy Rᵀ = R⁻¹; the conjugate transpose † in quantum mechanics.
In a research paper
Kᵀ makes every query-key pair meet in one matrix multiplication, producing an n×n grid of similarity scores.
Common misreadings
Reading xᵀ as "x to the power T".
Ignoring shapes. Most transpose confusion disappears if you write each matrix’s dimensions next to it.