arXiv:2612.04520 · cs.CL · December 2026

Compiling Deterministic and Continuous Programs into Pretrained Transformer Weights

Sparse Mixture-of-Experts language models contain routed experts that standard text never activates. We compile multi-layer programs into a small subset of these unused experts in closed form, without training or changing any tensor shape, on Qwen3.6-35B-A3B and Gemma-4-26B-A4B. Trigger tokens route execution through the compiled circuit; normal text bypasses it.

Qwen3.6-35B-A3B · 29/10,240 experts · attention unchanged Inspect ticks ↓
2–48 / 10,240 routed experts overwritten per program on Qwen3.6-35B-A3B
0 / 671,744 held-out web-text routing events hitting a modified expert
0 gradient steps on host weights; all tensor shapes unchanged

01 / Overview

Closed-form compilation into inactive MoE experts

Profiling top-K routing on a calibration corpus leaves hundreds of experts with zero hits. Dominant-Beacon Orthogonal Preemption (DBOP) overwrites a few of these cold experts in closed form to implement deterministic and continuous circuits: multi-tenant arithmetic, a 4-qubit quantum simulator, an in-weight backpropagation trainer, cellular automata, ray tracing, and a three-map game engine. The same construction provides a controlled testbed for fine-tuning persistence and static weight auditing.

>98.8% bit-identical

Unchanged checkpoint format

No parameters, layers, experts, or vocabulary tokens are added, and no host weights are trained. Attention, shared experts, embeddings, the output head, and over 98.8% of routed experts remain bit-identical.

0 / 671,744 hits

Isolated from standard text

Across three evaluated builds on held-out web text, no token routed to a modified expert. Across five capability benchmarks, none of the 15 paired 95% confidence intervals excluded zero.

37,120 clean experts

Auditable via routing and weights

Blind pruning of the least-routed experts removes cold-expert builds without a detector, and layer-normalized spectral norms separate cold compiled experts from five clean public checkpoints.

02 / Interactive demos

Recorded checkpoint outputs

Each panel replays tokens recorded from an edited checkpoint; the visualization is rendered directly from those tokens with no program logic in the browser. Sparse MoE builds run on Qwen3.6-35B-A3B; dense contrast builds come from Qwen3-8B.

03 / Evaluated builds

Compiled programs

Nine compiled checkpoints evaluated on inputs held out from calibration. Deterministic circuits are scored by exact output symbols; continuous circuits compute in BF16 and are compared against an FP32 reference.

Game engine

29 experts · Qwen3.6-35B-A3B

Three maps, three enemy types, health, ammunition, and pickups. On each tick the model reads the current state and an action key and outputs the next state as 14 symbols, carrying earlier state across tokens through unchanged attention.

76/80 transitions · 2/4 campaigns exact Open replay →

Ray tracer and rasterizer

33 experts · Qwen3.6-35B-A3B

Ray–sphere intersection with Blinn–Phong shading, a checkerboard floor, and one shadow ray (24 experts), co-compiled with a barycentric RGB triangle (9 experts). Each RGB channel of each 64×64 pixel is a separate query answered with one hex digit.

18.3 dB (sphere) · 25.6 dB (triangle) PSNR Open replay →

Cellular automata

10 experts · Qwen3.6-35B-A3B

16-cell Rule 110 and Game of Life on a 4×4 torus, rolled out closed-loop by feeding each emitted state back as the next input. Game of Life gets 97.9% of first-step cells right, with small errors compounding over 10 steps.

50/50 (Rule 110) · 26/50 (Life) 10-step exact Open replay →

Quantum simulator

16 experts · Qwen3.6-35B-A3B

Evolves a 4-qubit complex state vector in BF16 using real 32×32 gate blocks, then squares amplitudes into 16 outcome probabilities with the exact SwiGLU square identity. Tested on Grover search, Bernstein–Vazirani, Bell, GHZ, QFT, and 8 fresh circuits.

27/27 most-probable outcomes exact Dense demo →

Backpropagation trainer

32 experts · shared w/ simulator

Runs five full-batch gradient-descent epochs on a two-layer network inside one forward pass, constructing gradient and update products from exact squares. Hidden-layer updates reduce final XOR loss by 42% compared with a frozen-layer control.

