~/satyajit

Program-as-Weights: compiling a natural-language spec into a tiny local model

mdjsonmcp

2026-07-04 · 6 min · inference · fine-tuning

Why read this

Nichelast 15%

How PAW turns a plain-language spec into a LoRA through a mapper over learned basis matrices, with the paper's figures and its limits; results quoted.

  • Runs on a laptop CPU
  • A new technique
  • Explained from first principles

Inference & servingCC-BY-4.0Practitioner paper

How this was scored
Is it new?
2 of 3: A real new idea, method or capability
Can I trust it?
0 of 3: Restates claims
Can I run it?
2 of 3: Open code or weights with real limits
Will I understand it?
2 of 3: Mechanism from first principles with figures
Can I act on it?
1 of 3: General advice
Will it last?
1 of 3: Relevant for months
Does it affect many?
1 of 3: A specialist community
Only here?
1 of 3: Some original analysis

Score 43 of 100, ranked 521 of 577 rated articles. Each question is answered 0–3 by hand, and a 3 is rare. How articles are scored

Some everyday programming tasks refuse to be written as rules. Alerting a human on only the log lines that matter, repairing malformed JSON, ranking snippets by intent, deciding whether a message is urgent — even a regex for "parse this messy text" shatters on edge cases. The modern move is to punt: call a large language model API and let it decide, per input. That works, but you pay for it on every call, and you give up locality, reproducibility, and price.

Program-as-Weights (PAW) — from Waterloo, Cornell, and Harvard — proposes a different deal. Treat that fuzzy function like source code: compile it once from a natural-language specification into a compact, locally-executable neural artifact, and then run that artifact cheaply for every subsequent input. The compiler is a 4B model; the artifact is a small LoRA adapter; the thing that executes it is a frozen 0.6B interpreter. Play with the loop first — pick a spec, compile it, then feed inputs through the interpreter:

The headline result is the payoff of that split: a 0.6B Qwen3 interpreter running PAW programs matches direct prompting of Qwen3-32B, while using roughly one-fiftieth of the inference memory and running at 30 tokens/second on a MacBook M3.

The compiler–interpreter system

PAW borrows the oldest idea in programming — separate the compiler from the runtime — and instantiates it with neural parts. The compiler reads a function specification (plus an optional pseudo-program sketch) and emits a parameter-efficient adapter. The interpreter is a small, frozen model that, loaded with that adapter, executes the function on real inputs.

Three-panel PAW architecture. Left, the LoRA Compiler: a trainable Compiler model reads a function spec, a pseudo-program, and prefix tokens. Middle, the LoRA Mapper: mean-pooled compiler features go through an MLP that mixes a set of learned LoRA A and B basis matrices into the adapter's low-rank A and B factors. Right, the Interpreter: a frozen model runs the pseudo-program plus input through the injected LoRA to produce output.
PAW's best instantiation, Text-to-LoRA: the compiler's representation of the spec is mapped by a small MLP into a low-rank LoRA adapter (a mixture of learned basis matrices), which is injected into the frozen interpreter (paper, Figure 3).

The load-bearing piece is the LoRA mapper. Rather than have the compiler regress raw adapter weights (a huge, unstructured output), it mean-pools the compiler's features and passes them through an MLP that produces mixing coefficients over a set of learned LoRA basis matrices — the emitted adapter is a combination of reusable low-rank factors. That keeps the compiler's output small and well-conditioned, and it's what makes "spec → weights" learnable at all. (An earlier prefix-tuning variant works too; Text-to-LoRA is just the current best.)

To train the compiler, the authors built FuzzyBench, a 10-million-example dataset of fuzzy functions spanning text processing, search and matching, custom classification, code and NL commands, safety and verification, agentic tool use, and format repair — with clean and noisy specification variants so the compiler learns to be robust to sloppy prompts:

Donut chart of FuzzyBench's 10 million examples by theme: core text processing and NLP 30%, search/matching/web intelligence 18%, custom classification and filtering 15%, code and natural-language commands 12%, safety/verification/domain knowledge 12%, agentic and tool use 8%, format repair and validation 5%.
FuzzyBench: 10M fuzzy-function examples across seven themes, released with the paper, used to train the 4B compiler (paper, Figure 2).

Why compile at all? The economics

The reason this framing matters is cost structure. Calling a big model's API is a cost you pay on every input. PAW pays a one-time compile — a single pass of the 4B compiler — and then each application runs locally for almost nothing. So cumulative cost crosses over fast, and the gap only widens. Drag the number of calls:

That's the thesis in one picture: PAW reframes the foundation model from a per-input problem solver into a tool builder. You invoke the big model once per function definition, get back a small reusable artifact you own, and every function application after that is cheap, offline, and reproducible. Compile a library of them and each becomes a tiny local endpoint:

Three-stage flow. Function Specification: three plain-language specs (classify message urgency, fix malformed JSON, remove personal information). Neural Programs: the compiler turns each into a pseudo-program plus a colored LoRA adapter (LoRA 1, 2, 3). Local Deployment: each adapter runs on a small local LM as PAW Email Triage, PAW Json Fixer, and PAW PII Redactor, processing inputs into outputs on-device.
Compile a library: each spec becomes a pseudo-program plus a LoRA adapter, deployed as a small, local, single-purpose model (paper, Figure 15).

Two practical wins reinforce it: the paper reports the adapters quantize with no measurable accuracy loss, and the whole thing runs at interactive speed (30 tok/s) on a laptop — so the compiled function is genuinely local, not a cloud dependency in disguise.

The honest caveats

PAW is a genuinely new framing, but it buys its efficiency with real constraints, and the paper is candid about them:

The take

What I like about PAW is that it's a systems idea wearing an ML paper's clothes. The interesting move isn't a new architecture — it's noticing that we've quietly turned every fuzzy function into a recurring API bill, and that the compile/runtime split we use for ordinary code applies here too: pay the big model once to build the tool, then run the tool locally forever. The Text-to-LoRA mapper is the clever engineering that makes "spec → weights" tractable, but the reframing is the contribution — a foundation model as a compiler for behaviors rather than an always-on oracle. Whether it generalizes past single-step functions is the open question; as a way to make a hundred small fuzzy tasks local, private, and nearly free, it's one of the freshest ideas of the season. Code, the 4B compiler, and the 10M-example FuzzyBench are released (CC BY 4.0).


Built on Program-as-Weights: A Programming Paradigm for Fuzzy Functions (Zhang, Hotsko, Kim, Nie, Shieber, Deng; University of Waterloo, Cornell, Harvard; 2026, CC BY 4.0). Figures are reproduced from the paper; benchmark and efficiency figures (0.6B ≈ 32B, ~1/50 memory, 30 tok/s on an M3) are quoted from it. The interactive playground and cost model are illustrations of the mechanism, not runs of the released model.

Cite this article

For attribution, please use the following reference or BibTeX:

Satyajit Ghana, "Program-as-Weights: compiling a natural-language spec into a tiny local model", ai.thesatyajit.com, July 2026.

bibtex
@misc{ghana2026programasweights,
  author = {Satyajit Ghana},
  title  = {Program-as-Weights: compiling a natural-language spec into a tiny local model},
  url    = {https://ai.thesatyajit.com/articles/program-as-weights},
  year   = {2026}
}
share