Multimodal Interaction

A web agent can read a page as text, as a screenshot, or as a screenshot with numbered marks. Pick one: text finishes 7.25% of tasks, marks 16.37%, people 88.70%.

Learn how an AI agent sees a screen, plans its clicks, searches before it commits, remembers with a small notebook, and finally moves a robot arm.

Choose what the agent sees, one option at a time. Watch the page it gets and the share of tasks it finishes. Then we build, piece by piece, everything underneath: rewards, the web test bench, marks, plans, search, memory and robot actions.

You need a rough idea of what a language model is (a program that predicts the next word) and a little Python for the code. We build the rest from zero.

Based on Week 10.1 of MIT Multimodal AI (Spring 2026), taught by Paul Liang of the MIT Multisensory Intelligence group, and its seven readings. Lecture slides (PDF). Every idea is re-taught here in our own words and devices.

Choose what the agent sees

The success rates are VisualWebArena’s own (Koh et al., Table 3, 910 tasks): GPT-4 on page text 7.25%, GPT-4 with image captions 12.75%, GPT-4V with the screenshot 15.05%, GPT-4V with marks 16.37%, humans 88.70%. The shop page and the text the agent receives are our toy picture of each input, not the benchmark’s pages.

Chapter 0

Agents That Act on a Screen

See why a program that only talks is not enough, and place every system in this lesson on one map

You type a request into an assistant: “Buy the cheapest color photo printer and send it to Emily’s place.” A chat model can reply with a nice paragraph about printers. It cannot open the shop, compare six prices, pick the right one and press Buy.

Something that can do those things is an agent: a program that looks at the world, chooses an action, does it, and looks again. Think of a new intern at a computer. The intern reads the screen, moves the mouse, and sees what changed. An agent works the same way, with a model in place of the intern.

The lecture opens with why this matters. Many of the useful things we do today happen on a computer, and many of those happen on the web. Filling a spreadsheet, drawing a chart, checking a cloud console: all of it is menial work that people would happily hand over. That is the chance. An agent that can do it also augments people, because it frees their hours for harder work.

Four words you will use all lesson

The environment is the place the agent works in, such as a website. An observation is what the agent receives from it: a page of text, a screenshot, a sound. An action is what the agent sends back: a click, some typed text, a scroll. After each action the environment changes, and a new observation comes back. That loop is the whole subject of this lesson.

One more word. Grounding means tying the agent’s words to something real. “Click the Buy button” is only a sentence until the agent can point at the one button on the screen that carries that label. We return to grounding in Chapters 4 and 9.

One map for every agent

The lecturer draws a three-axis map of AI agents. It is a good way to keep your place, so we use it as the lesson’s spine. Each axis answers one question.

Try it. Pick a system and see where it sits on each axis.

Place a system on the map

Each row is one axis. The marker shows where the chosen system sits. Pick a different system and watch all three markers move.

The three axes and their stops are the lecture’s (slides 10 and 53). Where each example system sits is our own illustrative placement, not the lecture’s.

A chat model sits at the first stop of every axis: it only talks, it works alone, and it is a single model. The web shopper moves right on two axes. The robot arm moves furthest on grounding, because its actions change the physical world. The rest of the lesson walks along the map: Chapters 2 to 4 are digital grounding, Chapters 5 to 8 are structure, Chapter 6 is interaction, and Chapter 9 reaches the embodied stop.

Class business, in one paragraph

This was the week of the project midterm, due that week. It asked for a finished main idea and experiment setup, working datasets and baselines, a detailed error analysis, and first progress on a new idea. Homework 4 went out the next day, on reinforcement learning and reasoning. The midterm exam grades had a mean of 84.2 and a median of 85.7.

The road

The lecture has two halves. The first teaches the learning tool that agents rely on, rewards. The second walks the agent from the web to the robot. We follow it in order.

  1. Learning to reason from rewards: policy gradients, baselines and GRPO.
  2. The web as a test bench: WebArena, and why raw HTML is not enough.
  3. Tasks that need eyes: VisualWebArena and checks that run code.
  4. Marks on the page: set-of-marks, the baselines, OS-Atlas.
  5. Plan before you click: why agents stall and how high-level plans help.
  6. Ask when unsure: human help and measuring doubt.
  7. Search before you commit: tree search with a value function.
  8. Memory that stays small: MEM1 and its internal state.
  9. From screens to robot arms: OpenVLA and action tokens.
  10. The whole lecture on one page: numbers, code and where to go next.
An agent can book a table only by typing into a website, then reading the confirmation page. Which part of the loop is the confirmation page?

Chapter 1

Learning to Reason From Rewards

Teach a model to reason when you can only say right or wrong, using a baseline that makes every score mean something

A student solves a hard problem. The teacher does not show a worked solution. She only writes a mark at the bottom: right or wrong. How does the student improve? She tries again, keeps what worked, and drops what did not. That is learning from a reward, a score that tells you how good an outcome was.

This is the tool the rest of the lecture leans on. Agents take many steps before any result shows, so the only honest feedback is often a final score. We need to see how a model learns from one.

What reasoning is, and three ways to teach it

The lecture defines reasoning as combining knowledge, usually through several inferential steps, while using the structure of the problem. In the multimodal case the inputs are two or more kinds of data, say a chest X-ray and a patient record. Each is turned into a local representation (a list of numbers describing one input) and the two are aligned so they can be compared. The reasoning then runs over both and ends in an answer y.

Written as data flow, the model gets an input, writes some reasoning steps, and then writes the output: input → step 1 → step 2 → step 3 → output. The lecture lists three ways to teach a model to do this.

  1. Direct prompting. No training. You ask the model to think step by step, which is called chain of thought (CoT).
  2. Supervised fine-tuning. You train on examples of good reasoning. This needs reasoning traces: written-out solutions, which are costly to collect.
  3. Reinforcement learning. You need no traces. You need only a reward function that scores the reasoning and the output.

The third is the focus here, because it asks the least of the data. Its simplest form is the policy gradient. A policy is the model itself seen as a chooser: given input x, it gives each possible output y a probability p(y|x).

Win, raise it. Lose, lower it.

