Skip to content
programasweightsPublic

About

Minimal Python examples: calendar, syntax highlighting, flexbox, Arabic morphology, search filters, and cron with ProgramAsWeights.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

ProgramAsWeights demos

Small neural programs you can use in a few lines of Python.

Try the interactive demos · Python SDK

Run a neural program

Load a published program and call it like a Python function.

pip install programasweights --extra-index-url https://pypi.programasweights.com/simple/
import json
import programasweights as paw

calendar = paw.function("94cae81a182723b85cdf", remote=True)
print(json.loads(calendar(json.dumps({
    "text": "Every weekend from 2pm to 4pm",
    "today": "2026-09-21",
}))))
{"kind":"weekly","days":[6,7],"start":"14:00","end":"16:00"}

Use remote=False to download the program and run locally. All six use the same Qwen3 0.6B interpreter. No API key is needed to run these public programs.

Compile an English description

Clone this repository and edit the English description in time/spec.txt:

git clone https://github.com/programasweights/demos.git
cd demos

Then compile it into a reusable neural program:

from pathlib import Path
import programasweights as paw

spec = Path("time/spec.txt").read_text(encoding="utf-8").strip()
program = paw.compile(spec, compiler="paw-ft-bs48")

print(program.id)
calendar = paw.function(program.id, remote=True)

This uses the Finetune compiler. Save the resulting program ID to reuse it without recompiling. Use compiler="paw-4b-qwen3-0.6b" for the fast compiler. An optional PAW_API_KEY gives access to your account's compile quota.

Shortcut: python compile.py time.

Explore the demos

Each example includes a runnable script, its exact task specification, and instructions for building your own.

python time/example.py
python filters/example.py 'Wireless headphones under $150, cheapest first'
python syntax/example.py --local

Requires Python 3.10+. Examples use hosted inference by default; add --local to run on your computer, or --program YOUR_PROGRAM_ID to use your own program.

More examples

PII detection · Claudish translation · Avatar Director

Citation

If you use these demos in research, cite Program-as-Weights for the programming paradigm and Compile by Training for the training compiler used in the examples.

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

NeurIPS 2026 · Preprint

@inproceedings{zhang2026programasweights,
  title = {{Program-as-Weights: A Programming Paradigm for Fuzzy Functions}},
  author = {Zhang, Wentao and Hotsko, Liliana and Kim, Woojeong and Nie, Pengyu and Shieber, Stuart and Deng, Yuntian},
  booktitle = {The Fortieth Annual Conference on Neural Information Processing Systems},
  year = {2026},
  url = {https://arxiv.org/abs/2607.02512}
}

Compile by Training: Turning Natural-Language Specifications into Local Neural Functions

EMNLP 2026 System Demonstrations · Preprint

@inproceedings{deng-etal-2026-compile,
  title = {{Compile by Training: Turning Natural-Language Specifications into Local Neural Functions}},
  author = {Deng, Yuntian and Nie, Pengyu and Shieber, Stuart},
  editor = {Agrawal, Sweta and Abad, Alberto},
  booktitle = {Proceedings of the 2026 Conference on Empirical Methods in Natural Language Processing: System Demonstrations},
  month = oct,
  year = {2026},
  address = {Budapest, Hungary},
  publisher = {Association for Computational Linguistics},
  url = {https://aclanthology.org/2026.emnlp-demos.78/},
  doi = {10.18653/2026.emnlp-demos.78},
  pages = {830--839},
  ISBN = {979-8-89176-461-3}
}

Credits

Inspired by Shu's small-model roundup: gpu-time, gpu-lexer, neural-flexbox, TinySarf, gpu-query, and gpu-cron.

About

Minimal Python examples: calendar, syntax highlighting, flexbox, Arabic morphology, search filters, and cron with ProgramAsWeights.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages