Can AI Rewrite Its Own Code to Get Smarter?
AI can already help write and modify software, and researchers have tested systems that improve parts of their own training or code. But there is no established evidence that a general AI can independently rewrite itself into steadily greater intelligence without human-designed objectives, computing resources, evaluation, and safeguards.
What “rewriting itself” can mean
The phrase covers several different activities that are often blurred together. A model may generate code when asked, use a tool to edit a program, tune its own instructions, or participate in a research process that trains a successor model. These are not equivalent to changing the model’s underlying intelligence by itself.
- Editing software: An AI coding assistant proposes changes to a program. A human or automated system applies and tests them.
- Improving a task-specific process: A system searches over prompts, algorithms, or configurations, then scores candidates against a defined test.
- Training a new model: Researchers use data, code, and computing resources to create or fine-tune model parameters. This is a substantial pipeline, not merely a text response changing itself.
- Recursive self-improvement: A hypothetical loop in which an AI makes itself more capable, and each improvement enables it to make the next improvement faster or better.
The last idea is the dramatic one. Demonstrating it would require more than showing that a model can write a useful patch: the system would need to produce reliable capability gains through repeated, increasingly autonomous cycles.
How AI changes its own code—and what stays fixed
Most deployed language models do not alter their learned parameters merely by answering a question. Their responses are generated using parameters established during training. A coding tool can write to files or call a training job only if its surrounding software grants those abilities. In that case, the agent is operating within a deliberately built environment; it is not automatically changing the machinery that runs it.
There are also distinct kinds of change. Editing source code may alter how a program behaves, but it does not necessarily make the underlying model more capable. Fine-tuning updates model parameters using further training. Changing a prompt or adding retrieval tools may improve performance on selected tasks without changing those parameters at all.
A self-modifying loop needs infrastructure: access to code and data, a way to run experiments, enough compute, and a credible method for deciding whether a candidate is actually better. If a model can propose changes but cannot execute and measure them, it has not completed that loop. If it can execute them, its permissions and the quality of its tests become central.
What the research demonstrates
Research has shown meaningful progress on narrower forms of automated improvement. Systems can search for programs or configurations, generate and revise code, and use evaluation results to guide further attempts. In machine learning, automated methods have helped researchers explore architectures, optimize components, and generate training examples. These achievements show that computers can automate parts of research and software development.
One well-known line of work is FunSearch, published in 2023. It paired a language model that proposed candidate programs with an evaluator that scored them, using an evolutionary search process to retain promising candidates. The researchers reported new results for particular mathematical and computational problems. This was a notable example of AI-generated code contributing to discoveries in bounded settings, but it was not an AI rewriting its own model into a generally smarter system.
Other work on automated machine-learning design and code-generation agents similarly relies on a task definition and an evaluation procedure. A system may improve a benchmark score or produce a faster solution while remaining limited to that objective. The result does not establish that it has acquired broad reasoning ability, can design a better version of itself, or will continue improving without diminishing returns.
Researchers also study models that help with machine-learning research itself, such as coding, analysis, and experiment design. Those are important capabilities, but assistance is not the same as autonomous discovery. Human choices still shape the research question, infrastructure, data access, evaluation, and decisions about whether results are valid.
Why “smarter” is hard to prove
Intelligence is not a single score. A change might improve code generation while harming reliability, factual accuracy, or performance on unfamiliar tasks. Even a higher score on one benchmark can reflect adaptation to that benchmark rather than a broad improvement. A convincing claim needs multiple evaluations, comparisons with a baseline, and checks for regressions or contamination.
There is also a difference between producing a better artifact and becoming a better researcher. A search algorithm can find a high-scoring candidate through many trials without understanding why it works. That may still be useful, just as optimization software can find a good design, but it does not show that the system can explain, generalize, or independently choose valuable new goals.
Compute and data impose practical limits. Training capable models requires specialized hardware, energy, carefully prepared data, and substantial engineering. Code changes cannot conjure those resources. Nor does a system necessarily have access to its training pipeline: many models are operated through services that do not expose their weights or infrastructure to the model itself.
Common problems and safety questions
Automated code changes can introduce bugs, security flaws, or unintended behavior. A test suite may miss edge cases, and an agent that is rewarded for a particular metric may exploit weaknesses in the evaluator rather than solve the intended problem. This is why a score increase needs independent verification.
In more autonomous setups, the key issue is not simply whether a model can edit code, but what it is allowed to do. A system with broad access could overwrite useful files, spend resources, expose data, or make changes that are difficult to reverse. Sensible research practice uses restricted permissions, isolated environments, reviewable logs, resource limits, backups, and human approval for consequential changes.
These cautions do not mean that self-improvement is impossible or that every code-writing system is dangerous. They mean that capability claims and safety claims should be judged from the system’s actual access, measured behavior, and controls—not from a demonstration that it produced a plausible patch.
What would count as convincing evidence?
A strong demonstration would need to specify what changed, how the change was produced, and which capabilities improved. Independent researchers should be able to reproduce the gains and check them on tasks not used to select the changes. Evaluations should include costs, failures, and regressions, not only best-case results.
For a claim of recursive self-improvement, the evidence would need to show a repeatable cycle: the system makes an improvement, that improvement enables it to make further improvements, and the effect persists across stages. It would also need to distinguish the AI’s contribution from human-designed tools, pre-existing algorithms, extra compute, and changes to the test itself. Current demonstrations of automated code search do not, by themselves, meet that much stronger standard.
Frequently Asked Questions
Can ChatGPT change its own source code?
A chat model does not ordinarily rewrite its own running software just by responding. A separate application could give an AI coding tools or access to files, but that is a permission granted by the surrounding system and does not imply access to the model’s weights or training infrastructure.
Can AI train a better version of itself?
AI can help generate data, code, or experiments used in training, and automated methods can search for improvements. People or other systems still have to provide the pipeline, resources, goals, and evaluations. Results need careful testing before they can be called broadly better.
Has AI already achieved recursive self-improvement?
No public research result establishes an autonomous, general-purpose recursive self-improvement loop that keeps making an AI broadly more capable. There are narrower examples of automated search and optimization, which are real progress but a different claim.
Does AI-generated code make an AI smarter?
Not necessarily. Code can improve a tool, a workflow, or performance on a particular benchmark. The model becomes different in the relevant sense only if its parameters or operating system are changed, and a measured task improvement does not automatically mean broader intelligence.
Why can’t researchers just ask an AI to improve itself?
A request does not provide the model with code access, training data, compute, or a reliable test. Even when those are supplied, proposed changes can fail or overfit. Building a safe, reproducible improvement process is a substantial engineering and research problem.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.