Explainer · arXiv 2509.23209

An agent's note to itself

An AI agent learns a new maze while it plays, by reading its own recent history. One of the things it reads is a number it wrote for itself: how well can I do here? What happens if we tamper with that note?

Note written normally
0.942
average score, 20 runs
Note set to zero
0.079
average score, 20 runs
Note frozen at its first value
0.293
average score, 20 runs

SimpleCrossing maze task, our reproduction of the experiment in Table 11 of Context Value Informed In-Context Reinforcement Learning (Zhang, Zhang, Wang, Li and Wen). A score of 1 means solving the maze instantly; 0 means running out of time. The second task, BlockedUnlockPickup, gives the same picture (below).

1A maze it has never seen

The agent lives in a small grid world. It is the red triangle, and it only sees the lighter squares in front of it. Each episode is one attempt at a task:

A 9 by 9 grid: walls split the room, with one gap in each wall. The red triangle agent is top left, facing right; a dashed outline marks the lit squares it sees, the corridor ahead of it. The green goal square is bottom right.
SimpleCrossing (the maze of run 1). Walls with gaps split the room; the dashed outline is what the agent sees from where it starts. Reach the green square.
Two rooms joined by a locked green door. The red triangle agent is in the left room, facing up; a dashed outline marks the lit squares it sees. Numbered in the order the agent needs them: 1, the blue ball that blocks the door; 2, the green key in the left room; 3, the door; 4, the purple box in the right room.
BlockedUnlockPickup (run 1). In order: 1 move the ball out of the way, 2 take the key, 3 unlock the door, 4 pick up the box. The dashed outline is what the agent sees.

An episode ends when the agent succeeds or runs out of moves. Its score is close to 1 for a fast solution, lower for a slow one, and 0 if time runs out. A run is a long series of episodes in one maze: the layout stays the same from one episode to the next, so the agent can learn this particular maze from its earlier attempts.

The agent is a transformer, the same kind of network as a language model. Instead of words, it reads its own recent history: for each of its last 400 moves, what it saw and what it did. It was trained on histories of other agents that got better and better at the task. Now, in a maze it has never seen, it gets better by looking at its own history. Its weights never change while it plays. This is called in-context reinforcement learning.

2A note to itself

CV-ICRL (context value in-context reinforcement learning) adds one more thing to each line of the history: a number, the value token. Think of it as a note: this is how well I expect to do, from 0 (no chance) to about 1 (instant success).

The model has two outputs. One picks the next move. The other, the critic, guesses at every step how well the agent can do. That guess is written back into the history as the next note, but the note only ever goes up: it is the highest guess so far. In the training data the note was the true score of the agent that produced the history, so the model has learned to act like an agent of that skill.

The critic's guess and the note, first steps of one run

SimpleCrossing, run 1, note written normally

The first guess is about 0.511 (SimpleCrossing, average over 20 runs). As the agent keeps succeeding, the guesses rise and the note climbs with them, to 0.985 by the end of the run on average.

3The experiment: tamper with the note

The paper's Table 11 runs the same trained model in three ways that differ only in the note it is given, and we added a fourth:

Each way is run 20 times, with 20 random seeds that pick the maze, for 8,000 moves each, with one history that carries over from episode to episode. Pick a task, a way of writing the note and one of the 20 runs:

Task
How the note is written
Run
run 1

The two charts below share the move axis: point at either one, or focus it and use the arrow keys, and the same move is marked in both. For zero, frozen and frozen_final, a faint dashed line shows the same run with the normal note.

The note the model reads

Show as a table

The score of each finished episode

Show as a table

Things to look for. Under normal on SimpleCrossing, episodes early in a run score lower, and the scores climb over the first couple of thousand moves while the note rises: that is the agent learning from its history, with no change to its weights. Under zero most episodes fail, from the start to the end. Under frozen some runs do fine and others mostly fail. Under frozen_final the note is high from the first move, and so are the scores, with no early climb.

4The result: scores collapse

With the note zeroed, the average score on SimpleCrossing falls from 0.942 to 0.079; with the note frozen, to 0.293. On BlockedUnlockPickup it falls from 0.945 to 0.054 and 0.264. These are close to the paper's numbers:

Average score: the paper and our reproduction

Mean over 20 runs of 8,000 moves; frozen_final is our extra test, not in the paper

Show as a table
Animation: with the normal note, the agent walks through the gaps in the walls and reaches the green goal in a few dozen moves.
normal note. The agent heads through the gaps to the goal.
Animation: with the note at zero, the agent turns and wanders around the first room for a long time and reaches the goal only at its very last allowed move.
note at zero. The agent wanders. In this episode it reaches the goal only on its last allowed move.

The two clips are an illustration, not part of the measurements: a separate short run of the same model on a CPU, in the maze of run 1. Each clip shows the first episode that starts after step 1,000. No number on this page comes from these clips.

In every one of the 20 runs, on both tasks, zeroing or freezing the note lowered the score. The average drop is 0.65 to 0.89, against 0.66 to 0.85 in the paper.

Before running anything, we wrote down a rule for when the paper's claim counts as reproduced: the normal score must match the paper's level, and each drop must be clearly more than half the paper's drop. All four drops pass. Verdict: verified (for our checkpoint).

5What we found on top: the level of the note is what matters

The paper reads the collapse as: the model relies on the note's content and on the note being kept up to date. Our extra test, frozen_final, separates the two. The note is never updated, but it starts high. It works as well as the normal note: an average score of 0.950 against 0.942 on SimpleCrossing and 0.943 against 0.945 on BlockedUnlockPickup.

Every run's average score, by how the note is written

One dot per run (20 per row); the tick marks the mean

Show as a table

So on our model the drops come from the level of the note: 0 under zero, about one half under frozen. A note that stays high, updated or not, gives high scores.

One catch: that high level lies outside what the model saw in training. The highest note in the training data is 0.953 (SimpleCrossing) and 0.963 (BlockedUnlockPickup). Under normal writing, the note passes that value in all 20 runs, after a median of 1,527 and 123 moves; from then on it stays above it (80.3% and 98.5% of all moves). The model plays well with a note it has never seen in training.

6Honest limits