Command Palette
Search for a command to run...
Les modèles de langage peuvent réécrire leurs propres poids
Les modèles de langage peuvent réécrire leurs propres poids
Résumé
Un modèle de langage est entraîné une fois puis figé. L'améliorer exige une nouvelle phase d'entraînement, ou une invite, un dispositif externe ou un surcroît de calcul à l'inférence qui disparaît une fois la tâche terminée. Nous montrons une troisième voie : à notre connaissance pour la première fois, un modèle de langage réécrit ses propres poids par son propre raisonnement et s'améliore, sans gradients et sans entraînement. Nous appelons cela l'auto-réécriture : le modèle est son propre optimiseur. Dans des travaux antérieurs, un modèle de pointe en modifiait un beaucoup plus petit ; ici, un modèle ouvert de 27B, disposant de ses poids, de ses réponses notées et de la capacité de s'exécuter lui-même, diagnostique son propre échec et réécrit les poids qui en sont la cause. Il se dépasse lui-même : sa propre modification le rend 6,6 points plus précis sur des problèmes qu'il n'a jamais vus. Il continue de s'améliorer : il teste ses modifications sur des problèmes d'entraînement et ne soumet que ce qui fonctionne, chaque modification surpassant la précédente, et sur huit sessions consécutives sa précision ne fait qu'augmenter. Il répare une copie endommagée de lui-même, tel un robot cassé qui se répare sans être reconstruit : la copie ne résout presque rien, pourtant, sans réentraînement et sans jamais lire les poids d'origine, le modèle la ramène à plus de 80 % de la précision d'origine sur des tâches d'image qu'il n'a jamais vues. Et cette capacité émerge avec l'échelle : dans une même famille de modèles, les plus petits n'effectuent aucune modification ou se détruisent eux-mêmes, et seul le plus grand s'améliore et se répare. Contrairement à la mise à l'échelle au moment du test, l'auto-réécriture inscrit son gain dans les poids, sans coût par réponse ; contrairement à l'entraînement, elle n'effectue que des passes avant, comme le service en production. Le mur entre entraînement et inférence est une limite de nos outils, non une propriété de l'intelligence. Nous pensons que l'auto-réécriture est une étape nécessaire vers l'auto-amélioration récursive : un modèle qui, comme un humain, ne sépare pas l'entraînement de l'inférence pourrait continuer à se perfectionner tout au long de sa vie, sans modèle plus grand, sans dispositif externe ni ingénierie d'invite, et sans préni post-entraînement.
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.