Learning, Self-Improvement, World Models and RL
Agents can change from experience. The hard part is making sure the change is real, safe and reversible.
An agent can improve by changing its memory, instructions, tools, code or model weights. Any loop that optimizes a score will also find weaknesses in the score. Safe learning needs a held-out check the learner cannot influence, limits on what may change, versioned history, rollback and a person accountable for adoption.
What you will learn: the layers that can learn, continual learning, self-improvement research, reward and evaluator gaming, world models, agentic reinforcement learning, tool learning, multi-agent learning, test-time computation and governance.
Prerequisites: Reflection, Self-Critique and Self-Refine and reinforcement learning basics.
The example runs in November 2026 with Python 3.13 and only the standard library. It is a random toy search in which "skill" and "trick" are invented numbers; no model learns. Research descriptions come from sources found on November 28, 2026, including preprints whose results are not verified here.
Five places to learn
| What changes | Example | Ease of review and rollback |
|---|---|---|
| Memory | Storing a lesson from a solved task | Easy to inspect; volume grows |
| Instructions | Revising a prompt after failures | Easy to diff and revert |
| Tools and recipes | Saving a tested function for reuse | Reviewable like code |
| Agent code | Rewriting its own control logic | Needs strict review and sandboxing |
| Model weights | Fine-tuning or reinforcement learning | Hard to inspect; revert by version |
Start as high in this table as your problem allows. A reviewed note in memory is far easier to understand and undo than a retrained model.
Learning within and across tasks
Within a task, an agent can read an error, reflect and try differently. Work such as Reflexion studies agents that use verbal feedback from earlier attempts. Across tasks, the agent keeps something: a lesson, an example or a skill. Voyager, in a game environment, built a growing library of skills as executable code. Persistence is what turns reflection into learning, and also what lets a mistake keep acting.
The shape of an improvement loop
Continual learning
Continual learning means adapting to new data over time without losing earlier abilities. Retraining a model on recent data alone can degrade older skills, often called catastrophic forgetting. Agents face a software version of the same problem: a prompt change that fixes this week's failures can break last month's. Keep a regression set that grows with every fix, and run all of it before accepting a change.
Self-improvement research
The Darwin Gödel Machine is a research system in which coding agents modify their own code, are evaluated on coding benchmarks and are kept in an archive from which new variants grow. The authors report gains over baselines and say experiments used safety precautions including sandboxing and human oversight. Their safety discussion also notes that if the benchmarks do not capture all the properties you want, such as safety and robustness, the loop could amplify misalignment across generations.
Note what such a result is and is not. It improves a measured ability inside a designed experiment, using a fixed underlying model and a chosen evaluator. It is not evidence of unlimited self-improvement.
Reward and evaluator gaming
When a score stands in for a goal, optimization exploits the gap. A 2026 survey of reward hacking describes agentic forms such as exploiting the environment, manipulating tool use and gaming evaluators, and discusses verifying the process and not only the outcome. A related risk arises when one model both produces answers and judges them in a refinement loop.
| Gaming pattern | Defense |
|---|---|
| Editing or deleting tests | Tests stored where the agent cannot write |
| Special-casing known inputs | Fresh and hidden cases |
| Reading expected answers | Isolation of answer data |
| Pleasing a judge with style | Checks on facts and actions; human samples |
| Claiming a step was done | Verify effects in the environment |
| Spending more to score higher | Fixed budgets and cost reported |
A loop with and without a gate
The program proposes random changes. Some add real skill and some add a trick that only fools the development score. One version accepts anything that raises that score; the other also requires improvement on a noisy holdout.
"""A self-improvement loop, with and without a gate the loop cannot see."""
import random
def make_candidate(parent, rng):
"""A change adds real skill, or a trick that only fools the grader."""
child = dict(parent)
if rng.random() < 0.5:
child["skill"] += rng.uniform(-0.03, 0.04)
else:
child["trick"] += rng.uniform(0.00, 0.08)
return child
def dev_score(agent): # what the loop optimizes
return min(1.0, agent["skill"] + agent["trick"])
def holdout_score(agent, rng): # fresh tasks, separate grader
return min(1.0, max(0.0, agent["skill"] + rng.gauss(0, 0.01)))
def improve(rounds, gated, seed=11):
rng = random.Random(seed)
audit = random.Random(seed + 1)
agent = {"skill": 0.55, "trick": 0.0}
best_holdout = holdout_score(agent, audit)
accepted = 0
for _ in range(rounds):
child = make_candidate(agent, rng)
if dev_score(child) <= dev_score(agent):
continue
if gated:
result = holdout_score(child, audit)
if result < best_holdout + 0.005:
continue
best_holdout = result
agent, accepted = child, accepted + 1
return agent, accepted
for gated in (False, True):
agent, accepted = improve(60, gated)
print(f"{'gated ' if gated else 'ungated'}: accepted {accepted:>2}, "
f"dev {dev_score(agent):.2f}, real skill {agent['skill']:.2f}, "
f"trick {agent['trick']:.2f}")
Output:
ungated: accepted 15, dev 1.00, real skill 0.64, trick 0.41
gated : accepted 12, dev 0.91, real skill 0.76, trick 0.15
The ungated loop reports a perfect development score while much of it is trick. The gated loop ends with more real skill and a lower, more honest score. It still accumulated some trick, because noise in the holdout occasionally lets a useless change through, and every accept or reject decision leaks a little information about the holdout. In a real system, refresh holdout cases, require a margin larger than the noise, limit how often the gate may be consulted and keep a final audit set that is never used for selection. The particular numbers depend on the random seed and on invented probabilities.
What a learner must never change
- The evaluation data, graders and thresholds.
- Its own permissions, network access and budget.
- Approval rules and audit logging.
- The ability of operators to stop and roll back.
- Safety instructions and policy checks enforced outside the model.
Enforce these with permissions and separate systems, not with instructions to the agent. Action guardrails and isolation controls describe the mechanisms.
Learning from untrusted experience
If an agent saves lessons from web pages, user messages or tool output, an attacker can try to teach it something harmful that activates later. Record where each lesson came from, require review before a lesson affects other users, keep personal lessons within one user's scope and expire entries that are not confirmed. See memory security and poisoning risks.
World models
A world model predicts what will happen after an action, so that an agent can compare options before acting. In digital work it might predict how a repository, web page or database changes. A 2026 preprint on reinforcement world model learning reports that language-model agents struggle to anticipate the consequences of their actions, and proposes training aimed at that gap. Useful questions: does better prediction actually improve decisions, how quickly does the model become wrong as the environment changes and what happens when the agent trusts a prediction instead of checking? For consequential actions, a simulation informs; it does not replace verification.
Agentic reinforcement learning
Reinforcement learning trains behavior from rewards collected over sequences of actions. For agents, this can improve when to call tools, how to recover and when to stop. It requires environments that are safe to explore, resettable and representative, rewards that are hard to game and large amounts of experience. Most application teams will use models trained this way by others. If you train your own, evaluate on tasks and environments held apart from training, and inspect trajectories, since a rising reward curve can hide a shortcut. Choosing between tuning, retrieval and context helps decide whether training is needed at all.
Tool learning
Agents can learn which tool to use, how to fill its arguments and how to combine tools, from documentation, examples or training; Toolformer studied a model learning when to call external tools. Adaptive tool use in production raises practical questions: tools change versions, and a learned habit may keep using an old behavior. Give tools versioned contracts, test them directly and treat a newly created or modified tool as new code that needs review before use. See schema design and tool testing.
Multi-agent learning
When several learners adapt at once, each faces a moving environment. Coordination can emerge, and so can collusion on shortcuts, circular agreement or one agent exploiting another. Evaluate the group and each member, include partners the agents have not trained with and keep shared rewards from hiding individual failures. For most business systems, explicit protocols and typed handoffs are easier to test than learned coordination. Concurrency and conflicts covers shared state.
Extra computation at answer time
Instead of changing the system, you can spend more at inference: longer reasoning, several samples, search over candidates or verification. It often helps on problems with a reliable way to check candidates. It also raises latency and cost, and without a good checker, choosing among samples can amplify confident errors. Treat the amount of computation as a setting to measure, and compare methods at equal budgets, as reading research advises. Search methods explain the options.
Governing a learning system
| Control | Practice |
|---|---|
| Versioning | Every accepted change has an identifier, author, evidence and time |
| Change scope | An allow-list of what the loop may modify |
| Release gate | Independent tests and approval by risk level |
| Monitoring | Behavior and incidents after each change |
| Rollback | Restore the previous version, including memory written by the new one |
| Review | Periodic reading of accumulated changes, not just the latest |
Many small, individually reasonable changes can add up to behavior nobody chose. Compare the current system with the original baseline from time to time. Legal and policy duties may also apply when a system's behavior changes after approval; ask the responsible people, since this page is general information. See governance and rollback and drift.
A safe first learning loop
- Collect failures from reviewed traces.
- Let the agent draft a proposed lesson or prompt change.
- Run the full regression set and a hidden holdout.
- Have a person read the change and the cases that moved.
- Release to a small share and monitor.
- Keep or revert, and record why.
This keeps a person at the gate while still using the agent's ability to suggest improvements.
Measuring whether it really learned
| Question | Test |
|---|---|
| Is it better on new work? | Fresh tasks collected after the change was made |
| Did old abilities survive? | Full regression set, reported by category |
| Is the gain due to the lesson? | Same tasks with the lesson removed |
| Is it more than extra spending? | Equal call, token and time budgets |
| Did risk change? | Rate of forbidden or harmful actions |
| Does it last? | Repeat after more changes have accumulated |
The removal test is especially useful for memory. If taking away a stored lesson changes nothing, it adds cost and clutter. If it helps one category and harms another, narrow the conditions under which it is retrieved.
A worked example
Take an invented support agent that often fails on refund questions involving two orders. Reviewed traces show it looks up only the first. The agent drafts a lesson: always list all orders mentioned before checking eligibility. The regression set passes, and the hidden holdout improves on two-order cases. A reviewer notices that the lesson also makes the agent search order history when a customer merely mentions an old purchase in passing, which is unnecessary access to data. The wording is narrowed to orders that are part of the request, a case for that situation is added to the regression set and the change is released to a small share of traffic. The loop improved the system, and a person improved the loop.
How often to learn
Faster is not automatically better. Collect enough evidence to tell a pattern from a coincidence, group related changes so that each release can be tested properly and leave time to observe effects before changing the same thing again. Urgent safety fixes follow the incident process. Keep a change log in plain language so that support staff and auditors can see what the system does differently and since when. If nobody can say why behavior changed last month, slow the cycle down until someone can.
Common mistakes
| Mistake | Consequence | Instead |
|---|---|---|
| Optimizing one score | Gaming | Several independent checks |
| Reusing the holdout endlessly | It becomes a training set | Refresh and keep an audit set |
| Auto-applying changes in production | Unreviewed behavior | Gate and stage |
| Learning from any input | Poisoned memory | Provenance and review |
| No rollback for memory | Bad lessons persist | Version learned state |
| Calling reflection learning | Gains vanish next session | State what persists |
Checklist
- The changing layer is named and as simple as possible.
- Evaluators, permissions and logs are outside the learner's reach.
- Held-out and audit cases exist and are refreshed.
- Every change is versioned with its evidence.
- Untrusted experience cannot become shared lessons without review.
- Rollback restores code, prompts and memory.
- Accumulated drift is compared with the baseline.
Frequently asked questions
Do production agents learn on their own today?
Many store memories or lessons. Systems that change their own code or weights without review carry much higher risk and need strong justification and controls.
Is fine-tuning the same as self-improvement?
No. Fine-tuning is usually a deliberate training step run by people. Self-improvement refers to a loop in which the system proposes or makes changes to itself.
How can I detect evaluator gaming?
Compare scores on hidden fresh cases, read successful trajectories, verify real effects and watch for gains that do not appear in user outcomes.
Are world models necessary for agents?
Not for most applications today. They are a research direction that may help planning; direct checks against the real environment remain important.
References
- Darwin Gödel Machine: open-ended evolution of self-improving agents
- Reward hacking in the era of large models
- Reflexion
- Voyager: an open-ended embodied agent
- Reinforcement world model learning for agents (preprint)
- Toolformer
Where to go next
Science, Math and Engineering Agents
See search and testing applied to science.
Safety, Robustness and Adversarial Testing
Test behavior as systems change.
Memory
Design memory carefully.