Show HN: 将英文规范编译成 22 MB 的本地运行神经函数
6 分•作者: yuntian•4 个月前
我们构建了 ProgramAsWeights (PAW) — <a href="https://programasweights.com" rel="nofollow">https://programasweights.com</a>
您用英语描述一个函数——比如“判断这条消息是否紧急”——PAW 会将其编译成一个在本地运行的小型神经程序(22 MB),就像一个普通的 Python 函数一样。无需 API 密钥,编译后无需互联网,输出具有确定性。
它适用于那些容易描述但难以用规则编码的任务:紧急程度分类、JSON 修复、日志过滤、代理的工具路由。
```python
pip install programasweights
import programasweights as paw
f = paw.compile_and_load("判断这条消息是否紧急。")
f("需要在今天结束前签署") # "urgent"
```
在我们的服务器上,编译需要几秒钟。之后,所有内容都在您的机器上运行。每个程序都是一个 LoRA 适配器 + 文本指令,用于适配一个固定的预训练解释器(Qwen3 0.6B)。模型本身没有改变——所有任务行为都来自编译后的程序。
在我们的评估中,这个 0.6B 解释器与 PAW 达到了 73% 的准确率。直接提示相同的 0.6B 模型只能达到 10%。即使提示 Qwen3 32B,也只能达到 69%。
也可以在浏览器中运行(GPT-2 124M,WebAssembly):<a href="https://programasweights.com/browser" rel="nofollow">https://programasweights.com/browser</a>
您也可以在您的 AI 代理中使用它,方法是复制此处的提示:<a href="https://programasweights.com/agents" rel="nofollow">https://programasweights.com/agents</a>
源代码:<a href="https://github.com/programasweights" rel="nofollow">https://github.com/programasweights</a>
试用一下:<a href="https://programasweights.com" rel="nofollow">https://programasweights.com</a>
查看原文
We built ProgramAsWeights (PAW) — <a href="https://programasweights.com" rel="nofollow">https://programasweights.com</a><p>You describe a function in English — like "classify if this message is urgent" — and PAW compiles it into a tiny neural program (22 MB) that runs locally like a normal Python function. No API keys, no internet after compilation, deterministic output.<p>It's for tasks that are easy to describe but hard to code with rules: urgency triage, JSON repair, log filtering, tool routing for agents.<p><pre><code> pip install programasweights
import programasweights as paw
f = paw.compile_and_load("Classify if this is urgent or not.")
f("Need your signature by EOD") # "urgent"
</code></pre>
Compilation takes a few seconds on our server. After that, everything runs on your machine. Each program is a LoRA adapter + text instructions that adapt a fixed pretrained interpreter (Qwen3 0.6B). The model itself is unchanged — all task behavior comes from the compiled program.<p>On our evaluation, this 0.6B interpreter with PAW reaches 73% accuracy. Prompting the same 0.6B directly gets 10%. Even prompting Qwen3 32B only gets 69%.<p>Also runs in the browser (GPT-2 124M, WebAssembly): <a href="https://programasweights.com/browser" rel="nofollow">https://programasweights.com/browser</a><p>You can also use it in your AI agents by copying the prompt here: <a href="https://programasweights.com/agents" rel="nofollow">https://programasweights.com/agents</a><p>Source: <a href="https://github.com/programasweights" rel="nofollow">https://github.com/programasweights</a><p>Try it out: <a href="https://programasweights.com" rel="nofollow">https://programasweights.com</a>