Implementation Axes, and the Chapter Summary
August 25, 20264 min readbeginner
Committing the transform to hardware forces a set of choices that the mathematics leaves open.
Committing the transform to hardware forces a set of choices that the mathematics leaves open. This note names them, because they are where the engineering work in this area actually happens, and none of them is proprietary.
01.What a designer decides
Radix. Every butterfly in The Butterfly and Bit Reversal combined two values, which is radix-2. A radix-4 butterfly combines four at once, halving the number of levels at the cost of more multipliers and more complicated data routing per stage. Radix-8 goes further. The trade is level count against area, and the best point depends on the memory feeding it more than on the arithmetic itself.
Memory banking. Both operands of a butterfly have to arrive in the same cycle. A single-port memory delivers one word per cycle, so the datapath stalls half the time. A dual-port memory removes the stall and costs substantially more area. Conflict-free access schedules exist that let a banked single-port arrangement behave like a dual-port one, at the cost of an address-generation network. This is usually the hardest part of the design, and it is a memory problem rather than an arithmetic one.
Reduction inside the butterfly. The multiplication produces a value roughly twice the coefficient width, and it has to come back down before the next level. That reduction sits in the critical path of every butterfly, so its latency multiplies by across a transform. Barrett, Montgomery and Plantard reduction are the three candidates, and choosing among them is the subject of Chapter 7.
Pipelining against unfolding. One pipelined butterfly unit processes a pair per cycle and completes a transform in roughly cycles with minimal area. A fully unfolded design instantiates a butterfly for every pair at every level and completes in cycles with enormous area. The literature covers the whole spectrum between them, and the interesting designs sit in the middle.
A shared datapath. ML-KEM needs seven levels of length-128 butterflies. ML-DSA needs eight levels of length-256. A device supporting both standards would like one engine rather than two. Whether that is achievable without paying most of the area of two separate engines is a genuine open engineering question, and it is the one the research arc this book supports is aimed at.
02.Chapter summary
Ring-LWE replaces the vectors of plain LWE with elements of . One ring sample carries as much information as plain samples, because multiplying by a fixed polynomial is the same as multiplying by its negacyclic circulant matrix, and that matrix is entirely determined by the polynomial's coefficients. Storing numbers stores of them, which is where the key compression comes from. The price is a stronger assumption, since the matrix is no longer fully random.
Module-LWE adds a rank and stacks ring elements, so security can be raised by changing while stays at . That is why all six standardised parameter sets share one transform length, and why one hardware datapath can serve all of them.
Schoolbook multiplication in costs coefficient multiplications, about at , and a single scheme operation needs a dozen or more such products. The Number Theoretic Transform brings it down by about a factor of twenty.
It works because a polynomial is equally determined by its coefficients or by its values at enough points, and multiplication in the second representation is pointwise and therefore linear. Evaluating at arbitrary points would cost and save nothing, so the points are chosen as powers of a root of unity, which lets the recursion share work and brings the cost to .
The negacyclic version, which is what requires, evaluates at the odd powers of a primitive th root of unity, and those are exactly the roots of . That imposes the condition .
The atomic operation is the butterfly, and , and there are of them. It runs in place and produces its output in bit-reversed order, which implementations deliberately leave unsorted because the permutation cancels against the inverse transform.
ML-DSA satisfies the divisibility condition comfortably and runs the complete transform with . ML-KEM does not, because has one factor of two too few, so it runs an incomplete seven-level transform with and pays about a factor of two. That was accepted deliberately, to keep coefficients at bits everywhere else.
The next chapter uses all of this to build ML-KEM, and the transform stops being a topic and becomes an assumed primitive that everything else calls.