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

Tanmay Sah

arXiv:2611.26450 · 2026-11-22 공개 · arXiv · PDF

block-sparse zero-gradient circuit-grafting mellin-glu chebyshev-rope bpe-emission llm-arithmetic alpaca-prefix

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).

한국어 요약

한 줄 요약

LLM에 정확한 연산 회로를 무학습 상태에서 직접 컴파일하여 자연어 능력을 유지하면서 6자리 산술 정확도 99.17% 달성.

핵심 기여도

핵심 아이디어

기존 LLM은 정확한 다자리 산술에서 불안정하며, 외부 도구에 의존해야 한다. 본 연구는 **무학습** 상태에서 **정확한 회로**(exact circuits)를 **LLM 가중치에 직접 컴파일**하는 새로운 기법을 제안한다. 이는 **zero-gradient circuit-grafting primitives**를 통해 이루어지며, **RMSNorm 스케일링을 로그 간격 게이트 그리드로 변환**하고, **IEEE 754 오차 경계**를 유지한다. 특히, **Mellin-GLU quadrature**와 **Chebyshev Indefinite-RoPE**를 통해 토큰 간 스케일 취소를 수행하며, **GatedDeltaNet**을 사용한 메모리 없는 시프트를 통해 정확도를 보장한다. 이러한 접근은 **자연어 능력**(NL competence)을 유지하면서도 **정확한 연산**(exact computation)을 가능하게 한다.

기술적 접근법

주요 결과

의의 및 한계

본 연구는 **무학습 상태에서 정확한 회로를 LLM에 삽입**하는 기법을 제시하며, **자연어 능력 유지**와 **정확한 연산 수행**이라는 두 가지 목표를 동시에 달성한다. 특히, **IEEE 754 오차 경계**를 유지하면서도 **정확도 100%**를 달성한 회로(예: 3-literal Boolean, 5-bit Majority/Parity)는 기존 연구와 차별화된다. 그러나, **복잡한 산술**(예: 8자리 이상)이나 **부동소수점 연산**에 대한 실험은 명시되지 않았으며, **모델 아키텍처에 대한 일반화 가능성**도 추가 연구가 필요하다.

실용적 활용

본 기법은 **자동화된 산술 처리**, **자연어-정확연산 병합 시스템**, **하드웨어 가속 없이도 정확한 계산이 필요한 클라우드/엣지 환경**에 적용 가능하다. 특히, **무학습 상태에서 회로 삽입**이 가능하므로 **실시간 시스템**이나 **저전력 장치**에 유용할 수 있다.