Residual addition
x + sublayer(x)
The algorithm
Add the block's output back to its input. Mathematically the simplest node in the graph.
Why it resists a proof
In quantized-land it is a trap. Rescaling the narrow-range tensor onto the wide-range tensor's grid at low precision destroys it. Residual connections are also a primary source of the outlier activations that break quantization globally. zkGPT's evaluation simply deletes them from GPT-2.
Cryptographic toolbox
- Mixed precision: widen the bit-length locally
- Scale-factor alignment before addition
- Free in the PIOP: MLE addition checked at a random point
How each scheme proves it
Prove it for free; pay for it in bits, not in cryptography.
The authors prove the correctness of a modified version of GPT-2 that doesn't contain residual connections, attention masks, and the final projection layer. These relaxations significantly circumvent the outlier issues that we discussed in Section 1.
DeepProve · §6
- The PIOP is a one-line check: sample $r$, verify $y_Y = y_{X_1} + y_{X_2}$ against the three oracles.
- The engineering is entirely numeric: residual layers run at a larger bit-length than the rest of the model, chosen so the quantization grid is fine enough to represent both addends.
- DeepProve keeps residuals, attention masks, and the final projection. zkGPT removes all three, which is how it avoids the outlier problem it never discusses.
An elementwise Add over tensors, with NumPy broadcast semantics. Nothing to say, and nothing said.
Add,Sub,Mul,Divare supported elementwise ops; broadcasting is automatic.- Not "nothing said" in code. Each is a small degree-1/2/3 sumcheck whose 64-bit pre-clamp accumulation is re-executed into a
ClampAccvirtual MLE (never committed), tied to the committed operands by a cheap linear equality, then clamped by the sharedSatClamplookup.Divproves the Euclidean identityright·q + R − left = 0with a committed quotient and anUnsignedLessThan-range-checked remainder.
The pre-clamp acc is prover-supplied advice (re-executed, appended as ClampAcc, no separate commitment); its only anchors are the operand tie and the clamp lookup. The soundness-test harness (malicious_sub.rs) is worth teaching: a faithful attacker forges exactly one opening (proves left+1) to isolate which single check rejects — here, the operand tie. In ZK mode, Add/Sub/Sum are proved un-clamped and deliberately don't commit ClampRaD, so their saturating clamp is not range-checked under ZK.