Sample an answer from the policy. Score it. If the score is good, make that answer more likely next time. If it is bad, make it less likely. The lecture draws this as three rows: a win pushes its probability up, two losses push theirs down. As a formula, the model maximizes a sum over the sampled answers.

maximize
Nudge the model’s weights so this number goes up. This is gradient ascent.
∑i
Add up over every sampled answer i.
ri
The reward for answer i. Positive means raise the probability; negative means lower it.
log p(yi | xi)
The log of the probability the model gave answer yi for input xi. Raising it makes that answer likelier.

There is a catch, and the lecture states it plainly: this suffers from high variance. Variance here means the size of the random swings in the update. Suppose every reward is positive, say scores of 0.6, 0.8 and 0.7. Then every sampled answer is pushed up, even the weak one, and the update mostly measures luck.

Compare to what you expect

The fix starts from one sentence on the slide: the raw reward may not be very meaningful. What matters is whether a reward is higher or lower than you expect. So subtract a baseline b, your expectation, and push by the difference. The lecture’s example baseline is an exponential moving average of recent rewards.

Think of grades. A 70 is great in a class that averages 50 and poor in a class that averages 90. The raw 70 tells you little. The 70 minus the class average tells you everything. That difference is called the advantage.

GRPO: the group is the baseline

DeepSeek-R1 uses a neat version, GRPO (group relative policy optimization). The older method, PPO, trains a separate value model to guess the baseline. That is a second large network to train and store. GRPO drops it. For each question it samples a group of G answers, scores them all, and uses the group’s own scores as the baseline. The paper’s own figure says GRPO “foregoes the value model, instead estimating the baseline from group scores, significantly reducing training resources.”

Ai
The advantage of answer i: how much better it is than its group, in units of the group’s spread.
ri
The reward of answer i.
mean(r)
The average reward of the G answers. It plays the part of the baseline b.
std(r)
The standard deviation of the G rewards, a measure of how far apart they are. Dividing by it puts every question on the same scale.

A worked case, with every step. Six answers get rewards 1, 0, 0, 1, 0, 0. The mean is 2/6 = 0.333. The squared gaps are 0.444 for each 1 and 0.111 for each 0, so the average squared gap is (2 × 0.444 + 4 × 0.111) / 6 = 0.222, and the standard deviation is 0.471. A right answer gets (1 − 0.333) / 0.471 = +1.41. A wrong one gets (0 − 0.333) / 0.471 = −0.71. The two right answers are pushed up, the four wrong ones pushed down, and the pushes balance. Try it below.

See how each answer is pushed

Eight answers to one question. A green dot means right. Bars to the right raise an answer’s probability, bars to the left lower it. Switch the rule, move the slider, then press Resample.

35%

Illustrative: rewards are 1 for right and 0 for wrong, drawn at random at the chance you set, so each press is a new group. The three rules are the lecture’s (slides 5 to 8); GRPO divides by the standard deviation as in the DeepSeek-R1 paper.

Watch two things. With raw rewards of 0 and 1, nothing is ever pushed down: wrong answers are only ignored, and right ones all get the same push. Subtract the mean and wrong answers are actively lowered. Set the chance to 0.9 under GRPO: the few wrong answers get large negative pushes, because they are the surprise. And if all eight answers score the same, every advantage is 0. There is no signal, and nothing is learned from that group. That is a real cost, and it is why questions of the right difficulty matter.

The data flow, concretely

For one question, the prompt is a list of token ids. The model samples G = 8 answers, each a list of about 500 token ids. A checker returns one number per answer, a tensor of shape [8]. The code turns it into advantages, also [8], and multiplies each answer’s token log-probabilities, shape [8, 500], by its advantage. One scalar score steers hundreds of tokens, and that is why the signal is faint but cheap.

The lecture closes the topic with QoQ-Med, a model trained with a domain-aware version of GRPO to reason over images and medical sensor signals together. The reward is still just a score on the answer. Read the lecture’s example on the slide: the model writes a long reasoning trace over a chest X-ray and a clinical history, then picks an answer.

To go deeper, see policy gradients, GRPO and DAPO, the DeepSeek-R1 paper lesson and RL for reasoning.

Six answers get rewards 1, 1, 1, 0, 1, 1. Under GRPO, which statement is true?

Chapter 2

The Web as a Test Bench

Build a safe copy of the web where an agent can try, fail and be graded, and see why reading raw page code is a poor way to look

Here is a task: “Purchase a set of earphones with at least 4.5 stars in rating and ship it to me.” You could let a new agent loose on a real shop. It might buy forty pairs. It might break something. And you could never run the same test twice, because prices and stock change.

Researchers need a test bench: a copy of the web that is safe, repeatable and gradable. That is WebArena (Zhou et al., ICLR 2024). Think of a flight simulator. The pilot is real, the sky is fake, and every flight can be replayed.

What WebArena contains

WebArena is a set of working websites that run on the researcher’s own machine. They come from four popular categories: shopping, a content management system (CMS, the back office of a site), Reddit-style forums, and GitLab-style code hosting. Each is a self-hosted, open-source re-implementation. The data inside is copied from the real sites: product listings from Amazon, posts from Reddit, projects from GitHub.

The agent sits inside a loop with the sites. The lecture draws it with four labelled flows: the person gives instructions; the agent sends actions to the webpage; the page returns HTML; and the person can give feedback or answer a clarification question. A grader then checks whether the task really got done.

The result is a humbling one. Tasks that people find easy, about 78% success, are hard for language-model agents, about 14%. But the lecture adds a warning: these tasks were designed to use only text and HTML source code. The agent never needs to look at a picture.

One whole task, step by step

Let us run the earphones task slowly and look at the real messages. At every turn the environment sends an observation, here the text of the page with a number on each clickable item. The agent replies with one action, a short command naming an item by its number. Press Step.

Run the loop one step at a time

The agent sits on the left and the shop on the right. Each press sends one observation to the agent and one action back. Watch the HTML tokens add up at the bottom.

The task is the lecture’s (slide 14). The page text, the element numbers and the 4.6 star rating are our illustration. The action format follows WebArena and VisualWebArena: click [id] and type [id] [text]. The meter assumes every page is 100,000 tokens, the lecture’s figure for complex pages (slide 16).

