Why this paper caught our eye
Ask a small open model to multiply two six-digit numbers and you'll often get something that looks right and isn't. The usual fixes are to fine-tune the model on lots of worked examples or to hand the sum to an external calculator tool. A preprint posted to arXiv on 19 November 2026 tries a third route. Its author, Tanmay Sah, writes the arithmetic directly into the model's existing weights using closed-form maths. There's no gradient descent, no training data and no runtime hook.
The paper is titled "A CPU Inside an LLM: Zero-Gradient Compilation of Exact Circuits into Pretrained Weights". It runs to 27 pages with 24 tables and tests the idea on two current open checkpoints: IBM's Granite 4.2 3B and Alibaba's Qwen 3.5 4B. Google's Gemma 4 E4B also gets an architecture audit, though nobody has grafted full arithmetic into it yet.
How the graft works
The basic move is to widen the model. Each grafted layer gets extra dimensions, K of them, that sit on their own axes beside the original hidden state. The circuit lives in those new coordinates. The author rescales the layer norms by the square root of d/(d+K) so the original part of the network sees roughly the same activations it did before. Without that correction, ARC-Challenge scores collapse to 57.5% on Granite and 38.5% on Qwen, so this small detail carries a lot of weight.
Three tricks make the circuit behave exactly:
- Surviving normalisation. Modern models rescale every token with RMSNorm, and that scale factor isn't known ahead of time. The paper's answer is what it calls Mellin-GLU quadrature. A bias-free SwiGLU or GeGLU layer evaluates a grid of gate scales spaced on a log scale, which turns the unknown factor into a harmless shift along a flat plateau. The paper says this holds across more than a 250x range and gives IEEE 754 error bounds. With only a single scale, arithmetic accuracy falls to 8.3% on Granite and 20.0% on Qwen.
- Moving digits between tokens. Arithmetic needs information from several tokens. On Granite, the graft adds 25 attention heads with signed "Indefinite-RoPE" weights, so queries that shouldn't fire just attend to themselves and pick up nothing. Qwen 3.5 uses GatedDeltaNet layers, and here the author forces their decay to zero so they act as memoryless shifts. If those layers keep their state, Qwen's accuracy drops to 51.1%.
- Writing the answer out. Results come out as canonical tokens in base 1,000, so each output token holds a three-digit chunk. The readout uses the tied embedding matrix with a differential trick.
An automated five-stage compiler builds these layouts from a declarative spec, with no hand-assigned wires or layer numbers. It produces signed addition, subtraction and multiplication circuits for 4 to 8 digits at constant depth. It also emits 3-literal Boolean circuits and 5-bit majority and parity circuits, and the paper reports all of them at 100%. On Granite, layers 0 to 10 parse the input, layers 11 to 29 hold the arithmetic unit and layers 30 to 39 emit the answer. Qwen gets a similar split, and its full-attention layers aren't touched.
What the numbers say
On 1,200 six-digit problems in BF16, the grafted Qwen scores 100% on the arithmetic-prefix measure and Granite scores 99.17%. Granite reaches 100% when its circuit weights run in FP32. For comparison, the untouched base models manage 15.7% (Granite) and 47.3% (Qwen). A LoRA fine-tune on 12,800 examples only gets to 42.2% and 61.7%, and it can't pick up a sentence again after the number (0% inline continuation). The grafted models resume prose mid-sentence 98% to 100% of the time.
The general language scores barely move. GSM8K goes from 73.16 to 74.15 on Granite and from 75.59 to 76.35 on Qwen. Held-out MMLU-Pro dips by 0.1 to 0.2 points, and ARC-Challenge stays within a tenth of a point. Both models pass all 14 pre-registered long-context test splits, and the paper counts zero false triggers in roughly 10,400 unrelated prompts.
Granite has one weak spot worth knowing about: bare prompts land at 87.0% on the strictest measure, against 98.25% when the sum sits inside a sentence.
What it costs
The patch itself is tiny. Only 1.33 million non-zero values are active on Granite (0.036% of the model) and 2.39 million on Qwen, and the patches take 15.2 MB and 27.9 MB on disk. If you pad the dense matrices out to the new width, though, the parameter counts swell to 7.23 billion and 10.22 billion, and Granite's A100 memory use climbs from 6.83 GiB to 13.55 GiB.
The author's fix is a factorised "sparse sidecar" that keeps the native width and runs only the active circuit slices. That brings memory to about 7.9 GiB for Granite and 10.7 GiB for Qwen in BF16. It also cuts 2,048-token prefill time against the padded version, from 347.5 ms to 130.1 ms on Granite and from 847.9 ms to 433.7 ms on Qwen.
Where it falls short
The paper's honest about its gaps, and they matter:
- No division in the main layout. A separate eight-layer divider hits 100% in FP32, but that falls to 73.9% in TF32 and 56.1% in BF16.
- Fixed-size inputs only. These are single-pass circuits, so unbounded numbers or anything needing a loop is out of scope.
- Precision is fragile. You can't quantise the circuit weights uniformly to INT8 or INT4, since errors explode. FP16 overflows into NaN unless the gates are clamped, and the compiler flag -ffast-math breaks the negative-zero signal the circuits rely on to stay quiet. The BF16 carry behaviour is an observed limit that hasn't been proven.
- Tokenisation matters. A one-digit output scheme on Granite dragged a GSM8K subset from 68.33% down to 36.67%. The base-1,000 emitter fixes it, but the circuit plainly depends on how each model splits numbers into tokens.
- Narrow coverage. Two models carry full grafts. Gemma gets only an audit, and fused CUDA kernels are still future work.
- No public repository yet. The paper names companion scripts such as sparse_sidecar_runtime.py and lists SHA-256 hashes and reproduction commands in an appendix. Neither arXiv nor the Hugging Face papers page links to the code.
This is also a single-author preprint that hasn't been peer reviewed, so we'd treat every figure as provisional until someone else reproduces it.
What builders can take from it
For production maths, we'd keep using a calculator tool or code execution. They're simpler, they handle division and big numbers, and they're easy to audit. The paper's own target is narrower: places like air-gapped systems, where running host code isn't allowed and the model has to carry the logic itself.
The bigger lesson is about trust. The author points out that a grafted circuit stays exactly zero until its trigger appears. They measured 0 activations across 10,534 off-topic inputs and a KL shift under 0.002 nats. Ordinary benchmarks and perplexity checks wouldn't catch a dormant addition like that, whether it's harmless or not. If your team pulls weights from third parties, it's worth adding a few checks:
- Compare SHA-256 hashes of every shard against the publisher's official release.
- Check tensor shapes against the official config, since an unexpected width increase is a red flag.
- Scan for axis-aligned blocks that are cut off from the rest of the network, and for extreme gate-suppression constants.
Researchers can also take a simpler point away: pretrained transformers have enough structure that exact programs can be compiled into them by hand. We'll be watching for the code release and for independent reproductions.
Sources
- A CPU Inside an LLM: Zero-Gradient Compilation of Exact Circuits into Pretrained Weights (arXiv abstract)
- A CPU Inside an LLM, full HTML paper (arXiv v1)
- Hugging Face Papers page for arXiv:2611.26450
Build with people working on the same things
Join the Auckland Society for AI: NZ$599 a year with a ForgeBox and the members' projects area. Our Auckland meetups are open to everyone.