Skip to content

Program-as-Weights · Two-stage decision models

Build a decision model once. Run fast local inference.

Program-as-Weights (PAW) uses two stages: model building and local inference. First, compile a natural-language function specification into a saved neural program. Then, call that program repeatedly with a small local interpreter. The larger compiler runs when the function is built.

This is fuzzy-function programming, introduced in Program-as-Weights: A Programming Paradigm for Fuzzy Functions by Wentao Zhang, Liliana Hotsko, Woojeong Kim, Pengyu Nie, Stuart Shieber, and Yuntian Deng. NeurIPS 2026. First released July 2, 2026.

pip install programasweights
email_triage.py
import programasweights as paw

# Compile English into a local function.
fn = paw.compile_and_load(
    "Classify if a message needs immediate attention or can wait"
)

# Runs locally — no internet, no API call from here on.
fn("Thesis defense moved to 3pm, need your signature today")
# Returns "immediate"

Compilation uses the hosted PAW compiler. After the program and interpreter download, function calls run locally without an external API.

Two stages: build the model, then run fast local inference

Build once: function specification → compiler → saved neural program.

Run repeatedly: new input + saved program → local interpreter → result.

The saved program connects the two stages. A pipeline with routing and generation makes a routing decision and calls a language model for each request. PAW builds the function before those requests arrive; each call executes the program that was already built. That function can itself classify messages, route requests, or select tools.

1. Build the decision function

Describe the task and its output in English. The PAW compiler generates a neural program for that function. Test it on your examples, then save the program for reuse.

2. Run it on new inputs

Load the saved program with a small interpreter. Reuse the loaded function for each new message or application state. The compiler is outside the inference path.

This is the AI-as-tool-builder vision behind PAW: use the larger model to build reusable neural tools, then execute those tools locally. Compile outside the request handler and save the program for later runs.

You can start without a training dataset. The Standard compiler generates program weights from your specification; the Finetune compiler generates examples and trains the program further. Bring your own examples to evaluate either one.

The standard Qwen3-0.6B interpreter runs on a CPU; the SDK also supports GPU acceleration. Test with messages and edge cases from your application, and keep a separate test set when refining the specification.

Decision models are an application of PAW's fuzzy-function programming. The same interface supports extraction, JSON repair, search, and rewriting. Functions take text and return text, and ordinary code composes them. Try English to filters, PII extraction, or the other demos.

Decisions your software can call

Describe the task and the output you need. Compile the function, test it on your examples, then call it from your application.

Classification

Assign messages to categories you define, such as billing, access, or cancellation. Return the label your application expects.

Classification examples →

Routing

Map a request to a tool or website section. Ordinary code reads the result and chooses the next action.

Try the website helper →

Triage

Decide which messages need immediate attention or which log entries need investigation. Reuse the same function for each new input.

Log-monitoring example →

System 1 models inside an agent

System 1 models, also written System One models, focus on fast decisions inside software. TypeSafe’s Jev returns typed answers with probabilities and confidence information. PAW returns text, including labels and JSON. See the Jev comparison.

In an agent, a compiled PAW function can route a request, classify a message, or select a tool. Ordinary code handles the selected action. Requests that need more involved reasoning can go to a separate reasoning model. The compiled function is reused each time the agent reaches that decision.

Use PAW with your coding agent →

The programming model behind PAW

Research overview →

Program-as-Weights: A Programming Paradigm for Fuzzy Functions

Wentao Zhang, Liliana Hotsko, Woojeong Kim, Pengyu Nie, Stuart Shieber, Yuntian Deng

First arXiv submission:

Introduces fuzzy-function programming, a compiler–interpreter interface, and neural programs that combine text with learned parameters.

Explore hypernetworks, generated adapters, and neural compilation in the reading list.