HyperAIHyperAI

Command Palette

Search for a command to run...

LLM

Sprachmodelle können ihre eigenen Gewichte umschreiben

Zusammenfassung

Ein Sprachmodell wird einmal trainiert und dann eingefroren. Es zu verbessern erfordert einen weiteren Trainingslauf oder einen Prompt, ein Rahmenwerk oder zusätzliche Berechnungen zur Inferenzzeit, die wieder verschwinden, sobald die Aufgabe endet. Wir zeigen einen dritten Weg: Unseres Wissens erstmals schreibt ein Sprachmodell seine eigenen Gewichte durch eigenes Schlussfolgern um und wird dadurch besser – ohne Gradienten und ohne Training. Wir nennen dies Selbst-Umschreiben: Das Modell ist sein eigener Optimierer. In früheren Arbeiten editierte ein Frontier-Modell ein deutlich kleineres; hier diagnostiziert ein offenes 27B-Modell, dem seine Gewichte, seine bewerteten Antworten und die Fähigkeit, sich selbst auszuführen, gegeben werden, sein eigenes Versagen und schreibt die dahinterliegenden Gewichte um. Es übertrifft sich selbst: Seine eigene Änderung macht es um 6,6 Punkte genauer bei Aufgaben, die es nie zuvor gesehen hat. Es wird kontinuierlich besser: Es testet seine Änderungen an Übungsaufgaben und übernimmt nur, was funktioniert, wobei jede Änderung die vorherige verbessert, und über acht aufeinanderfolgende Sitzungen steigt seine Genauigkeit nur. Es repariert eine beschädigte Kopie seiner selbst, wie ein defekter Roboter, der sich selbst repariert, ohne neu gebaut zu werden: Die Kopie löst fast nichts, doch ohne erneutes Training und ohne jemals die ursprünglichen Gewichte zu lesen, bringt das Modell sie bei Bildaufgaben, die es nie gesehen hat, auf über 80 % der ursprünglichen Genauigkeit zurück. Und die Fähigkeit entsteht mit der Skalierung: In einer Modellfamilie nehmen die kleineren Modelle keine Änderung vor oder zerstören sich selbst, und nur das größte verbessert und repariert sich. Anders als Testzeit-Skalierung schreibt Selbst-Umschreiben seinen Gewinn in die Gewichte ein, ohne Kosten pro Antwort; anders als Training führt es nur Vorwärtsdurchläufe aus, wie beim Serving. Die Wand zwischen Training und Inferenz ist eine Grenze unserer Werkzeuge, keine Eigenschaft von Intelligenz. Wir glauben, dass Selbst-Umschreiben ein notwendiger Schritt in Richtung rekursiver Selbstverbesserung ist: Ein Modell, das wie ein Mensch Training nicht von Inferenz trennt, könnte sich lebenslang selbst weiterentwickeln – ohne größeres Modell, ohne Rahmenwerk oder Prompt-Engineering und ohne Preoder Post-Training.

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θM_\thetaMθ​ denote a model with weights θ=(Wk)k∈K\theta = (W_k)_{k \in \mathcal{K}}θ=(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 xxx, the model generates a response yyy under fixed settings π\piπ (prompt, sampling, and a token budget LLL). A response is graded g(x,y)=1g(x, y) = 1g(x,y)=1 if the thinking concludes within LLL tokens and the final answer matches the reference, and 0 otherwise. The accuracy on a task distribution D\mathcal{D}D is defined as:

Acc(θ;D)=Ex∼DEy∼Mθ(⋅∣x;π)[g(x,y)]\mathrm{Acc}(\theta; \mathcal{D}) = \mathbb{E}_{x \sim \mathcal{D}} \mathbb{E}_{y \sim M_\theta(\cdot | x; \pi)} [g(x, y)]Acc(θ;D)=Ex∼D​Ey∼Mθ​(⋅∣x;π)​[g(x,y)]

An edit Δ\DeltaΔ replaces a subset of tensors in θ\thetaθ with tensors of the same shape, producing θ⊕Δ\theta \oplus \Deltaθ⊕Δ. Self-rewriting tasks the model with writing an edit Δ^\hat{\Delta}Δ^ such that Acc(θ⊕Δ^;Dtest)>Acc(θ;Dtest)\mathrm{Acc}(\theta \oplus \hat{\Delta}; \mathcal{D}_{\mathrm{test}}) > \mathrm{Acc}(\theta; \mathcal{D}_{\mathrm{test}})Acc(θ⊕Δ^;Dtest​)>Acc(θ;Dtest​), where Dtest\mathcal{D}_{\mathrm{test}}Dtest​ is a held-out set. Crucially, no gradients with respect to θ\thetaθ are computed, and no optimizer acts on θ\thetaθ; every value in Δ^\hat{\Delta}Δ^ 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ϕM_\phiMϕ​ is the model itself (ϕ=θ\phi = \thetaϕ=θ). 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 N0N_0N0​ 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⊤WW - \alpha u u^\top WW−αuu⊤W, weakening the projection of a matrix WWW along a unit direction uuu of the hidden state by a fraction α\alphaα.
  • 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=20B=20B=20 forward passes and C=200C=200C=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 mmm problems with nnn answers each, the test reports the mean difference δ^\hat{\delta}δ^ and standard error:

δ^=1m∑i=1mdi,SE(δ^)=1m(m−1)∑i=1m(di−δ^)2,di=1n∑j=1n(gij1−gij0)\hat{\delta} = \frac{1}{m} \sum_{i=1}^m d_i, \qquad \mathrm{SE}(\hat{\delta}) = \sqrt{\frac{1}{m(m-1)} \sum_{i=1}^m (d_i - \hat{\delta})^2}, \qquad d_i = \frac{1}{n} \sum_{j=1}^n (g_{ij}^1 - g_{ij}^0)δ^=m1​i=1∑m​di​,SE(δ^)=m(m−1)1​i=1∑m​(di​−δ^)2​,di​=n1​j=1∑n​(gij1​−gij0​)

where gij0g_{ij}^0gij0​ and gij1g_{ij}^1gij1​ 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 θ~\tilde{\theta}θ~ where a block RRR of consecutive rows in the MLP output matrix WWW of one layer is overwritten with noise:

W~r,:∼N(0,(λσ)2I)for r∈R,∣R∣=8,λ=200\tilde{W}_{r,:} \sim \mathcal{N}(0, (\lambda \sigma)^2 I) \quad \text{for } r \in R, \qquad |R| = 8, \lambda = 200W~r,:​∼N(0,(λσ)2I)for r∈R,∣R∣=8,λ=200

The 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.


KI mit KI entwickeln

Von der Idee bis zum Launch – beschleunigen Sie Ihre KI-Entwicklung mit kostenlosem KI-Co-Coding, sofort einsatzbereiter Umgebung und bestem GPU-Preis.

KI-gestütztes kollaboratives Programmieren
Sofort einsatzbereite GPUs
Die besten Preise

HyperAI Newsletters

Abonnieren Sie unsere neuesten Updates
Wir werden die neuesten Updates der Woche in Ihren Posteingang liefern um neun Uhr jeden Montagmorgen
Unterstützt von MailChimp