Two things happened that a chat model never does. First, the agent’s output is a command, not a sentence, and a small program must parse it. If the agent writes “I will click the cart”, nothing happens. Second, the last step is a stop action. The agent must decide by itself that it is done.

After the stop, WebArena does not read the agent’s reply and guess. It looks at the shop’s database. Was an order created? Does the item have at least 4.5 stars? Does it ship to the right address? This is functional evaluation: judge the final state of the world, not the words. Chapter 3 returns to it.

Why raw HTML is a poor way to look

HTML is the code a browser turns into a page. WebArena agents read it, or its tidier cousin the accessibility tree, a list of the page’s parts built for screen readers. The lecture then argues that HTML is insufficient, and gives five reasons.

The last line of the slide goes further: agents will eventually move beyond the web to the world. A kitchen has no HTML. If an agent can only read page source, it cannot leave the browser.

Now you can state the problem for the next chapter. The test bench exists, but it only tests what text can carry. We need a bench where a picture matters, and an agent that can look.

For the wider picture of computer-use agents, see agent environments, computer-use agents and the ReAct paper lesson, which introduced the think-then-act pattern these agents use.

A task finishes with the agent saying “Done, I bought the earphones.” How does WebArena decide whether it passed?

Chapter 3

Tasks That Need Eyes

Meet a benchmark where the answer is in the picture, and learn how code can grade a task that has a thousand right answers

Here is the lecture’s shopping example: “Buy the cheapest color photo printer and send it to Emily’s place (as shown in the image).” The task comes with a photograph of a house. The product list shows printers as pictures. To finish, the agent must tell color printers from plain ones by looking, and match the house in the photo to an address.

Read the page source and you learn almost nothing about either. This is the gap VisualWebArena (Koh et al., ACL 2024) was built to measure. It keeps WebArena’s idea, a self-hosted test bench with automatic grading, and adds tasks that cannot be solved without vision.

What is in the benchmark

VisualWebArena has 910 tasks over three sites. Classifieds is a new site in the style of Craigslist, with 65,955 real listings. Shopping comes from WebArena, with product data from Amazon. Reddit is also inherited, with 31,464 posts full of images: photos, memes, charts. Every task is visually grounded. In 25.2% of tasks the instruction itself includes one or more images, so the agent must read interleaved pictures and words.

Six graduate students wrote the tasks. They wrote 314 templates, sentences with blanks such as “Find me the {attribute} {item} between {range}”, and expanded each into about 2.9 tasks. They also added 46 tasks (5.1%) that cannot be done. The agent must notice, stop, and say why. Knowing when to give up is part of acting well.

The agent’s actions use element numbers instead of screen coordinates. It writes click [1602] and not “click at pixel (840, 310)”. The authors chose this so models can focus on high-level reasoning, since many models were never trained to point at fine screen positions. The set includes click, hover, type, press a key, open or close a tab, go to a URL, go back, scroll, and stop with an answer.

Grading by running code

How do you grade “Buy me a green hoodie under $10”? Hundreds of products qualify. You cannot list every right answer. The benchmark uses execution-based evaluation: after the agent stops, small programs inspect the final state of the site and return a reward of 1 or 0. The lecture shows four example tasks, each paired with the check that grades it. The checks are built from a few pieces.

For tasks that change the site, each check also has a locator (which page elements to look at, for example every product image) and a URL (which page). The grader opens that page and applies the function to what it finds. Pick the right check for each task below.

Match each task to its checker

Read the task, then press the function you think grades it. A wrong choice explains why. Press Next task to move on.

The function names and their rules are VisualWebArena’s (Section 3.3). The five task sentences paraphrase the style of the lecture’s examples (slide 20) and the paper’s; they are not its exact tasks.

Notice the design. Each check is cheap, repeatable and strict only where it must be. A code is exact. A shopping task is judged on the product image. An open comment is judged by meaning. That mix lets one benchmark grade very different tasks without a person in the loop.

Beyond one screenshot: VideoWebArena

The lecture then shows VideoWebArena (Jang et al., ICLR 2025), an extension to tasks that need video understanding. Some tasks give the agent a video and ask a question about it. Others need the agent to act on the web using what a video shows, such as a shopping video that lists the items to buy. Grading stays automatic: question answering is checked by answer, and agent tasks by the final state.

For the full paper, read the series lesson on VisualWebArena. For the way models are scored on it, see Chapter 4.

A task says: “Find me a red car for between $3,000 and $6,000.” Hundreds of listings fit. Why does VisualWebArena grade by inspecting the final page instead of comparing the agent’s answer to a fixed string?

Chapter 4

Marks on the Page

Number every clickable thing on a screenshot so a model can point with a digit, then see how far this gets and how OS-Atlas learns to point anywhere

Imagine giving a stranger directions. “Turn at the third door from the corner” invites mistakes. “Turn at the door numbered 7” does not. If every door wears a number, you can describe any target with one digit.

That is the idea behind Set-of-Marks prompting, or SoM. A short script runs over the page and finds every interactable element: links, buttons, boxes, images you can click. It draws a bounding box and a number around each, on a copy of the screenshot. The model sees the picture with the numbers. A text list beside it pairs each number with the element’s label, such as [7] [A] [Comments]. The model answers with click [31].

Why the tree and the HTML lose

The lecture compares two views of the same page. The accessibility tree (or raw HTML) is, in the slide’s words, cluttered with unnecessary information, long and confusing. The SoM view is a simplified representation: a picture, plus a short list limited to the elements that can be clicked. Pointing by number also avoids a hard task. Predicting pixel coordinates needs fine spatial skill, and many models never trained for it.

Try the difference. Your job is the agent: add the $74 printer to the cart. In one mode you get the plain screenshot and must name a position. In the other, every item wears a number.

Point at the page like an agent

Task: add the $74 printer to the cart. Click on the page. Choose whether the agent gets a plain screenshot or one with numbered marks, and see the action it would send.

A toy page of 12 clickable items drawn for this lesson, shown at 1280 by 720 pixels in the action text. The two action styles, coordinates and element numbers, are the ones discussed in the VisualWebArena paper (Section 3.2); the paper uses numbers.

