Search

Search papers and lessons

Do As I Can, Not As I Say: Grounding Language in Robotic Affordances

Michael Ahn, Anthony Brohan, Noah Brown et al. · 2022

SayCan scores each robot skill twice: a language model rates whether the skill fits the instruction, and a learned value function rates whether the robot can do it now.

On this page

  • Colour = topic mix
  • Probability
  • Discrete math
  • Calculus
  • Neural network basics
  • Linear algebra
  • Reinforcement learning
  • Sign in to see your progress

TL;DR

A large language model knows a great deal about everyday tasks, but it has never tried them and does not know what a particular robot can do in a particular room. SayCan, from Google's robotics group in 2022, combines the two. The language model scores each of the robot's skills for how well it fits the instruction, a learned value function scores each skill for whether it can succeed from the current state, and the robot runs the skill with the highest product of the two.

Where you'll see it: in robot planning systems that turn a spoken request such as "I spilled my drink, can you help?" into a sequence of skills the robot can actually perform, and in later work that builds closed-loop feedback on top of the same pattern.

The problem

Language models generate fluent plans, and many of those plans are wrong for a robot. Asked how to clean a spill, a model may suggest a vacuum cleaner, which is useless if the robot has no vacuum, cannot use one, or the scene lacks one. Prompt engineering narrows the output by showing examples of the response format, but it does not constrain the output to skills the robot has, and it does not tell the model what is true in the scene right now.

The problem is one of grounding. The language model has semantic knowledge but no experience of the physical world, and the robot has physical skills but no understanding of the instruction. The paper asks how to extract the knowledge in a language model so that an embodied agent can follow high-level, temporally extended instructions, using only skills it actually has, in the state it is actually in.

Key idea

The key move is to stop asking the language model to write a plan and instead ask it to score options. A language model assigns a probability to any piece of text, so for each candidate skill description, such as "find a sponge" or "go to the table", it can compute how likely that text is as the next step for the instruction. The skill set is fixed, so the output is constrained to what the robot can do.

Each skill also has an affordance: a number between 0 and 1 for how likely it is to succeed from the current state. The paper's illustrative question for this is "if I ask the robot to do this, will it do it?" The affordance is learned, and it is a value function from reinforcement learning, trained so that it predicts success. The two numbers answer different questions. The language model answers whether the step is useful for the instruction, which is task-grounding. The affordance answers whether the step is possible now, which is world-grounding. The combined score answers whether the step will successfully move the instruction forward, and the robot picks the skill with the highest combined score.

flowchart LR
  I[Instruction] --> LLM[Language model scores each skill: task-grounding]
  S[Current scene and robot state] --> VF[Value functions score each skill: world-grounding]
  LLM --> P[Multiply the two scores]
  VF --> P
  P --> A[Run the best skill]
  A --> S

The loop runs until the model chooses a termination token such as "done". Each new skill is appended to the prompt, so the language model sees the plan so far.

The method

The factorization

The paper writes the probability that a skill will successfully advance an instruction ii from state ss as a product of two terms. Let ℓπ\ell_{\pi} be the text label of skill π\pi and cπc_{\pi} a Bernoulli variable for whether the skill succeeds. Then, up to a constant,

p(ci∣i,s,ℓπ)∝p(cπ∣s,ℓπ) p(ℓπ∣i).p(c_i \mid i, s, \ell_{\pi}) \propto p(c_{\pi} \mid s, \ell_{\pi}) \, p(\ell_{\pi} \mid i).

The first factor, p(ℓπ∣i)p(\ell_{\pi} \mid i), is the language model's score and is called task-grounding. The second, p(cπ∣s,ℓπ)p(c_{\pi} \mid s, \ell_{\pi}), is the affordance and is called world-grounding. The factorization assumes that a skill which succeeds advances the instruction with probability equal to its language score, and a skill which fails advances it with probability zero. That is a modelling choice, and the paper states it as one.

The selection rule is then

π=arg⁡max⁡π∈Π  p(cπ∣s,ℓπ) p(ℓπ∣i).\pi = \arg\max_{\pi \in \Pi} \; p(c_{\pi} \mid s, \ell_{\pi}) \, p(\ell_{\pi} \mid i).

Scoring a language model

The language model is never asked to generate a skill. Instead, for each skill label ℓπ\ell_{\pi}, it is asked for the probability of that label as a continuation of the prompt. The prompt is written as a dialogue: a user gives an instruction, and the model answers "I would: 1. ..." followed by steps. Each candidate step is scored in turn, and the skill labels form a fixed vocabulary. The paper's point is that this removes the problem of inadmissible actions, because the model can only pick from the skills that exist.

The language model's scores come from the same probabilities that drive text generation. Because a sequence probability factorizes into a product of next-word probabilities, the score of a skill label is the probability the model assigns to its words in order. The factorization is the chain rule of probability, the same one used to train every autoregressive language model.

Learning the affordances

