Command Palette
Search for a command to run...
언어 모델은 자신의 가중치를 스스로 재작성할 수 있다
언어 모델은 자신의 가중치를 스스로 재작성할 수 있다
초록
언어 모델은 한 번 학습된 후 고정된다. 이를 개선하려면 추가 학습 실행, 프롬프트, 하네스 또는 추론 시 추가 연산이 필요하며, 이는 과제가 끝나면 사라진다. 우리는 세 번째 방법을 제시한다. 우리가 아는 한 최초로, 언어 모델이 자신의 추론을 통해 자신의 가중치를 재작성하여 더 나아지며, 그래디언트도 학습도 사용하지 않는다. 우리는 이를 자기 재작성이라 부른다. 모델이 스스로의 최적화 도구가 되는 것이다. 이전 연구에서는 최첨단 모델이 훨씬 작은 모델을 편집했지만, 여기서는 개방형 27B 모델이 자신의 가중치, 채점된 답안, 그리고 자신을 실행할 수 있는 능력을 부여받고 자신의 실패를 진단하여 그 배후의 가중치를 재작성한다. 이는 스스로를 능가한다. 자신이 편집한 결과로, 한 번도 본 적 없는 문제에서 정확도가 6.6포인트 향상된다. 또한 계속해서 개선된다. 연습 문제에서 자신의 편집을 시험하고 효과가 있는 것만 제출하며, 각 편집은 이전 편집보다 개선되어 여덟 번의 연속 세션 동안 정확도는 상승만 한다. 마치 재건되지 않고 스스로 고치는 고장 난 로봇처럼, 손상된 자신의 복사본을 복구한다. 복사본은 거의 아무것도 풀지 못하지만, 재학습 없이 그리고 원본 가중치를 전혀 읽지 않은 채, 모델은 한 번도 본 적 없는 이미지 과제에서 원본 정확도의 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.