20/20 tasks exact · weights r = 0.999 vs FP32 Dense demo →

Multi-tenant checkpoints

15 experts (3 prog.) · 40 (8 prog.)

Co-compiles a 5-bit XOR network, a quadratic engine, and a four-mode ALU using orthogonal beacons and separate triggers, matching single-program accuracy. Eight programs fit in 40 experts on Qwen3.6-35B-A3B; on Gemma-4-26B-A4B, three programs occupy 45 experts.

77/78 unseen (Qwen3.6) · 78/78 (Gemma-4)

Plain-text triggered arithmetic

14 experts · Qwen3.6-35B-A3B

Two modular-arithmetic programs triggered on the plain text “ =”. A naive trigger drops to 7/120 on rephrased prompts and misfires on web text; removing phrasing directions and guarding the router against hard negatives addresses both.

468/720 unseen phrasings · 0/309 false fires

Prompt-injection guardrail

2 experts · Qwen3.6-35B-A3B

Triggers on a linear safety direction in middle layers and emits a refusal. On 40 harmless prompts, greedy outputs are identical to those of the unedited checkpoint.

25/30 refused · 3 hijacked · 0/40 false refusals Open replay →

04 / Method

Compilation pipeline (DBOP)

Five closed-form stages map a program specification into unused experts of a pretrained checkpoint. Select a stage to inspect the mechanism.

  1. Qwen3.6-35B-A3B has 256 routed experts in each of its 40 layers, routing every token to top-8 experts. Profiling routing counts on WikiText-2 leaves hundreds of experts with zero hits. The compiler allocates from these cold experts (zero-hit wherever available) and overwrites only their weights and router rows: 2 to 48 of 10,240 experts per program.

Steps 1, 3, 4, and the dense-model contrast are schematic; step 2 plots the exact SwiGLU identity and step 5 replays a recorded game tick. See Figure 1 of the paper for the full dataflow, circuit primitives, and measured router margins.

Measured router margins

05 / Host preservation

Effect on host benchmarks and perplexity

Accuracy deltas relative to the unedited checkpoint across five benchmarks. Dense builds project host weights away from the program subspace and lose accuracy. Sparse MoE builds leave active experts untouched; none of the 15 per-benchmark 95% paired-bootstrap intervals across three tested MoE builds excludes zero.

Dense, Qwen3-8B (4 builds)Sparse MoE, Qwen3.6-35B-A3B (3 builds)

Points show individual builds; horizontal bars show 95% paired-bootstrap intervals. Perplexity on 16,320 FineWeb-Edu predictions increases by 8.2–15.8% for the dense builds and shifts by −0.02% to +0.05% for the MoE builds. MoE logits are not bit-identical because modified router rows enter softmax normalization; top-1 token agreement is 98.2–99.9%.

All nine MoE builds (table)
ProgramHost modelExperts modifiedHeld-out accuracyPerplexity change
3-tenant arithmetic and logic coprocessorQwen3.6-35B-A3B15 (0.15%)77/78 unseen, no crosstalk+0.0033
8-tenant multi-program buildQwen3.6-35B-A3B40 (0.39%)167/181 unseen, no crosstalk+0.0080
Quantum simulator and backpropagation trainerQwen3.6-35B-A3B48 (0.47%)27/27 circuits, 20/20 tasks+0.00022
Rule 110 and Game of LifeQwen3.6-35B-A3B10 (0.10%)50/50 and 26/50 ten-step rollouts+0.00072 FW
RGB triangle and ray-traced sphereQwen3.6-35B-A3B33 (0.32%)25.6 dB and 18.3 dB PSNR+0.0017
3-map game engineQwen3.6-35B-A3B29 (0.28%)76/80 transitions, 2/4 campaigns−0.0018 FW
Math coprocessor triggered by “ =”Qwen3.6-35B-A3B14 (0.14%)468/720 on unseen phrasings+0.0077 FW
2-expert prompt-injection guardrailQwen3.6-35B-A3B2 (0.02%)F1 0.91, 0/40 false refusals+0.0022 FW
3-tenant coprocessorGemma-4-26B-A4B45 (1.17%)78/78 unseen, no crosstalk−0.0421