The affordance is a value function. In reinforcement learning, a value function VV or a Q-function Qπ(s,a)Q^{\pi}(s, a) is the expected discounted sum of future rewards from a state, or from a state and action, under a policy. The Q-function is learned with temporal-difference updates, which minimise a loss that compares the current estimate with a one-step target built from the reward and the estimated value of the next state.

The paper's observation is that if the reward is 11 when the task succeeds and 00 otherwise, and there is no discounting, then the value of a state-action pair is exactly the probability of success from that state. That makes a standard value function an affordance function. The paper trains value functions conditioned on the language command, so one network serves all the skills.

Example
Tiny: choosing one skill for a spill

The instruction is "I spilled my drink, can you help?" Three candidate skills have these illustrative scores. They are not from the paper.

  1. "find a sponge": language score 0.40.4, affordance 0.90.9 because a sponge is visible. Combined score 0.4×0.9=0.360.4 \times 0.9 = 0.36.
  2. "find a vacuum cleaner": language score 0.50.5, affordance 0.00.0 because the robot cannot see one and has no way to use one. Combined score 0.5×0.0=00.5 \times 0.0 = 0.
  3. "go to the table": language score 0.10.1, affordance 0.950.95. Combined score 0.1×0.95≈0.100.1 \times 0.95 \approx 0.10.

Interpretation: the language model alone ranks the vacuum first. Multiplying by the affordance removes it, and the sponge wins.

Example
Standard: the same instruction, one step later

After the sponge is picked up, the robot is holding it. The affordances change, and the combined scores change with them. The numbers are illustrative.

  1. "bring it to you": language score 0.60.6, affordance 0.90.9 now that the robot holds the sponge. Combined score 0.540.54.
  2. "find a sponge": language score 0.20.2, affordance 0.050.05 because the robot is already holding one. Combined score 0.010.01.
  3. "go to the table": language score 0.20.2, affordance 0.80.8. Combined score 0.160.16.

Interpretation: the choice follows the state. A plan that ignores the scene can keep asking for a step that is already done.

Example
Realistic: why long plans are hard

Suppose each skill in a ten-step plan succeeds with probability 0.90.9, and the steps are treated as independent. The paper does not compute this; the example uses it to show what compounding means.

  1. After one step the plan is still on track with probability 0.90.9.
  2. After ten steps it is on track with probability 0.9100.9^{10}. Computing this as 0.92=0.810.9^2 = 0.81, 0.94=0.65610.9^4 = 0.6561, 0.98=0.430470.9^8 = 0.43047, then multiplying by 0.810.81 gives about 0.3490.349.
  3. So a plan that is 90 percent reliable per step is only about 35 percent reliable over ten steps.

Interpretation: long-horizon instructions amplify small per-skill errors. The paper's long-horizon family scored lowest, and its most common failure there was early termination by the language model, but the arithmetic of compounding applies to every long plan.

Training the skills

SayCan needs a set of skills, each with a policy, a language description and a value function. The paper trains the policies in two ways. Behavioural cloning, following the BC-Z method, learns from demonstrations and gave the higher success rates. Reinforcement learning, following MT-Opt, learns from trial and error and gave the value functions that the system relied on. The authors note that the value functions from the reinforcement learning policies were crucial, because they translate what the robot can control into a semantic understanding of the scene.

To share the cost across many skills, the policies and value functions are multi-task and conditioned on the skill description. The description is turned into an embedding by a frozen sentence encoder, so a new description is a new input, not a new network. The reward is sparse: 1.01.0 if the episode ended in success, judged by human raters who watched a video, and 0.00.0 otherwise. A success needed two of three raters to agree.

The robot is a mobile manipulator with a seven-degree-of-freedom arm. The skill set has 551 skills in seven families, covering 17 objects, and the experiments use the subset that is most useful for composition.

Results

The evaluation uses 101 instructions in seven families. The families vary the horizon, from a single primitive to ten or more steps in a row; the language, from structured commands to crowd-sourced requests; and the embodiment, including starting from different points in a task. Plan success means the chosen skills are a valid way to complete the instruction, judged by two of three raters. Execution success means the robot actually completed it, judged the same way on video.

In the mock kitchen, which mirrors the environment in which the skills were trained, PaLM-SayCan reached 84 percent plan success and 74 percent execution success. In the real office kitchen, planning fell by 3 points to 81 percent and execution fell by 14 points to 60 percent. The paper reads this as generalization that is reasonable but not complete.

Each part of the system matters. Feeding the full instruction straight into the language-conditioned policy (BC NL) gave 0 percent in every family. Projecting the instruction onto the nearest known command (BC USE) reached 60 percent execution on single primitives and 0 percent elsewhere. Dropping the affordance term (No VF) reduced planning to 67 percent. Projecting the generative output of the language model to the nearest skill without affordances (Generative) gave 74 percent. Swapping the language model changed the results as well: FLAN-SayCan reached 70 percent planning and 61 percent execution, against 84 and 74 for PaLM-SayCan. The paper describes the last result as the first direct evidence that better language models translate into better robot performance.

