Command Palette
Search for a command to run...
言語モデルは自らの重みを書き換えることができる
言語モデルは自らの重みを書き換えることができる
概要
言語モデルは一度訓練されると凍結される。性能を向上させるには、別の訓練、プロンプト、ハーネス、あるいは推論時の追加計算が必要であり、それらはタスク終了とともに消えてしまう。我々は第三の方法を示す。我々の知る限り初めて、言語モデルが自らの推論によって自らの重みを書き換え、勾配も訓練もなしに性能を向上させる。これを自己書き換えと呼ぶ。モデルが自らの最適化器となるのである。先行研究では、フロンティアモデルがはるかに小さなモデルを編集していた。本研究では、オープンな27Bモデルが、自らの重み、採点済みの回答、そして自身を実行する能力を与えられ、自らの失敗を診断し、その背後にある重みを書き換える。モデルは自らを超える。自らの編集により、見たことのない問題で6.6ポイント精度が向上する。さらに改善を続ける。練習問題で編集を検証し、うまくいったものだけを提出し、各編集が前回を上回り、8回の連続セッションにわたって精度は上昇し続ける。損傷した自身のコピーを修復する。まるで、作り直されることなく自らを修理する壊れたロボットのように。コピーはほとんど何も解けないが、再訓練なしで、元の重みを一度も読むことなく、モデルは見たことのない画像タスクにおいて元の精度の80%以上まで回復させる。そしてこの能力はスケールとともに現れる。あるモデルファミリーでは、小さなモデルは編集を行わないか自らを壊してしまい、最大のモデルだけが改善と自己修復を達成する。テスト時スケーリングとは異なり、自己書き換えはその成果を重みに書き込み、回答ごとのコストがかからない。訓練とは異なり、推論時と同様に順伝播のみを実行する。訓練と推論の間の壁は、知能の性質ではなく、我々のツールの限界である。我々は、自己書き換えが再帰的自己改善への必要な一歩であると考える。人間のように訓練と推論を分離しないモデルは、より大きなモデルも、ハーネスもプロンプトエンジニアリングも、事前訓練も事後訓練もなしに、生涯にわたって自らを向上させ続けることができるだろう。
One-sentence Summary
Researchers at UIUC and collaborators show that an open 27B language model can self-rewrite its own weights through its own reasoning, acting as its own optimizer without gradients or training, improving accuracy by 6.6 points on unseen problems, repairing a damaged copy to over 80% of original accuracy, and exhibiting this capability only at scale.
Key Contributions
- Self-rewriting is introduced, in which a 27B open model inspects its hidden states and weights, diagnoses its own failures, and edits its weights without gradients or training. A resulting edit improves accuracy by 6.6 points on 490 unseen problems in a paired test.
- Self-repair is demonstrated, where the model finds and corrects a corrupted matrix in a damaged copy without retraining or reading the original weights, restoring the copy to 83% of base accuracy on unseen image tasks. In one model family, only the largest model improves and repairs itself while smaller models fail or damage themselves.
- Iterative self-improvement uses self-tests and rollbacks: the model evaluates candidate edits on practice problems, keeps only edits that work, and withdraws failed edits. Over eight sessions it ends with higher accuracy while adding no cost per later answer.
Introduction
Language models are typically trained once, frozen, and deployed; improving them afterward normally requires large-scale training infrastructure, while user interaction can change only prompts, whose effects disappear when the task changes. Prior self-improvement work has rewritten prompts or agent code, left weight changes to optimizers or gradient-based training on model outputs, or relied on a stronger model to edit a smaller model, and fault repair has generally depended on engineer-designed procedures. The authors introduce self-rewriting, in which a language model diagnoses its own failures and edits its own weights through reasoning alone, without gradients, optimizers, or a training pipeline. They show that a 27B open model can test edits against its unedited self and keep only beneficial changes, improving accuracy by 6.6 points on 490 unseen problems and repairing a corrupted copy of itself; the ability emerges with scale, since smaller models either fail to edit or break themselves.
Method
The authors introduce a method termed Self-Rewriting, in which a model improves its own weights through reasoning alone, acting as its own optimizer without gradient descent or external training infrastructure.
Problem Definition Let Mθ denote a model with weights θ=(Wk)k∈K. For every token at every layer, the model computes a hidden state vector, updated through attention and MLP output matrices. Given a problem x, the model generates a response y under fixed settings π (prompt, sampling, and a token budget L). A response is graded g(x,y)=1 if the thinking concludes within L tokens and the final answer matches the reference, and 0 otherwise. The accuracy on a task distribution D is defined as:
Acc(θ;D)=Ex∼DEy∼Mθ(⋅∣x;π)[g(x,y)]An edit Δ replaces a subset of tensors in θ with tensors of the same shape, producing θ⊕Δ. Self-rewriting tasks the model with writing an edit Δ^ such that Acc(θ⊕Δ^;Dtest)>Acc(θ;Dtest), where Dtest is a held-out set. Crucially, no gradients with respect to θ are computed, and no optimizer acts on θ; every value in Δ^ is written by the model's own reasoning.
The Session Framework The model modifies its weights through a session of turns. As shown in the framework diagram, the editor Mϕ is the model itself (ϕ=θ). Its base weights remain static, and the current edit applies only to the specific runs it requests.
Before the first turn, a starting diagnosis answers N0 practice problems to report failure modes, such as accuracy, token limit exhaustion, or repetition. At each turn, the model writes a rationale and selects one action:
- Code: Runs Python on a CPU within a session that maintains variables and allows reading or replacing weight tensors. A helper function computes W−αuu⊤W, weakening the projection of a matrix W along a unit direction u of the hidden state by a fraction α.
- Generate: Answers practice problems using the unedited weights, the edited weights, or both.
- Read: Returns the hidden states of the weights on chosen texts.
The session operates under strict constraints: it allows B=20 forward passes and C=200 code runs. The environment disables gradients, refuses optimizer calls, and lacks GPU or network access. Edits to input embeddings, final normalization, and output layers are prohibited, as are edits that merely rescale a tensor.
Paired Test and Evaluation When the Generate action runs both weight sets, the unedited and edited models answer the same problems with identical seeds, forming pairs. For m problems with n answers each, the test reports the mean difference δ^ and standard error:
δ^=m1i=1∑mdi,SE(δ^)=m(m−1)1i=1∑m(di−δ^)2,di=n1j=1∑n(gij1−gij0)where gij0 and gij1 are the grades without and with the edit. Before submission, the framework tests the edit on reserved practice problems unseen during the session, and the model decides whether to submit or withdraw the edit.
Damaged Copy and Repair Process To evaluate self-repair, the authors construct a damaged copy θ~ where a block R of consecutive rows in the MLP output matrix W of one layer is overwritten with noise:
W~r,:∼N(0,(λσ)2I)for r∈R,∣R∣=8,λ=200The undamaged model acts as the editor, receiving only the damaged copy's weights and diagnosis. It is informed that some values are corrupted but not their location or nature.
The following figure illustrates the step-by-step process of a repair session. The model begins by diagnosing symptoms (e.g., high token cutoff rates), reads hidden states to locate anomalies (e.g., activation explosion), attempts edits like clipping outliers, evaluates them via paired tests, and iteratively refines the repair until a final edit is submitted.
Experiment
The study evaluates Qwen3.5 models from 2B to 27B on self-editing and on repairing a copy whose MLP output matrix rows are corrupted with noise. The 27B model diagnoses the damage by measuring activation and weight statistics, identifies the corrupted layer, and applies a conservative clipping rule that restores performance, even transferring to unseen image tasks despite being found on text problems only. In self-editing, the same model tests and refines a small change that improves its accuracy on held-out problems, while smaller models either fail to edit or harm themselves. Overall, the results indicate that reliable self-repair and self-improvement emerge only at larger scale and depend on measurement-driven debugging rather than random edits.
The 27B model found that a damaged copy failed mainly because one MLP output matrix contained an extreme weight outlier, and it repaired the copy by clipping a very small fraction of weights in that matrix and nearby matrices, recovering partial held-out accuracy from total failure. For its own weights, it located a hidden-state direction separating answers that finish from those that run out of tokens, then removed a small component of that direction from two layer-8 output matrices, yielding significant improvements on both its own task and held-out performance. Smaller models either made no edit or harmed themselves, while only the 27B model made and kept a beneficial change. Repairing the damaged copy by clipping rare extreme weights restored held-out accuracy from zero to a partial recovery. For its own weights, subtracting a small component along the discovered hidden-state direction led to small but significant accuracy gains on both the model's own task and a held-out evaluation.
Across model sizes, only the 27B model improves itself on its own task and on held-out problems, while the 2B model makes no edit and the 4B and 9B models break themselves. The 27B model also repairs a noise-damaged copy of itself, recovering held-out accuracy without retraining or restoring the original weights. The 27B model's self-edit is significantly better than the base model on both its own tests and held-out problems. Smaller models fail at self-editing: 2B makes no edit, and 4B and 9B edits leave the models broken or unable to answer held-out problems. The 27B model repairs a corrupted copy from near zero accuracy to more than half of the base model's held-out accuracy, using its own values rather than restored weights.
Self-rewriting is the only route that changes weights without training, is chosen by the model itself, inspects its own internals, and adds no extra cost per input. Other self-improvement routes either do not change weights or rely on an optimizer, while existing weight-editing routes are driven by researchers or a stronger model rather than by the model being edited. In scaled experiments, smaller models fail to edit or harm themselves, while only the largest tested model improves itself and repairs damaged weights. Self-rewriting uniquely satisfies all five properties: it changes weights, needs no training, is chosen by the model itself, looks inside itself, and adds no extra cost per input. Prompt and agent-code rewriting and inference-time self-refinement leave weights unchanged, while training on the model's own outputs changes weights only through an optimizer. Model editing, direction ablation, and weight editing by a stronger model change weights but are not chosen by the model itself and do not look inside itself. Under the same task and tools, smaller models either make no edit or degrade themselves; only the largest tested model improves itself and repairs a damaged copy.
Experiments tested whether language models can inspect and edit their own weights without training, comparing multiple model sizes on self-improvement and repair of a damaged copy. The 27B model recovered a corrupted copy from near zero held-out accuracy by clipping rare extreme weight outliers, and improved itself by subtracting a small component along a discovered hidden-state direction from two output matrices, yielding gains on its own task and held-out problems. Smaller models either made no edit or degraded themselves, and the analysis identifies self-rewriting as the only route that changes weights without training while remaining chosen by the model itself and adding no per-input cost.