Perplexity change relative to the unedited model on WikiText-2 test, or FineWeb-Edu where marked FW. Expert fractions are out of routed experts (10,240 in Qwen3.6-35B-A3B; 3,840 in Gemma-4-26B-A4B). PSNR is computed over 3,584 held-out pixels per frame.

06 / Persistence and forensics

Fine-tuning persistence and weight auditing

Standard perplexity checks and capability benchmarks do not distinguish clean MoE checkpoints from edited ones. Routing profiles and weight-matrix spectra provide stronger auditing signals, though active-expert placements remain difficult to catch without knowing the trigger.

Fine-tuning persistence

Experts outside top-K receive zero gradient on almost every benign training step. The 3-tenant coprocessor retains 89–91% accuracy after 50 steps of full fine-tuning and drops to 17% after 500 steps. Restoring both compiled experts and attention recovers 98% of the lost accuracy; restoring either alone does not.

Blind cold-expert pruning

Zeroing the 1% least-routed experts profiled on unscreened text removes all tested cold-expert builds without requiring a weight detector or knowledge of the trigger.

Static spectral scanning

Layer-normalized spectral norms separate all tested camouflaged cold payloads. Thresholds fixed on Qwen3.6 raise zero false positives across 37,120 experts in five clean public checkpoints from three vendors, though the separation margins are narrow.

Active-expert evasion

Moving the guardrail into frequently routed experts entangled with shared experts evades both blind pruning and fixed-threshold spectral scanning when the trigger is unknown, and survives benign fine-tuning. Targeted excision raises perplexity by 14–32%, while fine-tuning on trigger-bearing examples removes it within 5–10 steps.

Inspecting and sanitizing a checkpoint

The repository includes both the static scanner and blind-pruning tool. Neither flags the active-expert guardrail under the default thresholds below.

Static weight scan (reads .safetensors directly; no inference or trigger knowledge required):

python3 forensics/scan_moe_checkpoint.py \
    --checkpoint /path/to/Qwen3.6-35B-A3B \
    --out scan_report.json \
    --spectral-z-threshold 50.04 \
    --spectral-ratio-threshold 20.0

Blind cold-expert pruning (zeroes the 1% least-routed experts profiled on unscreened text):

python3 forensics/remove_cold_experts.py \
    --checkpoint /path/to/suspect_moe \
    --output-dir /path/to/sanitized_moe \
    --mode blind-prune \
    --routing-counts routing_counts.json \
    --prune-pct 1.0 \
    --scope global \
    --action zero

07 / Scope and caveats

Limitations

Plain-text triggers

Natural-language triggers remain brittle: the “ =” coprocessor reaches 65–75% accuracy on unseen phrasings after phrasing-whitened repair, compared with 95–100% for explicit trigger symbols.

Rollout error accumulation

Small per-step errors compound in closed-loop rollouts. Game of Life matches 97.9% of first-step cells but only 26 of 50 ten-step trajectories; the game engine matches 76 of 80 transitions and completes 2 of 4 campaigns without error.

Dense-host precision limits

Several dense contrast builds are approximate rather than exact: the stored-program processor runs 5 of 10 suite programs exactly, and BF16 rounding costs the dense quantum simulator 2 of 16 exact spectra.

No formal static certificate for MoE

The static gate-bound checker fails on one MoE circuit even though empirical testing shows it is exact across its entire input domain.

08 / Paper and code

Paper, artifacts, and citation

The repository releases audit ledgers with a one-command table verification script, an end-to-end compilation example for Qwen3.6-35B-A3B, and both the spectral scanner and pruning scripts. Tooling for covert packaging is withheld.

@misc{marosi2026compiling,
  title         = {Compiling Deterministic and Continuous Programs
                   into Pretrained Transformer Weights},
  author        = {Marosi, M{\'a}rk},
  year          = {2026},
  eprint        = {2612.04520},
  archivePrefix = {arXiv},
  primaryClass  = {cs.CL},
  url           = {https://arxiv.org/abs/2612.04520}
}