Program-as-Weights: A Programming Paradigm for Fuzzy Functions
Wentao Zhang, Liliana Hotsko, Woojeong Kim, Pengyu Nie, Stuart Shieber, Yuntian Deng
Program-as-Weights compiles fuzzy natural-language tasks into small, locally executable neural adapters.
How can we turn natural-language descriptions of "fuzzy" tasks into small, portable, and locally executable neural weight files?
Developers often outsource "fuzzy" tasks—like log filtering or intent-based ranking—to large language model APIs because they resist precise symbolic rules. This creates a dependency on remote, costly, and opaque services for simple logic. Program-as-Weights (PAW) solves this by compiling a natural-language specification into a compact, reusable neural adapter. A 4B-parameter compiler generates this adapter, which is then injected into a frozen, lightweight 0.6B-parameter interpreter that runs entirely offline. On the FuzzyBench dataset, this 0.6B interpreter outperforms direct prompting of a 32B-parameter model while using 50x less memory.
Paper Primer
PAW treats the foundation model as a tool builder rather than a per-input solver. The core move is a hybrid program: a discrete "pseudo-program" that cleans the user's noisy specification, paired with a continuous LoRA adapter that injects task-specific behavior into the frozen interpreter.
PAW achieves higher accuracy than direct prompting of significantly larger models.
On FuzzyBench, a 0.6B-parameter interpreter with a PAW adapter reaches 73.78% exact match, compared to 68.70% for a 32B-parameter model.
The compiler-generated pseudo-program provides robust denoising for real-world specifications.
When specifications contain heavy typos, the PAW pipeline maintains performance significantly better than feeding raw specifications directly to the interpreter. 4.5 percentage point accuracy gap on heavy-typo inputs.
Why use a hybrid (discrete + continuous) program instead of just a continuous adapter?
The discrete pseudo-program acts as a buffer that shields the interpreter from ambiguity and noise in the user's original specification, while the continuous LoRA adapter provides the fine-grained behavioral control that text alone cannot capture.
Does this approach require retraining the interpreter for every new task?
No. The interpreter is frozen and installed once; adding a new fuzzy function only requires compiling a new, small (∼23 MB) LoRA adapter that is hot-swapped at runtime.
PAW shifts the paradigm from per-input API calls to per-function compilation, enabling high-performance fuzzy logic to run locally on resource-constrained devices.
Introduction: The Fuzzy Programming Problem
Program-as-Weights compiles natural‑language specs into tiny neural programs for local execution.
Modern software often outsources ambiguous tasks—such as alerting on important log lines or repairing malformed JSON—to large language‑model APIs. This incurs latency, reproducibility risks, and high cost because each input triggers a heavyweight model call. Program-as-Weights (PAW) eliminates that gap by compiling a natural‑language specification once into a compact neural artifact that can be executed locally, turning a per‑input LLM call into a cheap, offline function call.
A fuzzy function is a task whose intended behavior is easy for humans to describe but hard to encode as exact code or rules.
**Figure 19.** A library of compiled PAW programs. Three example natural-language function specifications (“Classify message urgency”, “Fix malformed JSON”, “Remove personal information”; left) are each compiled into a separate neural program (middle): a discrete pseudo-program in a fixed format plus a continuous per-example LoRA (depicted as red, blue, green adapters). At deployment time (right), all three programs are served by a single device-resident interpreter (LM) with the appropriate LoRA hot-attached per call — the “one runtime, many programs” picture that motivates compile-once-run-locally.