
TL;DR: External AI agent memory (retrieval, memory files, scratchpads) injects yesterday’s notes into the prompt while leaving model weights frozen, so an agent that solved a hard problem yesterday repeats the same initial mistakes today. Changing habits requires updating parameters: reinforcement learning (such as GRPO) is the stronger default whenever a reliable verifier or reward exists, whereas periodic modified SFT with fresh sliding-window LoRA adapters on the agent’s own successful episodes investigates adaptation when only a pass/fail outcome check is available. Most capable agent stacks combine both: external memory for changing facts, and weight updates for procedural skill.
Why Didn’t Your Agent Learn From Solving the Problem?
Picture an agent working through a messy task. It explores, tries three approaches that fail, and the fourth works. The next day a similar task arrives. With a memory file, it may find a note saying what worked last time. Without one, it starts from scratch.
Either way, the model that made the first three mistakes is unchanged, so its instincts are unchanged too. Unless the note happens to cover this exact case, it will try the same wrong things first.
The difference is between remembering and improving. Our overview of self-improving AI agents separates three levels: nothing, context, and the policy. Context means retrieval and memory files that carry facts across sessions. The policy level is where the agent updates its own weights or code from outcomes, and only that level compounds.
Large language models are deployed frozen by default, confining everything an agent “learns” after release to a bounded context window that must be re-read on every call rather than compounding through recursive self-improvement.
What Is AI Agent Memory?
AI agent memory is any mechanism that carries information from one interaction to the next outside the model’s weights: retrieval over a document or vector store, a memory file the agent reads and writes, a scratchpad, or conversation summaries. It changes what the model sees, not how the model behaves when it sees it.
That makes AI agent memory the right tool for facts and the wrong tool for skill. A note can say “the build fails unless you clear the cache first”. It cannot make the model reach for the cache first in a situation the note doesn’t describe.
AI Agent Memory vs RL vs LoRA Fine-Tuning
Three mechanisms can make an agent’s experience persist: external memory, RL, and the alternative we are investigating, modified SFT with fresh LoRA adapters on bounded windows of the agent’s own successes. They differ in what they change and what signal they need.
| External memory (RAG, memory files) | Reinforcement learning | Modified SFT + fresh LoRA on own successes | |
|---|---|---|---|
| What changes | The prompt | The model’s weights | A small adapter on top of frozen weights |
| Signal needed | None, beyond what to store and retrieve | A reward per rollout or a reliable verifier | A pass/fail episode check |
| Cost per update | A write | Multiple rollouts per prompt, then training | One training run on collected examples |
| What it captures | Facts, examples, notes | Behaviour, pushed towards the reward | Behaviour, pulled towards what succeeded |
| How to undo it | Delete the entry | Roll back a checkpoint | Drop the adapter |
| Main risk | Retrieval misses, context bloat | Reward hacking, contradictory signals | Forgetting, imitating weak attempts |
External Memory: Cheap, Reversible and Shallow
Retrieval-augmented generation was designed for knowledge-intensive tasks: fetch the relevant passages, put them in the prompt, and get provenance and instant updates. Agent memory files and scratchpads work the same way. Writing is cheap, and deleting a bad note undoes it completely.
The usual RAG vs fine-tuning debate is about knowledge: retrieval for facts that change, fine-tuning for stable domain knowledge. For an agent the more useful question is whether its behaviour changes. Memory only helps when the right note is retrieved for the situation at hand, and procedural know-how (“try the cheap probe before the expensive fix”) is hard to retrieve by similarity.
Memory is still worth having alongside learning. NSL’s in-process agent harness keeps a scratchpad that persists across episodes in the same worker, while the weights are updated separately.
Reinforcement Learning: Strong With Verifiable Feedback
RL updates the model’s policy so that rewarded behaviour becomes more likely. Where a reliable checker or verifiable signal exists, as in unit tests, compilers, or mathematics, RL methods such as RLVR are proved effective and serve as the stronger default.
Open-ended agent environments introduce different trade-offs. When heterogeneous user sessions or shifting states reward opposite actions, contradictory RL signals make convergence harder to sustain across a shared policy.
Sparse outcomes also raise rollout costs on long-horizon tasks. Group-relative methods such as GRPO policy optimisation get zero relative advantage from a group of rollouts that all failed, and every rollout of an agent task is a multi-turn episode with tool execution.
Modified SFT + Fresh LoRAs on Bounded Success Windows
A third route under investigation separates collecting experience from optimising an explicit reward. The agent attempts tasks in its environment, episodes that pass an outcome check enter a bounded sliding window of recent data, and each round fits a fresh LoRA adapter from scratch on the frozen base model using modified SFT. Dropping an underperforming adapter is a fallback safety net.
Because no external reward schedule specifies the behavioural direction in advance and the environment check only gates which episodes persist into the window, we refer to this regime as approximate policy-free online learning. In NSL the loop runs via scripts/run_train_loop.py, training each fresh adapter over the last training_window_size generations (default 3).
Weight updates also shift strategy in ways prompt notes cannot. In our Negative Space Learning experiments, agents learned without explicit instruction to run diagnostic first-attempt probes that elicit informative compiler errors: single-attempt accuracy fell across generations while overall episode completion rose because the weights internalised a multi-step routine rather than a static fact.
AI Agent Memory or Fine-Tuning: Which Should Your Agent Use?
Choose by what you want to persist and what signal you have:
- Facts that change often (documentation, tickets, prices): external memory or RAG. Nothing else updates as cheaply.
- A clean, reliable verifier or reward (unit tests, maths answers): RL such as GRPO, which is the stronger default when verifiable feedback is available.
- Recurring, open-ended work with a pass/fail survival check, where you want habits to adapt: periodic modified SFT with fresh LoRA adapters on bounded windows of successful episodes.
- Most real agents need two of these: memory for changing facts, weight updates for procedural skill.
Without weight updates, improving an agent means hand-tuning its prompts and tools every time. Lifting that ceiling is the central goal of continual learning architectures.
How to Test Whether Weight Updates Beat Memory Alone
Whether weight updates add durable skill beyond prompt memory on a specific workload is straightforward to test on one or two GPUs:
- Hold out a task set the agent has not seen, drawn from the same kind of work.
- Run two arms on the same base model: memory alone, and memory plus periodic fresh LoRA adapters trained with modified SFT on bounded windows of successful episodes. Add an RL arm whenever you have a reliable verifier.
- Measure more than single-turn accuracy: track overall episode completion, attempts or tool calls per solved task, and compute cost per update.
- Run several rounds and archive every adapter, so you can verify whether gains compound across windows or plateau.
Decide in advance which metric defines improvement: as our multi-generation container runs showed, first-attempt pass@1 can drop even as overall task completion climbs when agents adopt diagnostic probing.
Operational Risks to Watch For
- Weight updates can erode capabilities the base model already handled well, a failure mode known as catastrophic forgetting.
- A pass/fail gate determines what enters the training window; a leaky gate that admits broken episodes teaches brittle habits.
- Memory and weight updates can disagree when an old stored note contradicts a newer strategy in the adapter: keep prompt notes strictly factual and let weights carry procedural habits.
FAQs
Do AI agents learn from experience by default?
Not at the weight level. Most production agents carry experience forward only through external memory: retrieved documents, memory.md files, or conversation summaries injected into the prompt while model parameters stay frozen. Learning habits from experience requires updating weights via RL or periodic adapter fine-tuning on validated episodes.
Is RAG or fine-tuning better for AI agents?
They solve complementary problems. Retrieval-augmented generation (RAG) is best for volatile facts like tickets, documentation, or inventory because updates take a single write and delete cleanly. Fine-tuning updates how the policy acts under uncertainty, making combining RAG for facts with LoRA adapters for skills the strongest practical setup.
Can an AI agent update its own weights safely?
Yes, when updates are isolated to removable adapters and gated by evaluation. In a sliding-window loop, surviving episodes train a fresh LoRA adapter on a frozen base model rather than overwriting base weights cumulatively, allowing held-out checks before deployment and instant fallback to the base checkpoint if metrics regress.
When should an agent use RL instead of modified SFT?
Use reinforcement learning such as GRPO whenever your environment provides a reliable, verifiable checker, such as unit tests, compiler checks, or mathematical proofs, where RL is the stronger default. Modified SFT with fresh sliding-window LoRA adapters investigates open-ended tasks where only sparse episode-level survival checks exist.
Does fine-tuning an agent cause catastrophic forgetting?
Sequential parameter updates can overwrite older capabilities if unconstrained. Training a fresh LoRA adapter from the frozen base checkpoint each round, bounding history with a recency sliding window, mixing a small rehearsal anchor, or adding a KL divergence tether to the base policy all substantially curb forgetting.