Notice what the model must still do. Three nearly identical buttons carry the numbers 8, 9 and 10. The picture shows which button sits under which price. The text list gives each button its number. Neither view is enough alone, so the agent receives both, and it must join them: “the $74 printer is the middle tile, so its button is [9]”.

With numbers, a click can only land on a real element, and the agent’s job shrinks to choosing among 12 labels. With coordinates, a click one finger-width off lands on nothing, or on the wrong printer’s button. The lecture names the same trouble in its failure list: clicking the wrong item.

How far this gets: the baselines

The lecture then shows VisualWebArena baselines for GPT-4 and others. Read down the table. The pattern is the lesson.

Agent inputModelSuccess
Page text (accessibility tree)GPT-47.25%
Page text plus image captionsGPT-412.75%
Screenshot, captions and page textGPT-4V15.05%
Screenshot with set-of-marksGPT-4V16.37%
Page text only, a weaker modelGemini-Pro2.20%
Screenshot plus text, then with marksGemini-Pro6.04% then 5.71%
Humanspeople88.70%

Three facts stand out. Text alone is weak, and captions help: describing each image in words lifts GPT-4 from 7.25% to 12.75%. A model that can see helps more. And marks help a strong model, 15.05% to 16.37%, with large gains on the Classifieds and Reddit sites. But the same marks lowered Gemini-Pro, 6.04% to 5.71%. A mark is a tool, and a weaker model may not use it well. Even the best agent sits far below people.

The lecture shows one full success by GPT-4V with SoM: “block the user who posted a certain picture.” The agent starts on the Reddit home page, searches for a forum, opens the list of forums, opens the right one, goes to the profile of the poster, clicks the block button, and confirms. Seven steps, each one an action that names a numbered element.

OS-Atlas: learning to point anywhere

SoM needs a script that can find the clickable items, and on a phone or a desktop application there may be none. GUI grounding, the skill of turning an instruction like “click the Open button” into a screen position, must then come from the model alone. OS-Atlas (Wu et al., ICLR 2025) builds that skill into an open model. The lecture presents it under the heading web, desktop and mobile GUI grounding.

The authors gathered the largest open collection of its kind: over 2.3 million screenshots holding more than 13 million GUI elements, across five platforms (Windows, Linux, macOS, Android and the web). Training has two stages. First, GUI grounding pre-training teaches the model where things are, giving OS-Atlas-Base. Then action fine-tuning teaches it to turn an instruction into an executable action, giving OS-Atlas.

One design choice deserves a pause. Different datasets name actions differently: “click” on a desktop is the same act as “tap” on a phone. Training on both names confuses the model. OS-Atlas uses a unified action space with three basic actions that every platform shares, click, type and scroll, plus custom actions for platform extras, such as opening an app. The model can run in three modes: grounding (a separate planner says what to do and OS-Atlas finds where), action, and agent. For the full paper see OS-Atlas.

For more on this skill see GUI grounding and computer-use agents.

Why does the lecture prefer a screenshot with numbered marks to a screenshot alone, when the agent must click?

Chapter 5

Plan Before You Click

See why a strong model still stalls on a shop page, and how writing a short plan first keeps it moving

The lecture shows GPT-4 on a plain job: “Buy the highest rated product from the NS switch pouch category within a budget under 60 dollars.” The model types a search. The results appear. Then it stops. It says it is done, after one action, with nothing bought.

The desired behavior is a short chain: search, click a product, add it to the cart, check out, then stop and report. Nothing in that chain is hard. What failed was not a skill but the sequence. The model had no picture of where the task was heading.

How agents fail

The lecture groups the common failures into two families. Learn to tell them apart, because they have different cures.

Chapter 4 helps with the second family. This chapter and the next three attack the first.

Three jobs in one agent

The lecture draws the architecture of its own interactive agent as three numbered jobs.

  1. Planning: turn the objective into high-level plans, a short list of goals.
  2. Parsing: turn the observed webpage into something the model can use, the accessibility tree plus the image.
  3. Low-level actions: for each goal, produce concrete actions such as TYPE, CLICK or HOVER, and finally STOP to return the answer.

This mirrors how you cook from a recipe. You read the outline first (“chop, fry, simmer”), and only then do each motion. The lecture ties it to a line of earlier work: ReAct (think, then act), chain of thought, WebGPT, Mind2Web and Toolformer. All of them give the model room to think between actions.

What a good plan looks like

A high-level plan is a list of sub-goals, each written as a bracketed verb and an object. The lecture’s question is “What is the price range of wireless earphone in the One Stop Market?” Two plans are compared.

The plan the model generated has two lines: [Search] wireless earphone and [Find] the price range. The lecture labels it too ambiguous, hard to understand. “Find the price range” hides the work. A range needs the lowest and the highest price, and nothing says how to get them.

The human-written plan has six lines: search; sort by price from low to high; find the first item; sort from high to low; find the first item; identify the price range. Every line is one clear thing to do. Run both, below, on a shop with five earphones.

Run the task with and without a plan

The shop has five earphones. The true price range is $12 to $79. Choose how much plan the agent has, then press Run and watch each step land.

Illustrative runs. The two plans are the lecture’s (slide 33) and the stop-after-one-step behavior is its slide 32. The five prices ($39, $79, $12, $59, $25) and the way each agent behaves are our toy story, not measured results.

The run is a toy, but it shows the mechanism. With no plan, the agent has no destination, so it halts at the first screen. With the vague plan, it has a destination but no route: it reads the two prices it can already see, $39 and $79, and calls that the range. It never learns about the $12 earphone. With the clear plan, each line forces a fact. Sorting low to high puts the cheapest on top, and sorting high to low puts the dearest on top.

Treat a stall as a bug you can measure. The symptom is an agent that stops early or repeats itself. Count the actions per finished task, and count the share of runs that end in an early stop or a loop. The fix in this lecture is a better plan. After you change the plan, run the same counts again. If the numbers do not move, the plan was not the cause.

Where Mind2Web fits

