程序即权重:一种面向模糊函数的编程范式
Program-as-Weights: A Programming Paradigm for Fuzzy Functions
July 2, 2026
作者: Wentao Zhang, Liliana Hotsko, Woojeong Kim, Pengyu Nie, Stuart Shieber, Yuntian Deng
cs.AI
摘要
许多日常编程任务难以通过纯基于规则的方式实现,例如对重要日志行进行告警、修复格式异常的JSON,或按意图对搜索结果排序。这些任务正越来越多地被外包给大语言模型API,却牺牲了本地性、可复现性和成本。我们提出模糊函数编程(fuzzy-function programming):将这类函数从自然语言规范编译成紧凑的、本地可执行的神经制品。我们通过“权重即程序”(Program-as-Weights, PAW)实例化了这一范式——该方案使用一个在FuzzyBench(我们发布的一个包含1000万示例的数据集)上训练的4B编译器,为冻结的轻量级解释器生成参数高效适配器。执行PAW程序的0.6B Qwen3解释器,在性能上可与直接提示Qwen3-32B相媲美,同时仅使用约其五十分之一的推理内存,并在MacBook M3上以30 tokens/s的速度运行。PAW将基础模型从逐输入的问题求解器重构为工具构建器:每次函数定义时被调用一次,生成一个可复用的小型制品,而后续每次函数应用调用成本低廉且可离线运行。
English
Many everyday programming tasks resist clean rule-based implementation, such as alerting on important log lines, repairing malformed JSON, or ranking search results by intent, and are increasingly outsourced to large language model APIs at the cost of locality, reproducibility, and price. We propose fuzzy-function programming: compiling such a function from a natural-language specification into a compact, locally-executable neural artifact. We instantiate this paradigm with Program-as-Weights (PAW), in which a 4B compiler trained on FuzzyBench, a 10M-example dataset we release, emits parameter-efficient adapters for a frozen, lightweight interpreter. A 0.6B Qwen3 interpreter executing PAW programs matches the performance of direct prompting of Qwen3-32B, while using roughly one fiftieth of the inference memory and running at 30 tokens/s on a MacBook M3. PAW reframes the foundation model from a per-input problem solver into a tool builder: invoked once per function definition, it produces a small reusable artifact whose subsequent calls per function application are cheap and offline.