A CPU Inside an LLM: Zero-Gradient Compilation of Exact Circuits into Pretrained Weights

Tanmay Sah

Independent Researcher

Published November 19, 2026 · on the feed November 20, 2026 · ▲ 7 · arXiv 2611.26450

Interpretability & analysis No code arXiv ↗Hugging Face ↗

The abstract

Pretrained language models (LMs) remain unreliable on exact multi-digit arithmetic without gradient fine-tuning or external tool interpreters. We introduce closed-form, zero-gradient circuit-grafting primitives that compile deterministic computation directly into pretrained LM weights using zero training examples and zero runtime hooks, while bounding per-layer normalization drift and preserving natural-language (NL) competence. Our construction combines three analytical mechanisms: (1) two-layer Mellin-GLU quadrature over bias-free SwiGLU/GeGLU layers, turning unknown per-token RMSNorm scaling into translation along a log-spaced gate grid (>250times dynamic range) with IEEE 754 error bounds; (2) cross-token scale cancellation via signed Chebyshev Indefinite-RoPE self-sink attention and memoryless SiLU-antisymmetric GatedDeltaNet shifts; and (3) axis-aligned width extension (d to d+K) with d/(d+K) norm compensation, Base-1000 canonical BPE emission, and differential (+254,-256) tied unembeddings. An automated 5-stage compiler synthesizes 4-8 digit signed {+,-,times} circuits in constant TC^0 depth alongside 3-literal Boolean (100%, N=1{,}728; plus 42-layer Gemma 4 E4B audits) and 5-bit Majority/Parity (100%) circuits. On 6-digit arithmetic (N=1{,}200, BF16), IBM Granite 4.2 3B (1.07M-1.33M active non-zeros, le 0.036%) and Alibaba Qwen 3.5 4B (2.25M-2.39M non-zeros, le 0.057%) reach 99.17% and 100.00% ALU-prefix accuracy (100% with an FP32 sidecar) and 98%-100% mid-sentence resumption, outperforming 12.8K-sample LoRA (42.2% / 61.7%, 0% inline continuation). A factorized block-sparse sidecar holds A100 memory at 7.89 / 10.65 GiB (4.60 / 8.14 GiB under INT8/INT4 + FP32 sidecar) while passing all 14/14 pre-registered >2K-token Tango splits (N=4{,}392; 0/11,134 OOD triggers).

The Brief

3:04

A short podcast summary of the paper. Written and voiced by AI.

Transcript

A CPU Inside an LLM. Zero-Gradient Compilation of Exact Circuits into Pretrained Weights. By Tanmay Sah, working independently. Published on the nineteenth of November.

Pretrained language models are still unreliable at exact arithmetic over many digits. The usual remedies are gradient fine-tuning, or handing the calculation to an external tool interpreter. This work asks whether the arithmetic can instead be built into the model's existing weights, with no training at all.

The proposal is a set of closed-form, zero-gradient circuit-grafting primitives. They compile deterministic computation directly into the weights of a pretrained model. That compilation uses zero training examples and zero runtime hooks. It also bounds how far normalization drifts in each layer, and it preserves the model's competence in natural language.

The construction combines three analytical mechanisms. The first is a two-layer Mellin-GLU quadrature over bias-free SwiGLU or GeGLU layers. It turns the unknown per-token RMSNorm scaling into a translation along a log-spaced gate grid, with a dynamic range of more than two hundred and fifty times, and with IEEE seven hundred and fifty-four error bounds.

The second mechanism cancels scale across tokens. It uses signed Chebyshev Indefinite-RoPE self-sink attention, together with memoryless SiLU-antisymmetric GatedDeltaNet shifts. The third is an axis-aligned extension of the model's width, with norm compensation to match, along with a canonical BPE emission in base one thousand and differential tied unembeddings.

An automated compiler with five stages ties these together. It synthesizes signed circuits for addition, subtraction and multiplication on numbers of four to eight digits, in constant depth in TC zero. It also builds three-literal Boolean circuits, which reach one hundred percent, with further audits on the forty-two-layer Gemma four E four B. Five-bit Majority and Parity circuits also reach one hundred percent.

The main test is six-digit arithmetic in BF16. Two models are grafted: IBM Granite four point two, at three billion parameters, and Alibaba Qwen three point five, at four billion. In Granite the grafted circuits come to no more than zero point zero three six percent, counted as active non-zeros, and in Qwen to no more than zero point zero five seven percent.

Granite reaches ninety-nine point one seven percent ALU-prefix accuracy, and Qwen reaches one hundred percent. With an FP32 sidecar, both reach one hundred percent. Mid-sentence resumption runs from ninety-eight to one hundred percent. For comparison, LoRA trained on twelve point eight thousand samples reaches forty-two point two percent on one model and sixty-one point seven percent on the other, with no success at all on inline continuation.

Then there is memory. A factorized block-sparse sidecar holds A100 memory at seven point eight nine gibibytes for one model and ten point six five for the other. The models also pass all fourteen of fourteen pre-registered Tango splits longer than two thousand tokens, with zero out of eleven thousand one hundred and thirty-four OOD triggers.

The title's image is meant literally. Instead of training a model to do arithmetic or calling out to a tool, the circuit is written into the weights by construction, with the model's language ability left in place.

More with an account

Listen to every day’s papers

Daily playlists, deep dives, quests for the papers, and quizzes on their key terms.

Join free
KipQuest: the day’s AI research, as podcasts and quests. All papers Android app Privacy Contact Episodes are written and voiced by AI from each paper. Summaries can contain mistakes: the paper is the source.