The lecture lists Mind2Web (Deng et al., 2023) among the related work. It matters here for one idea. A real page’s HTML is far too long for a model, so the authors first filter it. A small language model scores each page element against the task and keeps the top candidates. Then a large model picks from those few, in rounds of up to 5 candidates plus a “none” option, which turns a huge choice into a short multiple-choice question. The dataset has 2,350 tasks from 137 real websites in 31 domains. Planning shrinks the goal; filtering shrinks the page. See the series lesson on Mind2Web.

In the lecture, a model told only “find the price range” read the first prices it saw and answered. What was missing from its plan?

Chapter 6

Ask When Unsure

Measure an agent’s doubt by asking it for several plans, and spend a person’s time only when the plans disagree

You ask a human assistant: “What is the price range of wireless earphones in the store?” A good assistant pauses. Do you mean the cheapest to the dearest of everything? Only the first page? Only the ones in stock? One short question now saves a wrong answer later.

An agent should do the same. The lecture calls this human-in-the-loop: the agent asks a person for clarification when it is uncertain about its generated plans. The sliding scale on the map from Chapter 0 moves one stop, from autonomous to human-in-the-loop.

The same question, three levels of help

The lecture follows one question through three plans. A zero-shot plan is written with no examples in the prompt. A few-shot plan is written after the prompt shows the model a few worked plans. The third plan comes after a human adds clarification.

The person did not do the work. They added one fact, “we need the lowest and the highest”, and the model did the rest. That is cheap for the person and valuable to the agent.

But when should it ask?

If the agent asks about everything, it becomes a nag and nobody saves any time. If it never asks, it makes confident mistakes. It needs a signal for doubt. The lecture’s signal is simple: sample the plan several times.

Recall from Chapter 1 that a model gives probabilities, and a sample is one random draw. Ask the model for its plan several times at a normal sampling temperature and compare. If it knows what to do, the plans agree. If it is unsure, they scatter. On the slide, all samples share the first line, search for the earphones. After that they split: one says find the price of the first earphone and determine the maximum; another says read all the prices and determine the minimum and maximum; a third simply stops. The scatter is the uncertainty. The lecture’s reading: without human clarification, the plan is ambiguous and the model is uncertain about the overall plan.

Turn that into a rule. Sample n plans. Count how many are the most common plan. Divide by n. This is the agreement. If agreement falls below a threshold you choose, ask the person. Try it.

Sample plans and decide whether to ask

The agent drafts its plan several times. Bars count how often each plan came up. Set the agreement you demand, then press Sample plans. Press Ask the person to add the clarification and sample again.

8
70%

Illustrative: the four plan variants are paraphrased from the lecture’s slide 35. We assume before clarification the model drafts them with chances 30%, 30%, 25% and 15%, and after clarification the correct sort-first plan 90% of the time. Those chances are made up to show the mechanism.

Work one case by hand. Eight plans are sampled: 3, 2, 2 and 1 of the four variants. The most common appears 3 times, so agreement is 3 / 8 = 37.5%. With a threshold of 70% the agent asks. After the person clarifies, suppose 7 of 8 samples are the sort-first plan. Agreement is 7 / 8 = 87.5%, above the bar, so the agent goes ahead without asking again.

Asking has its own failure mode. The symptom is an agent that interrupts a person about things it could have found itself. Measure it: count the questions per task and the share of tasks finished. If questions are many and the finish rate does not rise, the threshold is too high or the question is poorly chosen. Raise the bar for asking, or tighten the prompt that writes the plan.

Two settings matter. A higher threshold asks more often and is safer. A lower one asks less and is faster. You choose by what a wrong answer costs and what a person’s minute costs. Sampling more plans makes the agreement number steadier, at the price of more model calls.

Human feedback as a reading

The slide cites two papers. One is a survey of reinforcement learning from human feedback (Kaufmann et al., 2024). RLHF is the family of methods that learn from a person’s judgments instead of a hand-written score. A person compares two behaviors and picks the better one, and a reward model learns to predict those choices. The model is then trained to earn a high predicted reward. The survey covers this across control, robotics and language models. It is the background to the idea here: humans are a source of signal, and cheap signals, like a pairwise choice, scale best. Read the series lesson on the RLHF survey, or RLHF and DPO. The second paper, on human and LLM collaborative annotation, studies how a person can verify a model’s labels, which is the same economy of attention.

An agent samples 10 plans and 9 are identical. What should it do under a 70% agreement rule?

Chapter 7

Search Before You Commit

Try several paths, score where each one leads, and follow the best, so extra thinking at answer time buys real accuracy

You want to know how many times you bought one product. The answer sits behind your account page, then your orders, then a filter, then a particular order. At each page there are many links. A model that picks one link per page and never looks back will often pick wrong and never recover.

A chess player behaves differently. She imagines a move, imagines the reply, and compares several lines before she touches a piece. The lecture asks the web agent to do the same. It calls this search, and it recalls reinforcement learning, where looking ahead is old and central.

The tree of clicks

Draw the task as a tree. The root is the starting page. Each click leads to a new page, which is a child. Each page offers several clicks, so the tree branches. The lecture’s picture shows many clicks from the account page, and marks most branches as pruned by value function: cut off because they look unpromising.

This is the idea of Tree of Thoughts (Yao et al., NeurIPS 2023), applied to real actions in Tree Search for Language Model Agents (Koh et al., TMLR 2025). A key difference: here the tree lives in the actual environment. To try a branch, the agent really clicks, and to back up it really navigates back.

The value function is the compass

To prune, you must score. A value function reads the task and what the agent has seen so far, and returns a number from 0 to 1: how likely this state is to be on the way to success. 1 means the goal. In the paper the value function is itself a multimodal model, prompted with the task and the screenshots of the path. It answers success, failure but on track, or failure, and these map to 1, 0.5 and 0. The authors then ask for 20 separate reasoning paths and average the 20 scores, the same trick as the voting you may know from self-consistency. Averaging smooths out a noisy judge.

The search is best-first. Keep a frontier, a priority queue of states waiting to be examined, ordered by score. Repeat:

  1. Pop the highest-scored state from the frontier.
  2. Score it with the value function. If it beats the best so far, remember it.
  3. If its score reaches a threshold θ, or the search used its budget of c pops, stop and go to the best state found.
  4. Otherwise, if the depth is below d, ask the agent for b candidate actions, execute each, and add the resulting states to the frontier with the parent’s score.

