There’s a class of programming tasks that resists clean implementation: deciding whether a log line is “important,” repairing malformed JSON from a flaky API, ranking search results by user intent. These aren’t hard to describe — they’re hard to encode in rules. The typical solution today is to call an LLM API for every single invocation. It works, but it’s expensive, network-dependent, and non-deterministic.
A new research paper, Program-as-Weights: A Programming Paradigm for Fuzzy Functions (arXiv:2607.02512), proposes a different approach: compile a natural-language function specification into a small, reusable neural artifact — essentially a set of adapter weights — that runs locally on a lightweight model. You invoke the large model once to “compile” the function, then every subsequent call executes on a 0.6B parameter model with no API calls.
The result is a system called PAW (Program-as-Weights), and it reframes how we think about using LLMs. Instead of treating the foundation model as a per-input problem solver, PAW treats it as a tool builder — invoked once per function definition to produce a compact, offline-runnable program.
The Compiler-Interpreter Split
PAW borrows the architecture of traditional compilers. There are two components:
- The compiler — A 4B parameter model trained on FuzzyBench (a 10-million-example dataset released with the paper). Given a natural-language specification like “classify whether a message needs immediate attention,” it produces parameter-efficient adapters.
- The interpreter — A frozen, lightweight 0.6B Qwen3 model that loads the adapters and executes the program. This model never changes; the adapters are what define the function’s behavior.
This separation is what makes the whole thing practical. The 4B compiler runs once, during “compilation.” The 0.6B interpreter runs for every function call, locally, without network access. The compiled programs are roughly 22MB for the standard variant.
The performance claim is striking: a 0.6B Qwen3 interpreter running PAW programs matches the accuracy of directly prompting Qwen3-32B on the same tasks — while using roughly one-fiftieth of the inference memory and running at 30 tokens per second on a MacBook M3.
Using PAW in Practice
The Python SDK, available at github.com/programasweights/programasweights-python, makes the workflow straightforward. You install the package, describe your function in English, and compile it:
import programasweights as paw
# Use a pre-compiled function (downloads once, runs locally)
fn = paw.function("email-triage")
fn("Urgent: the server is down!") # "immediate"
fn("Newsletter: spring picnic") # "wait"
# Compile your own from a description
program = paw.compile(
"Fix malformed JSON: repair missing quotes and trailing commas",
slug="json-fixer"
)
fn = paw.function(program.slug)
fn("{name: 'Alice',}") # '{"name":"Alice"}'
# Or compile and load in one step
fn = paw.compile_and_load(
"Classify sentiment as positive or negative"
)
fn("I love this!") # "positive"
There’s also a CLI for scripting and automation:
paw compile --spec "Extract error lines from logs" --json
paw run --program <program_id> --input "[ERROR] timeout" --json
Two Compiler Variants
PAW ships with two compiler targets, each producing programs for a different interpreter:
- Standard (paw-4b-qwen3-0.6b) — Uses Qwen3 0.6B as the interpreter. Programs are ~22MB, inference takes 0.05–0.5s per call, and the base model is 594MB. This is the server default and offers the highest accuracy.
- Compact (paw-4b-gpt2) — Uses GPT-2 124M as the interpreter. Programs shrink to ~5MB, the base model is 134MB, and critically, programs compiled with this variant run in the browser via WebAssembly.
The browser angle is particularly interesting. Programs compiled with the compact variant can be embedded in any webpage and execute entirely client-side — no backend, no API keys, no server costs. The browser SDK provides the runtime:
import paw from '@programasweights/web';
const fn = await paw.function('email-triage-browser');
const result = await fn('Urgent: the server is down!');
// result: "immediate"
Where This Shines
PAW isn’t a replacement for general-purpose LLM inference. It targets a specific but common category: fuzzy functions — tasks where the logic is easy to describe in natural language but painful to implement as regex or if-else chains. The paper identifies several sweet spots:
- Format repair — fixing broken JSON, normalizing dates, repairing malformed inputs that are almost-but-not-quite valid
- Log triage — filtering verbose output to just the relevant errors, detecting anomalies
- Custom classification — defining what “important” or “relevant” means in your own words without training data
- Fuzzy search — typo-tolerant matching, semantic similarity, near-duplicate detection
- Intent routing — mapping free-text descriptions to the closest API endpoint, menu item, or configuration setting
- Agent preprocessing — parsing tool calls, validating LLM outputs, redacting secrets before further processing
The key insight is that these functions are called repeatedly with high volume but low complexity per call. Paying for a 32B model API invocation to classify one email is wasteful. Compiling the function once and running it locally 10,000 times is not.
Why the Architecture Matters
The deeper contribution is conceptual. PAW introduces “fuzzy-function programming” as a first-class paradigm — a middle ground between traditional deterministic code and full LLM inference. The compiler/interpreter split mirrors how we think about traditional programming languages: you don’t ship the compiler with your binary. Similarly, PAW lets you invoke a powerful model during development and ship only the lightweight artifacts to production.
The parameter-efficient adapters are the crucial piece. Instead of fine-tuning the entire interpreter for each function — which would require one model copy per program — PAW produces small adapter modules that can be hot-swapped on a single frozen interpreter. This is what makes it feasible to maintain dozens of fuzzy functions in a single application without ballooning memory.
GPU acceleration is enabled by default (Metal on macOS, CUDA on Linux), with automatic CPU fallback. For environments where GPU is problematic, setting PAW_GPU_LAYERS=0 forces CPU-only inference.
Integration with AI Coding Agents
One of the more practical aspects of PAW is its agent integration. It works with Cursor, Claude Code, Codex, and other AI coding assistants. You can instruct your agent to read the integration guide and set up fuzzy functions as part of your project. There’s even a skill installer for agents that support it:
npx skills add programasweights/skills
This means you can describe the function you need in plain English to your coding agent, have it compile and integrate a PAW program into your codebase, and then ship the neural artifact alongside your deterministic code — all without standing up an LLM inference service.
The Takeaway
PAW represents a shift in how we might think about LLM-powered features in production systems. Rather than treating every text-processing task as an inference problem that requires a network round-trip to a frontier model, it treats them as compilation targets — describe once, compile, and run locally forever.
The 50x memory reduction and the ability to run on consumer hardware (or even in the browser) make this practical for a wide range of applications that currently either ship without fuzzy-text features or eat the cost of constant API calls. The paper and code are both available, and the project is MIT-licensed. The project site at programasweights.com includes a playground where you can try compiling and running functions directly.
For teams building applications that process unstructured text at scale — log analyzers, email triage, search relevance, data cleaning pipelines — this compilation model is worth serious consideration as an alternative to per-call LLM inference.