ChatPaper.aiChatPaper

程式即權重:模糊函數的程式設計範式

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)**:將這類函數從自然語言規格編譯成一個緊湊、可於本地執行的神經網路工件(neural artifact)。我們以**權重即程式(Program-as-Weights,PAW)** 來具體實現此範式:一個基於我們所釋出的 10M 範例資料集 FuzzyBench 訓練而成的 4B 編譯器,會產生參數高效的適配器(parameter-efficient adapters),供一個凍結的輕量級解釋器使用。一個 0.6B 的 Qwen3 解釋器在執行 PAW 程式時,效能可匹敵直接提示 Qwen3-32B 的結果,但推理記憶體僅約為其五十分之一,且在 MacBook M3 上可達到每秒 30 個 token 的執行速度。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.