The three numbers d (depth), b (branching factor) and c (budget) bound the size of the tree. The paper’s settings are d = 5, b = 5 and c = 20. Search is a form of test-time compute: you spend more thinking when you answer, without changing the model’s weights.

Play with a toy tree. Three clicks per page, three levels deep, 40 pages in all. One page, hidden, is the goal. Choose how good the compass is, and raise the budget.

Search a tree with a value function

Top: one tree. Numbered dots are pages the search examined, in order; the green ring is the goal. Bottom: how often the search finds the goal across 300 random trees, for each budget.

8

Toy simulation, not the paper’s data. A page’s true value is the fraction of the way to the goal; the noisy compass adds random error of 0.25, the accurate one of 0.05, and the random order ignores values. Children enter the frontier with their parent’s score and the search stops at a score of 0.95, as in the paper’s algorithm.

Three things to try. With no value function, the search only samples the tree and success rises slowly, roughly with the share of pages examined. With a rough compass, it climbs faster. With a good compass, a few pops often reach the goal. And as you raise the budget, every curve rises: more search buys more success, with diminishing returns.

The real numbers

On VisualWebArena, putting this search on top of a GPT-4o agent gave a 39.7% relative gain and a new best success rate of 26.4%. On WebArena the gain was 28.0%, to 19.2%. The lecture’s plot, for Gemini-Pro, shows the same shape: with an accurate value function, exploration and search can substantially improve performance. The paper’s ablations on a 200-task subset give the clearest picture.

Setting (GPT-4o agent)SuccessWhat it shows
No search24.5%The baseline
Search budget c = 532.0%A little search already helps
Search budget c = 2037.0%More search, more success
Value function: LLaVA30.0%A weaker compass
Value function: GPT-4o, one reasoning path28.5%Without averaging, noisy
Value function: GPT-4o, 20 paths37.0%Averaging matters
Value function: the true reward43.5%Room to improve the compass

The last row is the research problem the lecture names: learning a good value function for search and for re-ranking whole trajectories. The gap between 37.0% and 43.5% is what a perfect compass would still add. The slide also floats a second idea, running many instances of the agent in parallel for better exploration. Read the paper on the series page Tree Search for LM Agents, and see Monte Carlo tree search for the classic form.

The agent’s value function is poor: it scores good and bad pages almost alike. What happens to best-first search?

Chapter 8

Memory That Stays Small

Train an agent to rewrite one short page of notes at every step and throw the rest away, so its cost stops growing

Picture a research assistant with sixteen questions to answer. She keeps one notebook and writes down every search result, in full, as it arrives. By question five the notebook is thick. By question twelve she spends most of her time flipping pages, and she can no longer find the fact she needs. Each new step costs more, and she starts to forget.

A smarter assistant works differently. After each search she rewrites a single page: “what I know so far”. Then she tears out the old pages. The notebook never grows. This is the idea of MEM1 (Zhou et al., ICLR 2026), from the lecturer’s own group.

The problem: context that only grows

Most language agents work by appending. The context is everything the model reads at one step. After every turn the agent adds its thought, its query and the tool’s reply. The context grows without bound. As the lecture says, reasoning context grows longer as there are more modalities and longer tasks, which brings new cost and forgetting problems. The paper lists three costs: unbounded memory growth, higher compute, and worse reasoning on lengths the model never saw in training.

The slide shows it as a chart. For existing agents the context length is a line sloping up. For MEM1 it is a sawtooth that stays flat.

The proposal: an internal state

MEM1 gives the model one special piece of text, the internal state, written between tags as <IS>...</IS>. It blends two jobs in one: it is the model’s reasoning and it is the model’s memory. At every turn the model writes a new internal state, then either a query or an answer.

The paper uses four tags. <IS> is the internal state. <query> is what the agent asks the environment, such as a search. <info> is what the environment returns. <answer> is the final reply. The loop, step by step:

  1. At turn t, the context holds the task, the latest state, and the latest info.
  2. The model writes <IS_t> and then <query_t> (or <answer_t> if it is done).
  3. The environment returns <info_t>.
  4. At turn t + 1, the model folds IS_t, query_t and info_t into a new <IS_t+1>. Then everything from turn t is deleted.

The slide calls this memory consolidation: only the latest internal state, the query and the new info stay. The agent is forced to integrate, update and compress what it knows at every step. At any moment the prompt holds at most two internal states, two queries and one info.

Compare the two memories turn by turn

The two bars show what each agent holds in its context at the turn you pick. The curves show how that size grows with the turn. Drag the turn.

6

Illustrative sizes: a 300-token task, then per turn a 150-token thought, a 40-token query and a 600-token reply; MEM1 holds a 250-token internal state. The shape (a straight rise against a flat line) is the paper’s; the token counts are ours.

Training it: only the answer pays

How does a model learn what to keep? Nobody labels the good summaries. MEM1 uses reinforcement learning (Chapter 1) with an outcome reward from the final answer: exact match with the correct answer, or an F1 score. If the notebook lost a needed fact, the answer is wrong and the reward is low. Over many rollouts the model learns to keep the facts that pay.

There is a technical snag. Normal policy-gradient training assumes one long, unbroken sequence. MEM1 rewrites its context every turn, so each turn was generated from a different, shorter prompt. The authors stitch the turns into one long trajectory and apply a two-dimensional attention mask: each token may look only at the tokens that were really in memory when it was generated. Then the ratio of new and old token probabilities, the quantity PPO needs, stays correct. A second mask hides the environment’s own tokens, so only the agent’s tokens receive gradients.

The data matter too. Common question sets ask one thing at a time. The authors compose several questions into one task, such as “Which US state is nicknamed The Equality State?” plus “Which US state is nicknamed The Beaver State?”, up to 16 questions. About 32.2% of the two-question tasks pair two closely related questions. Long tasks make memory the bottleneck.

What it achieves

