Writing the circuit instead of training it
Language models are still unreliable at exact multi-digit arithmetic unless you fine-tune them or hand them a calculator. A new paper proposes a third route: compile the arithmetic directly into the weights of a pretrained model, with no training examples and no runtime hooks.
The authors call the technique circuit grafting. It is closed form — the weights are computed analytically rather than learned — and it is designed to bound the drift it introduces in each layer’s normalisation so the model keeps its natural-language ability. An automated five-stage compiler turns a target computation into weight edits.
The construction has three parts: a two-layer quadrature over bias-free SwiGLU and GeGLU layers that turns unknown per-token normalisation scaling into a shift along a log-spaced gate grid with more than 250 times dynamic range and IEEE 754 error bounds; a cross-token scale cancellation using a signed Chebyshev attention sink and memoryless gated shifts; and an axis-aligned width extension that adds K dimensions with a square-root norm compensation, a base-1000 token encoding and differential tied unembeddings.
The numbers
On 6-digit arithmetic with 1,200 test cases in BF16, the grafted IBM Granite 4.2 3B reached 99.17% ALU-prefix accuracy and the grafted Alibaba Qwen 3.5 4B reached 100.00%. Both hit 100% with an additional FP32 sidecar. Mid-sentence resumption — the model carrying on with ordinary text after the arithmetic — ran at 98% to 100%.

The comparison is the striking part. The same models fine-tuned with LoRA on 12,800 samples scored 42.2% and 61.7%, with 0% inline continuation. Zero training examples beat 12,800 of them, on a task where the right answer is a matter of definition rather than of pattern.
The edits are also small. The grafted circuits occupy 1.07 to 1.33 million active non-zero parameters in the Granite model and 2.25 to 2.39 million in the Qwen model, which the authors put at no more than 0.036% and 0.057% of the weights respectively.
What else it compiles
Arithmetic is the headline case but not the only one. The compiler also produced 3-literal Boolean circuits at 100% accuracy over 1,728 cases, with audits on a 42-layer Gemma 4 E4B, and 5-bit majority and parity circuits at 100%. The signed add, subtract and multiply circuits for 4- to 8-digit operands sit in constant TC-zero depth.

A factorised block-sparse sidecar keeps A100 memory at 7.89 and 10.65 GiB for the two models, or 4.60 and 8.14 GiB with INT8 and INT4 quantisation plus the FP32 sidecar. The authors report passing all 14 of 14 pre-registered long-context splits over 4,392 cases, with no out-of-distribution triggers in 11,134 opportunities — the test for whether a grafted circuit fires when it should not.
The caveat worth stating
This is one preprint, not yet peer reviewed, and the technique is specific to architectures with the gating and normalisation structure it exploits. It also does not make a model better at mathematics; it makes a model exact at a fixed set of operations someone has compiled in advance.
What is interesting is the framing. If deterministic behaviour can be written into weights analytically, the choice for a capability a model should never get wrong stops being train-it-or-call-a-tool.