Compile by Training: Turning Natural-Language Specifications into Local Neural Functions
Abstract
Compile by training converts natural-language specifications into reusable neural functions by distilling teacher-generated examples into small adapters, enabling efficient deployment without remote model dependencies.
Many recurring text functions are easy to describe but difficult to implement with rules, while calling a large remote model for every input introduces repeated cost, latency, and dependency on a provider. We present compile by training, which turns a natural-language specification into a reusable neural function. At compile time, teacher models generate task-specific examples that are used to train a small adapter for a compact interpreter. The resulting function runs without the teachers and can be stored, versioned, and composed like ordinary software. On FuzzyBench-Hard, a subset on which the Program-as-Weights fast compiler produced no exact matches, compile by training reaches 83.6% semantic accuracy. This higher accuracy comes with a higher compile-time cost: roughly a minute rather than seconds for the fast compiler. We deploy the compiler in a public interactive service and demonstrate compiled functions in a multi-site website helper, a language-controlled 3D avatar, and a bidirectional English-Claudish translator.
Community
What if LLMs built reusable tools instead of solving the same task over and over?
Program-as-Weights (PAW) compiles a natural-language function description into a small neural program that runs on a shared 0.6B local interpreter. Our original compiler does this in a single forward pass, so compilation takes only seconds.
This work, Compile by Training, adds a higher-accuracy mode: teacher models synthesize task-specific examples at compile time, then about a minute of finetuning specializes the program. On a hard subset of FuzzyBench where the fast PAW compiler did not produce exact-match outputs, Compile by Training reaches 83.6% semantic accuracy.
Both compilers produce reusable PAW programs that can be called locally like regular Python functions.
Examples
๐ฃ๏ธ Claudish โ English โ Claude-style prose
https://programasweights.com/claudish
๐ค Avatar Director โ natural language โ action programs for a live 3D character
https://programasweights.com/avatar
๐ PII Masker โ detect and mask personal information locally
https://programasweights.com/pii
Try the higher-accuracy compiler:
https://programasweights.com/playground?compiler=paw-ft-bs48
The real cost win here is you skip the per-spec fine-tune. Write the spec, get a small local function โ no GPU bill per task, no big-model latency at inference. That alone makes it worth a look for anyone shipping agents.
But the teacher generates the training examples, so the compiled function only knows what the teacher thought to show it. The long tail is where that bites โ edge cases the teacher didn't generate, and you're silently wrong. I'd want degradation curves on out-of-distribution inputs before trusting it in prod. And the versioning claim: recompile from a changed spec, does it actually converge to the new behavior, or do you get drift you don't notice until it's in front of a customer?
Get this paper in your agent:
hf papers read 2609.04199 Don't have the latest CLI?
curl -LsSf https://hf.co/cli/install.sh | bash Models citing this paper 0
No model linking this paper
Datasets citing this paper 0
No dataset linking this paper
Spaces citing this paper 0
No Space linking this paper
Collections including this paper 0
No Collection including this paper