On the 16-question task, MEM1-7B scores 3.5 times better than Qwen2.5-14B-Instruct while using 3.7 times less memory. It needs only 27.1% of the peak tokens and 29.3% of the inference time. As questions are added, the baselines get worse and their context grows. MEM1’s context stays nearly flat. On the WebShop shopping environment, MEM1 reaches a reward of 70.87 with about 0.81 thousand peak tokens. GPT-4o gets 25.48 with about 5.30 thousand.

Behaviors nobody programmed

The lecture ends with three habits the model discovered. First, it stores the key facts of each question separately: after one question it lists the answer facts, then says it will now answer the second. Second, it updates its memory before moving on, writing something like “add this to our cumulative summary” and then planning the next search. Third, after several fruitless searches it gives up on one question and moves on, which saves the rest of the budget for questions it can win.

See the series lesson on MEM1, and related ideas in agent memory and memory in an agent gateway.

After turn 5, an append-everything agent and MEM1 are both about to run turn 6. Which statement is true about their prompts?

Chapter 9

From Screens to Robot Arms

Turn a robot’s motion into words a language model can write, and see how one model learns to drive many different robots

A robot arm sits over a table. A person says: “Put the eggplant in the bowl.” The arm must see the eggplant, find the bowl, and move through a dozen small motions without knocking anything over. Every motion is a set of numbers: how far to move, how far to turn, whether to close the gripper.

So far our agents produced clicks. This chapter reaches the last stop on the grounding axis from Chapter 0: embodied agents, whose actions move a body in the physical world. The lecture’s claim is bold: generate precise robotics control directly from trained vision-language models.

One model, many robots

Robots differ. One has two fingers, another a suction cup; arms differ in length and joints. For years each robot needed its own policy, trained on its own small dataset. The lecture shows Google’s RT-X effort, which pooled data from many robot types so that experience on one robot helps another. The pooled collection is the Open X-Embodiment dataset.

OpenVLA (Kim et al., 2024) builds on it. It is a vision-language-action model, or VLA: a vision-language model taught to output actions as well as words. It trains on 970,000 robot episodes, and it is fully open: the data recipe, the weights and the code are public. Its pieces, which the lecture draws as a diagram, are as follows.

  1. Two vision encoders. DINOv2 captures fine spatial detail, and SigLIP captures meaning. Their features are joined side by side.
  2. A projector. A small MLP maps the image features into the same space as the language model’s word embeddings, so pictures become something like words.
  3. Llama 2 7B. The language model reads the image tokens and the prompt “What should the robot do to put eggplant in bowl?” and writes the answer.
  4. An action de-tokenizer. The answer is a short string of special tokens. This step turns them back into numbers: a 7-dimensional action, meaning three position changes, three rotation changes and a gripper command.

How a number becomes a token

A language model writes tokens, which are whole numbers pointing into a vocabulary. A robot needs smooth numbers such as “move 1.37 centimeters”. The bridge is discretization: cut the range of each action dimension into equal slices, called bins, and name a move by its bin.

OpenVLA uses 256 bins for each of the 7 dimensions. The range for each dimension runs from the 1st percentile to the 99th percentile of the actions in the training data. A percentile is the value below which that share of the data falls. The 256 bin numbers are then written over the 256 least-used tokens of the Llama vocabulary, and the model trains with ordinary next-token prediction, scored only on the action tokens. No new network head was needed. A robot action is just seven more tokens to write.

Why the 1st to 99th percentile and not the minimum to the maximum? A single wild reading can stretch the range. If one outlier is 10 times bigger than usual, the slices become 10 times wider for everyone, and ordinary moves lose precision. Percentiles ignore the outliers. Try both.

Turn a move into a token

The histogram shows many small forward moves from a toy robot, plus a few big jumps. Choose how the range is set, change the number of bins, and drag the move you want to encode. The staircase below shows how well a smooth path survives.

256
1.40 cm

Toy data made for this lesson: 400 forward moves, mostly within about 3 cm, and two jumps near 20 cm. OpenVLA’s recipe (256 bins, 1st to 99th percentile, overwrite the 256 least-used Llama tokens) is from the paper, Section 3.2; the numbers on this device are not its.

Watch the bin width. With the minimum to maximum range, the toy range is about 23 cm wide, so 256 bins are about 0.9 mm each. With percentiles it is about 6 cm, and the bins shrink to about a quarter of a millimeter. Lower the bin count to 16 and the path turns into coarse steps: the robot would jerk. Raise it to 256 and the staircase hugs the curve.

What it achieves

OpenVLA outperforms the closed 55-billion-parameter RT-2-X by 16.5% in absolute task success across 29 tasks and several robots, with 7 times fewer parameters. It adapts to a new robot or task by fine-tuning with LoRA, a cheap way to train only a few small added matrices, on a single consumer GPU, and in multi-task settings it beats diffusion-policy imitation learning by 20.4%. One limit shows in the paper: without special tricks it runs at about 6 Hz on a high-end GPU, so it makes six decisions a second, slow for fast tasks.

The lecture adds a closing view of the map from Chapter 0. The same loop, observe, decide, act, is now closed through a camera and a motor instead of a browser. Read the series lesson on OpenVLA, and see vision-language-action models and RL for VLAs.

Why does OpenVLA set each action dimension’s range from the 1st to the 99th percentile instead of from the minimum to the maximum?

Chapter 10

The Whole Lecture on One Page

Review the agent from the screen to the robot arm, with the numbers, the core code and where to go next

The lecture ends on the same map it began with, and you can now fill in every stop. An agent is a loop: observe, decide, act, observe again. What changes from stop to stop is what the agent sees, how it decides, and where its actions land.

The one-paragraph summary

A reward can teach a model to reason without any worked solutions: policy gradients raise the probability of good answers, a baseline makes the raw score mean something, and GRPO takes the baseline from the group of sampled answers. On the web, WebArena offers a safe, repeatable test bench graded by the final state of the site; but raw HTML is long, messy and blind to layout, so VisualWebArena adds 910 tasks that need eyes, and set-of-marks numbers every clickable item so the model can point with a digit. OS-Atlas teaches a model to ground instructions on any screen. Agents still stall, so a clear high-level plan keeps them on route, sampling several plans measures doubt and decides when to ask a person, and tree search with a value function spends extra compute on the best paths. MEM1 keeps memory constant by rewriting an internal state each turn. Finally OpenVLA writes robot actions as tokens, so one model drives many robots.

