Compiling a Prompt Into a Small Neural Function You Can Version

Compiling a Prompt Into a Small Neural Function You Can Version

6 min read

A new arXiv paper proposes turning a natural-language spec into a reusable local neural function trained by teacher models, hitting 83.6% semantic accuracy on a hard benchmark where a faster compiler scored zero exact matches.

TL;DR: “Compile by Training” turns a plain-English spec into a small neural function you train once, then run locally without calling a big model every time, trading a minute of compile cost for cheaper, provider-independent inference.

The paper is “Compile by Training: Turning Natural-Language Specifications into Local Neural Functions,” posted across arXiv cs.AI, cs.CL, and cs.LG. The core pitch is one every operator running LLM calls in production has felt in the invoice: some text tasks are trivial to describe and annoying to hardcode, but hitting a remote frontier model for every single input piles up cost, latency, and vendor dependency. Their answer is to compile the description into a reusable artifact.

What does “compile by training” actually mean?

Think of it as a build step for a fuzzy function. You write a natural-language spec, the same way you’d write a prompt. At compile time, teacher models generate task-specific examples for that spec. Those examples train a small adapter sitting on top of a compact interpreter model. The output is a function that runs without the teachers.

That last part is the interesting bit. The compiled function is a standalone thing. The authors say it can be “stored, versioned, and composed like ordinary software.” So instead of a prompt string living in your codebase and a live API dependency at runtime, you get a weights artifact that behaves like any other module: pin a version, diff it, chain it into a pipeline.

a natural-language description passing through a one-time build step and emerging as a small self-contained component th

The framing borrows deliberately from compilers. Source code (the spec) goes in, a distillation process runs once, and you get a binary (the adapter) that runs cheaply many times. It is distillation, but pointed at a specific recurring function rather than a general-purpose small model.

How well does it work, and what does it cost?

The number the authors lead with: 83.6% semantic accuracy on FuzzyBench-Hard. The “Hard” qualifier matters. This is a subset where their own faster method, the Program-as-Weights fast compiler, “produced no exact matches.” So the comparison is against a baseline that scored zero on exact matches for this slice, and the training-based approach recovered most of the way to correct.

The catch is compile time. The fast compiler runs in seconds. Compile by training takes “roughly a minute.” That is not a runtime cost, it is a one-time build cost, which changes how you should read it. A minute to compile a function you’ll call ten thousand times is nothing. A minute to compile something you run twice is a waste. The economics only work when the function is genuinely recurring, which is exactly the use case they scope it to: recurring text functions.

Two honest caveats before anyone gets excited. First, 83.6% semantic accuracy means roughly one in six outputs misses on this hard set. For a website helper that is fine. For anything where a wrong answer is expensive, that error rate is a wall, not a footnote. Second, all three source postings are the same paper cross-listed across arXiv categories, so there is no independent replication here yet. This is one team’s result on one benchmark they are also involved in framing. Promising, not settled.

Where would this actually help a builder?

The authors deployed the compiler as a public interactive service and showed three demos: a multi-site website helper, a language-controlled 3D avatar, and a bidirectional English-Claudish translator. That last one is a tell about the flavor of tasks this fits. These are narrow, well-scoped, high-volume text transforms. Not open-ended reasoning.

a large remote engine on one side and many small local components on the other, each doing one narrow repeated job

Map that onto real infrastructure and the pattern is clear. Anywhere you’re currently paying frontier-model rates for a dumb-but-fuzzy job is a candidate: classifying support tickets into your own taxonomy, normalizing messy product descriptions, rewriting text to a house style, extracting fields from semi-structured blurbs, routing. These are the tasks that don’t need a 400-billion-parameter model but resist clean regex. Today most teams either overpay by calling the big model or underdeliver with brittle rules. A compiled local function is the missing middle.

The versioning angle is underrated. If your text-normalization logic is a prompt, you’re one silent model update away from behavior drift you didn’t ask for. A compiled artifact you pin doesn’t move when the provider ships a new checkpoint. For anything in a regulated or audit-heavy pipeline, “this exact function produced this output, and here’s the version” is worth a lot more than “we called an API that day and who knows what it was doing.”

What’s the real limit here?

Distillation into small models is not new, and the honest question is what this adds. The contribution I read is the workflow, not the technique: treating the spec-to-function path as a compile step with a stored, composable output, plus a public service to do it. That framing is what makes it usable rather than a research curiosity.

But the boundaries are strict. This works for functions you can describe and where teacher models can generate good training examples. If the teacher can’t do the task well, the compiled function inherits its ceiling, and possibly a lower one. It works for recurring tasks where amortizing a minute of compile pays off. It works where 83.6% on hard inputs is acceptable. Step outside any of those and you’re back to calling the big model.

There’s also a quieter dependency the framing softens. You escape the runtime provider dependency, but you still need capable teacher models at compile time. You’re not free of frontier models, you’re moving your reliance on them from every request to every build. For cost and latency that’s a huge win. For “can I do this with no big model at all,” less so.

The provider-independence story is the part I’d watch. Being able to freeze a function’s behavior, ship it on your own hardware, and not care what the vendor does next week is a structurally different position than renting inference by the token. If the accuracy holds up outside FuzzyBench, that’s the real unlock.

a frozen self-contained module running steadily while a shifting external system changes shape around it

A practitioner’s take: pull your last month of LLM invoices and find the highest-volume, narrowest, most repetitive text call you make. That one job, the classifier or the normalizer you run thousands of times a day, is your test case. Compile it, pin the version, and A/B it against your live API path on cost, latency, and error rate. The catch most readers will miss is that this is not a replacement for your reasoning-heavy calls, and treating it like one will burn you. It’s a way to stop renting a supercomputer to do arithmetic. Scope it to the boring, frequent, well-defined jobs, measure the 83.6%-class error rate on your own data before you trust it, and keep the big model for the work that actually needs a brain.