Program-as-Weights: A Programming Paradigm for Fuzzy Functions
arXiv · HuggingFace · ▲87
Abstract (verbatim)
Many everyday programming tasks resist clean rule-based implementation, such as alerting on important log lines, repairing malformed JSON, or ranking search results by intent, and are increasingly outsourced to large language model APIs at the cost of locality, reproducibility, and price. We propose fuzzy-function programming: compiling such a function from a natural-language specification into a compact, locally-executable neural artifact. We instantiate this paradigm with Program-as-Weights (PAW), in which a 4B compiler trained on FuzzyBench, a 10M-example dataset we release, emits parameter-efficient adapters for a frozen, lightweight interpreter. A 0.6B Qwen3 interpreter executing PAW programs matches the performance of direct prompting of Qwen3-32B, while using roughly one fiftieth of the inference memory and running at 30 tokens/s on a MacBook M3. PAW reframes the foundation model from a per-input problem solver into a tool builder: invoked once per function definition, it produces a small reusable artifact whose subsequent calls per function application are cheap and offline.
Background
Background Analysis
1. Technical Context and Real-World Needs
Many everyday programming tasks cannot be cleanly implemented with explicit rules or symbolic logic, such as filtering important log messages, repairing malformed JSON, or ranking search results by user intent. These "fuzzy functions" rely on human intuition but are hard to capture with precise code. Traditional approaches either involve brittle manual rules (e.g., regex) or outsourcing to large language model (LLM) APIs (e.g., GPT-3). However, the latter is costly, slow, and lacks reproducibility, making it unsuitable for local or offline use.
2. Limitations of Previous Methods
Existing solutions face three key issues:
- Cost and Efficiency: Remote LLM API calls are expensive and slow;
- Fragility: Model updates can break functionality, and offline execution is impossible;
- Non-Reproducibility: Dependency on external services makes software non-self-contained.
Manual rule-writing, while partial, fails under noisy inputs (e.g., typos or format changes).
3. Proposed Solution
The paper introduces "Program-as-Weights" (PAW), a paradigm that compiles fuzzy tasks into locally executable neural modules. The core idea is:
- Natural Language to Neural Program Compilation: Developers describe tasks in natural language (e.g., "extract error lines from logs"), which a compiler converts into a lightweight parameter-efficient adapter (e.g., LoRA) embedded in a frozen interpreter (e.g., Qwen3-0.6B);
- Two-Stage Compilation: A pre-trained model generates a clean pseudo-program (with examples), then a trained LoRA compiler produces the adapter;
- Local Execution: Compiled programs run offline on user devices, using 1/50th the memory of direct LLM calls and running at 30 tokens/s on a MacBook M3.
4. Key Differences from Prior Work
PAW’s innovation lies in shifting the foundation model from "solving each input anew" to "compile once, reuse many times." Unlike rigid rules or direct API calls, PAW uses parameter-efficient fine-tuning (PEFT) to solidify fuzzy tasks into reusable neural modules, balancing flexibility (natural language input) and efficiency (local execution). Additionally, PAW’s compiler is trained on a large-scale fuzzy task dataset (FuzzyBench, 10M examples), unlike prior work limited to single tasks or small data.
This paradigm paves the way for a "small-model future," where heavy computation happens only at compile time, and daily execution is local, resolving trade-offs between cost, efficiency, and reproducibility.