The numbers that matter

WhatNumberWhy it matters
GRPO worked examplerewards 1, 0, 0, 1, 0, 0 give +1.41 and −0.71The group mean is the baseline
WebArenahumans 78%, language-model agents 14%The gap the field set out to close
Complex web pageover 100,000 tokens of HTMLReading source code is slow and costly
VisualWebArena910 tasks, 3 sites, 25.2% with images, 5.1% unachievableVisual tasks, and the skill of stopping
Page text vs captions (GPT-4)7.25% then 12.75%Words about the pictures help
Screenshot vs marks (GPT-4V)15.05% then 16.37%Pointing by number helps a strong model
Humans on VisualWebArena88.70%The headroom is large
OS-Atlas data2.3 million screenshots, 13 million elements, 5 platformsGrounding needs data at scale
Mind2Web2,350 tasks, 137 sites, 31 domainsBreadth beyond a few test sites
Tree search, GPT-4o agent24.5% to 32.0% (c = 5) to 37.0% (c = 20)More search at answer time, more success
Tree search value function20 paths 37.0%; true reward 43.5%A better compass has room to add
MEM1 vs Qwen2.5-14B, 16 questions3.5 times better, 3.7 times less memory, 27.1% of peak tokensConstant memory is also better
MEM1 on WebShopreward 70.87; GPT-4o 25.48A small trained agent beats a large prompted one
OpenVLA970,000 episodes, 7B, 256 bins; +16.5% over RT-2-X (55B)A small open model beats a big closed one
Class, Week 10midterm exam mean 84.2, median 85.7Project midterm due; HW4 on RL and reasoning

The whole stack, as code

This is a sketch: model, env, value_fn and the helpers stand for whatever API and tools you use. Name the chapter behind each line.

pythondef advantages(rewards):                               # Ch 1: GRPO, no value model
    m, s = mean(rewards), std(rewards)
    return [(r - m) / s if s else 0.0 for r in rewards]

def observe(env):                                      # Ch 2 to 4: screenshot + numbered marks
    shot, items = env.screenshot(), env.clickables()
    return draw_marks(shot, items), label_list(items)  # "[31] [A] [Comments]"

def run(task, env, model, value_fn, ask_person, c=20):
    plans = [model.plan(task) for _ in range(8)]        # Ch 5: high-level plans
    if agreement(plans) < 0.7:                          # Ch 6: measure doubt
        task += ask_person(most_common_question(plans))
    state, frontier, best = "", [(1.0, env.snapshot())], (-1, None)
    for _ in range(c):                                    # Ch 7: best-first search
        _, node = pop_max(frontier)
        v = value_fn(task, node)                          # 0 to 1, average of 20 reasoning paths
        best = max(best, (v, node))
        if v >= 0.95: break
        marked, labels = observe(node.env)
        out = model.step(task, state, marked, labels)        # Ch 8: only the internal state carries over
        state = out.internal_state                        # old turns are dropped
        for a in out.actions[:5]:                           # "click [31]", "type [2] [earphones]"
            frontier.append((v, node.apply(a)))
    return best[1]

def action_to_tokens(a, lo, hi, bins=256):               # Ch 9: robot action, 7 numbers, one token each
    return [min(bins - 1, max(0, int((x - l) / (h - l) * bins))) for x, l, h in zip(a, lo, hi)]

Read it line by line. The reward helper is what trained the model. The observe function is what the agent sees. The plan and the question decide whether to proceed. The loop is search, with a state that does not grow. The last function is how the same idea reaches a robot.

Before you build an agent, check

  1. What does the observation really contain? Print it. If a task depends on a picture, a text-only view will fail.
  2. Can the agent name a target by id? If it must guess pixels, add marks.
  3. Is each line of the plan one action the agent can check?
  4. When should it ask a person? Pick an agreement threshold and measure how often it fires.
  5. Do you have a value function worth trusting? If not, more search budget helps little.
  6. Does the context grow with every turn? If so, plan a state that gets rewritten.
  7. Do you grade the final state of the world and not the agent’s words?
  8. For a robot, is the action range set by percentiles, and does the loop look again after every action?

Where this sits

This session opens the second half of the course. The week before, reasoning and explainable reasoning set the tool: explainable reasoning. The next session, Week 10.2, turns to cross-modal transfer. The agents here are the digital and embodied cases of the map; later sessions meet self-evolving systems (the top of the structure axis) and human-AI interaction.

Keep going

Credit

This lesson re-teaches Week 10.1 of MIT Multimodal AI (Spring 2026), taught by Paul Liang of the MIT Multisensory Intelligence group, using the course’s lecture slides and its seven assigned readings: VisualWebArena, OS-Atlas, Mind2Web, Tree Search for Language Model Agents, A Survey of Reinforcement Learning from Human Feedback, MEM1 and OpenVLA. The slides also cite WebArena (Zhou et al., ICLR 2024), VideoWebArena (Jang et al., ICLR 2025), DeepSeek-R1 (Guo et al., 2025) and QoQ-Med (Dai et al., NeurIPS 2025). All explanations, devices and toy numbers are ours, and each toy is labelled.

The takeaway. An interactive agent is a loop, and every stage of this lecture improves one part of it: a reward to learn from, an observation it can use, a plan to follow, a question when unsure, a search over paths, a memory that stays small, and an action it can write for a body.
An agent works well for 5 turns and then slows, forgets early facts and costs more each turn. Which chapter’s idea fits best?

Now press Teach and explain the loop from memory: how a group of answers becomes advantages, why a screenshot with numbered marks beats a bare one, how a plan and an agreement check keep an agent on route, how best-first search spends a budget, why MEM1’s context stays flat, and how a robot action becomes seven tokens. Then go back to the top and run the first instrument again, knowing why each bar sits where it does.

MMAI Week 10.1: Multimodal Interaction
The course site · Lecture slides · VisualWebArena · OS-Atlas · Mind2Web · Tree search for LM agents · RLHF survey · MEM1 · OpenVLA · Back to Gleams