The error analysis gives the division of labour. Of the errors, 65 percent came from the language model and 35 percent from the affordance functions. The embodiment family, which tests the system's understanding of the current state, was planned correctly only 64 percent of the time, mostly because of affordance errors. Negation and ambiguous references, such as asking for a drink with caffeine, were known weak points inherited from the language model. Chain-of-thought prompting, which generates a short explanation before each choice, handled negation and reasoning tasks in the cases the authors show.

Why it mattered

SayCan gave a concrete recipe for connecting language models to physical agents: constrain the model to a fixed set of skills, score the skills rather than sample them, and multiply by a learned estimate of feasibility. The recipe is interpretable, because each step of the plan comes with two numbers that a user can inspect. It is also modular. New skills are added by writing a description, training a value function, and adding an example to the prompt, which the drawer experiments test. The paper reports a 100 percent planning rate over 21 drawer queries, with execution at 33 percent because of the chained manipulation policy.

The paper is also candid about its limits. Its main bottleneck is the range and robustness of the skills, not the language. The system cannot easily react when a skill fails despite reporting a high value, and it has no feedback loop while a plan is running. The authors point to a follow-up, Huang et al., which adds closed-loop feedback through an "inner monologue" built on the same pattern. The paper has been widely cited, with about 4,250 citations on Semantic Scholar at the time of writing.

Reading guide

Read the paper in its own order. For each section, these prerequisites matter most:

  1. Introduction. Language Model for what a large language model is, and In-Context Learning for the prompting that the baselines rely on.
  2. Section 2, preliminaries. Conditional Probability and Autoregressive Model for the chain rule that gives p(W)p(W) as a product of next-word probabilities, Markov Decision Process for the formal setting, Temporal-Difference Learning and Bellman Equation for the value function and its loss, and Q-Learning for the Q-function.
  3. Section 3, the SayCan rule. Value Function and Reinforcement Learning for the affordance, Bernoulli Distribution for the success variable cπc_{\pi}, and Expected Value for the sum over outcomes.
  4. Section 3, scoring and the prompt. Softmax for turning a model's output scores into probabilities, and Chain-of-Thought Prompting for the explanation step added in Section 5.
  5. Section 4, training the skills. Behavior Cloning for the BC-Z policies, Dynamic Programming for the approximate dynamic programming behind the value functions, and Word Embedding for the frozen sentence encoder that conditions the policies on text.
  6. Section 5, experiments. Zero-Shot Learning for the claim that the system runs new instructions without new training, and Cosine Similarity for the projection used by the baselines that map generated text to the nearest skill.
  7. Section 5.1, ablating the language model. Transformer for the architecture behind the PaLM and FLAN models compared.

Check yourself

QuestionWhy does SayCan multiply the language score by an affordance, rather than using either one alone?Show answer

The language score says whether a skill is a useful next step for the instruction, but it knows nothing about the scene or the robot. The affordance says whether the skill can succeed from the current state, but it knows nothing about the instruction. A skill that is useful but impossible, such as a vacuum the robot cannot reach, must score low, and a skill that is possible but irrelevant must also score low. The product is large only when both are large, which is the probability that the skill advances the instruction successfully.

QuestionWith language score 0.40.4 and affordance 0.50.5 for skill A, and language score 0.30.3 and affordance 0.90.9 for skill B, which skill does SayCan choose, and what do the combined scores equal?Show answer

Skill A scores 0.4×0.5=0.200.4 \times 0.5 = 0.20, and skill B scores 0.3×0.9=0.270.3 \times 0.9 = 0.27. SayCan chooses skill B, even though skill A has the higher language score, because the robot is much more likely to complete B from the current state.

QuestionWhen the reward is 11 for success and 00 otherwise, with no discounting, what does the value function of a skill equal, and why does that make it an affordance?Show answer

The value of a state is the expected sum of rewards from that state onward. With a single reward of 11 at the end of a successful episode and 00 otherwise, that expected sum is exactly the probability of success. So the value function is the probability that the skill succeeds from the state, which is the affordance p(cπ∣s,ℓπ)p(c_{\pi} \mid s, \ell_{\pi}) used in the selection rule.

QuestionThe real-kitchen results show planning at 81 percent but execution at 60 percent. Which part of the system does the gap point to, and what does the paper's error analysis suggest about how to close it?Show answer

The gap between planning and execution is a gap between choosing the right skills and carrying them out. Planning is judged from the plan, and execution from video of the robot. The gap points to the skills themselves, whose policies must actually succeed when run, and to the lack of feedback when a skill fails. The paper's error analysis attributes most errors to the language model, which suggests better language models help. It also says the primary bottleneck is the range and robustness of the skills, and the closed-loop work it cites addresses failures during execution.

Sources

Read the full paper

Michael Ahn, Anthony Brohan, Noah Brown et al., 2022. arXiv:2204.01691