An inspection robot starts a new session. Asked where it found a defect yesterday, it reads the shift log and answers “shelf three.” Now leave the same log available but give no instruction. What would make the robot go back to that shelf? Keeping information and using it to choose what to do next are different capabilities.
Chapter 24 followed the hidden state as a model read a sentence. Here we pick up at the session boundary. Page 56 asks what carries over. Pages 57–59 trace who chooses a research task or a mathematical goal. Page 60 shows how to compute a reward that can change the next action. The worked examples distinguish illustrative numbers from results reported by researchers.
Worked examples Retrieving a memory · Delegating research · Weighting math goals · Curiosity on a repeat visit · Bits of empowerment · Predicting the action · Choosing the next shelf
Video guide by slide
| Part II page | Lecture video | Question to listen for |
|---|---|---|
| 56 | 52:22 | What survives in a file when a new session resets the hidden state? |
| 57 | 55:23 | Which parts of research, from choosing a question to editing a report, were delegated? |
| 58 | 59:07 | Where did “be good at math” come from? |
| 59 | 59:17 | What signal could let an agent choose where to explore next? |
| 60 | 1:01:49 | How does curiosity become a reward in the earlier lecture Lee recommends? |
These are spoken topic anchors. The 9:07 printed on page 60 belongs to a separate lecture recorded in 2018. NTU course schedule, May 22, 2026
#Part II, page 56 — Which memories have to be read again in a new session?
Follow H₀ → H₁ → H₂ across the top row and stop at the dotted line. The first box on the other side is H₀ again. A new session resets the runtime state in this diagram. The file in the middle row crosses that boundary. If the first session writes a record, and the next session retrieves it and places it in the input, the new H₁ can depend on what happened earlier. Both sessions share the network weights at the bottom. Lee compares the weights to genes because they change most slowly in this example. Lecture at 52:22, three timescales · 53:47, bringing a file back into context
| Layer on page 56 | What changes it? | What to check in a fresh session |
|---|---|---|
| Hidden state | The current input and the preceding state | Was any part of the previous conversation or state restored? |
| File-backed memory | A record written or edited by the agent or system | Which record was retrieved, and did it reach the input? |
| Network weights | Training or replacing a model checkpoint | Did both runs start from the same model version and weights? |
Storage and retrieval are separate events. A sorting agent can save yesterday’s shift instructions and still miss them today if its query retrieves other documents. Conversely, the original conversation can be closed and a fresh run of the same model can still use yesterday’s record when it is supplied again. To test the effect of retrieval, use the same model and question in fresh sessions and vary access to the record.
#Worked example 1. Which of three stored memories enters the new input?
Figure 6 of Park et al.’s Generative Agents asks a simulated character, Isabella, what she is looking forward to most. The candidate memories include planning a Valentine’s Day party, ordering decorations and researching party ideas. Recency depends on time since a record was last accessed. Relevance comes from the cosine similarity between the query and record embeddings. Importance is assigned when a record is created. The implementation normalizes each component to the 0–1 range and adds the three scores with equal weights of one. Park et al., 2023, §4.1 and Figure 6
Let r, i and q denote normalized recency, importance and relevance. Substituting the numbers printed in the original figure gives the following scores.
Suppose there is room for one record in this example. The party plan ranks first, 2.34−2.21=0.13 ahead of ordering decorations. The actual implementation takes as many of the highest-ranked records as fit in the available context. The 2.34 is a ranking score, not a probability of answering about the party. Turning off retrieval or access to this record in a fresh session leaves the file intact while cutting off that route for supplying the party information. Memory architecture, Figure 5 · Memory retrieval, Figure 6
#Part II, page 57 — Which part of the research did the agent choose?
Start with the robot on the right. The results already exist. Its job is to organize the material and polish the manuscript. The middle robot also plans and runs the experiment. The robot on the left can find a research question within a field. Look one step farther left, at the speech bubble. It still specifies the field in which to look for questions. Lee uses this slide to separate the ability to propose a question from the motive for starting the search. Lecture at 55:23, intrinsic motivation · 55:55, three stages of research
The lecturer introduces AlphaEvolve at the experiment-planning stage (56:09), then AI co-scientist at the question-finding stage (56:53). The person at the left supplies the research field. The first robot selects a specific question within it and passes that question to the next stage.
The input to the AI co-scientist project, which Lee mentions, makes that distinction concrete. A scientist supplies a research goal in natural language. The system generates hypotheses and proposals within that goal and compares candidates. Consider the assignment “Study why reflections make this inspection camera reject good parts.” An agent could decide whether to test lighting angle or exposure time first. The assignment already chose the field, camera inspection, and the objective, reducing false rejects. Lecture at 56:59 · Original AI co-scientist paper, 2025
#Worked example 2. If three of six experiments yield an accepted report, what fraction of assignments succeeded?
Consider ten independent, hypothetical runs of the camera assignment. Eight produce a testable question. Six of those complete an experiment. Of the six completed experiments, three pass a prespecified report review that checks the conclusions against the experimental record. A run that drops out does not proceed to the next stage.
| Stage | Runs passing this stage | Runs entering this stage |
|---|---|---|
| Propose a testable question Q | 8 | 10 starts |
| Complete an experiment E | 6 | 8 with accepted questions |
| Pass final report review R | 3 | 6 with completed experiments |
The pass rate at the last stage is 50%. The end-to-end completion rate is 30%. Multiplying the conditional fractions uses the progressively smaller denominators and requires no independence assumption between stages. These counts measure the ability to finish a sequence of tasks under a given research objective. The origin of that objective is a separate observation. A person supplied it in all ten runs.
#Part II, page 58 — How does “be good at math” become a score?
The goal in the middle of the slide is labeled H. The model on the right is labeled L(Aθ,H). Here Aθ is the agent with parameters θ, H represents human-provided goals or information, and L is a loss under those conditions. A proposer can pick hard questions on its own while someone has already chosen which kinds of questions earn credit. Changing that choice can change the score for the same agent. Lecture at 59:07, the external source of the goal · 58:06, being asked to propose math problems · Definition of H in chapter 14
The preceding prompt slide at 57:39 gives examples of a person specifying a question-generating task and its output format. Both prompts appear on page 6 in Chapter 15.
#Worked example 3. Can the better math model change when the answers stay the same?
Give two models the same ten arithmetic problems and ten geometry problems. In this hypothetical scorecard, model A solves eight arithmetic and four geometry problems. Model B solves six arithmetic and eight geometry problems. Let λ be the proportion of arithmetic problems in the intended evaluation and 1−λ the proportion of geometry problems. Weighted accuracy averages the two subject scores under those proportions. Awarding a loss of one for an error and zero for a correct answer makes expected loss equal to one minus accuracy.
| Arithmetic proportion specified by H | Model A accuracy / loss | Model B accuracy / loss | Lower-loss model |
|---|---|---|---|
| 80% | 0.72 / 0.28 | 0.64 / 0.36 | A |
| 25% | 0.50 / 0.50 | 0.75 / 0.25 | B |
We can also find the proportion at which the two scores tie. Subtract 0.4 from both sides and add 0.2λ to both sides. This leaves 0.6λ=0.4.
A ranks first when the arithmetic share exceeds two thirds. B ranks first below that point. The answers and model weights stayed fixed throughout. What changed was the evaluator’s translation of the goal into a number. This sets up the question on page 59. When nobody specifies the next arithmetic problem, what signal could guide an agent in choosing its next experience?
#Part II, page 59 — What should earn a reward when the agent chooses its next action?
This time the speech bubble belongs to the robot. It chooses mathematics as its goal H and is evaluated against that goal on the right. How might it decide what to explore next? The two bullets at the bottom of the slide ask different questions. Curiosity asks how well the agent can predict what it observes. Empowerment asks how much its choice now can influence what it observes later. We can build a score for each question. Lecture at 59:17 · NTU Part II, page 59
#Worked example 4. How much curiosity reward remains the next time a robot opens a door?
A robot pushes a door. In Pathak et al.’s Intrinsic Curiosity Module (ICM), the frames at the bottom, sₜ and sₜ₊₁, show the scene before and after the action. The inverse model on the right uses the features of both frames to infer which action occurred. This training signal teaches the feature encoder which parts of the scene help identify the action. The forward model on the left takes the initial features and the actual action to predict the features of the next frame. The curiosity reward is proportional to the squared distance between predicted and observed next features. Pathak et al., Curiosity-driven Exploration by Self-supervised Prediction, Equations 4–6
For a hand calculation, set the observed next features to (2, 1), the first prediction to (1, 1), and the reward scale η to 0.2. Only the first feature is off, by one unit. Suppose that after more training on this situation, the model predicts (1.8, 1). The same door and action produce the same observed features on the return visit in this example.
What about a screen of random pixels? A pixel on a display next to the door takes values zero or one with equal probability, independently of the action. A predictor of the raw pixel still incurs expected squared error 0.25 when it always outputs the best prediction, 0.5. If this irreducible error earns a reward, staying near the screen can be attractive. This is the “noisy TV” problem. Features trained by ICM’s inverse task can focus on cues that the door moved. How much unrelated noise they suppress needs to be tested in the actual environment. ICM, §2.1
Random Network Distillation (RND) gives the same observed frame to two networks. One is a randomly initialized target f whose weights stay fixed. The other is a predictor trained to match its output. If the target on one image is 2 and the prediction improves from 1.5 to 1.9, the raw bonus decreases as follows. An identical image always has the same target. Noise can still supply a stream of previously unseen images. Burda et al., 2018, Exploration by Random Network Distillation, §2.2
These feature values and bonuses are illustrative. In Table 1 of the RND paper, the reported final mean score for the Atari game Montezuma’s Revenge was 8,152 points for RND and 2,497 for the PPO baseline, a difference of 5,655 game points. The table measures extrinsic game performance. The values 0.25 and 0.01 above are units of an internal exploration bonus. RND, Table 1
#Worked example 5. How many bits of control do two possible destinations provide?
At a junction s, a robot presses a left or right button A and observes its destination S′ one step later. Knowing that two rooms are possible tells us little about whether the robot can choose its destination. Mohamed and Rezende fix the starting state and action horizon, then find the distribution over actions that maximizes the information shared by the action and the destination. The maximum is empowerment. The paper also considers sequences of actions. Here we allow one press and use base-two logarithms to report bits. Mohamed and Rezende, 2015, Variational Information Maximisation for Intrinsically Motivated Reinforcement Learning, Equation 2
Here H denotes entropy, the uncertainty of a probability distribution. The first term measures how uncertain the destination is before we see the action. The second measures the uncertainty that remains once we know which button was pressed. At a symmetric junction, each button routes the robot to the opposite room with probability ε. Pressing the two buttons equally often makes the rooms equally likely and gives the first term its maximum of one bit. The second term is the same for either button, so that choice maximizes their difference.
| What happens after a button press | Uncertainty given the action | Empowerment |
|---|---|---|
| The robot always reaches the indicated room | 0 bits | 1 bit |
| On average, one trip in four reaches the opposite room | About 0.811 bits | About 0.189 bits |
| A fair coin selects the room independently of the button | 1 bit | 0 bits |
In the middle row, knowing that the left button was pressed helps predict the destination but leaves some doubt. In the final row the destination can vary on every trip, yet seeing it gives no clue about the button. Random outcomes can thus keep a prediction error high in a system with zero empowerment. The three points in the figure are calculated for this hypothetical junction.
What can a language model explore? Two studies first posted in 2025 appear among the slide’s references. In Navigate the Unknown, IMAGINE treats a math problem and a complete generated solution as one trajectory. It allocates the exploration bonus to solutions judged incorrect. WorldLLM instead proposes natural-language hypotheses about an environment, takes actions and uses the observed transitions as evidence to revise those hypotheses. One system explores which lines of reasoning to generate. The other explores which observations could help refine an explanation of the world. Navigate the Unknown: Enhancing LLM Reasoning with Intrinsic Motivation Guided Exploration, Equations 5–6 · WorldLLM: Improving LLMs’ world modeling using curiosity-driven theory-making, §3
#Part II, page 60 — When does a curiosity bonus change the next action?
Page 60 revisits the Intrinsic Curiosity Module (ICM) from Lee’s 2018 reinforcement learning lecture. The two boxes at the bottom take observations before and after an action, sₜ and sₜ₊₁. The same encoder φ produces features from both. The network on the left uses the action to predict the next features. The one on the right infers which action took place from the two sets of features. At the top, diff compares the left network’s prediction with the observed next features. Main lecture at 1:01:49 · 2018 recording at 14:20, both networks · 2018 lecture, page 7 · Pathak et al., ICML 2017
#Worked example 6. Why predict an action that has already happened?
An inspection camera can move left or right. Suppose it moved right. Its own action log supplies the label. Let p be the probability that the inverse dynamics model assigns to “right” after seeing features from both frames. Cross-entropy loss falls as the model places more probability on the correct action. Here ln denotes the natural logarithm. Pathak et al., §2.2, inverse and forward models
If the frames reveal which way the part shifted in the image, suppose the model assigns p=0.8. If all it can see is a flashing background that carries no action information, it can give 0.5 to each of two equally frequent actions. Compute the two illustrative losses.
The inverse model’s training objective favors features that distinguish the actions. The 0.470 above is the difference between two inverse-model losses. The quantity supplied to the agent as an exploration bonus is the forward feature-prediction error from page 59. If a background change is consistently correlated with the action, the encoder can learn to use it. The inverse objective therefore does not guarantee that it will eliminate every distraction. Pathak et al., Figure 2 and Equations 2–3
On page 5 of the 2018 deck, the top row follows the agent’s interactions with the environment. The bottom row records two reward signals for the same transition. The time printed on page 60 of the main lecture, 9:07, opens the curiosity example. By 9:50 the animation shows both the environment reward and the bonus produced by the curiosity module. The recording then develops next-state prediction and prediction in feature space. 2018 recording at 9:07, introduction · 9:50, both rewards visible · 10:40, next-state prediction · Supplementary lecture, page 5
#Worked example 7. How large a bonus would favor the unfamiliar shelf?
Return to the inspection robot. It has enough time for one move. Revisiting shelf three has an expected task reward of 1 and a curiosity bonus of 0.1. Visiting a new shelf has an expected task reward of zero and a bonus of 0.6. These numbers are hypothetical. To compare the two scores, introduce an explicit weight β on the bonus. A one-decision horizon leaves no future rewards to discount.
| Bonus weight β | Familiar shelf | New shelf | Higher-scoring action |
|---|---|---|---|
| 1 | 1.1 | 0.6 | Reinspect the familiar shelf |
| 2 | 1.2 | 1.2 | Tie |
| 3 | 1.3 | 1.8 | Explore the new shelf |
At β=3 the new shelf scores 1.8, of which zero comes from the task reward. Report task reward, shelves visited and defects found alongside the total to see which outcome improved. The threshold of 2 depends on the units chosen for these rewards and on the one-move budget. 2018 lecture, combining environment and intrinsic rewards
The log on page 56 tells the robot where it inspected yesterday. The exploration bonus on pages 59–60 influences where it goes today. Whether the robot can read that log tomorrow and whether its choices produce more of the outcome people want are separately testable questions. Page 61 takes up the case in which the quantity an agent improves drifts away from the outcome people care about. NTU Part II, page 61