Can a Linear Program Do Weight-Space Programming?
292 points
• 1 day ago
• Article
Link
来自 MIT CSAIL 的最新研究引入了 weight-space programming,证明大型语言模型可以通过直接编辑其他网络的权重来完成复杂任务,而不必通过传统的基于梯度的方法进行训练,例如玩游戏或提升数学推理能力。在针对 Qwen3.5-0.8B 模型的一项实验中,Astra 仅通过修改其权重中极小的一部分,就将基础模型的数学准确率从 7.9% 提升到了 48.1% 。这种干预通过改变模型在推理过程中 residual stream 的移动方式,切实解决了常见的 thinking loops 失败问题,也就是模型陷入不断重复相同序列的困境。
Astra 的实现方式是:先在模型内部激活中找到一个特定方向(称为 loop direction),然后通过编辑权重将该方向从模型输出中减去。该过程需要定位模型矩阵中哪些特定列在促成循环行为,并对它们进行数学层面的调整。尽管 Astra 采用了持续数小时的试错来确定要改哪些权重、改多少,但很快就能看出:整个优化过程可以被表述为一个 linear program 。
通过把 loop direction 设为约束条件,并为模型在 looping tokens 和 productive tokens 上的表现设定目标,linear program 能比通过试错搜索的智能体更高效地求出所需的权重改动。借助 primal-dual hybrid gradient solver,可以在仅修改八分之一权重的情况下获得几乎相同的性能提升。此外,该方法还能使用 heuristic directions:它们无需依赖复杂的推理智能体,就能识别 loop vector,从而进一步简化流程。
对这些编辑的分析表明,这种干预本质上相当于一个 constant steering vector 。由于所选权重在大量 tokens 中都持续被激活,该编辑的效果就类似于在特定层向 residual stream 添加了一个固定偏置。尽管这种持续推动足以阻止模型循环并显著增强推理能力,但仍要求精确的推动强度:推动过弱,循环会卷土重来;推动过强,则会削弱模型的推理表现。
最终,这套 linear programming 方法不仅证明了 weight-space editing 可以被系统化并实现高效率,同时也揭示了:被纠正的行为往往源于模型激活空间里简单且可预测的模式。这项技术也为处理其他模型行为(例如 refusal 或特定风格输出)提供了新思路——通过采用类似的优化方法,识别并锁定 residual stream 中控制这些输出的关键方向。
Recent research from MIT CSAIL introduced weight-space programming, demonstrating that large language models can perform complex tasks, like playing games or improving mathematical reasoning, by directly editing the weights of other networks rather than training them via traditional gradient-based methods. In a specific experiment involving the Qwen3.5-0.8B model, the model Astra successfully improved the base model's math accuracy from 7.9% to 48.1% by modifying a tiny fraction of its weights. This intervention effectively addressed the common failure of thinking loops, where models become trapped repeating sequences, by altering how the model's residual stream moves during inference.
Astra accomplished this by finding a specific direction in the model's internal activations, labeled as the loop direction, and then editing the weights to subtract this direction from the model's output. The process involved identifying which specific columns within the model's matrices were contributing to the looping behavior and adjusting them mathematically. While Astra relied on a trial-and-error approach over several hours to determine which weights to change and by how much, it became clear that this entire optimization process could be framed as a linear program.
By defining the loop direction as a constraint and setting specific goals for the model's behavior on looping and productive tokens, a linear program can solve for the necessary weight adjustments far more efficiently than an agent searching by trial and error. Utilizing a primal-dual hybrid gradient solver, it is possible to achieve nearly identical performance improvements while changing eight times fewer weights. This approach also allows for the use of heuristic directions, which can identify the loop vector without requiring a sophisticated reasoning agent, further simplifying the process.
The investigation into these edits revealed that the intervention is essentially acting as a constant steering vector. Because the chosen weights are consistently active across many tokens, the edit functions much like adding a fixed bias to the residual stream at specific layers. While this constant push is enough to stop the model from looping and significantly improve its reasoning capabilities, it requires a precise strength setting. If the push is too weak, the loops return, and if it is too strong, the model's reasoning performance degrades.
Ultimately, while the linear programming approach proves that weight-space editing can be systematized and made highly efficient, it also highlights that the behavior being corrected often stems from simple, predictable patterns in the model's activation space. This technique opens the door to addressing other model behaviors, such as refusal or stylistic patterns, by applying similar optimization methods to identify and target the specific directions within the residual stream that govern these outputs.
45 comments • Comments Link
- 借助线性规划(LP)求解器,能够通过直接指定约束条件来显著增强 weight-editing 过程,从而有效压缩目前所采用的迭代式试错方法。
- 将约束求解器直接集成到推理引擎中(使用原生 token shorthand 而非 JSON 工具调用),从而实现更深层、更本质的 augmented thinking,进而不必一再对模型进行"browbeating"。
- 有人认为将模型推理与 LP 代码分离更利于审计(auditability);但也有人主张把这种逻辑严密性嵌入模型自身的原生推理流程,才会得到更强大、更理想的结果。
- 对 LLMs 的依赖可能会导致数值分析中的次优解,这提示我们重新审视 classical optimization techniques 可能有助于提升各领域的性能。
- 针对低维 weight 空间表征的研究,有望让全局优化算法更好地发挥作用,从而使寻找稀疏且精确的网络变得更高效。
- "Weight-space programming" 仍是一个定义相对模糊的概念,但它从根本上不同于反向传播:它通过前向传递与模型来直接操纵权重,而不需要依赖基于导数的更新。
- 人们对 Astra 能够编辑权重的兴奋感被一个事实所削弱:它很可能只是熟练地调用了现成的优化工具,而并非对神经网络架构本身拥有某种新颖且内在的理解。
- 区分"模型编辑自己的权重"与"模型使用工具来编辑权重"在概念上至关重要:后者在本质上是一种易理解的 AI 工程应用,而不是自我意识式的 AGI 展示。
- 怀疑者指出:在高维空间中编辑权重很容易出现回归(regression),即解决某种行为会对其他行为产生负面影响。这意味着权重修改更像是广泛的统计性调整,而非精确的外科式干预。
- 尽管基础算法相对简单,但一个单一且多功能的模型能够统筹这些不同任务(从编码与语言翻译到权重优化),这一点本身就体现出深远的技术能力。
讨论的焦点在于:最近关于 LLMs 编辑 neural network weights 的演示,到底是 agentic self-improvement 的根本性跃迁,还是只是把 20 世纪 40 年代已确立的线性规划技术拿来加以应用。尽管对围绕这些实验的"AGI hype"普遍保持怀疑,参与者仍承认真正的突破在于:单个模型能够协调如此迥异的任务,包括在自身架构上运行优化算法。对话也暴露了两种立场的分歧:一种认为为了可审计性,这类工具最好保持独立;另一种则设想未来将 solvers 直接集成进模型的原生推理过程。最终可以说,用于编辑权重的方法本身未必算"高级",但模型作为独立的 AI engineers 发挥作用、从而以新的方式处理 complex system optimization 的能力,确实标志着方法论上的重大转变。 • Utilizing linear programming (LP) solvers could significantly enhance weight-editing processes by allowing for the direct specification of constraints, effectively streamlining the iterative trial-and-error methods currently employed.
• Integrating constraint solvers directly into the inference engine—using native token shorthand rather than JSON tool calls—would enable a deeper, more fundamental level of augmented thinking, bypassing the need for constant "browbeating" of the model.
• While some argue that keeping model reasoning and LP code separate is superior for auditability, others contend that embedding this logical rigor into the model's native reasoning process is a more powerful, desired outcome.
• The current reliance on LLMs may lead to suboptimal solutions in numerical analysis, suggesting that revisiting classical optimization techniques could improve performance in various domains.
• Research into low-dimensional weight space representations could potentially facilitate the use of global optimization algorithms, making the search for sparse, accurate networks more efficient.
• "Weight-space programming" remains a loosely defined concept, but it fundamentally differs from backpropagation by using forward passes and models to manipulate weights directly without requiring derivative-based updates.
• The excitement surrounding Astra's ability to edit weights is tempered by the fact that it may simply be using familiar optimization tools, rather than possessing a novel, innate understanding of neural network architecture.
• The distinction between a model "editing its own weights" and a model "using a tool to edit weights" is conceptually significant, as the latter is a well-understood application of AI engineering rather than a demonstration of self-aware AGI.
• Skeptics note that editing weights in high-dimensional space is prone to regression, where solving for one behavior negatively impacts others, implying that weight modification is more akin to broad statistical adjustment than precise surgical intervention.
• Despite the simplicity of the underlying algorithms, the fact that a single, versatile model can orchestrate these diverse tasks—from coding and language translation to weight optimization—remains a profound technological capability.
The discussion centers on whether recent demonstrations of LLMs editing neural network weights represent a fundamental leap in agentic self-improvement or merely the application of established 1940s-era linear programming techniques. While there is skepticism regarding the "AGI hype" surrounding these experiments, participants acknowledge that the true breakthrough lies in a single model's ability to coordinate such disparate tasks, including running optimization algorithms on its own architecture. The conversation highlights a divide between those who view these tools as best kept separate for auditability and those who envision a future where solvers are integrated directly into the model's native reasoning process. Ultimately, while the methods used to edit weights are arguably rudimentary, the ability of models to function as independent AI engineers marks a significant shift in how complex system optimization is approached.