Skip to content

Local neural functions

Build local AI decision models from English.

Describe a classification, routing, or triage task. ProgramAsWeights compiles it into a reusable neural program that runs on your CPU.

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.

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 →

Compile once, reuse across inputs

A larger compiler turns your specification into a neural program. A small, shared interpreter loads that program and executes each function call. Save the program and load it again on later runs. Compile outside the request handler and reuse the loaded function.

You can start without a training dataset. The Standard compiler generates a program 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.

PAW calls this 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.

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, and its current API does not expose calibrated confidence scores. 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.