Language Models Can Rewrite Their Own Weights
Abstract: A LLM is trained once and frozen. Making it better takes another training run, or a prompt, a harness or extra computation at inference that is gone once the task ends. We show a third way: to our knowledge for the first time, a LLM rewrites its own weights by its own reasoning and becomes better, with no gradients and no training. We call this self-rewriting: the model is its own optimizer. In earlier work, a frontier model edited a much smaller one; here an open 27B model, given its weights, its graded answers and the ability to run itself, diagnoses its own failure and rewrites the weights behind it. It surpasses itself: its own edit makes it 6.6 points more accurate on problems it never saw. It keeps getting better: it tests its edits on practice problems and submits only what works, each edit improving on the last, and over eight consecutive sessions its accuracy only rises. It repairs a damaged copy of itself, like a broken robot that fixes itself without being rebuilt: the copy solves almost nothing, yet with no retraining and without ever reading the original weights, the model brings it back to over 80% of the original accuracy on image tasks it never saw. And the ability emerges with scale: in one model family, the smaller models make no edit or break themselves, and only the largest improves and repairs itself. Unlike test-time scaling, self-rewriting writes its gain into the weights, at no cost per answer; unlike training, it runs only forward passes, as serving does. The wall between training and inference is a limit of our tools, not a property of intelligence. We believe self-rewriting is a necessary step toward recursive self-improvement: a model that, like a human, does not separate training from inference could keep upgrading itself for life, with no larger model, no harness or prompt engineering, and no pre- or post-training.
Paper Prompts
Sign up for free to create and run prompts on this paper.
Explain it Like I'm 14
1. What is the paper about?
This paper studies whether a LLM can change its own internal settings to become better.
A LLM is an AI system that produces text. Inside it are millions or billions of numerical values called weights. These weights help the model decide what to say, much like connections in a brain help a person think.
Usually, improving an AI requires a new training process using powerful computers. This paper tests a different idea:
Can an AI examine its own mistakes, change some of its weights, test the change, and keep the change if it helps?
The researchers call this process self-rewriting.
2. What questions did the researchers ask?
The paper focuses on several main questions:
- Can a LLM improve its own performance by changing its weights?
- Can it do this without normal training, gradients, or an optimizer?
- Can the model test its changes and reject changes that make it worse?
- Can it repair a damaged copy of itself?
- Will the ability to improve itself appear only in larger models?
The researchers were especially interested in whether the model could make improvements that lasted. A change to a prompt may disappear when the task ends, but a change to the weights stays inside the model.
3. How did the researchers test this?
The model’s “brain”
The researchers used one family of LLMs with four sizes:
- 2 billion parameters
- 4 billion parameters
- 9 billion parameters
- 27 billion parameters
A parameter is a number inside the model. More parameters usually mean a larger and more complicated model.
The largest model had 27 billion parameters. It was allowed to inspect parts of its own weights and use Python code to change them.
The self-improvement experiment
The model was given practice math problems and information about how well it answered them. It could then:
- Look for patterns in its successful and unsuccessful answers.
- Read some of its internal activity, called hidden states.
- Suggest a small change to its weights.
- Test the changed version against the unchanged version.
- Keep the change or throw it away.
This is similar to a student noticing, “I often make this kind of mistake,” trying a new study method, and continuing only if the method improves test results.
The model was not allowed to use ordinary training. In particular:
- It could not calculate gradients, which are signals normally used to show how weights should change.
- It could not use an optimizer, which is a tool that automatically adjusts weights.
- It could only run the model and write values into its weights using its own reasoning.
Comparing answers fairly
The researchers used a paired test. The unchanged model and the edited model answered the same problems using the same random settings.
This is like giving two students the same test questions under the same conditions, then comparing which answers changed from wrong to right or from right to wrong.
The researchers also used new problems that the model had never seen while making its edit. These are called held-out problems. They help show whether the improvement is real or whether the model simply memorized the practice questions.
The self-repair experiment
The researchers also damaged a copy of the model by replacing part of its weights with random numbers.
The damaged copy performed very badly. The model was told only that some values had been corrupted. It had to:
- Find where the problem was.
- Guess what kind of damage had happened.
- Make a repair.
- Test whether the repaired copy worked better.
Importantly, the model was not allowed to look at the original, undamaged weights while repairing the copy.
4. What did the researchers find?
The largest model improved itself
The 27-billion-parameter model successfully changed its own weights and became more accurate.
In one important test, its accuracy improved by 6.6 percentage points on 490 new problems that it had not seen while making the edit.
In another experiment, its accuracy rose from about 57.2% to 58.3% on held-out problems. The improvement was smaller in that particular test, but it was still statistically meaningful.
The model was also able to notice when an edit was harmful. Across eight improvement sessions:
- It submitted three edits.
- It rejected five edits.
- The edits it submitted made the model in use continue to improve.
This is important because changing weights randomly can easily damage an AI.
It reduced endless or repetitive answers
One problem with the original model was that it sometimes continued “thinking” until it ran out of available tokens instead of finishing its answer.
The model compared the internal patterns of answers that finished normally with answers that became repetitive or too long. It then made a small change to one part of its weights.
This helped it stop more effectively and solve more problems.
It repaired a damaged copy
The 27-billion-parameter model also repaired a severely damaged copy of itself.
Before repair, the damaged copy solved almost none of the test problems. After the repair, it reached about 33% accuracy on one text evaluation, compared with 58.5% for the original undamaged model.
The model found that one matrix—a large table of numbers inside one layer—contained unusually large values. It reduced the extreme values rather than copying the original values back.
This shows that the model did not simply restore a backup. It found a practical way to reduce the damage.
The repair worked on image tasks too
The repair was discovered using text and math problems, but it also helped the model perform image-related tasks that it had not seen during the repair process.
On one image interface task called ScreenSpot-v2:
- The damaged model scored 0%.
- The repaired model scored 89%.
- The original model scored 93%.
This suggests that the repair fixed a general problem in the model rather than improving only one narrow kind of question.
Self-rewriting appeared only in the largest model
The smaller models did not succeed:
- The 2-billion-parameter model made no useful edit.
- The 4-billion- and 9-billion-parameter models made harmful changes or had to withdraw them.
- Only the 27-billion-parameter model successfully improved and repaired itself.
The researchers suggest that larger models may be better at understanding their own internal activity, planning useful experiments, and learning from the results.
5. Why are these results important?
Normally, there is a strong separation between:
- Training, when an AI’s weights are changed.
- Inference, when the trained AI is simply used.
This paper suggests that a capable model may be able to do both. It can use the model, study its behavior, and then modify itself without going through a full training process.
The possible advantages are:
- Improvements could remain in the model’s weights.
- The improved model would not need extra thinking time for every answer.
- Small improvements might be made without a huge training computer system.
- A model could potentially repair certain kinds of hardware or software damage.
- AI systems might become better through repeated cycles of testing and improvement.
This idea is related to recursive self-improvement, where an AI improves itself and then uses the improved version to make further improvements.
6. Important limitations and concerns
The findings are interesting, but they do not mean that AI can freely redesign itself in every situation.
The experiments were limited in several ways:
- They used one model family and one main type of task.
- The model had only a limited number of attempts and computer operations.
- The improvements were relatively small for ordinary self-improvement.
- Smaller models failed, sometimes damaging themselves.
- The researchers controlled which parts of the weights could be changed.
- The model still needed carefully designed tests and a framework that prevented unsafe operations.
There is also a safety concern. If a model changes itself without strong checks, it might accidentally become worse, less reliable, or behave in unexpected ways. Future systems would need ways to test, approve, undo, and monitor self-made changes.
Conclusion
The paper presents evidence that a sufficiently LLM can examine its own mistakes, rewrite parts of its internal weights, test the result, and sometimes become better. The 27-billion-parameter model improved its accuracy on new problems, reduced repetitive answers, and repaired a damaged copy of itself.
The main idea is like a robot that can inspect its own parts, figure out what is wrong, make a repair, and keep the repair if it works. The research is an early step toward AI systems that can learn and improve during use rather than requiring a completely new training process every time. However, the technique is still limited, works only for the largest model tested, and needs careful safeguards before it could be used widely.
Practical Applications
Immediate Applications
The results support controlled, experimental deployment rather than unsupervised self-modification in production. The demonstrated 27B model improved on held-out problems, but smaller models often made no edit or damaged themselves, and the experiments used synthetic corruption and primarily mathematical evaluation.
- Automated model-health diagnostics and repair for deployed LLMs — Software infrastructure, cloud AI, edge AI
- Run a frozen model on a diagnostic set, inspect activation statistics and weight distributions, identify anomalous matrices, and propose bounded repairs such as outlier clipping.
- This could help recover models affected by memory errors, corrupted checkpoints, numerical instability, or accidental parameter overwrites without restoring the entire model.
- A practical tool would be a
model-repairservice that compares layer statistics, generates candidate patches, and evaluates them using paired tests before deployment. - Dependencies: reliable checkpoint access, hardware or memory faults that resemble the tested corruption, representative diagnostic data, and an immutable backup for rollback. The paper only demonstrates recovery from a deliberately corrupted weight block, not arbitrary real-world failures.
- Self-debugging inference systems for repetitive or non-terminating generation — Conversational AI, coding assistants, customer-service systems
- A model can compare successful and failed generations, identify hidden-state directions associated with repetition or excessive token use, and apply a small weight edit to reduce those behaviors.
- This could be integrated into an offline maintenance workflow that periodically analyzes production failures and proposes a revised checkpoint, reducing token waste and latency.
- Potential products include an inference-monitoring dashboard that detects looping, token-limit exhaustion, and abnormal activation patterns, then launches a bounded self-rewriting session.
- Dependencies: access to representative failure examples, task-specific grading, safeguards against trading verbosity for incorrectness, and statistically valid held-out tests.
- Low-cost post-deployment model adaptation without gradient training — Enterprise software, on-premises AI, specialized assistants
- Organizations could use the model’s own failure logs and graded examples to generate small, persistent weight edits rather than undertaking a full fine-tuning run.
- This is especially relevant where GPU access, training pipelines, or data-export permissions are limited.
- A possible workflow is: collect failures → create a private practice set → let the model propose several edits → evaluate on reserved examples → approve or reject a new checkpoint.
- Dependencies: the model must be sufficiently capable of reasoning about its architecture; the task must have an automatic or human grading mechanism; and the edit must be isolated from sensitive or safety-critical behavior.
- A/B testing and checkpoint governance for self-generated edits — MLOps, model evaluation, responsible AI
- The paper’s paired-test procedure can be used as an operational gate: run base and edited models on identical inputs and random seeds, measure wrong-to-right and right-to-wrong changes, and retain an edit only if predefined criteria are met.
- This could become a standard component of model registries and continuous evaluation systems.
- Useful controls include immutable base checkpoints, edit provenance, activation-difference logs, rollback, confidence intervals, and evaluation on unseen data.
- Dependencies: held-out data must remain inaccessible to the editing session; repeated testing must avoid overfitting; and acceptance thresholds must account for safety, calibration, fairness, and regression risk, not only accuracy.
- Research platforms for studying non-gradient model editing — Academia, AI safety, machine learning research
- Researchers can reproduce the session structure: weight inspection, hidden-state reading, code-based edits, paired evaluation, and withdrawal of unsuccessful changes.
- The framework provides a practical testbed for studying whether models can diagnose internal failure modes and produce low-rank or localized modifications without an optimizer.
- Immediate research tools could include libraries for constrained tensor editing, activation-difference analysis, edit sandboxing, and automated held-out evaluation.
- Dependencies: reproducibility across model families, transparent access to weights and internals, standardized benchmarks, and careful separation between model-generated hypotheses and experimentally validated improvements.
- Automatic screening of damaged or anomalous model replicas — Model serving, distributed systems, robotics
- A model could inspect a replica that performs abnormally, locate unusually large weights or exploding activations, and suggest whether the replica should be repaired, quarantined, or replaced.
- In distributed serving, this could reduce downtime by identifying a faulty shard or checkpoint before operators rebuild the full model.
- Dependencies: failures must produce detectable statistical signatures; model weights must be writable in a secure sandbox; and automated repair must never replace forensic logging or human approval for critical systems.
- More efficient inference through persistent behavioral corrections — Cloud computing, energy efficiency, high-volume API services
- Edits that reduce repetition or premature token-limit exhaustion can lower average output length and therefore inference cost, latency, and energy use.
- Unlike test-time reasoning or repeated self-refinement, the paper’s claimed benefit is paid during the edit session rather than on every future answer.
- Dependencies: reductions in token use must not reduce answer quality; gains must persist across workloads and sampling settings; and the cost of the editing session must be lower than the expected serving savings.
Long-Term Applications
These applications require substantially more validation because the experiments involve one open model family, limited tasks, synthetic damage, and relatively small numbers of editing sessions.
- Self-maintaining language-model services — Cloud AI, enterprise IT, autonomous software operations
- A deployed model could continuously collect graded outcomes, diagnose recurring errors, test candidate weight changes, and promote only statistically supported edits.
- Over time, this could create a model that improves from operational experience without repeated full pre-training or post-training runs.
- A production architecture would require a separate “shadow” copy for experimentation, a frozen production checkpoint, staged rollout, automatic rollback, and independent safety evaluation.
- Dependencies: reliable outcome labels, protection against feedback loops, resistance to data poisoning, stable task distributions, and evidence that sequential edits do not accumulate hidden regressions.
- Self-repairing AI agents and robots — Robotics, autonomous vehicles, industrial automation, space systems
- A robot or embodied agent could detect abnormal behavior, use internal activations and performance tests to localize a damaged model component, and restore useful operation without downloading a complete replacement.
- The cross-modal result—repair discovered on text tasks transferring to image benchmarks—suggests the possibility of repairing shared representations rather than individual task heads.
- In remote or bandwidth-constrained environments, such as spacecraft or offshore equipment, local repair could be valuable.
- Dependencies: real hardware faults are more complex than synthetic row corruption; safety-critical systems need formal guarantees; sensors and actuators can also fail; and a damaged model may not be trustworthy enough to diagnose itself.
- Continual learning through weight-space experience accumulation — Personal assistants, adaptive education, healthcare support
- Instead of storing all adaptation in prompts, retrieval databases, or external agent code, a model could consolidate recurring improvements into its weights.
- A personal assistant might learn stable user preferences; an educational tutor might improve explanations for a curriculum; a clinical support model might adapt to institution-specific workflows.
- Dependencies: strict privacy and consent controls, prevention of catastrophic forgetting, separation of user-specific from general knowledge, auditability, and safeguards against encoding incorrect or biased feedback.
- Domain-specialized models maintained by non-expert organizations — Finance, legal technology, healthcare, education
- Hospitals, schools, or businesses could operate a capable open model and periodically let it propose small domain-specific edits from locally graded examples, avoiding transmission of sensitive data to a central training provider.
- Potential products include private “self-maintaining” checkpoints for clinical documentation, financial analysis, coding, or instructional feedback.
- Dependencies: domain experts must validate edits; local data must be representative; regulatory requirements may require reproducible training records; and improvements on local tasks may harm general performance or fairness.
- Recursive self-improvement loops — Advanced AI research
- The paper provides an initial mechanism for a model to diagnose failures, modify its own weights, test the result, and repeat the process across sessions.
- A more advanced system could generate increasingly effective edits, design better evaluation tasks, improve its own editing procedures, and potentially modify broader parts of its architecture or toolchain.
- This is the clearest long-term implication of the work, but it is not established by the reported experiments: the observed gains are modest, model-dependent, and obtained under constrained tasks.
- Dependencies: robust capability evaluations, anti-hacking measures, independent oversight, limits on edit scope, secure execution environments, and mechanisms ensuring that “improvement” does not merely exploit weaknesses in the grading process.
- Self-optimizing multimodal and tool-using agents — Software engineering, GUI automation, robotics
- An agent could use failures from code execution, image understanding, or GUI interaction to modify shared internal representations and improve across several modalities.
- For example, a coding agent might reduce repetitive reasoning, a GUI agent might repair degraded visual-action behavior, or a multimodal assistant might correct a shared representation responsible for errors in both text and images.
- Dependencies: multimodal held-out benchmarks, reliable outcome verification, safe access to executable code and tools, and evidence that cross-modal transfer is not specific to the tested model architecture.
- Autonomous model optimization for energy and latency — Data centers, edge computing, green AI
- A model could rewrite weights to reduce unnecessary reasoning, shorten outputs, or improve accuracy at a fixed token budget, thereby optimizing the accuracy–latency–energy trade-off.
- Future systems might jointly evaluate quality, cost, memory use, and carbon intensity when deciding whether to retain an edit.
- Dependencies: hardware-aware benchmarks, stable performance across workloads, accurate energy measurement, and safeguards against optimizing computational cost at the expense of reliability.
- Policy and standards for self-modifying AI systems — AI governance, auditing, cybersecurity
- The paper motivates new governance requirements for models whose deployed parameters can change after release.
- Policies could require versioned weight snapshots, cryptographically signed edits, independent held-out evaluations, edit logs, incident reporting, and explicit authorization for self-modification.
- Regulators and standards bodies may need to distinguish ordinary prompt or retrieval updates from persistent changes to model weights.
- Dependencies: technical standards for comparing checkpoints, interpretable edit provenance, enforceable audit access, and agreement on acceptable risk thresholds for different sectors.
- Daily-life adaptive assistants with persistent behavioral improvement — Consumer software and accessibility
- In the distant term, assistants could become better at a user’s preferred communication style, accessibility needs, recurring workflows, or household routines through validated weight updates rather than repeated prompting.
- A user-facing product might offer “propose,” “preview,” and “undo” controls for model changes, with separate private and general-purpose profiles.
- Dependencies: explicit user consent, transparent explanations of changes, easy rollback, protection against manipulation by other users, and assurance that personalization does not degrade factuality or safety.
Glossary
- Ablation study: An experiment that removes or isolates components to determine their individual contribution. “\noindentIt found the cause: the repair comes from the matrix it named.”
- Activation explosion: A condition in which neural-network activations grow to abnormally large values. “This suggests corrupted weights in early layers causing activation explosion.”
- Attention block: The transformer component that computes relationships among tokens and produces attention-based representations. “each layer writes into it through two output matrices, one of its attention block and one of its MLP.”
- Benchmark: A standardized dataset or task used to evaluate a model. “The repair also restores the copy on image tasks it never saw, to 83\% of the base model's accuracy.”
- Corrupted weights: Model parameters whose values have been altered so that the model’s behavior is degraded. “it locates the corrupted matrix and repairs it”
- DeltaNet: A linear-attention architecture that updates a recurrent state rather than computing full pairwise token attention. “Qwen3.5 2B, 4B, 9B and 27B, whose layers mix Gated DeltaNet linear attention”
- Embedding: A learned numerical representation that converts discrete inputs such as tokens into vectors. “It refuses edits to the input embedding, the last normalisation and the output layer”
- Forward pass: A computation that produces a model output from an input without updating parameters. “it runs only forward passes, as serving does”
- Gating parameters: Parameters that control how information is selectively admitted, suppressed, or combined within a neural-network component. “The gating fixes made it worse. Let me revert to just the clipping edits”
- Gated linear attention: An attention mechanism that combines linear-attention computation with learned gates controlling information flow. “whose layers mix Gated DeltaNet linear attention with full attention”
- Gradient: The derivative of an objective with respect to model parameters, commonly used to update neural-network weights during training. “No gradient with respect to is computed”
- HallusionBench: An image benchmark designed to evaluate visual hallucination and image-grounded reasoning. “the first of MMStar, HallusionBench, POPE and ScreenSpot-v2”
- Held-out data: Evaluation examples withheld from model development or editing. “Its own edit makes a 27B model 6.6 points more accurate on 490 problems it never saw”
- Hidden state: An internal vector representation produced by a neural network for a token at a particular layer. “or to read its hidden states.”
- Inference: The process of using a trained model to generate predictions or responses. “Unlike test-time scaling, self-rewriting writes its gain into the weights”
- Linear attention: An attention formulation whose computational cost scales more favorably with sequence length by avoiding full token-by-token attention matrices. “The 27B model's repair on six image benchmarks it never saw”
- LLM: LLM, a neural network trained on extensive text data to process and generate language. “that a LLM can do this to itself”
- MLP: Multilayer perceptron, a feed-forward neural-network subcomponent consisting of learned linear transformations and nonlinearities. “each layer writes into it through two output matrices, one of its attention block and one of its MLP.”
- Model editing: The targeted modification of a model’s parameters to change its behavior without fully retraining it. “A frontier model has been shown to edit the weights of a much smaller one”
- Normalization: A neural-network operation that rescales activations to stabilize computation. “It refuses edits to the input embedding, the last normalisation and the output layer”
- Optimizer: An algorithm that updates model parameters to minimize a training objective, typically using gradients. “Gradients and optimizers are blocked”
- Outlier clipping: Replacing unusually large parameter values with bounded values to reduce their influence. “Repair method: Clipped values exceeding 15\texttimes{} the median absolute value to 15\texttimes{} median.”
- Paired test: An evaluation in which two model conditions answer identical examples using identical random seeds, enabling direct comparison. “When generate runs both weights, the unedited and the edited model answer the same problems with the same seeds”
- Permutation test: A statistical test that estimates significance by repeatedly rearranging labels or paired observations. “own task and held-out (permutation)”
- POPE: A benchmark for evaluating object hallucination in vision-LLMs. “the first of MMStar, HallusionBench, POPE and ScreenSpot-v2”
- Prompt engineering: The deliberate design or optimization of prompts to influence a model’s behavior. “with no larger model, no harness or prompt engineering”
- Rank-one update: A parameter modification expressible as the outer product of two vectors, thereby having matrix rank one. “It is a small, rank-one change, better in every test the model runs of it”
- Recursive self-improvement: A process in which a system improves its own capabilities and uses those improvements to make further improvements. “a first step toward the loop that recursive self-improvement”
- Residual stream: The sequence of hidden representations passed between transformer layers through residual connections. “the ``residual stream'' the hidden state passed from layer to layer”
- ScreenSpot-v2: A benchmark testing whether a vision-LLM can identify and interact with targets in graphical user interfaces. “and on ScreenSpot-v2 from 0\% to 89\%”
- Self-rewriting: The process by which a model modifies its own weights using its own reasoning rather than external training. “We call this self-rewriting: the model is its own optimizer.”
- Serving: Running a trained model to produce outputs for users or applications. “it runs only forward passes, as serving does”
- Sign test: A nonparametric statistical test based on the number of positive and negative paired differences. “repair (sign test).”
- Standard deviation: A measure of the dispersion of numerical values around their mean. “with the MLP output matrix of one layer and the standard deviation of its entries”
- Test-time scaling: Increasing inference-time computation, sampling, or deliberation to improve model performance without changing model weights. “Unlike test-time scaling, it adds no computation per answer”
- Tensor: A multidimensional array of numerical values used to represent neural-network parameters or activations. “one tensor for each name ”
- Token budget: The maximum number of generated tokens permitted for a model response. “Every size works at a budget of 16{,}384 tokens per answer.”
- Transformer: A neural-network architecture based primarily on attention mechanisms for processing sequences. “the model reads its hidden states”
- Weight matrix: A matrix of learned numerical parameters that transforms activations within a neural network. “The MLP output matrix of layer 30 holds a weight 1397 times its median”
- Weights: Learned numerical parameters that determine a neural network’s computations and behavior. “A LLM can rewrite its own weights to make itself better”
- Zero-shot transfer: Performance on a task or modality that the model or editing procedure did not directly encounter during development. “the repair also restores the copy on image tasks it never saw”






