Contents
- 0. Primer: See the Whole Map First, Then Take the Algorithms Apart One by One
- 1. Problem Formalization: What Embodied AI Is Actually Optimizing
- 1.1 Starting from the MDP: A Widely Reused Abstraction
- 1.2 The Real Difficulty of Embodied AI: Partial Observability
- 1.3 Three Learning Paradigms: One Objective, Three Data Sources
- 2. Basic Layer: Reinforcement Learning — How to Learn Without Demonstrations
- 2.1 Policy Gradient: Directly Optimizing “the Probability of an Action”
- 2.2 PPO: Getting “the Size of the Update” Under Control
- 2.2.1 From Importance Sampling to the Clipped Objective
- 2.2.2 GAE: A Continuous Dial Between Bias and Variance
- 2.2.3 GAE Pseudocode and Walkthrough
- 2.2.4 PPO Pseudocode and Walkthrough
- 2.2.5 detach: Which Quantities in PPO Must Not Have Gradients
- 2.2.6 PPO Common-Pitfall Checklist (Embodied Edition)
- 2.2.7 PPO versus TRPO
- 2.2.8 Applicability: Where PPO Belongs in Embodied AI
- 2.3 SAC: Writing “Exploration” into the Objective Function
- 2.3.1 SAC Pseudocode and Walkthrough
- 2.3.2 detach and the tanh Jacobian: The Two Easiest Things to Get Wrong in SAC
- 2.3.3 SAC Implementation-Pitfall Checklist
- 2.3.4 Applicability: Where SAC Belongs in Embodied AI
- 2.4 How to Choose Between PPO and SAC
- 2.5 Beginner Experiment Checklist for the Basic Layer
- 3. Skill Layer: Imitation Learning — How to Learn Fast When Demonstrations Are Available
- 3.1 The Inherent Flaw of Behavior Cloning: Compounding Error
- 3.2 ACT: Action Chunking + Temporal Ensembling
- 3.2.1 ACT Pseudocode and Walkthrough
- 3.2.2 Gradient-Flow Checklist: Which Paths in ACT Must Have Gradients and Which Must Not
- 3.2.3 ACT Implementation-Pitfall Checklist
- 3.2.4 Comparison with “Pure Behavior Cloning”
- 3.2.5 Applicability: Where ACT Should Be Used
- 3.3 Diffusion Policy: Treating Actions as a “Denoising Generation” Problem
- 3.3.1 Diffusion Policy Pseudocode and Walkthrough
- 3.3.2 Gradient Flow and Condition Injection: The Paths Easily Confused in DP
- 3.3.3 DP Implementation-Pitfall Checklist
- 3.3.4 Comparison with Flow Matching (π₀), and Applicability
- 3.4 ACT versus Diffusion Policy
- 4. Foundation-Model Layer: Vision-Language-Action Models
- 4.1 Why the “Vision-Language-Action Model” Route Works
- 4.2 Route 1: Discretize Actions into Tokens (RT-2 / OpenVLA)
- 4.2.1 RT-2 / OpenVLA Pseudocode and Walkthrough
- 4.2.2 Gradient-Flow Checklist and Implementation Pitfalls
- 4.2.3 Comparison with π₀ and FAST
- 4.2.4 Applicability
- 4.3 Route 2: Flow-Matching Action Head (π₀)
- 4.3.1 The Network Structure and Pseudocode of π₀
- 4.3.2 Gradient-Flow Checklist: “Who Should Learn, Who Should Be Frozen, Who Should Not Propagate” in π₀
- 4.3.3 π₀ Implementation-Pitfall Checklist
- 4.3.4 Comparison with Discrete Tokens and Diffusion Policy, and Applicability
- 4.4 Route 3: Frequency-Domain Tokenization (FAST)
- 4.4.1 FAST Implementation-Pitfall Checklist
- 4.4.2 Comparison with Other Tokenization Schemes, and Applicability
- 4.5 Other Open-Source / Representative Models Worth Knowing
- 4.5.1 Mechanism Essentials, Common Pitfalls, and Applicability of the Four Models
- 5. World Models and Model-Based Reinforcement Learning
- 5.1 Three Routes for World Models
- 5.2 DreamerV3: Training a Policy by “Dreaming” in Latent Space
- 5.2.1 DreamerV3 Pseudocode and Walkthrough
- 5.2.2 Gradient-Flow Checklist: The Three Non-Interfering Gradient Paths in DreamerV3
- 5.2.3 DreamerV3 Implementation-Pitfall Checklist
- 5.2.4 Route Differences from TD-MPC2, and Applicability
- 5.3 TD-MPC2: Latent-Space MPC That Skips Decoding and Only Plans
- 5.3.1 TD-MPC2 Pseudocode and Walkthrough
- 5.3.2 Gradient-Flow Checklist: TD-MPC2’s Four “sg”s
- 5.3.3 TD-MPC2 Implementation-Pitfall Checklist
- 5.3.4 Comparison with DreamerV3 and JEPA, and Applicability
- 5.4 JEPA: Predicting “Representations”, Not “Details”
- 5.4.1 Gradient-Flow Checklist: JEPA Has Only One Gradient Path but Three “Do-Not-Touch” Rules
- 5.4.2 JEPA Implementation-Pitfall Checklist
- 5.4.3 Positioning Difference from Dreamer and TD-MPC2, and Applicability
- 5.5 How to Choose Among the Three
- 6. Robustness Layer: From Simulation to Reality (Sim-to-Real)
- 6.1 The Six Sources of the Reality Gap
- 6.2 Domain Randomization: Making the Policy “Well-Traveled”
- 6.2.1 Automatic Domain Randomization (ADR)
- 6.2.2 Complete Pseudocode for Domain Randomization + PPO
- 6.2.3 Why Domain Randomization Works, and When It Does Not
- 6.3 The Other Three Routes: System Identification, Domain Adaptation, Real-World Fine-Tuning
- 6.4 Safety and Evaluation: Real-Robot Deployment Is Not Just About Success Rate
- 7. Panoramic Comparison Table and Selection Decisions
- 7.1 One Master Table
- 7.2 Selection Decisions: Ask Yourself in Order of the Problem
- 7.3 Combined Use: Real Projects Rarely Use Only One Method
- 8. Five-Stage Learning Path
- Stage 0: Prerequisites
- Stage 1: Reinforcement Learning Basics (PPO / SAC)
- Stage 2: Imitation Learning (ACT / Diffusion Policy)
- Stage 3: VLA (Fine-Tuning Open-Source Models)
- Stage 4: World Models (DreamerV3 / TD-MPC2)
- Stage 5: Real Robots and Sim-to-Real
- Trade-Off Advice for the Learning Path
- Hardware and Budget: Zero-Yuan Simulation, Thousand-Yuan Robot Arms, and the Truth About the “50-Yuan Robot Dog”
- 9. Engineering Pitfalls and Common Misconceptions
- 9.1 Data Handling
- 9.2 Training
- 9.3 Deployment
- 9.4 Cognitive Misconceptions
- 10. Open Problems and Trends (as of 2026)
- 11. Summary: The Fundamental Differences Between Methods and Their Applicability Boundaries
- 11.1 One Table to See the Mechanism Differences
- 11.1.1 Cross-Method Quick Reference: The Quantities That “Must Stay Outside the Gradient” in Every Algorithm
- 11.2 Six Key Divergences: Where Do Methods Actually Differ?
- 11.3 Reverse Lookup by “Capability Gap”: Fill In Whatever You Lack
- 11.4 The Six Most Easily Mismatched Combinations
- 11.5 One-Page Quick Notes: One Sentence per Method
- 11.6 Three General Principles Worth Taking Away
- 12. Quick-Reference Summary: Core Differences and Applicable Scenarios of Each Algorithm
- 12.1 One Matrix: Positioning, Key Differences, Applicability and Forbidden Zones
- 12.2 Reverse Lookup by Constraint: Which One Should I Choose Under My Conditions
- 12.3 Default Combinations by Task Family
- 12.4 Four-Step Decision: From Constraints to a Plan
- 12.5 Five Cross-Cutting Conclusions
- Appendix A: Abbreviations Quick Reference
- Conclusion: How to Use This Document
Embodied AI Algorithms: From Beginner to Mastery
0. Primer: See the Whole Map First, Then Take the Algorithms Apart One by One
“Embodied AI” (intelligence with a physical body that can perceive, decide, and act inside a real or simulated environment) sounds like a new direction, but it is really the confluence of three old technical threads: reinforcement learning (RL, learning a policy by interacting with an environment and learning from trial and error), imitation learning (IL, acquiring skills by learning from human demonstrations), and large-scale pretrained models (learning general representations from massive data first, then transferring them to specific tasks).
The mistake beginners make most often is to read the literature in order of paper popularity: diffusion policy today, vision-language-action (VLA) models tomorrow, and after a pile of reading they still do not know what problem each of them solves or why each of them has to exist. The right approach is to first build a map organized by “capability level”, hang every algorithm at a fixed position on that map, and then take each one apart.
The organization of this article is exactly that map, four layers from top to bottom:
| Layer | Problem it solves | Representative algorithms | Data source | Output frequency (policy inference) |
|---|---|---|---|---|
| Foundation layer · semantics (subgoals) | Given one natural-language instruction, which subtask should be done now, where to go, what to grasp? | RT-2, OpenVLA, FAST, GR-2, HPT | Internet-scale multi-robot data + vision-language pretraining | Low frequency 3–10 Hz (chunk level or event level) |
| Foundation layer · action (continuous) | Given a subgoal, how to stably generate high-frequency continuous action chunks? | π₀ (flow-matching action expert), RDT-1B (diffusion action head), Octo (lightweight general baseline) | Multi-embodiment trajectories + unified action space | Medium frequency 10–50 Hz (action-chunk inference) |
| Skill layer | Given a specific task, how to reliably execute the action? | Behavior cloning, ACT, Diffusion Policy | Human teleoperation demonstrations (tens to thousands of episodes) | Medium frequency 10–50 Hz (action-chunk inference) |
| Foundation layer (basic) | Without demonstrations, how to optimize long-term return through trial and error? | PPO, SAC (model-free); DreamerV3, TD-MPC2 (model-based, see Chapter 5) | Autonomous interaction in a simulator | High frequency (simulation step level or control step level) |
| Robustness layer | Once a policy is learned in simulation, how to keep it from collapsing on the real robot? | Domain randomization, system identification, real-world fine-tuning | Simulation + a small amount of real data | Unchanged, runs through the whole pipeline |
Two things must be remembered about this table: the higher up you go, the more the layer depends on prior knowledge and big data; the lower down you go, the more it depends on interaction and reward design. And the higher up, the lower the decision frequency, but the “action generation frequency” is not necessarily low — the high level decides “what to do” (a few times per second is enough), the action layer decides “how to move” (ten to tens of times per second), and the low-level servo still runs at 100–1000 Hz (see the three-level frequency split in 7.3). These are three different notions of frequency.
The table splits the foundation-model layer into two rows because it has never been a homogeneous category. Three criteria are worth remembering separately:
- π₀ is a composite and cannot be labeled with a single frequency. Its vision-language backbone handles low-frequency semantics (on the order of 3–10 Hz), while the added flow-matching action expert handles high-frequency continuous action chunks (inference can reach 20–50 Hz, see Section 4.3). Both frequencies exist in one model at the same time. Labeling π₀ only as “3–10 Hz” throws away half of its action-layer capability.
- Octo is a lightweight general baseline, not a representative of “internet-scale pretraining”. It is trained on Open X-Embodiment, a large-scale multi-robot collection; it has few parameters, and its main use is “take the open-source weights and fine-tune on your own data”. It therefore sits in the “baseline / fine-tuning starting point” slot of the action layer, rather than being listed alongside heavy models such as RT-2 and OpenVLA.
- RDT-1B is a domain foundation model focused on dual arms. Its data scale is large (on the order of a million trajectories), but its task domain is concentrated on dual-arm manipulation, so its generalization boundary differs from that of a “general internet-level VLA”.
Two further points are easy to misread: JEPA is not in the basic layer — it outputs representations / world models and does not produce actions itself, so it must be paired with a planner or policy optimizer to close the loop (see Section 5.4 and the comparison table with DreamerV3 for details); and every Hz value in the frequency column means “how often the policy emits a decision or an action chunk”, not the servo loop frequency. What the policy outputs is usually a target point or an action chunk; the genuinely high-frequency closed loop is handled by the low-level controller.
Going from beginner to mastery means crossing five thresholds in order. Chapter 8 of this article gives an executable training path; they are listed here so that you can locate yourself at any time:
- Prerequisites: Markov decision processes (Markov Decision Process, MDP, a mathematical framework that formalizes the “state–action–reward” interaction), policy gradients, and the basic notation of probability theory and variational inference.
- Get one RL loop working: train a continuous-control task with PPO in MuJoCo (a commonly used physics simulation engine) and be able to explain every hyperparameter yourself.
- Get one imitation-learning loop working: train a grasping task with ACT or Diffusion Policy on demonstration data, and understand why “action chunking” rescues behavior cloning.
- Read and be able to fine-tune a VLA: understand the trade-off between the two routes of action tokenization (discretization) and continuous action generation (flow matching), and be able to use LoRA (Low-Rank Adaptation, a fine-tuning method that trains only a small number of additional parameters) to fine-tune an open-source VLA on your own data.
- Cross the reality gap: migrate a simulation policy to a real robot and master the full pipeline of domain randomization, system identification, and safety evaluation.
After reading Chapters 2 to 6, which correspond to these five thresholds, Chapter 11 is a horizontal summary: it steps out of the “by layer” order, uses one mechanism overview table, six key divergences, and one “capability gap” reverse-lookup chain to compare all methods side by side, and specifically answers “which one should I pick, and when should I not pick it”. Chapter 12 is the lookup-table version of the summary: it compresses the same conclusions into a “difference–scenario” matrix, reverse lookups by resource constraint, and default combinations per task family, for direct use when choosing a model. If you come only for model selection, you can go straight to the constraint decision in Chapter 7, then the mechanism comparison in Chapter 11, and finally settle the plan with Chapter 12.
Reading conventions: in the formulas of this article, denotes state, denotes action, denotes reward, denotes policy (the distribution of actions given a state), and denotes the discount factor; value-network parameters are written and policy-network parameters . Every pseudocode block annotates “Input / Output” and the shapes of key variables on its first line inside the block, and symbols follow the definition of their first appearance in that section — when the same symbol is reused across sections its meaning stays consistent, and if a section temporarily changes the convention it is noted inside the block. All derivations are kept in click-to-expand collapsible blocks — read the conclusion and the intuition first, and expand the derivation only when you need it. This is the most time-efficient way to read from beginner to mastery.
1. Problem Formalization: What Embodied AI Is Actually Optimizing
1.1 Starting from the MDP: A Widely Reused Abstraction
Any embodied task, whether “pick up a cup” or “fold clothes”, can be written as an MDP: a five-tuple , where is the state space, is the action space, is the state transition probability, is the reward function, and is the discount factor (the closer to 1, the more long-term return matters).
The agent’s goal is to find a policy that maximizes the expected discounted return:
Here is a trajectory. This expression is the objective shared by all later algorithms — RL, imitation learning, and world models differ only in “how this expectation is estimated” and “what data is used to estimate it”.
Derivation: Why a discount factor is used, and where the Bellman optimality equation comes from
Step 1: what the discount does. Without discounting (), the sum of returns may diverge as long as the task continues; moreover “one point of reward today” and “one point of reward a year from now” would be treated equally, which does not match the practical needs of control problems. With , the return is upper bounded by , and distant rewards get lower weight, which guarantees convergence mathematically.
Step 2: define the state value. The expected return starting from state and acting according to policy :
Step 3: peel off the first step. Take the first term of the sum out on its own; the remaining terms are exactly the value starting from :
This is the Bellman expectation equation. It turns an “infinite sum” into a recursion of “one-step reward + value of the next state”, and it is the root of all value iteration and temporal difference (Temporal Difference, TD, updating the current estimate with an estimate of the next step) methods.
Step 4: take the optimum. Replace the policy with “pick the optimal action in every state” to obtain the optimal value function :
The corresponding action value (execute action in state first, then act according to the optimal policy) satisfies:
This is the Bellman optimality equation. It shows that the optimal action value can be defined self-consistently — no knowledge of the full environment model is needed; as long as there is a sufficiently large table (or a function approximator) updated iteratively, it converges to it. This “self-consistency” property is the theoretical basis of every TD learning algorithm that follows (including the deep versions in the DQN family).
Step 5: policy and value imply each other. Given , the optimal policy is the greedy policy ; conversely, given a policy, its value can be evaluated with the Bellman expectation equation. This alternating “evaluate — improve” process is called policy iteration, and convergence is guaranteed by the contraction property of the Bellman operator (with contraction coefficient ).
1.2 The Real Difficulty of Embodied AI: Partial Observability
The MDP above assumes the agent can see the full state. Real robots cannot: a camera only sees part of the scene inside a conical field of view in front of it, and occluded objects, the precise torque of its own joints, and the ground friction coefficient are all unavailable. The problem then becomes a partially observable Markov decision process (Partially Observable MDP, POMDP): the agent receives an observation that depends on the true state through but is not identical to .
The standard solution to a POMDP is to maintain a belief , that is, “given everything seen and done so far, the probability distribution over what the current state is”. The policy changes from “state to action” into “belief to action” .
Derivation: The Bayesian recursion of the belief (the core update of a POMDP)
Suppose the belief at the previous instant is known; after executing action we observe . The new belief is then:
Where it comes from: apply Bayes’ rule to ; the numerator expands into “observation likelihood × state prior”, and the state prior is obtained by summing “previous belief × transition probability”:
The denominator is a normalization constant (a sum over ) that keeps the belief a probability distribution.
Why this expression matters: it shows that “memory” can be compressed into a probability distribution instead of storing the whole history. In engineering nobody actually computes this integral (states are continuous and extremely high-dimensional); instead a recurrent neural network (Recurrent Neural Network, RNN) or the hidden state of a Transformer approximately “remembers” the history — this is exactly why ACT, DreamerV3, and VLA all come with a history encoder. Understand this and you understand “why almost every embodied policy consumes a history of frames rather than a single frame”.
1.3 Three Learning Paradigms: One Objective, Three Data Sources
Facing the same , the field has evolved three complementary routes; their fundamental difference is where the data comes from and whether a reward signal is needed:
| Paradigm | Data | Reward | Advantages | Fatal weakness |
|---|---|---|---|---|
| Reinforcement learning | The agent interacts with the environment itself | Required | Can surpass demonstrations and find better policies | Low sample efficiency, hard reward design, dangerous trial and error on real robots |
| Imitation learning | Human teleoperation demonstrations | Not required | High data utilization, simple to implement, natural behavior | Distribution shift (covariate shift, see 3.1) causes compounding error |
| Model-based | Interaction data + a learned environment model | Optional | Highest sample efficiency, supports “imagination” planning | Model error accumulates, long-horizon predictions distort |
A mature embodied system usually uses all three: a VLA is pretrained on massive demonstrations (imitation learning), the lower layer uses RL for fine control and robustness, and a world model is used for low-cost trial and error and planning. Do not treat them as mutually exclusive options — this is the first cognitive upgrade on the way from beginner to mastery.
The rest of the article takes the four-layer map apart layer by layer. Every section follows the same structure: intuition → principle → expandable derivation → pseudocode → pseudocode walkthrough → common pitfalls.
2. Basic Layer: Reinforcement Learning — How to Learn Without Demonstrations
2.1 Policy Gradient: Directly Optimizing “the Probability of an Action”
Value-function methods (the Q-learning family) first learn “how many points each action is worth” and then pick actions by score; policy gradient (Policy Gradient, PG) does the opposite: it parameterizes the policy directly and uses gradient ascent to increase the probability of “actions that obtain high return”.
The central formula is the policy gradient theorem:
where is an estimate of the advantage function (advantage, measuring “how much better this action is than average”). Intuition: when , increase the probability of that action; when , decrease it.
Derivation: The policy gradient theorem (log-likelihood trick + a baseline introduces no bias)
Step 1: push the gradient inside the expectation. The trajectory probability is
The objective is , hence
The second equality uses the identity . What this step achieves is turning “a gradient with respect to a distribution” into “an expectation over samples”, which can then be estimated by sampling.
Step 2: only the policy term contains . In , the initial state distribution and the transition probability do not depend on (the environment does not change with the policy), so after differentiating only
remains.
Step 3: introduce a baseline. If the return is replaced by “the return from time onward, ” minus a baseline that depends only on the state, , the expectation is unchanged:
because the gradient of a probability distribution with respect to its parameters integrates to zero. This property says: subtracting a baseline does not change the expected gradient; it only reduces the variance. Taking makes the advantage ; in practice one often uses the Monte Carlo return minus a value estimate, i.e. .
Step 4: why it converges. With a soft policy (such as a Gaussian policy) and a suitable step size, the expected direction of the above gradient agrees with the true gradient of , so stochastic gradient ascent converges to a local optimum. All the engineering complexity comes from “the variance is too large”, which is precisely why PPO and GAE exist later.
Three pitfalls of the starter implementation (REINFORCE): (1) using the whole-trajectory return as a weight gives enormous variance, so a baseline is mandatory; (2) not normalizing the advantage means that different reward scales across tasks make the learning rate meaningless; (3) the sampling policy and the update policy must be identical (on-policy), otherwise the gradient is biased.
2.2 PPO: Getting “the Size of the Update” Under Control
Proximal policy optimization (Proximal Policy Optimization, PPO) was proposed in 2017 and is still the default baseline for continuous control today. It addresses a structural defect of policy gradients: a slightly too large step and the policy collapses — one update pushes the probability of some action close to 0 or 1, after which counterexamples are never sampled again, and the gradient vanishes or explodes.
PPO’s remedy is to “limit the size of each update”. It has two key components: the clipped surrogate objective and generalized advantage estimation (Generalized Advantage Estimation, GAE).
2.2.1 From Importance Sampling to the Clipped Objective
Let the old policy be and the new policy , and define the probability ratio
PPO maximizes:
where is usually set to 0.2.
Derivation: Why importance sampling is used, why min is taken, and what the clipping actually limits
Step 1: why importance sampling (Importance Sampling, IS). Data collected by the old policy has to be used to evaluate the new policy, which requires a correction by the probability ratio:
Without this correction, computing the gradient of the new policy directly from old data gives a biased estimate.
Step 2: the problem with plain IS. If and are too far apart, can be enormous (variance explosion) or tiny (information loss). The distance between the two must therefore be constrained inside the objective. PPO’s choice is “clipping” rather than explicitly computing the Kullback-Leibler divergence (KL divergence, which measures the difference between two distributions).
Step 3: what min does. Look at two cases:
- (the action is good and we want to raise its probability): the objective is , but once exceeds it is clipped to and the gradient becomes 0 — raising it further brings no extra benefit, so it stops there.
- (the action is bad and we want to lower its probability): the objective is , and once drops below it is clipped to and the gradient is again 0 — lowering it further brings no extra benefit.
Taking the min gives a “pessimistic lower bound”: when the clipped term and the original term disagree in direction (for example while is very small), the smaller one is taken, so that the objective is never overestimated because of clipping and out-of-range updates are never encouraged.
Step 4: what constraint it is equivalent to. In the small neighborhood where is close to 1, , and the second-order approximation of the KL divergence is
so “restricting to ” is approximately “restricting the policy movement to a trust region”. TRPO (Trust Region Policy Optimization) solves this constraint explicitly (with conjugate gradients plus a line search), while PPO approximates it with a clipped surrogate objective — this is the fundamental reason PPO is cheap, stable, and good enough.
2.2.2 GAE: A Continuous Dial Between Bias and Variance
Advantage estimation has two extremes: use the one-step TD error (high bias, low variance), or use the Monte Carlo return of the whole trajectory (low bias, high variance). GAE interpolates continuously between them with one parameter .
Define the TD error ; then
Derivation: The exponentially weighted expansion of GAE, and what the two ends λ=0 / λ=1 degenerate into
Expand the sum term by term:
: only remains, i.e. the one-step TD error. High bias, low variance — the bias comes from bootstrapping: the only real signal in the whole expression is , everything else relies on guesses from the value network , and this error persists whenever estimates badly; the variance is low because only a single random reward is accumulated, so there are the fewest sources of randomness.
: all have equal weight (because ), and the telescoping sum cancels term by term:
The last two terms cancel after shifting the index, and the result is exactly the Monte Carlo return minus the baseline, , i.e. an unbiased but high-variance estimate: unbiased because there is no bootstrapping any more and all real rewards are used; high variance because dozens to hundreds of random rewards along the whole trajectory are summed, so the randomness grows linearly.
Intermediate values: the smaller , the more we trust “bootstrapping” (using the value estimate in place of the actual subsequent return); the larger, the more we trust “actual sampling”. In practice is a common compromise.
Engineering note: GAE is not accumulated forward along the trajectory but computed by backward recursion (from the last step backwards), because depends on :
The boundary condition means “there is no more information beyond the trajectory”; at the end of the recursion, the advantage of the last step degenerates into its own . See 2.2.3 for the full implementation.
Derivation: Why termination and truncation must be distinguished as two separate masks
Step 1: distinguish the two kinds of “episode end”.
- True termination (terminal, e.g. falling over or task success): the environment enters an absorbing state, no states exist afterwards, and the future return is identically 0;
- Time truncation (truncation, e.g. being forcibly cut off at the 1000-step limit): the episode is merely “cut short”, the environment itself could continue to evolve, and the future return is not 0.
Step 2: the corresponding to each case.
On true termination, the term must be set to zero:
On time truncation, bootstrapping must be kept (using to represent “the return that could have been obtained after the interruption”):
Step 3: why one cannot simply treat everything as termination. Suppose a trajectory is truncated at and the true return afterwards is not 0 (for example the robot is still moving toward the goal). If it is wrongly treated as termination, loses out of thin air; this negative bias then propagates forward attenuated by :
As a result, states closer to the time limit have their advantages pushed lower; and since , the regression target of the value network is systematically biased low as well. After long training, the value function develops an artificial downward slope near the time limit — the so-called false cliff: the policy learns to “give up when approaching step 1000”, because it believes the remaining time is worthless.
Step 4: conversely, treating termination as truncation is equally harmful. If an episode really ends and bootstrapping is still applied, counts the value of the next episode into the end of this one, effectively “stealing” reward across episodes: the value estimate is inflated and the advantage jumps at the episode boundary.
Step 5: express both with a mask. Take with meaning true termination; then
Note that the mask must be applied in both places: the first masks the bootstrapping term, the second masks the advantage coming from the next episode. Changing only the first and forgetting the second is the most common mistake when reproducing GAE — already belongs to the new episode, and without cutting it off the two episodes get mixed together.
Step 6: how to implement it. Record two flags during sampling: done (true termination) and truncated (time limit or external interruption); use only done as the mask when computing GAE, and use truncated only for statistics and curriculum scheduling, never for masking bootstrapping. If the environment returns only a single boolean, split it into two in the wrapper layer — this is why mainstream implementations (such as Stable-Baselines3 and CleanRL) all handle it separately.
For the full consequences of mistaking truncation for termination and how to fix them, see also trap 6 in Chapter 9, 9.2.
Derivation: Why the regression target of the value network is Ret = Â + V rather than the Monte Carlo return
Step 1: the definition of the advantage. The advantage is “how much better this action is than the policy’s average level”:
Rearranging gives ; replacing the on the left with its estimate yields
Step 2: why this target is better than the Monte Carlo return. Using directly as the regression target makes the variance grow linearly with trajectory length (this is the case); in the advantage has already mixed bootstrapping and sampling through , so the variance is suppressed and the bias depends only on the quality of . In other words, the value network regresses the “ estimate already smoothed by GAE”, not the raw return.
Step 3: three implementation details.
- Compute first, then , and must use the unstandardized — advantage standardization serves only the policy loss; adding a standardized back to shifts and rescales the value target as a whole, and has to be retuned before convergence is even possible.
- serves only as the label of the value network and must not backpropagate gradients into the input of (detach); otherwise the value loss flows back through the label and forms a self-loop.
- If the reward has been normalized (reward scaling), must be computed from the same normalized reward, otherwise the value scale disagrees with the reward the policy sees.
This is the origin of line ⑥, Ret_t = A_t + V_φ(s_t), in the pseudocode of 2.2.3.
2.2.3 GAE Pseudocode and Walkthrough
All the formulas above ultimately land in one function: “given a batch of samples, compute the advantages and the value labels”. This code deserves to be written out separately, because it is the place most easily written wrong when reproducing PPO — one wrong mask and the training curve quietly degrades, while no anomaly can be seen in the metrics.
Algorithm: generalized advantage estimation GAE (single trajectory, values given by V_φ)
Input: r[0..T-1] reward at each step
v[0..T] value estimate of each step; v[T] is the bootstrap value of the final state
done[0..T-1] termination mask (1 = true termination; time truncation recorded as 0)
γ discount factor, λ GAE coefficient
Output: A[0..T-1] advantages, Ret[0..T-1] regression targets of the value network
A[T] ← 0 # ① no information beyond the trajectory
for t = T-1 downto 0: # ② must go backwards
bootstrap ← 0 if done[t] == 1 else v[t+1] # ③ termination cuts bootstrapping
δ ← r[t] + γ·bootstrap - v[t] # ④ one-step TD error
A[t] ← δ + γ·λ·(1-done[t])·A[t+1] # ⑤ exponentially weighted recursion
Ret[t] ← A[t] + v[t] # ⑥ regression target of the value
# batch level: after concatenating E parallel trajectories into one dimension
A ← (A - mean(A)) / (std(A) + 1e-8) # ⑦ standardize over the whole batch only
return A, Ret
Walkthrough (numbers correspond to the steps above):
- ① Why set . The recursion needs an initial value; there are no steps after the final state, so the advantage is naturally 0. The real information is in : if the final state is a true termination, should be 0; if it is a time truncation, must carry the value estimate of the truncated state — missing this is equivalent to treating truncation as termination, which is exactly the cause of the “false cliff” in the previous collapsible block.
- ② Why it must go backwards. depends on ; in a forward scan is still unknown. This is also why many people “write it exactly as the formula says and still get it wrong”: the formula is a sum, the code is a recursion, and the direction has to be reversed.
- ③ The mask acts only on the bootstrapping term.
bootstrap ← 0 if done[t] == 1 else v[t+1]is equivalent to . Note thatdone(true termination) is used here, not truncation; the truncation flag does not participate in this line. - ④ contains only one step of real reward. Everything else relies on bootstrapping from , which is the source of its “low variance, high bias”; the role of is to add the real rewards of more subsequent steps with weight , gradually trading the bias back.
- ⑤ The second mask cannot be omitted.
(1-done[t])also cuts off the incoming ; if it is omitted, a terminating step pulls the advantage of the next episode into this episode and the two mix. A common wrong version isA[t] = δ + γλ·A[t+1]with masking only inside — the line looks perfectly reasonable on its own, yet the result has a systematic bias at episode boundaries. - ⑥ Ret is computed from the unstandardized A. Standardization serves only the policy loss (so that the learning rate means the same thing under different reward scales); standardizing before ⑥ shifts and rescales the value target as a whole, must be retuned before convergence is possible, and this is very hard to notice.
- ⑦ Where and over what range to standardize. Compute the mean and standard deviation over the whole batch (all parallel environments × all time steps); do not standardize each trajectory separately — standardizing inside a single trajectory erases the relative information “how large the advantages of different trajectories are”, which is equivalent to flattening good and bad trajectories together. only prevents division by zero.
- Numerics and performance. is the number of sampling steps per round (commonly 1024–4096), and a plain Python loop becomes the bottleneck here; mainstream implementations put the time dimension in the innermost tensor dimension and vectorize with “fixed-length loop + tensor slicing”, or use a segmented parallel prefix scan. The exponential decay of keeps the accumulation stable and float32 suffices; but if the reward magnitude is large, the reward should be normalized first, otherwise becomes too large, the value loss drowns the policy loss, and is pushed out of balance.
- How to self-check. Under a random policy the mean advantage over the whole batch should be close to 0, because the advantage is itself a deviation “relative to the average level”; if it deviates clearly from 0, a mask is usually in the wrong place, or the bootstrap value of the final state was set to 0 when it should have been the truncated-state estimate. Another check is to fix a set of and hand-compute the expected values at both ends and , then compare term by term with the implementation.
- Relation to 2.2.4. This is the kernel of step 2 in the PPO pseudocode; extracting it into a separate function makes unit testing easy. Real code should also store
doneandtruncatedin two separate arrays and use onlydoneinside GAE.
2.2.4 PPO Pseudocode and Walkthrough
Algorithm: PPO with GAE (on-policy, parallel environments, continuous action space)
Input: environments env×E, rollout length T, update epochs K, minibatches M, clip ε=0.2,
GAE λ=0.95, discount γ=0.99, policy loss weight c_pi=1, value loss weight c_v=0.5, entropy weight c_ent=0.01
Output: policy network π_θ (Gaussian mean, state-independent log-std) and value network V_φ
# ---------- one round: collect data with the current policy ----------
for t = 1..T, for each env e: # ① fully parallel
a_t = π_θ(s_t) # sample a_t from N(μ_θ(s_t), σ²)
(s_{t+1}, r_t, done_t, trunc_t) = env[e].step(a_t)
store (s_t, a_t, log π_θ(a_t|s_t), r_t, done_t)
s_t ← s_{t+1}; if done_t: reset env[e] # ② do not reset on truncation? see 2.2.3 mask
# ---------- compute advantages and value targets (see 2.2.3) ----------
A_t = GAE(r, V_φ(s), done, γ, λ)
Ret_t = A_t + V_φ(s_t) # ③ before standardization
A_t ← (A_t - mean)/std # ④ standardize only the policy loss
# ---------- K epochs of minibatch updates ----------
for epoch = 1..K:
for each minibatch:
ratio = exp(log π_θ(a|s) - log π_old(a|s)) # ⑤ current policy / old policy
L_pi = -min(ratio·A, clip(ratio,1-ε,1+ε)·A).mean()
L_v = 0.5·((V_φ(s) - Ret)²).mean() # ⑥ Ret detached
L_ent = entropy(π_θ(·|s)).mean()
L = c_pi·L_pi + c_v·L_v - c_ent·L_ent
update θ, φ with gradient descent
early stop if approx_kl > 1.5·target_kl # ⑦ optional safety valve
Walkthrough:
- ① Parallel environments are not an optimization, they are a necessity. On-policy data can be used only once; with a single environment, one round produces only samples, of which the variance is terrible. Typically 8–64 environments run in parallel, filling a batch of transitions.
- ② Truncation handling. When
truncfires, the environment should be reset as well, but the bootstrap value of the final state must be taken from the value network (see the mask derivation in 2.2.3), anddone=0should be stored. - ③ The order must not be reversed. must be computed before , and must use the unstandardized ; otherwise the scale of the value target drifts.
- ④ Standardizing only for the policy loss. Advantage standardization makes the effective learning rate insensitive to the reward scale across tasks, which is a prerequisite for “one set of hyperparameters handling many tasks”.
- ⑤ The old log-probability must be cached.
log π_oldis computed and stored at sampling time, never recomputed with the current parameters — otherwise the ratio is identically 1 and clipping never fires. - ⑥ The value target must be detached. functions as a label; if gradients flow back through it, the value loss forms a self-loop and training collapses within a few dozen rounds (see 2.2.6).
- ⑦ Early stopping is optional but strongly recommended. Track the approximate KL between the new and old policies inside the epoch; once it exceeds a threshold (for example the target), abort the remaining updates of this epoch — the data has been “used up” and further updates are pure damage.
Two implementation details worth noting: PPO usually shares a feature extractor between the policy head and the value head (actor-critic shared trunk), which saves parameters but couple the two losses — if the value loss is clearly dominant (large reward scale), the shared trunk gets skewed toward value prediction and the policy learns slowly. The alternative, separate trunks, costs twice as much but trains more cleanly. Second, log_std should be a learnable but state-independent parameter (one scalar per action dimension), not output by the network; the former is more stable and does not let the exploration noise be dragged around by the state encoding.
2.2.5 detach: Which Quantities in PPO Must Not Have Gradients
detach is a PyTorch operation: it keeps the numerical value of a tensor but takes it out of the computation graph, so that any later operation on it stops gradients from flowing back to the network that produced it. Four quantities in PPO must be treated as constants, and all four describe “the past”:
| Quantity that must be detached | Where it comes from | Consequence if not detached |
|---|---|---|
logp_old (old log-probability) | at sampling time | The denominator of the probability ratio also carries gradients, which amounts to optimizing the old and the new policy at the same time; the ratio loses the meaning of “how far the new policy has deviated” and the update direction is systematically distorted |
v_old (old value estimate) | at sampling time | It enters both GAE and the value label; with gradients, the critic is torn between “computing the advantage” and “regressing the label” |
Adv (advantage) | Obtained by backward recursion from v_old and the rewards | The actor loss flows back into the critic through the advantage, so the policy gradient is no longer “differentiating only with respect to ” and the actor and critic contaminate each other |
Ret (value regression label) | When minimizing both sides move, which is equivalent to chasing a moving target that you built yourself; in extreme cases the gradients cancel and you get a degenerate solution where “the loss is decreasing but the value is not learned” |
There is only one test: ask “should this quantity change after this update?” If the answer is “it should not”, it must be detached. The old policy’s probability, the old value, and the advantage and label computed from the old value are all constants during this update.
The most common wrong version in embodied projects (forgetting to cut the graph after sampling in parallel environments):
# Wrong: no no_grad at sampling time, the old values enter the buffer with the whole graph
logp_old = dist.log_prob(a).sum(-1) # carries gradients
v_old = v_net(s) # carries gradients
buf.store(s, a, r, done, logp_old, v_old)
# Right: build no graph during sampling, and detach explicitly once more before storing
with torch.no_grad():
dist = policy(s)
logp_old = dist.log_prob(a).sum(-1)
v_old = v_net(s)
buf.store(s, a, r, done, logp_old.detach(), v_old.detach())
Three details that are easily confused:
torch.no_grad()and.detach()are not the same thing. The former stops graph construction for a whole block of computation (saving memory and time, suitable for sampling); the latter only cuts the history of one tensor, and later operations on it can still build a graph. At sampling time wrap the forward pass inno_grad, thendetachonce more on the tensors being stored — belt and braces.- Never wrap
logp_newandv_newinno_gradduring the update phase. These two must carry gradients; otherwise the whole loss has no gradient and training silently stops working (the symptom is a constant loss and parameters that never move). - Detaching
v_olddoes not affect the numerical correctness of GAE. GAE only uses the value of to compute and and does not need to differentiate through it; it is regressed as a label, which also needs no differentiation. What does need gradients is , obtained by a fresh forward pass during the update phase.
If the actor and the critic share a vision backbone (very common in embodied tasks, because image encoders are expensive), there is one more constraint: the shared part may receive gradients only through the v_new and logp_new paths; v_old, Adv, and Ret must not flow back through it. The practical approach is “shared backbone + two independent heads”, with the value loss scale-normalized and the gradient norms of both heads monitored; when tuning becomes painful, splitting into two separate networks is actually less trouble.
2.2.6 PPO Common-Pitfall Checklist (Embodied Edition)
Compressing the derivations above into one troubleshooting table, ordered by how often the problems appear in embodied projects:
| Symptom | Likely cause | Fix |
|---|---|---|
| Collapses early in training, actions become deterministic | Learning rate too large, K too large, too large | Drop the learning rate to the order, set K to 3–10 and to 0.1–0.2, and monitor the k3 KL |
| Value loss will not go down | Monte Carlo return used as the label, label not detached, standardized advantage used to build the label | Use ; detach the label; standardize only for the actor |
| Advantage jumps at episode boundaries | done and truncated not separated, the mask multiplied in only one place | Store the two flags separately, use only done inside GAE, and multiply the mask in both places |
| Probability ratio stays far from 1 | logp_old recomputed during the update, or the old value never stored | Store logp_old at sampling time and detach it; use exp(logp_new - logp_old) instead of dividing probabilities |
| Monitored KL goes negative | was used | Switch to the k3 estimator , which is always non-negative |
| Good in simulation, shaky on the real robot | Observations not normalized, actions not bounded, control rate inconsistent with training | running mean/std normalization; scale actions after tanh by the real limits; unify the frequency and compensate for latency |
| Training unstable but nothing looks wrong | Reward magnitude too large, no return normalization | Reward scaling / return standardization, with GAE and the value target using the same scale |
| Fine manipulation will not learn | The exploration noise of the Gaussian policy shows up as random jitter at the end effector | Lower the initial log_std and set a floor; or switch to SAC / initialize from demonstrations |
| Performance varies wildly across parallel environments | Random seeds / initial states not randomized, environment parameters not randomized | Randomize the initial state and environment parameters each episode (see domain randomization in Chapter 6) |
| Better and better on the same batch, worse and worse on the real robot | No early stopping, K too large so it overfits old data | Add KL early stopping (break out once it exceeds 1.5× the target KL), or use an adaptive |
“Action bounding” deserves a separate note: the PPO policy is usually a Gaussian, and sampled actions may exceed the joint limits. Clipping directly to the limits teaches the policy a degenerate “pressed against the boundary” solution (the gradient is zero at the boundary, so the policy never learns that pushing further is useless); the standard approach is to push the Gaussian sample through tanh into , then scale it linearly by the real upper and lower bounds, while subtracting the tanh Jacobian term from log_prob — exactly the same as in SAC (see 2.3.2).
2.2.7 PPO versus TRPO
| Dimension | TRPO (Trust Region Policy Optimization) | PPO (Proximal Policy Optimization) |
|---|---|---|
| Constraint | Hard KL constraint | Probability-ratio clipping (soft constraint) |
| Solver | Conjugate gradients + line search (second-order approximation) | Standard gradient descent (first-order) |
| Implementation complexity | High (the Fisher matrix and conjugate gradients both have to be right) | Low (one forward, one clip, one backward) |
| Reuse of each data batch | Usually once | K epochs, several times |
| Stability | Good, but sensitive to step size and approximation error | Good, and easier to tune |
| Fit for large-scale parallelism | Fair | Excellent ( environments scale linearly) |
| Practical popularity | Academic benchmarks and theoretical analysis | Engineering default; the workhorse of embodied AI / games / RLHF |
There are three common PPO variants: PPO-Clip (used in this article, the most common), PPO-Penalty (put the KL into the loss with an adaptively adjusted penalty coefficient), and the adaptive KL coefficient version (dynamically adjust or the penalty coefficient according to the ratio of the actual KL to the target KL). More than nine out of ten embodied projects use PPO-Clip, because it has a single hyperparameter and is insensitive to the reward scale.
2.2.8 Applicability: Where PPO Belongs in Embodied AI
PPO’s boundary is clear: large-scale parallel sampling is possible, a reward can be defined, actions may be continuous or discrete, and extreme sample efficiency is not required.
| Scenario | Suitable for PPO | Why and recommendation |
|---|---|---|
| Humanoid locomotion in simulation | Very suitable | Thousands of parallel environments make sampling cheap; rewards (forward speed, posture penalties) are easy to write |
| Coarse policy pretraining for quadrupeds / arms in simulation | Very suitable | Use PPO to learn a robust initial policy at scale in simulation, then fine-tune on the real robot |
| Dexterous-hand fine manipulation (pegs, screws) | Fair | Exploration noise becomes jitter at the end effector and sample efficiency is low; initialize from demonstrations or switch to SAC/DP |
| Online learning on a real robot (every interaction is expensive) | Not suitable | On-policy and data is discarded after one use; millions of interactions are unaffordable on hardware; switch to SAC or imitation learning |
| Plenty of offline demonstrations but no reward | Not suitable | PPO needs a reward and environment interaction; use behavior cloning / ACT / Diffusion Policy |
| Sparse reward requiring long-horizon reasoning | Weak | Weak exploration, easily stuck; needs curriculum learning, reward shaping, or a world model |
| High-frequency force control (>100 Hz) | Not suitable | Policy forward pass plus communication latency cannot keep up; use low-level controllers with a low-frequency policy layer |
This yields a practical division of labor for embodied projects: use PPO in simulation to train “motion capability” (walking, running, standing up, resisting disturbance), use imitation learning on the real robot to acquire “manipulation skills” (pick, place, insert), and connect the two with domain randomization and real-world fine-tuning. This is also why the learning path in Chapter 8 puts PPO in stage 1 and ACT/DP in stage 2.
2.3 SAC: Writing “Exploration” into the Objective Function
Soft actor-critic (Soft Actor-Critic, SAC) is an off-policy (off-policy, meaning historical data can be reused) maximum-entropy RL algorithm. It changes the objective from “maximize return” to “maximize return + policy entropy”:
where is the policy entropy, and is the temperature coefficient (controlling the weight of “exploration” relative to “return”).
Derivation: The soft Bellman equation, soft policy iteration, and the reparameterized gradient
Step 1: why add entropy. Under a pure return objective the optimal policy is often deterministic (pick a single action in a given state), and once noise pushes that action off target there is no fallback. With entropy, the objective prefers policies that “keep diversity among several good actions”; exploration then happens naturally, and robustness to model error improves. In the extreme the policy approaches a uniform distribution (pure exploration), and degenerates into standard RL.
Step 2: the soft value function. Define the soft Q function so that
where the soft state value is a log-sum-exp soft maximum over all actions in state :
For discrete actions it is . As this degenerates into ; as grows, more actions are counted in — this is exactly what “soft” means: not a hard maximum, but a temperature-smoothed maximum.
Step 3: soft policy improvement. It can be shown that the optimal policy is a Boltzmann distribution:
The idea of the proof: extremize under the constraint with a Lagrange multiplier; differentiating with respect to gives , and rearranging completes it.
Step 4: why this expression is not used directly in engineering. In a continuous action space, integrating or summing over all actions is infeasible. SAC therefore uses two tricks: (1) reparameterized sampling — , , moving the randomness to , which is independent of the parameters, so that gradients can pass through the sampling; (2) twin Q networks with a minimum to suppress overestimation (see the next paragraph).
Step 5: the reparameterized gradient. For
differentiate directly with respect to , because is a deterministic function of (all the randomness lives in ). Note that the compression changes the probability density, so the Jacobian correction term is needed — this is why log_prob has to subtract that term in the pseudocode.
Step 6: twin Q to suppress overestimation. Take the smaller of the two Q-network outputs:
A single Q network feeds “lucky overestimates” back into the next round during bootstrapping, and the error keeps growing (the max operator has a systematic positive bias); taking the min significantly reduces that bias.
Step 7: automatic temperature adjustment. Treat as a parameter too, with the objective
where is the target entropy, often taken as for continuous control. Intuition: if the current policy entropy is below the target entropy (under-exploration), the gradient increases and forces the policy to be more random; otherwise it lowers and allows the policy to be more deterministic.
2.3.1 SAC Pseudocode and Walkthrough
Algorithm: SAC (continuous actions, automatic temperature)
Networks: policy π_θ (mean + standard deviation, tanh squashing), two Q networks Q_φ1/Q_φ2, target Q networks Q_φ1'/Q_φ2'
Hyperparameters: discount γ, soft-update coefficient τ, batch size B, learning rate, target entropy H_bar = -dim(A), initial α
Buffer: replay buffer D (large enough capacity, reusable across episodes)
for step = 1 .. max_steps:
# ---------- 1. interact and store ----------
a = tanh(μ_θ(s) + σ_θ(s)·ε) # ε ~ N(0, I)
s', r, done = env.step(a)
D.push(s, a, r, s', done); s ← s'
if s is the start of an episode: sample B transitions from D and go to the update
# ---------- 2. compute the target value (no gradients) ----------
a' = tanh(μ_θ(s') + σ_θ(s')·ε') # sample from the current policy
logp'= log π_θ(a'|s') - Σ log(1 - tanh²(u')) # with the tanh Jacobian correction
y = r + γ·(1-done)·( min(Q_φ1'(s',a'), Q_φ2'(s',a')) - α·logp' )
# ---------- 3. update the two Q networks ----------
for i in {1, 2}:
L_Q_i = 0.5·( Q_φi(s,a) - stop_grad(y) )²
gradient descent update φ_i
# ---------- 4. update the policy ----------
a_π = tanh(μ_θ(s) + σ_θ(s)·ε) # reparameterized
logp = log π_θ(a_π|s) - Σ log(1 - tanh²(u_π))
L_π = ( α·logp - min(Q_φ1(s,a_π), Q_φ2(s,a_π)) ).mean()
gradient descent update θ
# ---------- 5. update the temperature ----------
L_α = -( α·( logp.detach() + H_bar ) ).mean()
gradient descent update α (often parameterized as log α to keep it positive)
# ---------- 6. soft-update the target networks ----------
φ_i' ← τ·φ_i + (1-τ)·φ_i' # τ ≈ 0.005
Walkthrough:
- The value of being off-policy. Because of the replay buffer (experience replay pool), one piece of data can be reused repeatedly, so sample efficiency is an order of magnitude higher than PPO; the price is that “off-policy correction” is needed (SAC achieves it naturally through Q learning and does not need importance sampling).
- Twin Q + taking the min.
min(...)is the core of SAC’s stability; do not keep only one to save memory. - The tanh Jacobian term. Omitting
-Σ log(1 - tanh²(u))miscalculates the policy density, which shows up as alpha drifting on its own and the policy becoming more and more deterministic. This is the most common hidden bug in SAC implementations. - Soft update of the target networks. Too large a makes the target unstable; too small and learning lags. 0.005 is a common starting point.
- Why it can be used on real hardware. Reusable offline data + automatic exploration make SAC suitable for “expensive interaction but offline-training-friendly” scenarios (such as servo-level control of a real robotic arm).
- SAC’s shortcomings: sensitive to the reward scale (normalization required), exploration is still a bottleneck on long-horizon sparse-reward tasks, and the expressiveness of multi-modal action distributions is limited (a Gaussian policy can only be unimodal).
2.3.2 detach and the tanh Jacobian: The Two Easiest Things to Get Wrong in SAC
SAC’s gradient flow is more complex than PPO’s, because it has both “online network” and “target network” parameters at the same time, plus a path that goes through policy sampling. Listing the checklist by “who should receive gradients”:
| Quantity | Should it have gradients | Explanation |
|---|---|---|
y (TD target: ) | Must stop_grad | It is a label. With gradients the Q network chases itself |
| inside | Must stop_grad (with respect to the action) | The action in the target only needs its value. If gradients were allowed to flow back, the Q loss would optimize the policy at the same time and the two objectives would fight each other |
logp.detach() entering the temperature loss | Must detach | The temperature only needs “the gap between the current entropy and the target entropy” and should not backpropagate to the policy through it |
| entering the policy loss | Must carry gradients, but only up to the policy | Often written as min(Q1,Q2) and then detach-ed once for temperature monitoring; it must be kept in the policy loss |
| Target network parameters | Do not participate in backpropagation | Update only by soft update ; do not put them in the optimizer |
A typical mistake is “forgetting stop_grad on the target value”; it is well concealed in code, because the loss still decreases — it just converges to the wrong point:
# Wrong: gradients on the target side, the Q networks chase themselves
a2, logp2 = policy.sample(s2)
y = r + gamma * (1 - done) * (q_target_min(s2, a2) - alpha * logp2)
loss_q = ((q1(s, a) - y) ** 2).mean() + ((q2(s, a) - y) ** 2).mean()
# Right: detach the whole target side
with torch.no_grad():
a2, logp2 = policy.sample(s2)
y = r + gamma * (1 - done) * (q_target_min(s2, a2) - alpha * logp2)
loss_q = ((q1(s, a) - y) ** 2).mean() + ((q2(s, a) - y) ** 2).mean()
The tanh Jacobian correction is the second guaranteed mistake. The policy squashes the action as with . The probability density has to be converted with the change-of-variables formula:
The second term is exactly the logarithm of the Jacobian determinant. The consequence of omitting it is not an immediate error but a mismatch between the numerical value of the policy density and the actual sampling distribution: the entropy term in the policy loss is computed wrongly and the temperature drifts in the wrong direction, showing up as “after a few hundred rounds of training the policy inexplicably becomes more and more deterministic and then gets stuck”. On the curves this bug looks very much like “exploration decaying too fast”, which makes it extremely hard to diagnose.
There is one more numerical detail: when is large, underflows to 0 and log(0) gives -inf. In engineering, either clip to beforehand, or use the equivalent stable form
Most frameworks (such as Stable-Baselines3) already handle this internally; when writing it by hand you must take care of it yourself.
2.3.3 SAC Implementation-Pitfall Checklist
| Symptom | Likely cause | Fix |
|---|---|---|
| Q values explode or diverge | Target value not detached, only one of the twin Q used, target network too large | Wrap the target computation in no_grad; keep twin Q with min; start at 0.005 |
| The policy becomes more and more deterministic and finally gets stuck | tanh Jacobian term missing, log_std has no lower bound | Add ; clip log_std into something like |
| increases monotonically to a huge value | Target entropy set wrong (sign or scale), reward scale too large | Use for continuous control; normalize the reward first |
| drops close to 0 and exploration is lost | The policy entropy estimate is too high (wrong sign of the Jacobian term) | Check the sign: the squashed density should be smaller, so the Jacobian term is “subtracted” |
| Performance drops sharply after switching tasks | Too high a proportion of old-task data in the replay buffer, not cleared | Clear the buffer when switching tasks, or sample stratified by task |
| Action jitter on a real robot | The policy mean output is not bounded, control frequency too low | Scale the action by the real limits after tanh; raise the control frequency or add action low-pass filtering |
| Almost no learning in the early phase | Replay buffer not warmed up, too little initial random data | Explore randomly for a few thousand steps before starting updates |
| Multi-modal tasks learned as an “average action” | A Gaussian policy can only be unimodal | Switch to a mixture-density policy, a diffusion policy, or initialize from demonstrations |
| The value function learns slowly while the policy keeps changing | Q not detached from the policy inside the policy loss, or the critic learning rate is too low | Differentiate the policy loss only with respect to ; raise the critic learning rate or adjust the loss weights |
2.3.4 Applicability: Where SAC Belongs in Embodied AI
| Scenario | Suitable for SAC | Why and recommendation |
|---|---|---|
| Servo-level control of a real robotic arm | Suitable | Historical data can be reused, an obvious advantage when interaction is expensive; warm up the replay buffer with demonstration data |
| Tasks sensitive to sample efficiency in simulation | Suitable | Converges within steps, far fewer than PPO’s |
| High-frequency continuous actions (joint velocity/torque) | Suitable | Unimodal Gaussian + tanh squashing; inference needs only one forward pass |
| Needing large-scale parallelism (thousands of environments) | Fair | Updates are a serial bottleneck and throughput is worse than PPO; consider parallel sampling + asynchronous updates |
| Sparse reward, long-horizon tasks | Weak | Maximum-entropy exploration still gets stuck under sparse rewards; HER (Hindsight Experience Replay, hindsight experience replay) or curriculum learning is needed |
| Multi-modal action distributions (going left or right are both reasonable) | Weak | The Gaussian policy collapses into an average action; switch to Diffusion Policy or a mixture-density head |
| Purely offline data, no online interaction | Usable but needs modification | Standard SAC requires online interaction; purely offline scenarios should use offline RL such as CQL/IQL |
One sentence for the division of labor between the two: PPO trades “parallelism” for samples, SAC trades “reuse” for samples. In simulation parallelism is cheap, so choose PPO; on a real robot interaction is expensive, so choose SAC. Neither is the best answer for “manipulation skills” — when demonstrations exist, ACT/DP have sample efficiency another order of magnitude higher (Chapter 3).
2.4 How to Choose Between PPO and SAC
| Dimension | PPO | SAC |
|---|---|---|
| Data usage | On-policy, discarded after one use | Off-policy, reusable |
| Sample efficiency | Low ( steps) | High ( steps) |
| Parallel scaling | Excellent ( environments scale linearly) | Fair (updates are the serial bottleneck) |
| Hyperparameter sensitivity | Medium (clip, KL, epochs) | High (temperature, reward scale, τ) |
| Exploration | Gaussian noise (weak) | Maximum entropy (strong) |
| Discrete actions | Supported (needs special handling) | Supported but needs tricks (Gumbel-Softmax) |
| Typical use | Large-scale parallel simulation training, humanoid locomotion | Fine real-robot control, scenarios with sufficient offline data |
One-line selection: in simulation, if hundreds of parallel environments can be launched → PPO; if data is expensive, must be reused, and exploration matters → SAC. The two often coexist in an embodied system: the upper layer uses PPO to train locomotion skills, the lower layer uses SAC to train fine end-effector manipulation.
2.5 Beginner Experiment Checklist for the Basic Layer
Reading without practicing is the same as not learning. It is recommended to finish these three experiments in order (all can be run on a single machine):
- Run PPO on MuJoCo HalfCheetah to a return of 4000+: the goal is to master the trio of parallel sampling, GAE, and observation normalization.
- Reach the target with fewer steps using SAC on the same task: compare sample efficiency and feel the power of the replay buffer for yourself.
- Multiply the reward scale by 10 and train again: observe SAC collapsing while PPO is affected less — this will make you genuinely understand why “reward normalization” matters.
3. Skill Layer: Imitation Learning — How to Learn Fast When Demonstrations Are Available
3.1 The Inherent Flaw of Behavior Cloning: Compounding Error
Behavior cloning (Behavior Cloning, BC) is the most straightforward form of imitation learning: treat the demonstrations as supervised-learning sample pairs, train a network to output actions, and use mean squared error or cross entropy as the loss:
It performs very well on the training set but often “starts out fine and drifts further and further off” at deployment. The cause is not overfitting but distribution shift (covariate shift): once the policy deviates from the demonstration distribution it enters states that never appeared in the demonstrations, and the network has never learned “how to correct” in those states.
Derivation: Why the error of behavior cloning grows quadratically with episode length (O(εT²))
Assume the single-step prediction error is bounded, , and assume the policy’s error accumulates by some factor.
Step 1: one-step deviation. At step the policy action differs from the demonstration action by , which shifts the state distribution by roughly (first-order approximation).
Step 2: error amplification. A state shift of in turn increases the action error of the next step by another , so the cumulative deviation at step is bounded by roughly .
Step 3: total cost. The cumulative deviation of the whole trajectory (for example the total position error) is
Conclusion: the single-step error is , the error of the whole trajectory is — this is quadratic amplification, not linear. It explains why BC is usable on short episodes (grasping, pressing a button) and collapses quickly on long episodes (folding clothes, long-distance navigation).
Mitigation ideas (corresponding to each algorithm that follows):
- Give the policy a training signal also on “its own error states” → DAgger (Dataset Aggregation, letting the expert label actions again on the states the policy itself reaches), which requires continuous human intervention.
- Do not predict the action step by step; predict a chunk of actions → ACT’s action chunking.
- Do not output a single-point action; output a multi-modal distribution and sample from it → Diffusion Policy.
- Use closed-loop feedback + high-frequency replanning to shorten the time span of each prediction → the action chunk + replanning of VLA.
3.2 ACT: Action Chunking + Temporal Ensembling
The action chunking transformer (Action Chunking with Transformers, ACT) was proposed by a Stanford team in 2023 and is the de facto standard for imitation learning on low-cost robotic arms. It has two core designs:
- Action chunking: instead of predicting a single-step action, predict a sequence of actions for the next steps in one go ( is common). This shortens the effective episode length to of the original and reduces the compounding error to — the quadratic term drops by a factor of directly.
- Temporal ensembling: predicting only once every steps causes noticeable pauses at inference time; ACT instead predicts a chunk at every time step and takes a weighted average over the overlapping parts, which is both smooth and reduces jitter.
In addition, it uses a conditional variational autoencoder (Conditional Variational Autoencoder, CVAE) to handle the multi-modality of human demonstrations (in the same scene a human might grasp with the left hand or the right hand; direct regression would learn the average of the two — an action that resembles neither).
Derivation: The evidence lower bound (ELBO) of the CVAE, and why it can express multi-modal actions
Let the observation be (including history frames and joint states), the action chunk be , and introduce a latent variable representing “which style/intent this demonstration adopts”. The generative model is and the encoder (posterior) is .
Step 1: write the log-likelihood.
Direct integration is infeasible (the latent space is high-dimensional).
Step 2: introduce an arbitrary posterior and decompose. Multiply and divide by :
By Jensen’s inequality (the concavity of the logarithm) this gives the lower bound:
The equality holds only when , that is, when the encoder is exactly the true posterior — this is what “variational” means: approximating an intractable posterior with a learnable distribution.
Step 3: reparameterization. If is taken and sampling is done as (), gradients can pass through the sampling process, so the encoder and decoder can be trained jointly.
Step 4: why the multi-modality problem is solved. During training, extracts information from “which style the current demonstration belongs to”; at inference time is sampled from the prior — each sample amounts to “choosing a style”, and the decoder generates an action chunk in that style accordingly. The model therefore learns a multi-modal conditional distribution instead of averaging several modes into one collapsed mode. Fixing at its mean (equivalent to removing the CVAE) noticeably degrades performance; this is one of the core conclusions of ACT’s ablation experiments.
Step 5: the actual loss. The training objective is
Note that the prior is taken as the standard normal (rather than ), so the KL term has an analytic form, and in practice one directly computes the closed-form KL between two Gaussians. controls how much information the latent variable carries; 1–10 is common.
Derivation: Why temporal ensembling uses exponential weighting, and how it suppresses jitter
Suppose there is one prediction at every time step, giving several estimates of action (from chunks with different starting instants). The simple approach is to take the arithmetic mean of all predictions covering :
But different predictions have different “freshness”: a chunk predicted just now and a chunk predicted long ago are not equally reliable. ACT uses exponential weighting:
where is “the age of that prediction relative to the current instant” and is the decay coefficient.
Why it works: for each prediction source, the error can be decomposed into “systematic bias + random jitter”. The weighted average reduces random jitter by ; the exponential weights let the newest prediction dominate, which keeps the response fast to abrupt changes (an object slipping). If is too large → it degenerates into single-chunk prediction and the jitter comes back; if is too small → over-smoothing and lagging response. Common values of are between 0.01 and 0.1 and need tuning according to the control frequency.
Relation to action chunking: without ensembling, replanning every steps makes the control command jump at chunk boundaries (because two adjacent predictions are not exactly consistent), which shows up as “stuttering”. Ensembling smooths the jumps away; this is why ACT is noticeably smoother on real hardware than “naive chunking”.
3.2.1 ACT Pseudocode and Walkthrough
Training phase:
Input: demonstration dataset D = {(o_{t}, a_{t:t+k})}, chunk length k, history length H
Networks: vision backbone (ResNet/ViT) → history encoder (Transformer) → CVAE encoder/decoder
→ action decoder (Transformer, outputs k×action_dim)
for each batch:
o = frames and proprioceptive states from t-H+1 .. t # history window
a = the demonstrated a_{t:t+k} # target action chunk
μ, σ= CVAE encoder(o, a) # the future action is visible during training
z = μ + σ·ε # ε ~ N(0,I)
a_hat = action decoder(history encoding(o), z)
L = L1(a_hat, a) + β·KL( N(μ,σ²) || N(0,I) )
backpropagate and update all parameters
Inference phase (control frequency 50 Hz, k=100, i.e. one chunk every 2 seconds):
cache the chunks from the most recent predictions, recording their “age”
every k steps (or every time step, depending on compute):
z ~ N(0, I) # sample one style each time
a_hat = action decoder(history encoding(H most recent frames), z) # one forward pass yields k steps
write a_hat into the cache
at each control step t:
a_t = exponentially weighted average over all cached chunks covering t
send a_t to the low-level controller (position/velocity servo)
Walkthrough:
- Training sees the future action, inference does not. The CVAE encoder takes as input, where is the future chunk — available only during training; at inference time only is available and is sampled. This is a typical example of “training–inference asymmetry” (similar to the prior of a VAE-based language model).
- L1 rather than L2. Action sequences often contain abrupt changes (the instant of grasping), and L2 over-smooths these critical points; L1 is more robust to outliers. Measured results show L1 is clearly better.
- The history encoder cannot be omitted. A single frame cannot reveal velocity or occlusion history; ACT uses a Transformer to encode the most recent frames + proprioceptive state. The history length is an important hyperparameter (too short and velocity cannot be inferred, too long and latency increases).
- The trade-off of chunk length . Large → more compounding-error reduction and cheaper inference, but slower response to environment changes and more open-loop error accumulation inside the chunk; small → fast response, but it degrades back into step-by-step BC. @ 50 Hz ≈ 2 seconds is a common compromise. The faster the task (such as catching a frisbee), the smaller should be.
- The inference latency budget. One ACT forward pass has to produce 100 steps, so the model cannot be too large; in practice a ResNet-18-level backbone + a small Transformer is often used, achieving 10–30 ms on Jetson-level compute.
- What it cannot solve. ACT is still reliable only near the demonstration distribution and fails on entirely new objects/lighting; it also has no “error correction” capability. This is exactly where VLA pretraining or RL fine-tuning has to fill in.
3.2.2 Gradient-Flow Checklist: Which Paths in ACT Must Have Gradients and Which Must Not
ACT’s structure is simpler than the RL algorithms above (pure supervised learning, no bootstrapped target), but the introduction of the CVAE makes the gradient flow have two easy-to-err points:
| Path | Gradient requirement | Reason |
|---|---|---|
| Reconstruction loss → decoder | Required | This is the main learning signal |
| Reconstruction loss → CVAE encoder | Required (through reparameterization) | The encoder must learn “extract action-relevant information” from the reconstruction gradient |
| KL term → encoder | Required | Pulls the posterior toward the standard normal so that sampling from the prior works at inference |
| KL term → decoder | Should not exist | The KL is defined between two distributions and the decoder does not participate; if the decoder input is mistakenly included in the KL, action fitting slows down |
| at inference time | No gradient needed | Sampled directly from , not part of any optimization |
| Action target | Constant | A label, which naturally needs no gradient (a tensor rather than a network output suffices) |
What really deserves emphasis is the training–inference asymmetry: during training comes from the posterior , at inference comes from the prior . If the KL weight is too small, the posterior hardly degenerates toward the prior, the sampled at inference does not match the distribution seen during training, and the symptom is “very low training loss but strange actions on the real robot”. Conversely, if is too large, the information carried by is squeezed out, the CVAE degenerates into ordinary regression, and the multi-modal expressiveness disappears.
A practical check: after training, measure the utilization of each dimension (variance per dimension). If the variance of the vast majority of dimensions is close to 0, is too large or the encoder capacity is insufficient; if the posterior mean differs enormously from the prior (a very large KL), is too small. The original ACT paper balances this with “fixed + linear warm-up”; in practice between 1 and 10 with action-dimension scaling suffices.
One more often-ignored point: image augmentation must not change the action labels. When applying random cropping/color jitter to images, the action labels must stay unchanged; if the augmentation is a “geometric transform”, the action coordinates must be transformed correspondingly, otherwise the model is being fed wrong supervision. This kind of bug shows up on the training set as “loss decreases but real-robot accuracy is an order of magnitude worse”.
3.2.3 ACT Implementation-Pitfall Checklist
| Symptom | Likely cause | Fix |
|---|---|---|
| Action jumps at chunk boundaries | Temporal ensembling weights set wrong, chunks not overlapping | Use exponential weighting (newer chunks get higher weight); make adjacent chunks overlap by at least half |
| Real robot lags, response is sluggish | Chunk length too large, history window too long, inference frequency too low | Shorten (20–30 for fast tasks); keep history to 1–2 seconds; raise the inference frequency |
| Very low training loss but real-robot failure | CVAE posterior/prior mismatch ( too small), insufficient history window | Raise or use KL warm-up; lengthen the history window |
| Actions become an “average action” | Pure L2 loss + unimodal assumption, collapse | Use L1; check the variance of each dimension; increase the KL weight if necessary |
| Motion at the grasping instant is smoothed away | L2 loss over-smooths abrupt changes | Switch to L1 or Huber; weight the key frames |
| Accuracy drops sharply after changing the camera/workstation | Image normalization inconsistent with training, camera intrinsics/extrinsics changed | Unify preprocessing; add color jitter and random cropping as augmentation if necessary |
| Worse after mixing multi-robot data | Action spaces not unified (joint angles vs. end-effector pose) | Unify to the same action space (see the unified action space practice in 4.5) |
| Inference time exceeds budget | Backbone too large, re-inference at every step | Freeze the backbone and cache features; infer the whole chunk at a fixed interval |
| Effective only within the demonstration distribution | The boundary of the method itself | Add VLA pretraining, DAgger-style corrective data, or RL fine-tuning |
3.2.4 Comparison with “Pure Behavior Cloning”
| Dimension | Step-by-step behavior cloning (BC) | ACT (chunking + temporal ensembling) |
|---|---|---|
| Prediction granularity | Single-step action | -step action chunk |
| Compounding error | Error accumulates per step; deviation can reach after steps | Open loop within a chunk, closed loop between chunks; accumulation is truncated to the scale of the chunk length |
| Multi-modal actions | Unimodal regression → average action | The CVAE latent variable provides multi-modal expressiveness |
| Inference cost | One forward pass per step | One forward pass every steps (lower after amortization) |
| Requirement on the number of demonstrations | Medium | Higher (needs to cover multiple styles of the same state) |
| Implementation complexity | Low | Medium (CVAE + ensembling cache) |
| Typical failure | Long-horizon drift | Cannot correct immediately when disturbed within a chunk |
In one sentence: ACT uses “predicting several steps at once” to compress the compounding error from “growing linearly with the number of steps” into “growing with the number of chunks”, and then uses temporal ensembling to smooth out the chunk boundaries. This is its only — and decisive — improvement over pure BC.
3.2.5 Applicability: Where ACT Should Be Used
| Scenario | Suitable for ACT | Why and recommendation |
|---|---|---|
| Tabletop tidying, pick-and-place, folding and other medium-to-low-speed manipulation | Very suitable | 50 Hz with a 1–2 second chunk length matches exactly |
| Tasks with 50–500 demonstrations | Very suitable | ACT’s sample efficiency is best in this range |
| Tasks needing high-frequency response (catching a ball, high-speed sorting) | Fair | Open loop within a chunk, so the response is limited by the chunk length; shorten and raise the inference frequency |
| Multi-modal demonstrations (several ways to do the same state) | Suitable | The CVAE latent variable can express multiple modes |
| Generalization to entirely new objects/scenes | Not suitable | Reliable only within the demonstration distribution; VLA pretraining is needed |
| Tasks needing force control / compliant contact | Fair | Position control dominates; force control needs an additional torque channel and a high-frequency loop |
| Heterogeneous multi-robot data | Needs modification | Unify the action space first, or use per-embodiment stems (see 4.5) |
3.3 Diffusion Policy: Treating Actions as a “Denoising Generation” Problem
The diffusion policy (Diffusion Policy, DP) is the other main line from 2023; its core insight is that the failure of behavior cloning is often not that the network is too small, but that the modeling assumption of “unimodal regression” is wrong. Human demonstrations may contain several reasonable actions in the same state (going around the left or around the right), and MSE regression gives the average of the two — an action that is physically infeasible. Diffusion models express multi-modal distributions naturally and train stably (unlike GANs, which need adversarial training).
It frames “generating actions from noise” as a reverse diffusion process: starting from pure Gaussian noise , iteratively denoise for steps and finally obtain the action chunk . The condition is the observation (image + proprioceptive state).
Derivation: The closed form of forward noising, the reverse mean, and the ε-prediction objective
Step 1: the forward process. Define a Markov chain that adds a small amount of Gaussian noise at each step:
where is a predefined noise schedule (controlling how much noise is added at each step).
Step 2: the closed form for any step. Let and ; repeated substitution of Gaussian convolutions gives
that is, any instant can be reached in one step: , . This is the key to the training efficiency of diffusion models — there is no need to actually iterate the noising times.
Step 3: the reverse process. By Bayes’ rule, is still Gaussian, with mean
Step 4: parameterization. The true is unknown and is predicted by the network. Express in terms of “ and the predicted noise ”:
Substituting back into the mean expression and simplifying gives the commonly used reverse sampling form:
Step 5: the training objective. A simple regression on the noise prediction:
Why this objective works: it is equivalent to optimizing the denoising-matching term in the evidence lower bound (ELBO); intuitively, the network learns “given a noisy action and the noise level , tell what this noise looks like”, and subtracting it yields the clean action. Note that must be fed in as a condition, otherwise the network cannot know how much noise to remove.
Step 6: inference acceleration. Standard DDPM needs (often 100–1000) steps; DDIM (Denoising Diffusion Implicit Models) turns sampling into a deterministic, step-skipping form that works with 10 steps. Robot control is latency-sensitive, so practical deployments almost always use DDIM or even faster distilled versions.
3.3.1 Diffusion Policy Pseudocode and Walkthrough
Training:
Input: demonstrations D = {(o_t, a_{t:t+k})}, diffusion steps K, noise schedule β_1..β_K
Networks: vision encoder + 1D convolutional U-Net (or Transformer), conditioned on o and noise level k
for each batch:
o, a0 = sample an observation and the ground-truth action chunk
k = sample randomly from 1..K
ε = N(0, I)
a_k = sqrt(ᾱ_k)·a0 + sqrt(1-ᾱ_k)·ε # jump to noise level k in one step
ε_hat = ε_θ(a_k, k, o) # predict the noise
L = || ε - ε_hat ||²
update θ
Inference (DDIM, 10 steps):
a_K ~ N(0, I) # start from pure noise
for k = K .. 1:
ε_hat = ε_θ(a_k, k, o)
a_{k-1} = DDIM update(a_k, ε_hat, k) # deterministic step skipping
output a_0 (a k-step action chunk); execute the first few steps, then replan
Walkthrough:
- Why generate an “action chunk” at once rather than a single step. For the same reason as ACT: it reduces compounding error; and diffusion’s multi-step sampling is expensive, so generating the whole chunk in one go is what makes it worthwhile.
- The noise level must be fed to the network. Common implementations use sinusoidal positional encoding (the same origin as the timestep encoding in Transformers). Omit it and the network cannot tell “should this be heavily denoised or lightly denoised”, and the generation comes out blurry.
- How the observation condition is injected. Two mainstream approaches: ① concatenate the observation features at every denoising step (simpler); ② use cross-attention (observation features as key/value, action tokens as query). The latter is more expressive but more expensive.
- Inference latency is the biggest engineering constraint. 10 DDIM steps × one network forward pass per step, at 50 Hz control, requires less than 2 ms per step, which usually needs distillation or a smaller network; this is also the direct reason why flow-matching methods such as π₀ emerged (they produce an action in 1 step).
- Why it is more robust to multi-modality than ACT. ACT expresses multiple modes through the CVAE latent variable, and training is unstable (posterior collapse); diffusion’s forward process is fixed and training is just noise regression, so stability is markedly better, which is why DP is more commonly used on complex tasks.
- Shortcomings. Sampling is slow, it is sensitive to the noise schedule, the chunk still runs open loop, and it does not fit scenarios needing very high-frequency (>100 Hz) force control.
3.3.2 Gradient Flow and Condition Injection: The Paths Easily Confused in DP
DP is pure supervised learning, so the gradient flow itself is simpler than in SAC/Dreamer, but “which quantities should be noised and which should not” is often written wrong:
| Path | Gradient or processing requirement | Reason |
|---|---|---|
| → network parameters | Required | The only learning signal |
| Regression target | Constant (obtained by sampling) | A label, no gradient needed |
| The encoding of condition | Has gradients, but is not noised | The condition is “clean”; noising would destroy task information as well |
| Action target | Constant | A label |
| Noise level | Constant (discrete or continuous embedding) | Only a condition, not a quantity to be optimized |
| at inference time | No gradient needed | The pure-noise starting point |
| Using EMA weights for inference | Do not participate in backpropagation | Forward only; unlike the EMA target encoder in JEPA, here it only smooths |
Two frequent mistakes:
- Adding noise to the observation. Some people add noise to images to make the model “robust”, but this amounts to injecting uncertainty into the condition, so the model learns “guess the action under a blurred image” and real-robot accuracy actually drops. The right way to gain robustness is data augmentation (cropping, color jitter), not diffusion noising.
- The noise schedule does not match the number of inference steps. Training uses the of , while inference uses DDIM with 10 steps; applying the training schedule coefficients directly makes the denoising trajectory deviate. Either use DDIM’s compatible coefficients, or recalibrate after distilling to a few-step model. The symptom is “the generated actions are shifted by an overall constant” or “end-effector jitter”.
One more training trick worth remembering: weight the loss by noise level (min-SNR weighting), so that the model spends more capacity on “medium noise”. Without weighting, the many easy high-noise samples dominate the gradient and the generated details get worse.
3.3.3 DP Implementation-Pitfall Checklist
| Symptom | Likely cause | Fix |
|---|---|---|
| Generated actions are blurry, like averages | Too few denoising steps, noise schedule too narrow, insufficient network capacity | Increase the number of DDIM steps (10–20); check whether is close to 0; widen the U-Net |
| Inference latency over budget | A large network at every step, no distillation | Use DDIM/DDPM with few steps; distill to 1–4 steps; shrink the network or cache visual features |
| Actions shifted as a whole | Inconsistent decoding coefficients between training and inference, actions not normalized | Unify the convention; normalize actions to using dataset statistics |
| End-effector jitter | Open loop within the chunk + residual noise, executing for too long | Execute only the first few steps and replan; use fewer noise steps at the end |
| Slower with multiple camera inputs | Each camera goes through an independent encoder and nothing is cached | Share the backbone; cache the condition features (the condition does not change within a control step) |
| Training does not converge | Learning rate too large, noise-level embedding missing | Drop the learning rate to ; confirm that is injected into the network |
| Effective only within the demonstration distribution | The boundary of the method | Add VLA pretraining or RL fine-tuning |
| Fails entirely after changing robots | Action space and normalization statistics inconsistent | Unify the action space and recompute the normalization statistics |
3.3.4 Comparison with Flow Matching (π₀), and Applicability
| Dimension | Diffusion Policy | Flow-matching action head (π₀, see 4.3) |
|---|---|---|
| Generation path | Curved (progressive denoising according to the noise schedule) | Nearly straight (OT pairing) |
| Number of sampling steps | 10–100 | 1–10 |
| Training objective | Predict the noise | Regress the velocity field |
| Need a large backbone | No (can start from a small network) | Yes (usually hung on a VLM backbone) |
| Single-machine deployment cost | Low–medium | High |
| Multi-modal expressiveness | Strong | Strong |
DP’s applicability boundary:
| Scenario | Suitable for DP | Why and recommendation |
|---|---|---|
| Fine manipulation, multi-modal demonstrations (left or right) | Very suitable | Generative modeling is naturally multi-modal and trains more stably than CVAE |
| 200–2000 demonstrations | Very suitable | The more data, the better the generative model’s expressiveness |
| Edge deployment under compute constraints | Fair | Multi-step denoising is a hard cost; distillation or few-step sampling is needed |
| High-frequency force control (>100 Hz) | Not suitable | Sampling + communication latency cannot meet the requirement |
| Needing very strong generalization to new objects | Not suitable (used alone) | Needs a VLA backbone |
| Simple unimodal tasks, very little data | Overkill | ACT is cheaper and equally effective |
3.4 ACT versus Diffusion Policy
| Dimension | ACT | Diffusion Policy |
|---|---|---|
| Multi-modal modeling | CVAE latent variable (training is more brittle) | Diffusion generation (training is stable) |
| Inference cost | One forward pass produces the whole chunk (low) | K-step denoising (high, needs distillation) |
| Action smoothness | Guaranteed by temporal ensembling | Naturally smooth in the generation process |
| Data requirement | Tens to hundreds of demonstrations | Hundreds to thousands (more) |
| Typical scenario | Low-cost robotic arms, fast deployment | Fine manipulation, multi-modal demonstrations |
| Main risk | Posterior collapse, chunk-boundary jumps | Latency, noise schedule mismatch |
Selection advice: tight budget and want to get it working fast → ACT; the demonstrations clearly contain several ways of doing things, or high-precision multi-modal actions are needed → Diffusion Policy.
4. Foundation-Model Layer: Vision-Language-Action Models
The models of the two layers above all follow the pattern “one robot, one task, retrain once”. That works in a lab but not in a product: change an object or a sentence and the data has to be collected again. What the foundation layer solves is generalization — letting one model understand natural-language instructions, recognize objects it has never seen, and need only very few demonstrations or even none at all on a new task.
4.1 Why the “Vision-Language-Action Model” Route Works
Large language models (Large Language Model, LLM) and vision-language models (Vision-Language Model, VLM) have already learned two things from internet-scale data that are extremely valuable for robots:
- Semantic priors: instructions such as “put the soda can in the trash bin” or “open the drawer halfway” involve concepts and objects that the VLM has already seen during pretraining, so the robot does not need to collect tens of thousands of episodes itself to build the concept of “what a soda can looks like”.
- A vision-language alignment structure: the intermediate representations of the VLM already align “image regions” with “words”, which provides a good initialization for “seeing the target → generating the action”.
The idea of the vision-language-action model (Vision-Language-Action model, VLA) is therefore to turn actions into another kind of “language token”, reuse the VLM architecture and pretrained weights directly, and do post-training (post-training, further training after pretraining) only on robot data. Robot learning thereby changes from “training a dedicated policy from scratch” to “fine-tuning a model that can already look at pictures and talk”.
The unified structure is roughly:
image I_t + instruction ℓ + proprioceptive state q_t
↓ vision encoder (ViT)
↓ concatenated with text tokens into one sequence
↓ autoregressive Transformer (or a diffusion / flow-matching decoding head)
action chunk a_{t:t+k}
The only difference lies in “how actions are represented and decoded”, from which three routes branch out.
4.2 Route 1: Discretize Actions into Tokens (RT-2 / OpenVLA)
This is the most direct idea: since the VLM can only output tokens from its vocabulary, give actions a vocabulary too.
RT-2 (Robotic Transformer 2, 2023) splits the value range of each action dimension into 256 bins, each bin corresponding to a special token. The action is usually 7-dimensional (end-effector position x/y/z, orientation roll/pitch/yaw, gripper open/close), so the vocabulary grows by tokens. The training objective is the standard autoregressive cross entropy, exactly the same as training a VLM.
OpenVLA (2024) reproduced this open-source and optimized the engineering: using Llama-2 7B or Prismatic VLM as the backbone, trained on Open X-Embodiment (about 970k real robot trajectories), producing an open-source VLA with about 7B parameters that can be fine-tuned directly.
The key detail is quantile discretization: bins are not cut at equal width but at the quantiles of the data distribution.
Derivation: Quantile discretization of actions, boundary handling, and decoding error
The problem. With equal-width bins, if the distribution of an action dimension is extremely uneven (for example the gripper is at 0 or 1 for 90% of the time and rarely in between), the vast majority of samples fall into a few bins and learning becomes extremely imbalanced; joint limits also differ, so a range must be set for each dimension separately.
The approach. For all training values of the -th action dimension, , compute quantiles
with . By convention and , guaranteeing the full range is covered.
Encoding (action → token). The center of bin is the midpoint between adjacent quantiles:
Given a true action , find the bin it falls into:
The index is the token id for that dimension and is mapped to the corresponding special symbol in the vocabulary.
Decoding (token → action). After the network emits the token, the bin center is looked up directly:
Upper bound on decoding error. Let the width of bin be . Since is the center and the true value must lie in the same bin, the error does not exceed half the width:
What this formula says. Precision is not uniform: where data is dense (quantiles packed together) is small and precision is high; where data is sparse is large and precision is low. In other words, the model is fine on common actions and coarse on rare ones — exactly the inductive bias we want, and it explains why quantile binning is far better than equal-width binning at the same token budget.
Relation to cross entropy. If each dimension is treated as an independent -class classification, the training loss is
Note that the condition includes the dimensions already generated at the same instant (), a direct consequence of autoregressive decoding: the 7 dimensions are generated serially, so one action prediction needs 7 forward passes. This is the biggest inference bottleneck of this route.
Why it is still usable. Because action chunking predicts several steps at once: predicting steps × 7 dimensions = tokens makes the token count larger, but the number of forward passes amortized per control step drops sharply. Both RT-2 and OpenVLA use the “emit a short action chunk at once” approach.
4.2.1 RT-2 / OpenVLA Pseudocode and Walkthrough
Preparation phase (offline, one time):
for each action dimension j = 1..7:
compute the quantiles q_j^(0..256) over the training set for that dimension
compute the center ā_j^(c) of each bin
Vocabulary extension: assign one special token id to each (j, c) combination
Training (post-training on robot data):
Input: image I_t, instruction text ℓ, proprioceptive state q_t, demonstrated action chunk a_{t:t+k}
Tokenization:
I_t → ViT splits into several visual tokens
ℓ → text tokens
q_t → each dimension discretized into a few tokens (or projected linearly)
a_{t:t+k} → quantile-quantized per (dimension j, step t'), giving 7k action tokens
Concatenate into one sequence and train with "next token prediction":
L = -Σ log p_θ(action tokens | all preceding tokens)
Update only (or low-rank adapt) the Transformer; the vision encoder can be frozen
Inference (control frequency 5–20 Hz):
encode image + instruction + proprioceptive state into a prefix
autoregressively generate 7k action tokens
look up the table to decode them into a numeric action chunk, send the first few steps
cache the chunk and do temporal ensembling (same as ACT)
Walkthrough:
- The biggest advantage is full compatibility with the VLM ecosystem. Actions are tokens, so the VLM’s pretrained weights, training code, and inference framework (KV cache, batching, quantization) can all be inherited directly. Almost no engineering rework is needed, which is the core reason RT-2 drew attention at the time.
- The biggest disadvantage is being slow. Autoregressively decoding 7k tokens, even with a KV cache, a 7B model on an edge device can only manage a few Hz. It therefore suits “slow but accurate” tasks (tidying a desk, folding clothes) and not high-frequency force control.
- Quantile discretization is a necessary engineering detail. Equal-width binning loses a noticeable amount of performance; quantile binning makes every bin carry roughly the same number of samples, balances training, and automatically adapts to the joint ranges of different robots (no manual normalization needed).
- Proprioceptive state must be handled carefully. Position/velocity are continuous; hard discretization loses precision. The common approach is to normalize each dimension and project it linearly into a few tokens, or simply concatenate it as one vector into the sequence (OpenVLA uses the latter: better results and far fewer tokens).
- Visual tokens are a hidden cost. A 224×224 image split into 14×14 patches is 256 tokens; with multiple cameras (wrist + head + side view) that easily becomes over a thousand tokens, and the prefix length directly determines latency. In practice the vision encoder is often frozen and its outputs cached.
- It still needs robot data for post-training. The VLM provides semantic priors, not control ability; without robot data the model can only “describe what should be done” and cannot “produce the correct action sequence”. Pretraining solves generalization, post-training solves usability; neither can replace the other.
- Generalization boundary. The generalization reported in the RT-2 paper is mainly at the “semantic level” (new objects, new instruction combinations), and on “precise manipulation” (plugging a hole, pouring water) it is still worse than a dedicated policy. This is directly related to its action precision being limited by discretization.
4.2.2 Gradient-Flow Checklist and Implementation Pitfalls
Supervised learning’s gradient flow is not complicated in itself, but “vocabulary extension” brings a few unique pitfalls:
| Quantity | Gradient requirement | Explanation |
|---|---|---|
| Cross-entropy loss of action tokens → Transformer | Required | The only learning signal |
| Action token id (label) | Constant | A discrete label, naturally without gradients |
| Vision encoder | Can be frozen or use a low learning rate | Freezing saves memory and preserves pretrained representations; full fine-tuning easily overfits small robot datasets |
| Linear projection of proprioceptive state | Required | Newly initialized, it must learn |
| The 1,792 newly added token embeddings | Required | Randomly initialized; if the vocabulary is frozen, training simply does not move |
Pitfall checklist:
| Symptom | Likely cause | Fix |
|---|---|---|
| Action precision clearly insufficient | 256 bins too coarse, quantile statistics computed over the whole dataset (including outliers) | Increase to 512 bins; exclude out-of-range samples before computing quantiles |
| Training loss normal but real-robot actions jump | Bin centers at decoding differ from training, or equal-width inverse decoding used | Share the same quantile table between training and inference and freeze it |
| Inference only 1–2 Hz | Per-dimension autoregression with 7k forward passes, prefix too long | Increase the chunk length to amortize; cache KV; fewer cameras; smaller backbone |
| Cannot learn new actions | New actions fall outside the training distribution and the quantile table | Recompute quantiles periodically; or keep several equal-width fallback bins |
| Poor language instruction following | Instruction data mix too low, visual tokens eat the context | Increase instruction diversity; shorten the visual token count |
| Poor joint-dimension precision | Proprioceptive state hard-discretized | Switch proprioceptive state to a linear projection instead of the vocabulary |
| Forgets prior abilities after fine-tuning | Full-parameter fine-tuning, learning rate too large | Freeze the vision tower, low-rank adaptation, mix in pretraining data |
4.2.3 Comparison with π₀ and FAST
| Dimension | RT-2 / OpenVLA (discrete tokens) | π₀ (continuous flow matching) | FAST (frequency-domain tokens) |
|---|---|---|---|
| Action representation | 256 bins per dimension | Continuous vector | DCT coefficients + run-length encoding |
| Decoding method | Autoregressive token by token | ODE integration over a few steps | Autoregressive tokens → inverse DCT |
| Precision ceiling | Limited by bin width (half width) | Continuous, high precision | Limited by the quantization step |
| Inference latency | High (many tokens) | Medium (the backbone dominates) | Medium (tokens already compressed) |
| Compatibility with the LLM ecosystem | Complete | Partial (the decoding head must change) | Complete |
| Best suited for | Slow but accurate, semantic generalization | High frequency, high precision, multi-modal | Long sequences, few degrees of freedom |
An easily overlooked difference is the nature of the error: the error of discrete tokens is “staircase-shaped” (identical inside a bin), the error of flow matching is a “small continuous deviation”, and the error of FAST is “overall smoothing caused by frequency-domain truncation”. The first makes contact tasks jitter at bin boundaries, the last flattens fast actions. Selection should be based on how sensitive the task is to the shape of the error, not only on the average error.
4.2.4 Applicability
| Scenario | Suitable for discrete-token VLA | Why and recommendation |
|---|---|---|
| Semantic generalization (new objects, new instructions) | Very suitable | Inherits the VLM semantic prior directly |
| Medium-to-low-speed tasks such as desk tidying and folding clothes | Suitable | Insensitive to latency |
| Sub-centimeter precision such as plugging holes or screwing | Fair/weak | 256 bins are not precise enough; switch to a continuous head |
| High-frequency control (>30 Hz) | Not suitable | Autoregressive decoding is too slow |
| Edge-device deployment | Fair | The 7B model needs quantization + caching; or distill to a small model |
| Lacking robot data, only a VLM | Not suitable for direct use | Post-training is mandatory, otherwise it only “describes actions” |
4.3 Route 2: Flow-Matching Action Head (π₀)
π₀ (pi-zero, 2024, Physical Intelligence) addresses the two pain points above with a different approach: do not turn actions into tokens; instead attach a dedicated “action expert” that generates continuous actions, using flow matching so that the whole action chunk comes out in one or a few forward passes.
The overall skeleton is still a VLM: vision and language go through the pretrained VLM pathway, but actions do not go through the vocabulary — they take a continuous “noise to action” generation pathway. The two pathways are coupled through attention, so that action tokens can attend to vision/language tokens and thereby obtain the instruction and scene information.
Derivation: The conditional flow-matching loss, the straight-line path, and optimal transport
The goal. We want to learn a velocity field that “turns the noise distribution into the action distribution”. Let be the true action chunk (data) and be noise. Define a path from to , .
Step 1: choose the path. The simplest is a straight line (linear interpolation, also called rectified flow):
Step 2: compute the velocity field. Differentiate with respect to :
Note that along a straight-line path the velocity is a constant vector, independent of . This is exactly why it is easier to learn than diffusion (whose curved path varies with the schedule).
Step 3: the conditional flow-matching loss. Train a network ( is the observation/instruction condition) to regress that velocity:
Step 4: why this loss is correct. Let be the marginal distribution of . It can be shown that minimizing the above expression is equivalent to fitting to the “probability-flow” velocity field of the marginal , and that velocity field satisfies the continuity equation
With available, one can integrate the ordinary differential equation (Ordinary Differential Equation, ODE)
from any , from to , to obtain . This is the complete procedure of “generating an action”.
Step 5: why the straight-line path is better. If the pairing of and is random (independent sampling), straight-line paths cross each other, the marginal velocity field exhibits “averaging out”, and integration needs many steps. If the pairing is optimal (i.e. and form an optimal transport (OT) coupling), the straight lines do not intersect, the paths are nearly straight, and a few steps (even 1) suffice to complete the integration.
In practice OT pairing is used: within each batch, a simple greedy/Hungarian matching pairs noise with actions by distance. The cost is small but it shortens the integration steps markedly. This is why π₀ can manage “10 steps or even fewer”.
Step 6: comparison with diffusion (in one sentence). Diffusion learns “how much noise to remove at each step” and must accumulate according to the schedule; flow matching learns “how far and in which direction to move in one step”, the path is straight, and therefore large step sizes are allowed. Mathematically both come from probability flows, but in engineering the sampling efficiency of flow matching is markedly higher.
Step 7: details of the loss and time sampling. The sampling distribution of affects difficulty: near noise dominates, near signal dominates, and the middle is hardest. In practice sampling biased toward the middle is common (such as a distribution or logit-normal), converging better than uniform sampling — a trick widely used by π₀ and later work.
4.3.1 The Network Structure and Pseudocode of π₀
The structure of π₀ can be summarized as “one VLM backbone + one action expert + bidirectional attention”:
- Backbone: a pretrained VLM (PaliGemma class), taking images and language as input and outputting a vision-language token sequence.
- Action expert: a set of additional Transformer layers whose input is “action tokens” (initially noise) plus the timestep embedding ; every layer can attend to the backbone’s vision-language tokens.
- Training: the backbone can use a low learning rate (or be partly frozen), and the action expert is trained from scratch; the loss is the conditional flow-matching loss above.
- Inference: start from noise, do -step Euler integration ( about 5–10) to obtain the action chunk; execute the first few steps and then replan.
Training:
Input: demonstrations (I_t, ℓ, q_t, a_{t:t+k})
Backbone = pretrained VLM (vision encoder + LLM)
Action expert = newly added Transformer layers (far fewer parameters than the backbone)
for each batch:
# 1. condition pathway (run once, can be cached)
h_vl = backbone encoding(I_t, ℓ, q_t) # vision-language token sequence
# 2. sample noise, time, target
x0 ~ N(0, I) # same shape as the action chunk (k × 7)
t ~ a distribution biased toward the middle (e.g. logit-normal)
x1 = the true action chunk a_{t:t+k}
xt = (1-t)·x0 + t·x1 # a point on the straight-line path
# 3. action expert forward: action tokens cross-attend to h_vl
v_hat = action expert(xt, t | h_vl)
# 4. regress the velocity (note the target is x1 - x0, independent of t)
L = || v_hat - (x1 - x0) ||²
update the action expert (optionally update the backbone with a low learning rate)
Inference (control frequency 20–50 Hz, chunk length k):
h_vl = backbone encoding(I_t, ℓ, q_t) # must run every step, cache for speed
xt = x0 ~ N(0, I)
for n = 1..N: # N = 5–10 Euler steps
xt = xt + (1/N)·action expert(xt, n/N | h_vl)
output x1 as the action chunk, execute the first few steps and replan
Walkthrough:
- Why a dedicated “action expert” instead of reusing LLM layers. Actions are continuous high-dimensional vectors extremely sensitive to precision, while language tokens are discrete; sharing parameters lets action precision be “dragged around” by the language modeling objective. Separate parameters with information shared only through attention is the key design that reconciles “inheriting semantic priors” with “guaranteeing action precision”.
- The number of integration steps directly determines latency. With the action expert’s forward cost is about 10×; since the action expert is much smaller than the backbone, the total cost is still acceptable. The real bulk is the backbone — which is why π₀-class methods cache vision encoding results or reuse backbone outputs within a chunk during deployment.
- OT pairing is the precondition for “few steps”. Without OT pairing, straight-line paths cross and has to be tens of steps; with it, can drop below 10. This is a typical trade of “a bit more compute at training time for much less at inference time”.
- Open loop within the chunk remains. The generated action chunk is an open-loop trajectory that physical disturbances will push off course; hence “execute part, then replan”, and temporal ensembling must smooth the chunk boundaries (same as ACT).
- Its strengths are “high frequency + high precision + multi-modal”. Continuous output is not limited by discretization precision; emitting a whole chunk at once supports high-frequency control; generative modeling is naturally multi-modal. Together these three make π₀-class methods the mainstream choice for real-robot manipulation tasks in 2024–2026.
- Its weakness is the threshold of data and compute. Training a VLM backbone + action expert is far more expensive than ACT/DP, and heterogeneous multi-robot, multi-task data is required to show the generalization advantage. Small teams usually fine-tune open-source weights directly rather than training from scratch.
4.3.2 Gradient-Flow Checklist: “Who Should Learn, Who Should Be Frozen, Who Should Not Propagate” in π₀
π₀ trains three kinds of networks together, so the delineation of gradient flow is far more complex than in the discrete-token route:
| Path | Gradient requirement | Reason |
|---|---|---|
| Flow-matching loss → action expert | Required (main signal) | This is the only learning source for action generation |
| Flow-matching loss → backbone | Optional, low learning rate | Allows the action objective to adjust the vision-language representation slightly; a full-speed update would destroy the semantic priors |
| Vision encoder | Usually frozen | Preserves pretrained representations and saves memory |
| Embedding of timestep | Constant input, the parameters inside the network are learnable | is a condition, not a quantity to be optimized |
| Target velocity | Constant | A label |
| Noise | Constant | Obtained by sampling |
| Intermediate states in the ODE integration at inference time | No gradient needed | Pure forward pass |
One key judgment: the action expert must not share all of its parameters with the language model. Forced sharing makes the language-modeling objective pull the representation toward “discrete semantics”, whereas actions require millimeter-level continuous precision; the gradient directions of the two conflict, which shows up as “language ability has not degraded, but action precision will not improve”. π₀’s “independent action expert + attention coupling” is designed precisely to avoid this conflict.
4.3.3 π₀ Implementation-Pitfall Checklist
| Symptom | Likely cause | Fix |
|---|---|---|
| Actions are overall too “soft” and cannot keep up with fast changes | OT pairing not done, too few integration steps | Enable in-batch OT pairing; raise to 10 |
| Training loss is low but real-robot trajectories drift | sampled uniformly at training time, fixed step size at inference | Switch to sampling biased toward the low-noise region (such as a Beta distribution); align the inference step size with the training distribution |
| Action magnitude accumulates and grows chunk by chunk | No temporal ensembling between chunks, replanning interval too long | Same as ACT: execute the first several steps + exponential weighted ensembling |
| The backbone is “trained broken” and instruction following degrades | Backbone learning rate too high | Freeze the backbone or lower it to 1/10 of the action expert’s |
| Latency exceeds the budget with multiple cameras | The backbone is rerun at every step | Cache the vision-language features and reuse them within a chunk |
| Actions are discontinuous at chunk boundaries | Independent noise sampling each time, no correlation between chunks | Condition on the tail of the previous chunk, or do overlapping averaging |
| Overfitting after fine-tuning on small data | Action expert capacity too large, insufficient data diversity | Reduce the width of the action expert; add multi-embodiment data |
| Some joints are never accurate | Action normalization uses global statistics rather than per-joint | Normalize per dimension and denormalize at the output |
4.3.4 Comparison with Discrete Tokens and Diffusion Policy, and Applicability
| Dimension | π₀ (flow matching) | RT-2 (discrete) | DP (diffusion) |
|---|---|---|---|
| Precision | High (continuous) | Limited by bin width | High (continuous) |
| Sampling steps | 1–10 | 7k autoregressive passes | 10–100 |
| Training stability | Good (regress the velocity field) | Good (classification) | Good (regress the noise) |
| Multi-modal expressiveness | Strong | Medium (affected by the bins) | Strong |
| Requirement on the backbone | VLM-level | VLM-level | Can be small |
| Deployment cost | High | Medium–high | Medium |
Applicability:
| Scenario | Suitable for π₀ | Why and recommendation |
|---|---|---|
| High-frequency + high-precision real-robot manipulation | Very suitable | Few-step generation, continuous actions, multi-modal expressiveness |
| Pretraining on heterogeneous multi-embodiment data | Very suitable | Relies on a unified action space (see 4.5) |
| Single machine, small data, fast deployment | Not suitable | Training and deployment costs are too high; start with ACT/DP |
| Edge devices with extremely limited compute | Fair | Needs distillation of the action expert or quantization of the backbone |
| Purely semantic generalization, low precision requirement | Overkill | A discrete-token VLA is cheaper |
4.4 Route 3: Frequency-Domain Tokenization (FAST)
FAST (Frequency-space Action Sequence Tokenization, 2025, Physical Intelligence) solves a very practical problem: an autoregressive VLA wants to keep the benefits of “tokenization” (reusing the LLM ecosystem), but discretizing per dimension and per frame produces far too many tokens.
Its approach is to treat the whole action sequence as a signal and compress it:
- For each action dimension, take an action sequence of length ;
- Apply the discrete cosine transform (Discrete Cosine Transform, DCT) to move the time-domain signal into the frequency domain;
- Quantize in the frequency domain and order coefficients “low frequency first”;
- Use run-length encoding to collapse the many repeated / near-zero coefficients;
- Obtain a token string far shorter than the raw dimensionality and hand it to the autoregressive model.
Derivation: The DCT, energy concentration in the frequency domain, and the compression ratio of run-length encoding
Step 1: the DCT-II definition. For a real sequence of length , the type-II discrete cosine transform is
and the inverse transform is
Step 2: why the frequency domain can compress. Robot action sequences consist of “smooth trajectories + a few abrupt changes”. The energy of a smooth trajectory is concentrated at low frequencies (small ), and the high-frequency components are close to 0. Hence, once the coefficients are ordered from small to large , a large number of tail coefficients can be coarsely quantized or even discarded with very small error. This is exactly the same reason JPEG uses the DCT.
Step 3: quantization and error. Let the quantization step be and the quantized coefficient be ; then the per-coefficient error satisfies . By the linearity of the inverse transform, the reconstruction error of the signal satisfies
that is, the reconstruction error at every action point does not exceed one quantization step. This gives a direct conversion between “quantization granularity ↔ action precision”, which is easier to control than point-wise discretization.
Step 4: the compression ratio of run-length encoding. Suppose there are non-zero coefficients after quantization and the remaining are 0. Encoding them as (value, run length) pairs, the token count is approximately
When , the compression ratio is approximately . Measurements on typical manipulation tasks show that FAST reduces the token count per trajectory to 1/3 to 1/5 of the original, and because the frequency-domain representation is “smoother”, the autoregressive model also converges faster.
Step 5: the interface with an “autoregressive VLA”. The encoded tokens are mixed into the same sequence as ordinary vocabulary tokens, and the model is trained with next-token prediction as usual. At decoding time the inverse DCT is applied first and then the actions are restored according to the quantization step. FAST therefore keeps the LLM ecosystem (pretrained weights, KV cache) while sharply shortening the sequence length — this is its core advantage over per-dimension discretization (Section 4.2).
Step 6: the cost. Frequency-domain encoding is “lossy and delayed”: steps must be accumulated before one transform can be done, block boundaries need overlapping or padding, and the inverse transform adds computation. In practice a shorter window is used (for example corresponding to 0.5–1 second) to balance this.
Training (data preprocessing stage, one time):
for each trajectory's action sequence:
split by action dimension, take a window of length T for each dimension
apply the DCT to obtain A_k
order by k from small to large and quantize with Δ
run-length encode: collapse runs of identical/zero coefficients into (value, length)
output: the action token sequence (far shorter than T × dimensions)
concatenate this sequence with vision/language tokens and train the VLM with next-token prediction
Inference:
encode image + instruction to obtain the prefix
autoregressively generate the action token sequence
run-length decode → inverse DCT → obtain the action chunk
execute the first several steps, then replan
Walkthrough:
- It does not change the paradigm of “actions are tokens”, only “how tokens are cut”. All of RT-2’s ecosystem advantages (reusing VLMs, KV cache, quantization toolchains) are therefore preserved.
- The compression ratio comes from the properties of the signal, not from the model. Unlike learning a compressor, DCT + run-length encoding is a fixed transform that needs no training, is stable, and is interpretable; the price is that it cannot adapt to the action statistics of different tasks.
- Precision is controlled by the quantization step . This is a more intuitive parameter than “256 bins”: directly corresponds to the maximum reconstruction error at an action point. When tuning, first decide the position error the task allows (such as ±2 mm), then derive from it.
- The block length is a trade-off. Large → higher compression ratio, but more latency and discontinuous block boundaries; small → faster response, but less compression benefit.
- It suits “long action sequences + few degrees of freedom” best. If the action dimensionality is high (such as a multi-fingered dexterous hand with 20+ dimensions), every dimension needs its own DCT and the token total still inflates; a continuous action head (π₀ class) is then more advantageous.
4.4.1 FAST Implementation-Pitfall Checklist
| Symptom | Likely cause | Fix |
|---|---|---|
| Actions show “ringing”, end effector jitters | High-frequency coefficients coarsely quantized or discarded | Reduce ; keep more high-frequency coefficients; use finer quantization for the end effector separately |
| Actions are smoothed out overall, response slows | Window too long, low-frequency truncation too aggressive | Shorten (0.3–0.8 s); keep the first several orders of coefficients |
| Token count goes up instead of down | Actions are jittery, too many non-zero coefficients | Low-pass smooth the demonstrations first; increase ; change the window length |
| Discontinuities at block boundaries | Adjacent windows transformed independently, no overlap | Overlap windows by 25%–50% and cross-fade at the boundaries |
| Wrong action magnitude after decoding | The normalization coefficient of the inverse transform is wrong (the is missing) | Implement strictly according to the DCT-II inverse formula and unit-test the round-trip error |
| Training loss normal but real-robot accuracy insufficient | Quantization error accumulates over joints, error shape mismatched to the task | Derive from the error the task allows (e.g. ±2 mm corresponds to mm) |
| Semantics confused after run-length encoding | Encoding order (low frequency first) not aligned with decoding | Fix the encoding order and mark boundaries explicitly in the vocabulary |
4.4.2 Comparison with Other Tokenization Schemes, and Applicability
| Dimension | Per-dimension per-frame discretization (RT-2) | FAST (frequency domain + run-length encoding) | Continuous head (π₀/DP) |
|---|---|---|---|
| Sequence length | Long () | Short (about 1/3–1/5) | No tokens |
| Precision control | Bin width | Quantization step | Continuous |
| LLM ecosystem compatibility | Complete | Complete | Partial |
| Error shape | Staircase | Overall smoothing / ringing | Small continuous deviation |
| Best suited for | Semantic generalization | Long sequences, few degrees of freedom | High frequency, high precision, multi-modal |
Applicability:
| Scenario | Suitable for FAST | Why and recommendation |
|---|---|---|
| Long action chunks + low-dimensional actions (within 7 dims) | Very suitable | Largest compression benefit |
| Already using an autoregressive VLA and wanting a shorter sequence | Very suitable | Change only the tokenizer, not the model |
| High-dimensional dexterous hand (20+ dims) | Fair | Tokens remain numerous after per-dimension transforms; consider a continuous head |
| Extremely high-frequency abrupt actions (tapping, tossing and catching) | Relatively weak | High-frequency coefficients get compressed away; keep more coefficients |
| Needing point-wise millimeter precision | Fair | Reducing costs compression ratio |
4.5 Other Open-Source / Representative Models Worth Knowing
Beyond the three main lines above, several other classes of models make up the complete picture of VLAs from 2023 to 2026; it is enough to understand their positioning.
Octo (2023–2024, an open-source generalist policy). Its positioning is “the general-purpose Transformer of the robotics world”: a Transformer trunk takes multi-camera images + language + proprioceptive state and outputs an action chunk; it is pretrained on Open X-Embodiment and supports many robot embodiments (single arm, dual arm, quadruped). Its value lies mainly in providing a reproducible open-source baseline and a flexible multi-embodiment interface, which makes it suitable as a starting point for teaching and for further development. Technically it does not introduce a new paradigm; it is an engineering integration of “Transformer policy + large-scale multi-embodiment data”.
GR-2 (2024, generative video pretraining). It first pretrains a model on a video generation task (learning to predict “how the picture will change as a result of the action”) and then converts that model into a policy. The core motivation is that video data (internet scale) far exceeds robot action data, and video pretraining can learn physical intuition (how objects move, how contact happens), which is closer to control than the purely semantic priors of a VLM. It is a cross-product of “world-model thinking” and “VLA thinking”.
HPT (Heterogeneous Pre-trained Transformer, 2024). It solves the problem that “different robot embodiments differ enormously”. It introduces embodiment-specific stems (input/output adaptation modules): each robot has its own vision stem and action stem, and they share the Transformer trunk in the middle. Different embodiments thereby share “task understanding” while each keeps its own “embodiment interface”. This has become the standard practice for multi-embodiment VLAs.
RDT-1B (2024, a large model for dual-arm robots). With about 1B parameters and aimed at dual-arm robots, it is pretrained on about 46 datasets and 1M+ trajectories and uses a diffusion-style action head (rather than discretization). Its significance is that it validated the unified action space route: projecting the actions of different robots into a shared physical-quantity space (end-effector pose + gripper), so that heterogeneous data can be trained together. This is the key precondition for data scale to grow.
One comparison table puts the above models in the same coordinate system:
| Model | Action representation | Decoding head | Pretraining data focus | Main contribution |
|---|---|---|---|---|
| RT-2 | Per-dimension quantile discrete tokens | Autoregressive | Internet VLM + robot data | Proved “actions as tokens” works |
| OpenVLA | Same as above | Autoregressive (Llama backbone) | Open X-Embodiment (970k trajectories) | The first usable open-source 7B VLA |
| π₀ | Continuous action chunk | Flow matching (OT pairing) | Heterogeneous multi-embodiment real robot data | High frequency + high precision + few-step sampling |
| FAST | Frequency-domain compressed tokens | Autoregressive | Same as above | Solved the token-length explosion |
| Octo | Continuous action chunk | Diffusion/regression head | Open X-Embodiment | Open-source generalist baseline, multi-embodiment interface |
| GR-2 | Continuous action chunk | Diffusion head | Video generation pretraining | Learning physical intuition from video |
| HPT | Continuous action chunk | Per-embodiment independent stems | Multi-embodiment heterogeneous | Cross-embodiment parameter sharing |
| RDT-1B | Continuous action chunk | Diffusion head | 46 datasets / 1M+ trajectories | Unified action space, dual-arm large model |
4.5.1 Mechanism Essentials, Common Pitfalls, and Applicability of the Four Models
These four models need not be expanded into nine sections, but each is worth remembering for “what problem it solves, where it is easiest to get wrong, and when to choose it”.
| Model | Mechanism essentials | Key design | Common pitfalls | Applicability |
|---|---|---|---|---|
| Octo | Transformer trunk + action-chunk regression/diffusion head, multi-embodiment input/output adaptation | Unified multi-camera tokenization, pluggable observation/action tokenizer | Running a new embodiment without changing the tokenizer so the action dimensions do not match; the pretrained weights overfit on small data | Teaching, further development, multi-embodiment experiments needing a reproducible baseline |
| GR-2 | Pretrain with video generation (predicting future frames), then convert into a policy | Video pretraining provides physical intuition; a generative head outputs actions | Video data is not aligned with the robot action space (no action labels); texture details of generated video waste capacity | Contact-rich tasks needing physical intuition; when video data is plentiful |
| HPT | Shared Transformer trunk + an independent stem per embodiment | Embodiment-specific input/output stems, shared trunk | A stem that is too narrow under-represents the embodiment features; unbalanced data ratios across embodiments | Multi-embodiment heterogeneous data, cross-embodiment transfer |
| RDT-1B | 1B parameters, diffusion action head, unified action space | Project heterogeneous actions into a shared physical-quantity space (end-effector pose + gripper) | The unified space loses embodiment-specific degrees of freedom (such as dexterous finger joints); projection error accumulates | Dual-arm robots, large-scale heterogeneous-data pretraining |
One shared engineering conclusion: among these four models the “model structure” differs far less than the “data processing pipeline”. In practice, nine out of ten reproduction failures come from action space unification, normalization statistics, temporal alignment, and camera calibration, not from network design. This is also why Chapter 6 puts “calibration and time synchronization” before domain randomization.
5. World Models and Model-Based Reinforcement Learning
All the methods above assume “the policy maps observations directly to actions”. Biology does not work that way: before doing something, a person “rehearses” it in their head — imagining what will happen if the cup is pushed over. A world model makes that rehearsal capability explicit by learning a model of “given the current state and action, predict the next state and reward”, and then planning or training a policy inside that model.
Why does it matter? Because real interaction is the most expensive resource. Collecting one trajectory on a real robot takes tens of seconds and may damage the hardware; simulation also costs compute. If thousands of trajectories can be “imagined” inside a model, sample efficiency improves by one to two orders of magnitude. This is especially critical for embodied AI — collecting robot data costs far more than text and images.
5.1 Three Routes for World Models
| Route | What it predicts | Representative methods | Main advantage | Main cost |
|---|---|---|---|---|
| Pixel reconstruction | The next image frame | The Dreamer family | Intuitive, visualizable | Compute is wasted on texture details |
| Latent-space prediction (no decoder) | Latent state + reward + value | TD-MPC2 | Fast, supports long-horizon planning | Latent space is hard to interpret and drifts easily |
| Representation prediction (no reconstruction) | Future representation (embedding) | The JEPA family | Ignores unpredictable details | Needs protection against representation collapse; downstream adaptation is complex |
The point of divergence among the three is a fundamental question: to what granularity should “predicting the future” predict? Pixel level is the most complete but the most wasteful; latent space is a compromise; representation level is the cheapest but needs extra regularization to avoid the degenerate solution “all inputs map to the same vector”.
5.2 DreamerV3: Training a Policy by “Dreaming” in Latent Space
Dreamer’s core component is the recurrent state space model (Recurrent State Space Model, RSSM). It splits the state into two parts:
- Deterministic latent state : produced by a recurrent network (GRU) from the action history and the previous latent variable; it is responsible for memory;
- Stochastic latent state : sampled from a prior/posterior distribution; it is responsible for expressing uncertainty.
The benefit of this design is that training uses the posterior (it has observations and is more accurate), while imagination uses the prior (there are no observations and it must predict) — and the two are pulled together by a KL term, which guarantees that “imagination” and “reality” do not diverge.
Derivation: The evidence lower bound (ELBO) of the RSSM, KL balancing, and the symlog transform
Step 1: write the lower bound of the log-likelihood. Let the observation sequence be , the actions , and the latent variables . Maximizing directly is infeasible (it requires integrating over the latent variables), so variational inference introduces the posterior :
Key derivation: write as and apply Jensen’s inequality (under the concave function , ). The reward and termination signals each have their own reconstruction terms, and ( being the “whether to continue” flag); together they form the complete objective.
Step 2: why the KL term needs “balancing”. The expression above optimizes two things at once: making the posterior close to the observation (improving reconstruction), and making the posterior close to the prior (improving predictability). The two conflict: the posterior wants to “remember every detail”, the prior wants to “keep only the predictable part”. Without weighting, the posterior usually fills the latent variables with details, so that the prior cannot learn and imagination deviates badly.
DreamerV3’s fix is to split the KL into two terms and stop the gradient on one of them (stop-gradient, written ):
- The first term pulls the prior toward the posterior, but does not let the gradient flow through ( is the “teacher” and must not degrade because of ‘s shortcomings) — this term trains the prior, with weight ;
- The second term pulls the posterior toward the prior, likewise without letting the gradient flow through — it trains the encoder/posterior, with weight .
A larger means “make the prior learn first”. This is the key to DreamerV3 running on dozens of wildly different tasks with one set of hyperparameters: the balancing coefficients decouple “learning the representation” from “learning to predict”, removing the need to retune the KL weight per task.
Step 3: why symlog is needed. Reward magnitudes differ hugely across tasks (+0.01 for one step, +100 for winning a game). Direct MSE regression lets large rewards dominate the gradient. DreamerV3 applies symmetric logarithmic compression to rewards, values, and observations alike:
Properties: when , (small values are not distorted); when , the growth is compressed logarithmically (large values do not explode); the sign is preserved, the function is monotonic and invertible (its inverse is symexp).
Step 4: why it handles negative rewards as well. Because symlog is an odd function, negative rewards are compressed the same way without losing their sign. With instead, negative rewards would be undefined — this is exactly why “symmetric” is necessary.
Step 5: policy learning happens “in imagination”. Starting from a real posterior state in latent space, the prior “imagines” an -step trajectory (no interaction with the environment), and the actor and critic are trained on the imagined trajectory with the -return (-return, i.e. the weighted multi-step return of TD(λ)):
degenerates into the Monte Carlo return (unbiased but high variance), into one-step TD (biased but low variance); intermediate values balance the two. Note that no gradient flows back into the world model (the imagined trajectory is treated as “the environment”); otherwise the world model would be distorted by the policy objective.
5.2.1 DreamerV3 Pseudocode and Walkthrough
Initialization: RSSM (encoder q, prior p, decoder), actor, critic, replay buffer
for each round of interaction with the environment:
# ---------- data collection (using the current actor, with exploration noise) ----------
h, z = latent state at the previous instant
observation o_t
h = GRU(h, z, a_{t-1})
z ~ q(h, o_t) # an observation is available, so use the posterior
a_t = actor(h, z) + exploration noise
execute a_t, obtain o_{t+1}, r_t, c_t, and store them in the replay buffer
# ---------- world model training ----------
for each batch (sample sequences of length T from the replay buffer):
for t = 1..T:
h_t = GRU(h_{t-1}, z_{t-1}, a_{t-1})
z_t ~ q(h_t, o_t) # posterior (for training)
z_hat_t ~ p(h_t) # prior (computed at the same time, for the KL)
L_recon = -ln p(o_t|h_t,z_t) - ln p(r_t|h_t,z_t) - ln p(c_t|h_t,z_t)
L_KL = 0.8·KL(sg(q) || p) + 0.2·KL(q || sg(p))
L_wm = L_recon + β_KL·L_KL + β_pred·(extra prediction terms for reward/termination)
update the encoder/decoder/prior (without touching the actor or critic)
# ---------- train the actor / critic in imagination ----------
h, z = take real posterior states from the replay buffer as starting points
for τ = 1..H (imagined steps, e.g. 15):
z_hat ~ p(h) # prior only, no real observation
r_hat, c_hat = decoder/prediction head(h, z_hat)
h = GRU(h, z_hat, actor(h, z_hat)) # the action comes from the actor
accumulate the λ-return G_τ
L_actor = -Σ G_τ # or a variant with entropy regularization
L_critic = Σ (V(h,z) - sg(G_τ))²
update the actor and critic (gradients do not flow back into the world model)
Walkthrough:
- “Training in imagination” is the source of its sample efficiency. One real interaction can be paired with several imagined rollouts (15–50 imagined steps per batch), as if one real trajectory were amplified into dozens of training signals. This is why Dreamer-class methods clearly outperform model-free RL in low-data regimes.
- The dual-track posterior/prior design cannot be omitted. With only the posterior, inference (the imagination phase) has no observation and collapses; with only the prior, training lacks enough information to fit the observations. The dual track plus a KL pulling them together is the only solution.
- The KL balancing coefficient is the key to “being general across tasks”. Traditional Dreamer has to tune the KL weight per task; after splitting the terms with stop-gradient, DreamerV3 can use a fixed value. Do not change this number casually when reproducing, because it encodes the explicit intent “make the prior predictable first”.
- symlog is not just a numerical trick. It makes the same loss function stable on tasks with reward magnitudes from to , and is a necessary condition for “one set of hyperparameters running dozens of tasks”.
- The number of imagined steps has an optimal value. Too short and long-term consequences are not learned; too long and errors accumulate (prior drift). In practice about 15 is common, together with “termination prediction” for early truncation (the model predicts “the episode ends” itself so as not to keep imagining in wrong states).
- Its weak point is “compounding model error”. After 50 imagined steps the predicted state may have completely diverged from reality, and the policy exploits the model’s flaws (model exploitation). It is therefore better suited to short-to-medium-horizon tasks; long-horizon tasks need hierarchy or model ensembles.
- It is “world model + RL”, not “model predictive control”. Dreamer trains a policy network on imagined trajectories and at deployment runs only the policy (fast); TD-MPC2 below does online planning (it runs optimization at deployment). These are two different engineering routes.
5.2.2 Gradient-Flow Checklist: The Three Non-Interfering Gradient Paths in DreamerV3
Dreamer trains the same representation with three losses at the same time, and the most failure-prone spot is “gradients contaminating each other”. Listing them one by one:
| Path | Gradient requirement | Reason |
|---|---|---|
| World model loss (reconstruction + reward + termination prediction) → RSSM and decoder | Required | This is the representation learning signal |
| KL term → posterior and prior | Required, but with an sg target on the prior side | Guarantees “the prior is predictable” rather than dragging the posterior down |
| Policy loss → policy network | Required | Main signal |
| Policy loss → world model | Must be sg (stop gradient) | Otherwise the policy “rewrites the world model into a fake model that yields high returns”, i.e. model exploitation |
| Value loss → value network | Required | TD regression |
| Value loss → world model/policy | Should be sg | The value is only an evaluator and should not rewrite the model |
| States on the imagined trajectory | Keep gradients to the policy, but cut them to the model with sg | This is Dreamer’s most critical graph structure |
In PyTorch, this boundary of “the policy gradient goes through the policy but not the model” usually looks like this:
# Imagination rollout: states are rolled out by the model, but treated as constants for the policy loss
z = z_t.detach()
for t in range(H):
a, logp = actor(z) # the policy output carries gradients
z_next, r, cont = world_model.imagine(z.detach(), a.detach())
z = z_next.detach() # key point: the imagination chain does not backpropagate into the policy loss
# the policy parameters only get gradients through the logp term; a's value enters the model and the gradient is cut here
The most common beginner mistake is “not detaching the whole imagination rollout”, so the policy loss backpropagates all the way into the RSSM; the return rises quickly for a short while, but after two or three hundred rounds the model has been rewritten to be more and more “optimistic” and real-robot performance falls off a cliff. The curve signature of this bug is very characteristic: training return rises monotonically, real evaluation return rises then collapses; when the two clearly diverge, check this gradient boundary.
5.2.3 DreamerV3 Implementation-Pitfall Checklist
| Symptom | Likely cause | Fix |
|---|---|---|
| Training return rises, real return collapses | The policy loss backpropagates into the world model (model exploitation) | detach the state in the imagination rollout |
| The picture becomes completely blurry after a few imagined steps | Prior drift, inappropriate KL balancing coefficient | Fix ; shorten the imagination horizon; use termination prediction for early truncation |
| It collapses whenever the reward magnitude changes | symlog not used, return normalization not done | Apply symlog to both reward and return uniformly; use percentile normalization |
| Posterior collapse, latent variables unused | KL weight too large, decoder too strong | Reduce the KL weight; check whether the reconstruction gradient reaches the posterior |
| Value scale drift | Value target not normalized, symlog not used | Apply symlog and percentile scaling to the value target |
| Long-horizon tasks learn nothing | Imagination error compounds, horizon exceeds the model’s reliable range | Hierarchical policy, shorten , add model ensembles |
| Discrete-action tasks do not converge | The policy still uses a Gaussian instead of a categorical distribution | Switch the distribution according to the action type |
| Out of GPU memory | Imagined sequences and real sequences are backpropagated together | Backpropagate in segments; keep only the policy gradient in the imagination segment |
| Hyperparameters must be retuned for a new task | The “cross-task fixed hyperparameter” configuration is not used | Adopt the fixed hyperparameter set from the original paper (including , symlog, percentiles) |
5.2.4 Route Differences from TD-MPC2, and Applicability
| Dimension | DreamerV3 | TD-MPC2 |
|---|---|---|
| Decoder | Yes (reconstructs observations) | No (constrained by a consistency loss) |
| Policy network | Yes (deployment runs only the policy) | No (online planning at deployment) |
| Deployment compute | One forward pass, extremely fast | CEM iterations at every step, slower |
| Training signal | Reconstruction + reward + termination | Consistency + reward + TD |
| Suitable tasks | Short-to-medium horizon, needs dense representations | Short horizon, needs precise local control |
| Main risk | The model is exploited by the policy | Planning falls into the model-error region |
DreamerV3’s applicability boundary:
| Scenario | Suitable for DreamerV3? | Reason and recommendation |
|---|---|---|
| Simulation training with a low data budget | Very suitable | One real interaction can be amplified into dozens of imagined ones |
| Visual input that requires representation learning | Very suitable | The reconstruction objective provides dense supervision |
| Multi-task settings with very different reward magnitudes | Very suitable | symlog + fixed hyperparameters are designed exactly for this |
| High-precision contact tasks (peg insertion) | So-so | Reconstructed pixels do not match the precision required for decisions; planning-based methods are more suitable |
| Long-horizon tasks (> hundreds of steps) | Weaker | Error compounds; hierarchy is needed |
| Online learning on real robots | So-so | Training is expensive, and model errors are costly on real hardware |
5.3 TD-MPC2: Latent-Space MPC That Skips Decoding and Only Plans
The philosophy of TD-MPC2 (Temporal Difference Model Predictive Control, 2023–2024) is the opposite of Dreamer’s: do not reconstruct observations, and do not train a policy network; do model predictive control (Model Predictive Control, MPC) directly in latent space.
It needs only four components:
There is no decoder — this is its most important design choice. The benefit is saved compute and avoidance of “reconstructing pixels”, an objective unrelated to decisions; the price is that the latent space has no pixel-level supervision and must be “pinned down” by other losses.
Derivation: the decoder-free representation-consistency loss, TD learning, and CEM planning
Question one: without a decoder, how do we prevent latent-space collapse? If we optimize only reward prediction, the encoder can map all observations to the same vector (because the reward depends only on task-relevant parts). TD-MPC2 constrains this with a multi-step temporal consistency loss: the result of “rolling steps in latent space” is aligned with “directly encoding the real observation steps later”:
Here means rolling the dynamics times, and means no gradient is backpropagated on the target side (otherwise the encoder can “cheat” by driving both sides to zero).
Why this expression prevents collapse. It requires the latent state to retain enough information to predict the next steps. If all observations were mapped to the same vector, the target steps later would be identical to the current one, which implicitly requires that observations “making the future distinguishable from the present” must be encoded — so the collapsed solution does not satisfy consistency.
Question two: how is the value learned? With TD learning (Temporal Difference), the target is -step bootstrapping (using one’s own estimate as the target for later timesteps):
guarantees that gradients flow only out of “the current value”, while the target side is treated as a constant — this is the common formulation of all TD methods, otherwise a fixed-point drift of “chasing one’s own tail” appears.
Question three: how are actions selected at deployment? With the cross-entropy method (Cross-Entropy Method, CEM). It performs iterative sampling-based optimization in the space of action sequences:
- Initialize the action-sequence distribution (diagonal Gaussian);
- Sample candidate sequences, roll each steps with the model, and accumulate the return
- Take the “elites” with the highest returns () and re-estimate the mean and variance from their actions:
- Repeat steps 2–3 a few rounds and output the first several steps of as the actions to execute.
Why CEM rather than gradient optimization. The MPC objective is “the cumulative return over the next steps”; taking its gradient with respect to actions requires backpropagating through the entire dynamics model (an extremely deep computation graph, with bounded actions). CEM is gradient-free: it only needs forward rollouts and naturally supports action bounds (clipping after sampling), so it is robust. The price is many samples — this is the main compute cost of MPC-style methods at deployment.
Question four: the relationship between CEM and “temperature”. If elite selection is viewed as softmax weighting, the shrinkage speed of is equivalent to a “temperature” parameter: shrinking too fast converges prematurely to a local optimum, too slow gives insufficient precision. In practice, a fixed number of iterations (say 6) with moderate shrinkage per round is the stable choice.
5.3.1 TD-MPC2 Pseudocode and Walkthrough
Components: encoder enc, latent dynamics d, reward head R, value head V (no decoder)
Hyperparameters: planning horizon H (e.g. 5), CEM sample count N (e.g. 512), elite count K (e.g. 64), iteration count M (e.g. 6)
# ---------- Training (interact with the environment + sample from the replay buffer) ----------
for each interaction:
z = enc(o_t)
obtain a_t by CEM planning (see below), add exploration noise and execute, store (o_t, a_t, r_t, o_{t+1}, c_t)
for each training batch:
z_t = enc(o_t)
for k = 1..H:
z_hat_{t+k} = d(z_hat_{t+k-1}, a_{t+k-1})
r_hat_{t+k-1} = R(z_hat_{t+k-1}, a_{t+k-1})
L_cons = Σ_k || z_hat_{t+k} - sg(enc(o_{t+k})) ||²
L_rew = Σ_k (r_hat_{t+k-1} - sg(r_{t+k-1}))²
L_val = (V(z_t) - sg(Σ_{i<n} γ^i r_{t+i} + γ^n V(z_{t+n})))²
L = L_cons + L_rew + L_val
update enc, d, R, V
# ---------- CEM planning at deployment (run at every control step) ----------
μ = 0, σ = 1 # initialize the action-sequence distribution (H × action dimension)
for m = 1..M:
# sample N candidate action sequences, all clipped to the action bounds
for i = 1..N:
A^(i) = clip(μ + σ·ε^(i)), ε^(i) ~ N(0, I)
z = enc(o_t)
G^(i) = 0
for t = 1..H:
r = R(z, A^(i)_t); z = d(z, A^(i)_t)
G^(i) += γ^{t-1}·r
G^(i) += γ^H·V(z) # bootstrap with the value function at the end
select the K sequences with the largest G → update μ, σ with their A
output the first several steps of μ, execute them, then replan (receding horizon)
Walkthrough:
- The decoder-free design is a deliberate trade-off. It saves the compute of “reconstructing the whole image” and removes that objective conflict, letting the model focus on “information relevant to decisions”. The price is that the representation must be pinned down by a consistency loss, and the latent space cannot be visualized and is hard to debug.
- The consistency loss acts like a “self-supervised world model”. It gives the encoder a representation with a “predict-the-future” structure, which is the same idea as JEPA (see 5.4); the only difference is that TD-MPC2 predicts “the latent state” while JEPA predicts “the output of a target encoder”.
- Deployment compute is spent entirely on planning. Each control step requires forward rollouts (e.g. ), which is tight at 50 Hz even with a small model. This is the inherent bottleneck of the MPC route for high-frequency control, and it is exactly where Dreamer’s “train a policy, run one forward pass at deployment” wins.
- CEM parallelizes very well. The candidates can be fully parallelized (batched forward passes), so it is not slow on a GPU; the real latency comes from “having to replan when control steps are short”.
- It is easier than Dreamer to use in scenarios with “frequent task switching”. Planning targets the reward directly, so changing tasks only means changing the reward function, without retraining a policy; Dreamer usually needs to retrain the actor when the task changes.
- Weak points. Latent-model error accumulates after rollout steps, leading to “model exploitation”; and CEM is only a local optimizer, so sampling efficiency drops when the action space is high-dimensional (e.g. 30+ dimensions for a humanoid). In practice it is often paired with “prior-policy sampling” (learning an action proposal distribution) to mitigate this.
5.3.2 Gradient-Flow Checklist: TD-MPC2’s Four “sg”s
All TD-MPC2 losses are written in the same line of code, and where sits determines whether it learns correctly:
| Path | Gradient requirement | What happens otherwise |
|---|---|---|
| Consistency loss → dynamics | Required | The dynamics is not learned and planning immediately fails |
| Consistency-loss target | Must be sg | Both sides move, and the encoder compresses all observations into the same vector (collapse) |
| Reward-loss target | Must be sg (the label itself has no gradient) | Usually not a mistake, but taking the label from the model output is self-deception |
| Value-loss target (-step return + ) | Must be sg | The target chases itself and the value scale drifts |
| CEM forward passes during planning | No gradient needed | Wrap in torch.no_grad(), otherwise GPU memory explodes |
| Encoder parameters | Updated jointly by the consistency, reward, and value paths | Imbalanced weights across the three paths bias the representation toward one objective |
One easily overlooked detail: in the consistency loss, should only be applied to the target side; the prediction side must not be wrapped in no_grad as well. Some people wrap the whole block to save memory, so the dynamics only receives gradients from the reward loss, diverges after a few rollouts, and shows up as “ is fine, is a mess”.
5.3.3 TD-MPC2 Implementation-Pitfall Checklist
| Symptom | Likely cause | Fix |
|---|---|---|
| Latent-space collapse, planned actions constant | Consistency target not sg, encoder too strong | stop_grad on the target side; add VICReg-style variance regularization |
| Predictions completely distorted after rollout steps | Consistency trained only for , too close to 1 | Cover consistency up to steps; use of 3–5; lower appropriately |
| Planned actions jitter, execution not smooth | re-initialized from scratch at every step | Warm-start from the previous solution; or low-pass filter the output |
| Deployment cannot reach the control frequency | too large, model not small | Reduce (4–6) and (128–256); batch the forward passes; lower the control frequency |
| Planning fails for high-dimensional actions (30+ dims) | CEM sampling is inefficient in high-dimensional spaces | Learn an action proposal network, reduce dimensionality, or use MPPI (Model Predictive Path Integral) instead |
| Collapses after the reward scale changes | Reward not normalized | Standardize the reward; symlog the value target |
| Retraining needed when the task changes | Normal (it is reward-driven) | Just change the reward function; fine-tune the model if necessary |
| Training loss drops but real-robot performance is bad | The latent space is misaligned with pixels (cannot be debugged visually) | Add an auxiliary reconstruction head for diagnosis (training only) |
5.3.4 Comparison with DreamerV3 and JEPA, and Applicability
| Dimension | TD-MPC2 | DreamerV3 | JEPA |
|---|---|---|---|
| Representation learning | Consistency loss (no decoder) | Reconstruction + KL (with decoder) | Prediction in representation space + EMA |
| Decision making | Online CEM planning | Trains a policy network | Usually representation pretraining, followed by a downstream policy |
| Deployment latency | High (planning at every step) | Extremely low (one forward pass) | Depends on the downstream component |
| Cost of switching tasks | Low (change the reward) | High (retrain the actor) | Medium |
| Main risk | Local optima, hard sampling in high dimensions | Model exploitation, imagination drift | Representation collapse |
TD-MPC2’s applicability boundary:
| Scenario | Suitable for TD-MPC2? | Reason and recommendation |
|---|---|---|
| Short horizon, precise local control (pushing, insertion, turning) | Very suitable | Planning can optimize the reward directly, with high precision |
| Needs frequent task switching | Very suitable | Only the reward function changes |
| Low-dimensional actions (≤ 12 dims) | Very suitable | CEM sampling efficiency is acceptable |
| Whole-body control of a high-dimensional humanoid | So-so | Curse of dimensionality in sampling; needs a proposal network or hierarchy |
| High-frequency control (> 50 Hz) | Weaker | Per-step planning is expensive |
| Long-horizon tasks | Weaker | Model error compounds |
| Just want a fast deployable policy | Not suitable | Use Dreamer or plain model-free RL |
5.4 JEPA: Predicting “Representations”, Not “Details”
The core claim of JEPA (Joint-Embedding Predictive Architecture, proposed from 2022 onward by Yann LeCun’s group) is: when predicting the future you should not predict every pixel, because most pixels are unpredictable (texture, lighting, noise), and forcing a prediction only makes the model waste compute on irrelevant details.
Its approach: encode both the observation and the target into representations, then predict in representation space.
Here is the target encoder, whose parameters are not updated by gradients but by an exponential moving average (Exponential Moving Average, EMA) of the online encoder parameters:
Derivation: why a target encoder and EMA are needed, the three forms of representation collapse, and VICReg regularization
Question one: what happens without a target encoder? If the loss is written directly as , gradients optimize the predictor and both encoders at the same time. The laziest solution is to let the encoder output a constant (identical for all inputs), making the loss identically zero. This is representation collapse.
Question two: why does an EMA target encoder mitigate it? Once the target side has its gradient cut by , the encoder can no longer be lazy by “pulling the representation of toward the prediction”; and follows slowly, providing a lagging but identically distributed target. This is the same idea as the momentum encoder in “Momentum Contrast” (MoCo): use a slowly moving anchor to prevent both sides from collapsing together.
Question three: the effective time constant of EMA. Expanding recursively gives
that is, the target parameters are a geometrically weighted average of past online parameters, with an effective window of about steps (about 100 steps when ). Too large → the target lags too much and learning stalls; too small → the target is synchronized with the online encoder and collapse prevention fails. 0.99 is a good empirical compromise.
Question four: even with EMA, collapse can still happen — how do we prevent it completely? Add explicit variance–covariance regularization, i.e. VICReg (Variance-Invariance-Covariance Regularization):
- Variance term: requires the standard deviation of every representation dimension to be at least (a hinge loss) and penalizes otherwise — directly forbidding “all outputs are the same”;
- Covariance term: requires covariances between different dimensions to be close to 0, avoiding dimension redundancy (two dimensions carrying the same information is a waste);
- Invariance term: this is the actual prediction objective.
Together the three terms remove the degenerate “collapsed” solution from the feasible set.
Question five: why is “representation prediction” useful for robots? Because the effect of an action is usually reflected in a few key quantities (whether an object moved, whether it was grasped), while pixel-level details (reflections, shadows) are useless for decisions and hard to predict. Predicting representations amounts to automatic “information filtering”, concentrating modeling capacity on the controllable, predictable part. This also explains why JEPA-style methods have outstanding sample efficiency on video and robotics.
Question six: the price. Predictions in representation space cannot be directly “visualized”, so debugging is hard; and if a downstream task needs exactly the details that the representation discarded (e.g. “which way the screw groove faces”), performance drops. JEPA is therefore better suited to high-level planning and representation learning; fine-grained manipulation still usually needs pixel-level or geometric supervision.
Pretraining (self-supervised, runs even without action labels):
online encoder enc_θ, predictor pred_φ, target encoder enc_θ̄ (θ̄ initialized from θ)
for each batch (sampling (x, y, a) from unlabeled video/trajectories):
z_x = enc_θ(x)
z_y = enc_θ̄(y) # target side, gradient cut
z_hat = pred_φ(z_x, a) # prediction in representation space
L = || z_hat - sg(z_y) ||²
+ λ_var·variance regularizer(z_x)
+ λ_cov·covariance regularizer(z_x)
update θ, φ
θ̄ = m·θ̄ + (1-m)·θ # EMA update of the target encoder
Downstream use (two ways):
(a) use enc_θ as a visual encoder and attach it to the action head of ACT / DP / VLA for fine-tuning;
(b) add a planner in representation space (similar to TD-MPC2's CEM), but roll out in z space
Walkthrough:
- It is essentially a “self-supervised world model”. It can learn “what changes together with what” from video without action labels, which lets it use internet-scale video pretraining — this is its biggest data advantage over Dreamer/TD-MPC2.
- Target encoder + EMA + variance regularization: all three are indispensable. Removing any one of them makes training collapse or diverge. Reproductions must implement all three together.
- Where does (the action) in the loss come from. If the data has action labels (robot trajectories), feed the action directly; if there is only video, “latent actions” or “inter-frame differences” can serve as a coarse action proxy. The latter is what many video world models actually do.
- It is complementary to VLA, not a replacement. JEPA provides visual representations and physical intuition, VLA provides semantics and action generation; recent work has attached JEPA-style pretraining to VLA backbones, which is a fusion of the two paradigms.
- A common misuse in practice. Treating JEPA as “universal pretraining” and directly attaching a linear action head is often worse than a dedicated action head (diffusion/flow matching); the correct usage is to use its encoder as initialization, while the action head still follows the methods in Chapter 3/Chapter 4.
5.4.1 Gradient-Flow Checklist: JEPA Has Only One Gradient Path but Three “Do-Not-Touch” Rules
| Path | Gradient requirement | Explanation |
|---|---|---|
| Prediction loss → online encoder | Required (can carry a small weight) | Adapts the representation to the “predictable” objective |
| Prediction loss → predictor | Required (main signal) | The predictor carries most of the fitting work |
| Prediction loss → target encoder | Must be sg | The target side does not move, otherwise both sides collapse |
| Variance regularizer / covariance regularizer → online encoder | Required | Prevents all outputs from collapsing to one point |
| EMA update of | Not a gradient, but a parameter write | Must not be updated by the optimizer, and must not appear in .parameters() |
| Downstream fine-tuning stage | Usually freeze the encoder or use a low learning rate | Avoid destroying the learned representation |
An extremely hidden implementation bug: registering the target encoder in the optimizer as well (e.g. optimizer = Adam(list(online.parameters()) + list(target.parameters()))). Then sg looks applied, but the optimizer still moves one step per iteration, destroying the “slow anchor” property of EMA; nothing shows up early in training, but the representation gradually collapses later. The correct approach is to set requires_grad=False on the target encoder parameters, not pass them to the optimizer, and write them in place with the EMA formula only.
5.4.2 JEPA Implementation-Pitfall Checklist
| Symptom | Likely cause | Fix |
|---|---|---|
| Representation collapse (all inputs map to the same vector) | Target side not sg, no variance regularization, EMA coefficient too small | stop_grad on the target side; add VICReg variance/covariance terms; raise above 0.99 |
| The loss suddenly becomes NaN | Representations not normalized, variance-regularizer weight too large | L2-normalize the representations; tune the regularizer weight to the loss magnitude |
| Pretraining is good, downstream is bad | The representation lost task-relevant details | Do not fully freeze downstream; add an adaptation layer; or change the prediction target |
| Training on video works, on robots it does not | Action proxy too coarse (frame differences), wrong temporal span | Use real actions or a finer action proxy; adjust the prediction time span |
| Training is extremely slow | Two encoders are computed at every step and the target side is not cached | Use no_grad on the target side; video-frame features can be pre-extracted and cached |
| Representations are inconsistent across views | Each view encoded independently, no cross-view prediction | Add a cross-view prediction objective (the same downstream state under different views should align) |
| The predictor is too strong, the encoder “gets lazy” | Predictor capacity far exceeds encoder capacity | Balance the two capacities; give the encoder loss a higher weight |
5.4.3 Positioning Difference from Dreamer and TD-MPC2, and Applicability
The fundamental difference between JEPA and the other two is not in “network structure” but in the fact that it is usually not a complete policy, but a representation-pretraining stage. Dreamer and TD-MPC2 both come with a decision mechanism (policy or planning); JEPA only provides a “predictable representation”, and decisions must be attached downstream.
| Scenario | Suitable for JEPA? | Reason and recommendation |
|---|---|---|
| Plenty of video without action labels | Very suitable | This is exactly its data advantage over Dreamer/TD-MPC2 |
| As visual-backbone initialization for VLA / ACT / DP | Very suitable | Improves sample efficiency and physical intuition |
| Needs fine-grained geometric precision (screw-groove orientation) | Weaker | Representations drop details; pixel-level or geometric supervision is needed |
| Used alone as a complete policy | Not suitable | Lacks a decision mechanism; must attach an action head or planner |
| Extremely limited compute, very little data | So-so | Pretraining is expensive, and the gains are unclear with small data |
| Needs fast interpretable debugging | Weaker | The latent space cannot be visualized |
5.5 How to Choose Among the Three
| Dimension | DreamerV3 | TD-MPC2 | JEPA |
|---|---|---|---|
| Decoder needed | Yes (reconstructs observations) | No | No |
| What deployment computes | One forward pass of the policy network | Online CEM planning (expensive) | Depends on the downstream attachment |
| Sample efficiency | Very high | High | Very high (can work without action labels) |
| Fit for high-frequency control | Good (policy forward pass is fast) | Poor (planning at every step) | Good (if attached to a policy head) |
| Cost of switching tasks | Requires retraining the actor | Only change the reward function | Requires fine-tuning the downstream head |
| Main risk | Compounding model error, exploiting loopholes | Latent-space drift, planning compute | Representation collapse, loss of details |
| Typical use | Low-data control, games | Medium-horizon control, fast adaptation | Visual pretraining, high-level planning |
One-sentence selection guide: to train a policy that can execute at high frequency under a low data budget → DreamerV3; to adapt quickly to a new reward at test time with compute available for planning → TD-MPC2; to learn representations from massive unlabeled video → JEPA.
6. Robustness Layer: From Simulation to Reality (Sim-to-Real)
Up to here, every method above can produce beautiful curves in simulation. But a 95% success rate in simulation often drops to 30% on real hardware. This layer introduces no new paradigm; it only asks “how do we make what was learned in simulation still hold in the real world” — the unavoidable gate of every robotics project, and the one that consumes the most engineering time.
6.1 The Six Sources of the Reality Gap
Classifying the differences is the first step to solving them. Ordered by “difficulty of fixing”, from easy to hard:
| Source | Manifestation | Common countermeasure |
|---|---|---|
| ① Visual domain gap | Lighting, color temperature, material reflections, background texture, camera exposure | Image randomization, fine-tuning on real images, domain adaptation |
| ② Sensor noise and latency | Camera 20–60 ms latency, IMU noise, encoder quantization | Latency modeling, noise injection, state-estimation filtering |
| ③ Dynamic parameters | Mass, center of mass, joint damping, link flexibility | Domain randomization, system identification |
| ④ Actuator nonlinearity | Dead zone, saturation, backlash, PD gains drifting with temperature | Actuator models, torque limiting, identification from real data |
| ⑤ Contact and friction | Collision stiffness, friction cone, static/dynamic friction switching, deformation | Domain randomization + soft contact models; the hardest |
| ⑥ Control loop | Frequency mismatch, filter phase lag, communication jitter | Unify the control frequency, latency compensation, time alignment |
Why ⑤ is the hardest: contact is a discontinuous, non-differentiable, strongly nonlinear physical process. “Rigid body + Coulomb friction” in a simulator differs enormously from “elastic deformation + stick-slip switching” in reality, and manipulation tasks rely entirely on contact (grasping, pushing, inserting, screwing). This is also why real-robot success rates on contact-rich tasks have long been low — it is not a matter of tuning parameters but of model accuracy.
Before discussing any policy, get the three calibration quantities of the perception pipeline right — get any one wrong and all the later domain randomization and fine-tuning is wasted, because they fix model errors while what is wrong here is “the input itself”:
- Camera intrinsics and extrinsics: intrinsic errors bend the pixel-to-ray mapping as a whole, while extrinsic errors show up directly as a systematic offset between “the object position you see” and “the real object position”. Use a checkerboard or dot calibration board for standard calibration, and recalibrate after every collision, lens change, or mounting change; recalibration is far cheaper than misdiagnosing “the policy does not converge”.
- Hand-eye calibration: aligning the camera frame with the robot end-effector (or base) frame. With eye-in-hand (the camera is mounted on the end-effector) the error changes with joint configuration; with eye-to-hand (the camera is fixed to the frame) the error changes with frame vibration and workspace position — the two error types look completely different, so fault diagnosis must first decide which one it is.
- Time synchronization: image timestamps and joint-angle timestamps must be aligned at the millisecond level. Misalignment puts “observation” and “action” out of step, which for the policy is equivalent to injecting random latency, so it learns the wrong causal relationship — on training curves this shows up as “great in simulation, mysteriously jittery on the real robot”.
If there are also tactile, force/torque, or IMU sensors, calibrate their zero points and ranges first in the same way, and unify the coordinate frames of all cameras and sensors into the same base frame.
6.2 Domain Randomization: Making the Policy “Well-Traveled”
Domain randomization (Domain Randomization, DR) is the most mainstream and most effective move: do not train with a single set of parameters; every episode samples a set of environment parameters from a distribution (mass, friction, lighting, camera position, latency, …), so the policy learns to “succeed even when the parameters are uncertain”.
It essentially replaces the “training distribution” from a single point with a distribution covering the real parameters.
Derivation: the risk upper bound of domain randomization, the coverage condition, and the cost of “randomizing too widely”
Step one: formalization. Let the environment parameters be (mass, friction coefficient, light intensity, etc.); the expected return of policy under parameters is
The training objective is “the average over the randomization distribution”:
while what we really care about is — a single point.
Step two: write the difference between the single point and the average as an integral. If lies in the support of ,
Step three: use total variation distance to give an upper bound. If the return is bounded , then for any two environment parameters the difference in their trajectory distributions can be controlled by the total variation (Total Variation, TV) distance:
(This step comes from the standard result “the difference of the expectations of a bounded function under two distributions does not exceed a constant × TV distance”.)
Substituting into the previous expression gives
Step four: what this upper bound tells us. It is “training performance + a penalty term ”, and depends on two things:
- Whether has mass near (coverage). If the randomization range simply does not contain the real value, is large and the upper bound is useless — this is the most common failure cause: friction is only randomized up to 0.5 while the real robot is at 1.2.
- The spread of . The narrower , the higher the probability of landing near and the smaller ; but the easier it is to “miss” the real value.
Step five: why “wider is better” is wrong. Widen the randomization range and the training objective becomes “the average over a large number of extreme environments”. To cover all cases the policy takes more conservative actions (e.g. always slow down, increase grip force), causing lower absolute performance in the real environment. This is another manifestation of the bias–variance trade-off:
The two terms move in opposite directions, so there is an optimum: a width that exactly covers the real parameter distribution.
Step six: practical conclusions. Three operational guidelines:
- Measure the real parameters first (even roughly, with a scale, force gauge, caliper) to determine the lower and upper bounds of the randomization interval, and never let the real value fall outside it;
- Make the interval slightly wider than the measured range (e.g. measured friction 0.8–1.1, randomized 0.6–1.3), leaving margin for calibration error;
- Widen the “most critical parameters” and narrow the “irrelevant ones” — for example, in grasping tasks friction matters far more than background texture, so do not waste randomization budget on texture.
6.2.1 Automatic Domain Randomization (ADR)
Setting randomization ranges by hand is time-consuming, and the optimal range differs across tasks. ADR (Automatic Domain Randomization) lets the range grow automatically: start from a very narrow interval and expand outward once the policy performs well enough at the “boundary”.
Initialization: set the interval [lo, hi] of every parameter very narrow (even close to the real value)
Hyperparameters: expansion threshold θ_pass (e.g. success rate 0.7), expansion step δ
for each training round:
# ---------- Data collection: sample according to the current interval ----------
sample one episode of environment parameters ξ ~ U(lo, hi)
run the policy under ξ, record whether it succeeded (or the return)
store into the replay buffer
# ---------- Decide whether expansion is needed ----------
compute the success rate p_boundary "near the interval boundary"
if p_boundary > θ_pass:
for every expandable parameter:
with some probability decrease lo by δ and increase hi by δ # or expand by quantiles
if the interval has reached the physical upper/lower limit: freeze that parameter
# ---------- Policy update ----------
train PPO/SAC with all data in the replay buffer (including data from historically narrower intervals)
Walkthrough:
- The core of ADR is “curriculum learning”. It replaces “handing over a very wide range all at once” with “widening gradually”, avoiding the problem that an early policy cannot learn at all under extreme environments. This matches the idea of curriculum learning.
- The boundary success rate is the “passing grade”. The range may only be pushed harder when the policy can also succeed at the hardest end. The threshold therefore decides “how robust a policy must be before expanding”, usually 0.7–0.9.
- Historical data must be kept. After expansion, data from the old interval must not be discarded, otherwise the policy “forgets” it (catastrophic forgetting). This is a common bug in ADR implementations.
- Must expansion act on all related parameters simultaneously? No. Each parameter can be judged independently (maintaining its own boundary success rate), so “easy parameters” expand first and “hard parameters” later, which is more efficient.
- Its ceiling is the simulator’s physical limit. If the simulator itself cannot express real friction behavior, no amount of range expansion reaches real-robot performance — ADR can only cover parameters; it cannot fix structural errors in the model.
6.2.2 Complete Pseudocode for Domain Randomization + PPO
# Goal: train a grasping policy in simulation that can go straight onto the real robot
# ---------- 0. Build the parameter table (measure first) ----------
parameter_table = {
mass: [0.8× measured, 1.2× measured],
friction_coef: [0.6× measured, 1.3× measured],
joint_damping: [0.7× nominal, 1.5× nominal],
PD_gain: [0.8× nominal, 1.2× nominal],
camera_position: uniform perturbation of ±2 cm,
camera_latency: [0, 60] ms,
light_intensity: [0.5× baseline, 2× baseline],
background_texture: sampled from 200 random images,
action_latency: [0, 2] control steps
}
for each training iteration:
# ---------- Sample many environments in parallel ----------
for each parallel worker (e.g. 4096):
sample ξ ~ parameter_table (independently per worker)
rebuild/reset the simulation scene with ξ
run T steps, record (o, a, r, o', done)
implement "action latency" as: execute a_{t-d} (d sampled from the parameter table)
implement "camera latency" as: return the image from time t-d
# ---------- Training ----------
for each epoch:
sample a batch from the replay buffer
update the policy and value network with the PPO clipped objective
(if visual input: randomly apply brightness/contrast/color shift/blur to images)
# ---------- Periodic evaluation (for early stopping and model selection) ----------
evaluate in a simulation with "real parameters only" (no randomization)
record the success rate; if it does not improve for N consecutive rounds, lower the learning rate or stop early
Walkthrough:
- The number of parallel environments determines the “variance of the randomization”. 4096 parallel environments let each iteration cover a sufficiently wide combination of parameters; with only a few dozen, the effect of randomization is greatly reduced (insufficient sampling).
- Latency must be modeled explicitly. Camera latency and communication latency on real robots are typical problems that “the policy cannot learn in simulation”. Implementing latency as “the policy sees the observation from steps ago” is the simplest and most effective approach.
- The “degree” of visual randomization must be controlled. Excessive brightness/color randomization makes the policy insensitive to color (e.g. unable to tell red objects from blue ones); in practice, “task-relevant attributes” (object color) should be excluded from randomization.
- Evaluate with “real parameters only”, not with the randomized average. The training objective is “the average over a wide distribution”, but the model-selection criterion should be “best under real parameters” — when the two disagree, the latter wins.
- Randomization cannot replace system identification. If the simulator’s contact model is badly off overall (e.g. the real gripper deforms and the simulation does not model it at all), randomization only shakes a wrong model and cannot converge to real-robot performance.
6.2.3 Why Domain Randomization Works, and When It Does Not
This subsection introduces no new algorithm; it answers one engineering question: when should we keep adding randomization, and when should we stop and fix something else? The criteria can be organized into a diagnostic table:
| Real-robot symptom | More likely cause | Priority action |
|---|---|---|
| Simulation success rate 95%, real robot 30%, failures concentrated at the contact instant | Contact model error (friction, deformation, compliance) | Add friction/stiffness randomization; introduce system identification; fine-tune with real contact data if necessary |
| Good in simulation, real-robot motion uniformly too slow/fast | Action latency and time synchronization not modeled | Add action latency and camera latency; unify the control frequency |
| Fails when lighting/background changes | Visual distribution shift | Add lighting and texture randomization; but exclude task-relevant attributes (object color) |
| Fails when the workstation or camera changes | Camera intrinsics/extrinsics change | Add camera pose perturbation; do hand-eye calibration |
| Simulation metrics drop after adding randomization, real robot unchanged | Randomization range too wide, the policy becomes overly conservative | Narrow the range; expand gradually with ADR; select models by “evaluation under real parameters” |
| Works early on the real robot, drifts after a few hours | Thermal drift, battery voltage, mechanical wear | Include these quantities in randomization; add periodic real-robot fine-tuning |
| Badly off no matter how much you randomize | The observation/action space definition is already wrong (calibration, frames, units) | Check calibration and coordinate frames first, then talk about randomization |
One rule of thumb: randomization should only cover quantities that “really do vary in the real system and that the policy cannot infer from observations”. If the policy can estimate a quantity directly from observations (e.g. lighting is visible in the image), randomizing it brings limited benefit; conversely, if a quantity is completely unobservable to the policy (e.g. motor internal resistance, battery voltage) and it affects the dynamics, then it must be randomized.
6.3 The Other Three Routes: System Identification, Domain Adaptation, Real-World Fine-Tuning
System identification (System Identification, SysID). Instead of randomizing, fit the simulation parameters accurately with real data. The approach treats the simulator’s key parameters as quantities to be estimated and minimizes the trajectory difference between simulation and reality:
Here can be a joint-angle trajectory, an end-effector pose, or a torque reading. For solving, Bayesian optimization (Bayesian Optimization, sample-efficient and suited to expensive simulator calls) or CMA-ES (covariance matrix adaptation evolution strategy, suited to moderate dimensions and non-smooth objectives) is commonly used.
Derivation: why system identification has “multiple solutions”, and how identifiability is quantified
Step one: locally linearize the “parameter fit”. Let the parameters to identify be and the real-robot observation be ( is “number of sample points × number of channels”, usually far larger than ). Do a first-order expansion around the current initial value :
Write and ; the least-squares objective becomes
Step two: the normal equations give the condition for a “unique solution”. Take the gradient with respect to and set it to zero:
When has full rank (the columns of are linearly independent),
and the solution is unique. So “can the parameter be identified” is equivalent to “are the columns of linearly independent” — a pure linear-algebra condition, independent of whether Bayesian optimization or CMA-ES is used.
Step three: unidentifiable = has a null-space direction. If there is a nonzero direction with , then moving any distance along that direction does not change the prediction (to first order), the loss surface is flat along it, is singular, and there are infinitely many optima. The physical meaning is “this dataset does not excite that parameter”. Two typical examples:
- Friction coefficient affects the trajectory only when slipping occurs. If the collected trajectory is pure rolling throughout (static friction never saturates), then , that column is approximately all zeros, and no fitting can pin down the friction value;
- Contact stiffness and contact damping can substitute for each other in the torque curve (high stiffness with low damping and low stiffness with high damping give similar peaks and decay), so the two columns are approximately collinear and the smallest eigenvalue of is near zero.
Step four: identifiability is quantified by eigenvalues and the condition number, not as “can/cannot”. Under observation noise , the covariance of the estimation error is
The standard deviation of the -th parameter is . Writing it in eigenvalue form is more intuitive: let the eigenvalues of be ; then the standard deviation in the worst direction (the parameter combination corresponding to ) is . As the standard deviation diverges — this is the quantitative version of “multiple solutions”: it is not that there is no information at all, but that the information is so small that it is drowned by noise. The condition number is a normalized statement of the same thing.
Step five: all three handling routes can be read off this expression.
① Add regularization (ridge regression/Tikhonov, equivalent to giving a Gaussian prior):
Adding makes the matrix positive definite and the solution unique, but the price is that in the direction of the optimum is “pressed toward zero”, i.e. pulled back to the prior — so regularization buys a “stable but biased” estimate.
② Design excitation trajectories: make the smallest eigenvalue of as large as possible. The D-optimality criterion in experimental design maximizes ; concretely, make every joint exercise enough range of amplitude, velocity, and acceleration, and deliberately include several contact events.
③ Give up identification and randomize instead: when is too small and the regularized estimate is no longer trustworthy, treating it as a randomization target is safer than freezing in a wrong value.
Step six: this explains the recommendation in the 6.3 table that “contact-type parameters should mainly be randomized over a narrow range”. Contact events appear sparsely in the data (the contact columns of are nonzero in only a few rows), so the effective rank is low; friction and stiffness are also highly collinear, making the condition number enormous. Together these make the estimate interval for contact parameters so wide that it has no practical value, so the more reliable engineering approach is “identify kinematics and geometry (large , good condition number) + randomize contact parameters + fine-tune with real contact data”.
“Identify first” and “randomize first” are not alternatives; they should be handled separately according to each parameter’s identifiability. The criterion is: is this parameter “excited” sufficiently in the collected data — if the trajectory contains almost no motion segment that reflects it in isolation, the fitted value is non-unique, and fixing it to an “approximate value” then amounts to welding the error into the simulator; conversely, if it can be uniquely determined by the trajectory, randomizing it over a wide range only widens the training distribution unnecessarily and lowers the policy’s performance under real parameters.
| Parameter class | Typical parameters | Recommended treatment | Reason |
|---|---|---|---|
| Kinematics and geometry | Link lengths, camera intrinsics/extrinsics, joint zero offsets, tool frame | Identify first, then fix | Uniquely determined by trajectory fitting; errors translate directly into end-effector positioning error, so they must be accurate |
| Dynamics | Link masses, center-of-mass positions, moments of inertia, motor torque constants | Identify first, or randomize only over a narrow range around the identified value | Depends on whether the excitation trajectory covers enough poses; identified values are trustworthy but still have residual error |
| Contact and friction | Friction coefficients, contact stiffness, contact damping, gripper deformation | Mainly narrow-range randomization | Contact events are sparse in the data and the parameters are non-unique; fitting with torque trajectories often “matches however you tune it” |
| Time-varying and unidentifiable | Wear, cable compliance, torque bias caused by battery voltage, unmodeled transmission backlash | Wide-range randomization + online adaptation | Cannot be measured accurately in advance, and drifts over time and operating conditions |
The standard engineering order is: first collect a dedicated excitation trajectory (make every joint exercise enough range of amplitude, velocity, and acceleration, and include several contact events) → fit the identifiable parameters → inspect the residual: if the residual is concentrated in the contact phase, the problem is the contact model rather than kinematics, so switch the contact parameters to randomization targets → finally, accept the result in an environment with “real parameters, no randomization” (see walkthrough item 4 of 6.2).
- Advantages: once the parameters are accurate, simulation and reality match closely and the transfer loss of the policy is small;
- Disadvantages: contact parameters (friction, stiffness) can almost never be uniquely determined by trajectory fitting (unidentifiable), and the parameters drift with wear;
- Practical combination: first tune the “identifiable parameters” with system identification, then randomize the “unidentifiable parameters” over a narrow range — this is the most commonly used combination in industry.
Which layers to actually touch during real-world fine-tuning. This question is easier to get wrong than “whether to fine-tune at all” — full-parameter fine-tuning on a small dataset erases the generalization learned during pretraining:
- VLA-type models (OpenVLA, π₀, etc.): freeze the visual encoder and most of the language backbone, train only the action head (or action expert) + the last one or two layers, with low-rank adaptation (LoRA) or adapters; consider unfreezing the backbone only after hundreds of hours of data.
- ACT / Diffusion Policy: small models with few parameters, so full-parameter training is usually fine; but if there are only a few dozen real-robot demonstrations, freezing the visual backbone and training only the action decoder is still recommended.
- Residual RL: train only the small network that produces the “correction”, with the base policy completely frozen. This is needed both for sample efficiency and for safety — the base action is unchanged, so the worst case is that the correction fails, not that the whole system goes out of control.
Domain adaptation. Do not touch the dynamics; align only the representation. A typical approach is to add a “domain discriminator” at the feature level so that the encoder’s output cannot distinguish “simulated image” from “real image” (adversarial alignment, similar to the DANN idea); or to pretrain self-supervised on real images and then freeze the encoder.
- Applicable: scenarios with large visual differences and small dynamic differences (e.g. poor rendering quality in simulation but an accurate physical model);
- Risk: adversarial training is unstable, and alignment may also erase “task-relevant information” (for example, aligning away object color).
Real-world fine-tuning. The simplest and most direct approach: take the policy pretrained in simulation onto the real robot and continue training with a small amount of real data.
- If the task is imitation learning: collect 20–50 real-robot demonstrations and fine-tune with ACT/DP (lowest cost, most commonly used);
- If the task is reinforcement learning: real-robot RL is risky and sample-hungry, so practice usually uses “residual RL” — the simulated policy outputs the base action and RL learns only a small correction, greatly reducing exploration risk;
- Key experience: use a small learning rate when fine-tuning and mix in some simulated data, otherwise the generalization learned in simulation is catastrophically forgotten.
6.4 Safety and Evaluation: Real-Robot Deployment Is Not Just About Success Rate
Safety bottom lines (none of them can be skipped):
- Action clipping and torque limits: apply hard limits at the lowest level of the controller (not at the policy level) to prevent abnormal policy outputs from damaging the equipment;
- Watchdog: if inference times out or observations are interrupted, enter a safe stop immediately;
- Speed ramp-up: first validate at 10% speed and gradually raise it to 100%, with manual confirmation at every level;
- Manual emergency stop: the physical emergency-stop button must be at hand and independent of the software emergency stop;
- Workspace limits: use software fences to restrict the end-effector’s range of motion so it cannot hit people;
- First run with no load: run a new policy first in an environment with no objects and no people, and confirm the motions are reasonable.
Evaluation methods (more important than the success-rate number):
- Layered reporting rather than a single total: stratify by “object category / lighting condition / initial position offset / presence of occlusion”, otherwise an average success rate of 80% may hide the disaster of “0% on new objects”;
- Multiple independent trials: at least 20 trials per condition, reporting the success rate and the Wilson confidence interval (Wilson score interval, the interval obtained by inverting the score test; it is more stable than the common normal approximation for small samples)
( is the number of successes and the number of trials. As a contrast, the textbook normal-approximation interval is , but it degenerates to a zero-width point when or — “20 out of 20 successes” does not mean “100% success rate”.)
Derivation: how the Wilson interval is solved, and why $n=20$ cannot separate 70% from 90%
Step one: interval estimation is equivalent to “inverting a hypothesis test”. Let the true success rate be , with successes observed and estimate . Perform a score test for a candidate value (using the variance under the candidate value rather than under the estimate):
If , then is considered consistent with the observation and is kept inside the interval. Hence
Step two: rearrange the inequality into a quadratic inequality in . Expand and move terms:
Step three: solve this quadratic inequality; the two roots are the interval endpoints. By the quadratic formula, the roots are
Simplify the discriminant:
After taking the square root, factor out , and divide numerator and denominator by , obtaining
This is the closed-form solution of the Wilson interval. Its structure can be read directly: the in the numerator pulls the center from toward (shrinking toward the middle for small samples), the denominator compresses the whole interval, and the inside the square root guarantees that the width stays positive when or .
Step four: why the normal approximation fails for small samples. The normal approximation uses the estimate instead of the true to compute the variance. When the estimated variance is , the interval collapses to , which amounts to claiming “the true success rate must be 0” — whereas 20 out of 20 successes precisely suggests the true rate may be very high. Wilson uses the variance under the candidate value and applies center and width corrections, so it still gives a nonzero width at the boundary. The root of the difference is “should the variance be computed from the estimate or from the candidate value”.
Step five: compute the actual width for , . Substituting :
The sum inside the square root is , the square root is about , multiplied by gives ; the denominator is . So the half-width is about and the interval is about — falls inside this interval, so “a true success rate of 90%” and “an observed success rate of 80%” simply cannot be distinguished with 20 trials.
Step six: how many trials are needed to distinguish 70% from 90%.? Estimate the order of magnitude with the half-width of the normal approximation, requiring the half-width not to exceed half of the gap between the two levels ():
That is, each condition needs at least more than 80 trials to separate 70% from 90%. This also explains why paper conclusions of “20 trials, 80% average success rate” often cannot be reproduced: it is not that the policy is unstable, but that the sample size is simply insufficient to support a comparison at that precision.
- Distinguish “failure types”: how much is grasping empty, dropping the object, colliding, timing out, or getting stuck? This directly indicates which layer to fix;
- Do not use MSE instead of success rate: a policy with a small action MSE may be completely unable to complete the task (e.g. it always outputs “stay still”).
7. Panoramic Comparison Table and Selection Decisions
The previous six chapters unfolded in the order “from basic to foundation-model to robustness”, but in real projects selection does not follow that order; it follows constraints: how much data do you have? Do you have a real robot? Do you need it to understand natural language? What control frequency?
7.1 One Master Table
| Algorithm / model | Layer | Main input | Main output | Data scale | Training compute | Inference latency |
|---|---|---|---|---|---|---|
| PPO | Basic layer | State/images | Single-step action | Medium (millions of interaction steps) | One GPU to multiple GPUs | Extremely low (one forward pass) |
| SAC | Basic layer | Continuous state | Single-step continuous action | Medium–high (better sample efficiency than PPO) | One GPU | Extremely low |
| BC (behavior cloning) | Skill layer | Observation | Single-step action | Low (tens to hundreds of demonstrations) | Extremely low | Low |
| ACT | Skill layer | Multi-camera images + joints | Action chunk (k steps) | Low–medium (50–500 demonstrations) | One GPU | Low (~10–30 ms) |
| Diffusion Policy | Skill layer | Observation history | Action chunk | Low–medium | One GPU | Medium (multi-step denoising) |
| RT-2 | Foundation-model layer · semantics | Image + instruction | Discrete action tokens | High (millions of trajectories) | Large-scale | High (autoregressive) |
| OpenVLA | Foundation-model layer · semantics | Image + instruction | Discrete action tokens | High | Large-scale (multiple GPUs) | Medium–high (7B autoregressive) |
| π₀ | Foundation-model layer · action | Image + instruction + joints | Continuous action chunk | Extremely high (multi-embodiment) | Large-scale | Medium (backbone + few integration steps) |
| FAST | Foundation-model layer · semantics | Image + instruction | Frequency-domain compressed tokens | High | Large-scale | Medium |
| Octo | Foundation-model layer · action | Multi-camera + instruction + joints | Action chunk | High (multi-embodiment) | Multiple GPUs | Low–medium |
| GR-2 | Foundation-model layer · semantics | Video + instruction | Action chunk | Extremely high (video pretraining) | Large-scale | Medium |
| HPT | Foundation-model layer · semantics | Multi-embodiment input | Actions per embodiment | Extremely high | Large-scale | Medium |
| RDT-1B | Foundation-model layer · action | Image + instruction + joints | Action chunk (diffusion) | Extremely high (1M+ trajectories) | Large-scale | Medium |
| DreamerV3 | World model | Observation | Policy (trained via imagination) | Low (high sample efficiency) | One GPU | Extremely low |
| TD-MPC2 | World model | Observation | Action (online planning) | Medium | One GPU | High (CEM planning) |
| JEPA | World model | Video/observation | Representation (not actions) | Extremely high (can be unlabeled) | Large-scale | Depends on the downstream component |
Key points for reading the table:
- “Data scale” is the hardest gate. BC/ACT are the only ones that work on “a few dozen demonstrations”; VLA-type models need millions of trajectories, so small teams can almost never train them from scratch and can only fine-tune.
- “Inference latency” determines whether it can go on a real robot. Autoregressive VLA and online MPC can both exceed 50 ms and must be amortized with chunked prediction, action experts, caching, and so on.
- “Training compute” and “data scale” are often both constrained. If neither is sufficient, the pragmatic choice is ACT/DP + a little real-robot fine-tuning; do not start with a VLA.
7.2 Selection Decisions: Ask Yourself in Order of the Problem
Question one: do I have a real robot?
- No, only simulation → go with “simulation RL + domain randomization”, using PPO or SAC as the base; if online planning cost is acceptable, TD-MPC2 converges faster.
- I have a real robot but dare not let it explore on its own → go with imitation learning (ACT / Diffusion Policy).
- I have a real robot and can collect data safely → imitation learning as the main route, plus a little real-world fine-tuning if necessary.
Question two: does the task need to understand natural language?
- No (fixed task, fixed workstation) → do not use a VLA. ACT/DP usually achieve higher success rates, lower latency, and simpler debugging on fixed tasks.
- Yes (switch tasks with one sentence, open vocabulary) → use “fine-tuning an open-source VLA” (OpenVLA / π₀ / Octo) and post-train on your own data.
Question three: how much action precision is required?
- Sub-millimeter, contact-rich (peg insertion, screw driving, pouring water) → continuous action heads (π₀ flow matching / diffusion), not discrete tokens.
- Centimeter-level is enough (transport, coarse placement) → discrete tokens or ACT both suffice.
Question four: how high is the required control frequency?
- > 50 Hz (force control, dynamic balancing) → must be the “one forward pass per policy” route (ACT / π₀ few-step integration / Dreamer policy), ruling out autoregressive models and online MPC.
- < 20 Hz (desktop manipulation, slow grasping) → both autoregressive VLA and MPC are acceptable.
Question five: can the data be scaled up?
- Yes (hundreds of hours or more, multi-embodiment) → take the foundation-model route; pretraining is worth the investment.
- No → take “a specialized policy + strong inductive bias” and spend data on “task diversity” rather than “quantity”.
A common wrong path is: having only 100 demonstrations but fine-tuning a 7B VLA directly, ending up overfitting to the backgrounds and object positions of those 100 trajectories, with worse generalization than a 60M-parameter ACT. Model scale should match data scale.
7.3 Combined Use: Real Projects Rarely Use Only One Method
A real engineering solution is usually a “multi-layer assembly”:
High level (slow, 1–5 Hz): VLA or LLM planner → outputs subtask / target pose
Middle level (medium, 10–20 Hz): ACT / diffusion policy → outputs action chunks
Low level (fast, 100–1000 Hz): joint servo / impedance control → outputs torques
- Benefit of layering: each layer only solves the problem at its own frequency; if the high level is wrong, the low level can still guarantee safety.
- Cost of layering: complex interface design, and errors propagate between levels.
- Practical advice: first validate feasibility with a “single-layer end-to-end” setup, then split the layers. Splitting layers is usually for interpretability and safety, not for performance.
8. Five-Stage Learning Path
Below is an executable path; each stage gives “goal / minimal experiment / acceptance criteria / common pitfalls”. Do not skip stages: the parts you skip come back later in the form of “it does not work and I do not know why”.
Stage 0: Prerequisites
- Goal: be able to run a Gymnasium environment independently, read formulas in papers, and write a two-layer network by hand.
- Minimal experiment: write a CartPole REINFORCE implementation in PyTorch by hand, without any RL library.
- Acceptance criteria: can explain “why REINFORCE needs a baseline”; can implement it from scratch and plot the learning curve.
- Common pitfalls: diving straight into the PPO source code without understanding “where the variance of the policy-gradient estimate comes from”.
Stage 1: Reinforcement Learning Basics (PPO / SAC)
- Goal: understand MDP, Bellman equations, policy gradient, GAE, entropy regularization; be able to tune stable curves on continuous control tasks.
- Minimal experiment: MuJoCo’s
HalfCheetah-v4andAnt-v4, trained with PPO and SAC respectively, with 3 random seeds each. - Acceptance criteria:
- PPO reaches more than 80% of the reference implementation’s return on HalfCheetah;
- can plot “mean ± standard deviation over 3 seeds” curves rather than a single line;
- can explain “why SAC has higher sample efficiency than PPO, but PPO is faster in wall-clock time under parallel sampling”.
- Common pitfalls:
- forgetting observation normalization (RunningMeanStd), causing unstable training;
- mixing up GAE’s and ;
- judging algorithms by “single-seed” conclusions (the variance is huge and easily leads to wrong conclusions).
Stage 2: Imitation Learning (ACT / Diffusion Policy)
- Goal: understand the compounding error of behavior cloning, action chunking, temporal ensembling, and action generation by diffusion/flow matching.
- Minimal experiment: train ACT on public datasets (e.g. ALOHA’s insertion tasks, RoboMimic’s Lift/Can), then train Diffusion Policy, and compare.
- Acceptance criteria:
- ACT’s success rate on fixed tasks > 60% (depending on task difficulty);
- can explain “why action chunking is needed” and “how to choose the exponential weights of temporal ensembling”;
- can reproduce the phenomenon that “when the demonstrations are multimodal, the regression head fails and the diffusion head succeeds” (multimodal data can be constructed artificially).
- Common pitfalls:
- splitting different time segments of the same trajectory into the training/validation sets during data splitting (data leakage, giving an inflated validation success rate);
- image preprocessing inconsistent between training and inference (RGB in training, BGR at deployment);
- evaluating the policy with MSE instead of closed-loop success rate.
Stage 3: VLA (Fine-Tuning Open-Source Models)
- Goal: understand the two routes of “actions as tokens” and “continuous action heads”, and be able to fine-tune an open-source VLA.
- Minimal experiment: use the open weights of OpenVLA or π₀ and do LoRA fine-tuning on 50–200 self-collected real-robot (or simulated) demonstrations, evaluating instruction following and generalization.
- Acceptance criteria:
- after fine-tuning, the success rate “within the training distribution” is not lower than an ACT trained on the same amount of data;
- clearly better than ACT on “new objects / new instruction combinations” (this is what a VLA is for);
- can clearly explain the physical reasons for “why it generalizes better” and “why it is slower”.
- Common pitfalls:
- fine-tuning only the action head and freezing all of the vision, so the model cannot adapt to a new camera viewpoint;
- too large a learning rate causing catastrophic forgetting (the model forgets how to follow instructions);
- instruction texts in the data are too monotonous, so the model learns a “fixed action” and the generalization evaluation is distorted.
Stage 4: World Models (DreamerV3 / TD-MPC2)
- Goal: understand latent-space models, imagination training, and online planning; be able to connect a world model with policy learning.
- Minimal experiment: run DreamerV3 on 3–5 tasks (including sparse-reward tasks) in the DeepMind Control suite, then run TD-MPC2 on the same tasks and compare sample efficiency.
- Acceptance criteria:
- reach more than 70% of the reference performance within 100k environment steps;
- can explain “why KL balancing lets one set of hyperparameters work across tasks”;
- can plot the trade-off curve of “imagination horizon versus final performance”.
- Common pitfalls:
- gradients from imagined trajectories backpropagating into the world model (contaminating model training);
- too few CEM samples, so planning degenerates into randomness;
- using pixel reconstruction error as the only metric while ignoring “whether decision-relevant information is retained”.
Stage 5: Real Robots and Sim-to-Real
- Goal: deploy any of the above methods on a real robot and handle latency, calibration, safety, and evaluation.
- Minimal experiment: a “pick-and-place” task: simulated pretraining (domain randomization) → zero-shot real-robot test → fine-tuning on 20 real-robot demonstrations → test again.
- Acceptance criteria:
- the gap between simulation success rate and real-robot success rate is quantifiable (e.g. 90% in simulation, 40% zero-shot on the real robot, 75% after fine-tuning);
- ≥ 20 trials per condition, reporting confidence intervals and the distribution of failure types;
- the whole pipeline has an emergency stop and clipping, and has passed low-speed validation.
- Common pitfalls:
- inconsistent control frequency between simulation and the real robot (50 Hz in simulation, 10 Hz on the real robot), so the policy immediately collapses;
- camera calibration error causing a 2 cm difference between “the position you see” and “the actual position”, so it grasps empty;
- forgetting to model actuator latency, causing oscillation on the real robot.
Trade-Off Advice for the Learning Path
- Only want to do research and publish papers: stages 1 → 2 → 4 are the main line (RL + imitation + world models), with VLA as a comparison baseline.
- Want to build a product prototype: stages 2 → 3 → 5 are the main line (imitation + VLA fine-tuning + real robot), with RL used only locally (e.g. low-level control).
- Want to do algorithm research (new methods): stage 1 must be solid (otherwise you cannot judge “what is good about a new method”); the rest can be chosen according to your direction.
Hardware and Budget: Zero-Yuan Simulation, Thousand-Yuan Robot Arms, and the Truth About the “50-Yuan Robot Dog”
The five-stage path only covered “what to learn”; it did not cover “how much it costs”. This section adds the budget dimension, because most people get stuck at their first purchase: either they are misled by the marketing claim “you can build a robot for a few dozen yuan” and find that what arrives cannot run any learning algorithm, or they buy a complete machine from the start, spend the money, and do not know how to use it.
1. Split Into Tiers First: Different Things to Validate Require Different Hardware
| Tier | Typical spend (RMB, as of the 2026-11 search) | What it can validate | What it cannot validate |
|---|---|---|---|
| A. Pure simulation | 0 yuan marginal cost (assuming a discrete GPU is already available) | Control policies, imitation learning, world models, the Sim-to-Real pipeline | Real dynamics, sensor noise, actuator latency, calibration error |
| B. Desktop-level real robot | 1,000–1,500 yuan (single arm + camera + own computer) | Data collection, ACT/diffusion policy training, real-robot closed-loop success rate | Dual-arm coordination, mobile manipulation, on-device inference of large models |
| C. Onboard compute | 2,500–4,500 yuan (adding a development kit to B) | Offline inference without a computer, latency and power measurement | Large-scale parallel training, multi-camera high frame rates |
| D. Dual-arm mobile | 4,000–6,500 yuan | Dual-arm coordination, mobile grasping, long-horizon tasks | Industrial-grade precision, high payloads |
| E. Research/general-purpose base | 30,000 yuan to 100,000 yuan and above | High-precision force control, humanoid whole-body control, large-scale VLA fine-tuning | Low-cost reproduction (this step does not fit a personal budget) |
The key to this table is that every tier has an explicit “cannot validate”. Many discussions either carry conclusions from tier A straight over to tier E, or use tier E prices to deny the feasibility of tier A — both mismatch “validation goal” and “hardware tier”.
2. Hardware Price Table (Search Snapshot of 2026-11-10)
Prices are listed separately as “parts delivered price” and “kit price”. The price of the same model often differs by 30%–50% across channels; the numbers below are only for judging order of magnitude and budget allocation and must be re-verified before purchase.
| Category | Model | Reference price | Basis and notes |
|---|---|---|---|
| Bus servo (with position feedback) | Feetech STS3215 (magnetic encoder, TTL serial bus, 30 kg·cm class) | 53–99 yuan/unit | Taobao parts from 53 yuan; another seller at 64 yuan and 99 yuan; 1688 bulk is lower |
| Analog servo (no position feedback) | SG90 / MG90S | 4–6 yuan / 8–15 yuan | SG90 has plastic gears; MG90S has metal gears and costs about 1 USD more |
| Desktop robot-arm kit | SO-ARM100 / SO-101 (one leader and one follower, including 6–7 STS3215, driver board, power supply) | 950–2,168 yuan/kit | 1688 one-piece starting price; US retail 199–299 USD (excluding shipping and tax) |
| Dual-arm mobile platform (parts) | XLeRobot Basic (using your own laptop + a single RGB head camera) | About 3,999 yuan | Official bill of materials with regional quotes: about 660 USD in the US, about 680 EUR in Europe, about 3,999 yuan in China |
| Dual-arm mobile platform (with onboard compute) | XLeRobot + edge computer | Within 1,300 USD | Upper bound of the complete-machine cost reported in the academic paper |
| Robot development kit (high compute) | RDK S100 (80 TOPS) | 2,799 yuan (launch price 2,499 yuan) | Official pricing; third-party retail 3,499 yuan; S100P (128 TOPS) 5,999 yuan |
| Edge AI development kit | NVIDIA Jetson Orin Nano Super (8 GB) | 249 USD / suggested retail 2,070 yuan | Official page price; domestic channels are often above the suggested price |
| Desktop six-axis arm | myCobot 280 (Arduino / M5 / Raspberry Pi versions) | 599–799 USD (commonly just over 3,000 yuan in China) | Official store price; domestic channel prices differ from the official price |
| Open-source quadruped (with Raspberry Pi) | Hiwonder PuppyPi (Raspberry Pi 5, 4 GB) | 589.99 USD; 2,999–4,100 yuan in China | Official price; Taobao kit price |
| Open-source quadruped (low-price tier) | MechDog and other fully open-source quadrupeds | About 1,699 yuan | Taobao price, usually excluding extra compute and a depth camera |
| Depth camera | Intel RealSense D435i | 2,380–2,899 yuan | Taobao/1688 parts; D435 (no IMU) 2,122–2,320 yuan |
| Complete humanoid | Unitree G1 | From 99,000 yuan (cut to about 85,000 yuan in 2026); 13,500 USD in the US | Official and media reports; deployment and service bring the landed cost to about 100,000–200,000 yuan |
Three “hidden costs” to catch when reading this table:
- Cameras and compute are usually not included in the “robot-arm kit”. The 950–1,100 yuan SO-101 kit is just the arm body; the computer for training and the camera for deployment are extra.
- Batteries, power supplies, shipping, tax, and tools (screwdrivers, hex keys, zip ties, spare servos) are usually omitted from the advertised price and actually add 10%–25%.
- Structural parts come in “with 3D-printed parts” and “print it yourself”. Printing it yourself requires a printer (thousand-yuan class) and filament, priced by gram; hiring someone to print is priced by part and is often 3–5 times more expensive than the filament.
3. Is the “50-Yuan Material Cost” Credible?
An entry-level plan circulated in Chinese-language communities in November 2026 (original share link) has a reliable path section (simulation first, then a robot arm, then Sim2Real), but one sentence — “the material cost of a desktop-level quadruped robot dog is only about 50 yuan” — lost its qualifications when it was widely forwarded. Breaking it down item by item at real parts prices:
| Component | Quantity | Unit price (lowest parts price, 2026-11) | Subtotal |
|---|---|---|---|
| ESP8266 main controller (NodeMCU-type development board) | 1 | 10–15 yuan | 10–15 yuan |
| 16-channel servo driver board (PCA9685) | 1 | 8–15 yuan | 8–15 yuan |
| SG90 analog servo (quadruped × 2 joints) | 8 | 4–6 yuan | 32–48 yuan |
| 18650 lithium battery × 2 + battery holder | 1 set | 20–35 yuan | 20–35 yuan |
| 3D-printed structural parts (about 80–120 g of PLA) | 1 set | 5–12 yuan (filament) | 5–12 yuan |
| Dupont wires, screws, brass standoffs | some | 5–10 yuan | 5–10 yuan |
| Offline voice module (optional) | 1 | 10–20 yuan | 10–20 yuan |
| Total (excluding battery and shipping, with own printer) | 65–110 yuan | ||
| Total (including battery, with own printer) | 85–145 yuan | ||
| Total (including battery, paid printing of structural parts, including shipping) | 120–230 yuan |
The conclusion has three layers:
- As a “extreme material-cost basis of accounting”, 50 yuan barely holds. Similar open-source projects also claim “about 30 yuan excluding the battery” (plug-in versions of robot dogs with 12-yuan servos, a 4.5-yuan screen, and a 4-yuan main controller); the basis is the same: lowest channel prices, excluding the battery, excluding shipping, excluding printing amortization, excluding tools and spare parts. Add the battery and shipping back and it is already 85–145 yuan.
- As “the practical cost of embodied AI”, 50 yuan does not hold. This machine can only run fixed action sequences, fixed expressions, and fixed voice phrases. The reasons are hard constraints: the SG90 is an open-loop PWM servo with no position feedback, poor repeatability, and easy burnout when stalled; the ESP8266 has no neural-network accelerator and only a few MB of memory, so it cannot run any vision network; the platform has no camera, so it cannot collect paired “vision–action” data. Without data and without repeatable actuators, none of the four algorithm layers (reinforcement learning, imitation learning, VLA, world models) can be validated.
- To cross from 50 yuan to “capable of learning”, the minimum threshold is about 1,000–1,500 yuan. The difference is not “inflated marketing” but four indispensable items: bus servos with position feedback (STS3215 × 6, about 318–594 yuan), a camera (100–300 yuan), structural parts and power (100–300 yuan), and compute (0 marginal cost with your own computer, or about 2,070 yuan for a Jetson Orin Nano Super). This matches the realistic transaction price of the SO-101 kit (950–1,100 yuan).
4. Item-by-Item Verdicts: What in That Plan Is Credible and What Needs Correction
| Original claim | Verdict | Basis and correction |
|---|---|---|
| No hardware needed to start; simulation runs the core algorithms at zero cost | Credible | “Zero cost” means marginal cost; the premise is an existing discrete GPU with 6 GB or more of VRAM. If a new one must be bought, it is actually a 2,000–3,000 yuan GPU expense |
| 6 GB of VRAM or more is enough | Needs correction (too low) | 6–8 GB works for small-batch ACT and diffusion-policy training; VLA LoRA fine-tuning is recommended at 12–16 GB, full-parameter fine-tuning at 24 GB or more; also consider how image resolution and action-chunk length amplify VRAM use |
| MuJoCo/PyBullet for getting started → Isaac Sim/Isaac Gym for scale → Habitat for visual navigation | Credible | The division of labor among the three tools matches the community situation; the Isaac family has hard requirements on NVIDIA GPUs and driver versions |
| Prefer robot arms for manipulation tasks; robot dogs only supplement legged control | Credible | Public datasets, pretrained models, and evaluation protocols for grasping tasks are all concentrated on the robot-arm side; public manipulation data for quadrupeds is extremely scarce |
| Sim2Real follows “simulated pretraining → parameter identification → domain randomization → real-robot fine-tuning” | Credible | Consistent with the four-step flow in Chapter 6; parameter identification requires extra calibration fixtures and measurements, which are hidden costs |
| A complete XLeRobot build costs less than 1,000 USD (about 4,000 yuan) | Credible | Official bill of materials: about 660 USD in the US, about 3,999 yuan in China; but that price excludes the laptop for training and excludes camera and compute upgrades |
| The RDK S100 + LeRobot dual-arm solution costs within 5,000 yuan | Basically credible, but very tight | S100 kit 2,799 yuan + dual-arm kit 950–1,100 yuan + camera 100–300 yuan + power and structure 200–400 yuan, totaling about 4,000–4,600 yuan; adding shipping, tools, and spare servos pushes it close to the limit |
| myCobot 280 costs about 3,000 yuan | Basically credible | The common domestic channel price is indeed just over 3,000 yuan; the official store price is 599–799 USD |
| A full-stack open-source quadruped costs about 1,500 yuan in hardware | Basically credible | Comparable open-source quadrupeds (e.g. MechDog) cost about 1,699 yuan; but usually excluding a depth camera and extra compute |
| A desktop quadruped costs about 50 yuan in materials | A matter of accounting basis (see the previous section) | It holds under the extreme material-cost basis; it does not hold as “the entry cost of embodied AI”, and the battery, shipping, and printing amortization must be added |
In one sentence: the “path” in this plan is right, but the “prices” must be read with their basis of accounting. The path is highly credible (simulation first, robot arms first, four-step Sim2Real), while the credibility of the prices depends on whether it states clearly “with or without battery, camera, compute, shipping, and printing”.
5. Four Configurations That Can Be Implemented Directly According to Budget
| Budget | Configuration | First acceptance goal |
|---|---|---|
| 0–300 yuan | MuJoCo + Gymnasium + LeRobot simulation environment, loading the SO-101 model | Train ACT with scripted demonstrations; simulation success rate > 60%; able to plot three-seed curves |
| 1,000–1,500 yuan | SO-101 leader-follower kit (950–1,100 yuan) + USB camera (100–300 yuan) + your own computer | Collect 50–100 real-robot demonstrations; ACT success rate within the training distribution > 60% |
| 2,500–4,500 yuan | The previous tier + Jetson Orin Nano Super (about 2,070 yuan) or RDK S100 (2,799 yuan) | Run inference without a computer; measure end-to-end latency and power; align the success rate with the computer-side result |
| 4,000–6,500 yuan | XLeRobot parts (about 3,999 yuan) + camera/compute | Dual-arm coordinated grasping; long-horizon tasks combining a mobile base and an arm |
The research tier (myCobot 280 / RealSense D435i / workstation) and the general-purpose base (Unitree G1, from 85,000 yuan) should only be considered when high-precision force control, humanoid whole-body control, or large-scale VLA fine-tuning is needed; for individuals in the learning stage, spending money on these two tiers has far lower marginal benefit than getting the first four tiers working.
6. Six Must-Ask Questions Before Buying
- Does the actuator have position feedback? Bus servos (such as the STS3215) have magnetic encoders and readback, so action trajectories can be recorded and stalls detected; PWM servos (SG90) do not, so there is no ground truth for “whether the action was executed”.
- What are the control frequency and the communication method? Bus servos commonly use 1 Mbps with a control frequency on the order of 1 kHz; PWM servos are on the order of 50 Hz. A difference of one order of magnitude in frequency means a completely different time scale for the policy.
- Is the listed price a material price or a landed price? Does it include the battery, power supply, shipping, tax, spare servos, and tools?
- Do the structural parts include printing? “With printed parts” means usable on arrival; “print it yourself” means adding a printer and leveling time.
- Are the camera and compute included? Can the camera’s resolution, frame rate, and exposure be locked (automatic exposure jumping will make the policy treat “brightness changes” as “object motion”)?
- Is there a complete bill of materials and assembly documentation, and is there any third-party reproduction record? Projects with only rendered images and no bill of materials usually have severely underestimated real costs.
7. The Real Big Cost Is Often Data, Not Hardware
A 30–60 second teleoperation demonstration takes about 2–4 minutes to collect and organize; 100 demonstrations mean 4–7 hours of pure human labor, not counting re-collection of failures, annotation, and cleaning. At this scale, the labor time cost often exceeds the 1,000–1,500 yuan hardware investment. This also explains why the correct order is “get the pipeline working in simulation first, then collect the minimum necessary data on the real robot” — buying hardware first and then fumbling with the pipeline wastes the most expensive part of the budget.
Price note: all numbers above are public-channel search snapshots as of 2026-11-10 (1688, Taobao, official stores, and official documentation), excluding shipping and tax, and ignoring bulk discounts. Prices of electronic components and kits fluctuate greatly; before ordering, rely on the page price at that time. The prices cited in this article are only for judging order of magnitude and allocating budget, not as a quotation basis.
Main sources (search date 2026-11-10):
- SO-ARM100/LeRobot robot-arm kit (1688)
- XLeRobot bill of materials (official documentation, with regional quotes)
- Cutting the Cord: the complete-machine cost of XLeRobot with onboard compute (paper)
- RDK S100 robot development kit (DFRobot retail page)
- D-Robotics RDK S100 launch and pricing (EET-China)
- NVIDIA Jetson Orin Nano Super developer kit (official page)
- Jetson Orin Nano Super suggested retail price 2,070 yuan (NVIDIA China blog)
- Hiwonder PuppyPi (official product page)
- Intel RealSense D435i parts price (Taobao)
- myCobot 280 (official store)
- Unitree G1 (official store)
- Unitree G1 price cut to 85,000 yuan (Sina Finance, 2026-10)
- Cost breakdown of the MindPaw “50-yuan” quadruped (CSDN)
- LCEDA (Lichuang) open-source hardware: an ESP8266 robot dog at about 30 yuan excluding the battery
- Hackster: an open-source quadruped at the 50-USD level
- Berkeley Humanoid Lite: complete-machine hardware cost within 5,000 USD (paper)
9. Engineering Pitfalls and Common Misconceptions
This section is the “list of pitfalls we have stepped into”. They do not appear in papers, but they can waste two weeks of your experiments.
9.1 Data Handling
- Data leakage. Cutting the same trajectory into multiple windows and then randomly splitting them into training/validation sets. The correct approach is to split by trajectory (all windows of the same trajectory must be in the same set).
- Loss of normalization statistics. Normalizing observations with the training set’s mean and variance during training, then forgetting to save those two numbers at deployment, or re-computing them on the validation set. Normalization parameters must be saved together with the model.
- Inconsistent action spaces. Training with “joint position increments” and deploying with “end-effector pose increments”; or training with “absolute positions” and deploying with “increments”. This class of error shows up as “the policy is great in simulation and flails on the real robot”.
- Inconsistent image preprocessing. Bilinear resize in training and nearest-neighbor at deployment; BGR in training and RGB at deployment; normalization to [0,1] in training and to [-1,1] at deployment. Preprocessing code must share a single implementation.
- Time-alignment errors. The timestamps of images, joint states, and actions are not aligned, so that “the picture you see is 30 ms later than the action”. This is fatal in high-speed tasks.
9.2 Training
- Confusing termination with truncation (a classic RL pitfall). See the derivation block below — this is the most common bug in PPO implementations and causes a systematic bias in the value function.
- BatchNorm fails in RL. The distribution of data in the replay buffer changes with the policy, so BatchNorm’s running statistics become distorted; and inconsistency between training and inference modes makes deployment behavior drift. Prefer LayerNorm or no normalization layer in RL.
- Learning rate not scaled with batch size. Changing the batch from 256 to 2048 without adjusting the learning rate makes convergence slower or divergent.
- Replay buffer too large, causing the “policy to lag behind”. If the buffer is too large, most samples come from old policies, the off-policy correction is insufficient, and the learning signal weakens.
- Single-seed conclusions. RL has enormous seed variance (for the same algorithm and task, returns can differ by a factor of 2). Use at least 3 seeds and report the mean and standard deviation.
- Using training-mode randomization during evaluation. Evaluation should be done under “fixed real parameters”, otherwise the numbers are meaningless.
Derivation: why “time-limit truncation” must bootstrap, while “true termination” must not
Background. An episode may end for two reasons: the environment reaches a terminal state (e.g. falling over, success), or the time limit is reached (e.g. 500 steps). Both appear as done = True in the data, but their semantics are completely different.
General form of the TD target.
where is the indicator of “whether it truly terminated” (1 means terminated).
Case one: true termination. After termination there is no future return, is meaningless, so and the target is simply . If truncation is mistakenly treated as termination, the true return is underestimated (the future reward of “it could actually continue” is discarded).
Case two: time-limit truncation. The episode is forcibly interrupted, but the environment itself has not terminated; is still valid and future returns still exist. Here we should bootstrap ():
If truncation is mistakenly treated as termination (), the value function learns “value drops sharply near the time limit”, producing a spurious value cliff. The policy then learns to “slack off when time is nearly up”, a behavior that is meaningless in real deployment.
Why many people make this mistake. Because early versions of Gymnasium returned only a single done boolean and did not distinguish terminated from truncated; many open-source implementations directly treat done as termination. Newer versions split it into two fields, and implementations must handle them separately:
# Correct form
y = r + gamma * (1.0 - terminated) * V_next # Note: use only terminated, not truncated
The cost of this bug. On tasks with a time limit (the default upper limit of 1000 steps in most Gym environments), the value function develops a systematic bias, showing up as “a sawtooth return curve in late training and abnormal policy behavior in the last few hundred steps”. It is hidden, because the curve looks like “just instability”.
A one-sentence criterion. Ask yourself: “after this step, can the environment continue?” If it can → bootstrap; if it cannot → do not bootstrap.
9.3 Deployment
- Control frequency mismatch. Training at 20 Hz and deploying at 10 Hz means the “action magnitude per step” the policy learned becomes doubled on the real robot, causing overshoot directly.
- Latency not compensated. A 40 ms visual latency is equivalent to “driving blind for 40 ms” in highly dynamic tasks. Countermeasure: model latency explicitly, or extrapolate with state estimation.
- Missing action smoothing. Jumps at the boundary of adjacent action chunks cause mechanical jitter and wear. Countermeasure: temporal ensembling (ACT’s exponential weighting) or low-pass filtering (note that filtering introduces phase lag).
- Safety clipping placed at the policy level. When the policy output is abnormal, if the clipping is inside the policy (e.g. using
tanh), a faulty model can still output dangerous actions. Clipping must be at the lowest level of the controller. - No failure-recovery mechanism. After the real robot gets stuck it needs manual intervention, but there is no “detect stuck → automatically return to the safe pose” logic, so someone has to run over every time it fails.
9.4 Cognitive Misconceptions
- “Success in simulation = success on the real robot.” They are separated by the six gaps in Chapter 6 and must be measured empirically.
- “More parameters are always better.” Training a 7B model on 100 demonstrations usually generalizes worse than a 60M ACT. Capacity must match data.
- “An 80% success rate is enough.” For industrial scenarios, a 20% failure rate means manual intervention every 5 attempts; you also need to check whether the failure types are recoverable.
- “Adding randomization is enough for sim2real.” If the simulator’s contact model is itself wrong, randomization is only shaking a wrong model.
- “Imitation learning does not need a reward, so it is simple.” It moves the difficulty from “designing a reward” to “collecting high-quality demonstrations + handling distribution shift”; it does not disappear.
10. Open Problems and Trends (as of 2026)
This section is not “predicting the future”; it lists problems that remain unsolved and that directly affect engineering decisions.
① Long horizon and memory. Most existing methods work on tasks lasting “seconds to tens of seconds”. Tasks lasting minutes to hours require hierarchy (high-level planning + low-level execution) and long-term memory, while current VLA context windows are limited and world-model errors compound. This is the gap between “a household robot” and “a single-workstation operator”.
② Unified action space. Different robots (single arm, dual arm, humanoid, dexterous hand) have completely different action dimensions and semantics. Work such as RDT-1B uses “end-effector pose + gripper” as a unified projection, but this loses joint-level information; how to design an action representation that is “both general and lossless in precision” remains undecided.
③ Touch and force control. Vision-language-action models are almost all “seeing” models, lacking tactile and torque feedback. Yet the core information for tasks like insertion, tightening, and unscrewing caps lives in the force/tactile channel. A VLA with touch is an obvious research gap.
④ The cost of data scaling. Text and images can be crawled, but robot data must be physically collected. Teleoperation, simulation synthesis, and video-to-action are the three main paths, but none has resolved the contradiction between “data diversity and cost”.
⑤ Lack of evaluation standards. At present each lab uses its own robot, its own tasks, and its own success criteria, so results cannot be compared across labs. Simulation benchmarks (such as RoboMimic, LIBERO, CALVIN) alleviate part of this, but “evaluation of simulation-to-real transfer” still has no standard. This directly leads to “great numbers in papers, hard to reproduce”.
⑥ The credibility of world models. “Model exploitation” caused by compounding model error (the policy exploits model errors) is an inherent difficulty. How to quantify “in which states the model is trustworthy” and make the policy avoid untrustworthy regions is the core difficulty of current world-model research.
⑦ Inference latency and edge deployment. A 7B model cannot easily reach 50 Hz on edge devices. Quantization, distillation, separating the action expert, and chunked prediction all mitigate this, but the fundamental contradiction of “large model + high-frequency control” remains unsolved.
⑧ Safety and verifiability. Neural-network policies have no formal guarantees. Industrial deployment requires engineering measures such as “bounded error” and “detectable failure”, to which academia pays insufficient attention.
⑨ From “action cloning” to “task understanding”. Current VLAs mostly imitate “the action sequences that appear in the demonstrations” and lack explicit modeling of task goals and causal relations. Whether a model can “understand why this should be done” instead of “remember how it was done” is the key to generalizing to entirely new tasks.
⑩ Architectural unification of multimodal fusion. Vision, language, action, touch, and audio currently each have their own encoder, and fusion is mostly “concatenation + attention”. Whether a more fundamental unified representation exists remains an open question.
Advice for readers. If your goal is to build a product, focus on ①②③⑤⑧ (they determine whether it can ship); if your goal is to do research, ④⑥⑨⑩ are currently the most promising directions.
11. Summary: The Fundamental Differences Between Methods and Their Applicability Boundaries
The previous seven chapters unfolded in the order “basic layer → skill layer → foundation-model layer → world models → robustness layer”, and Chapter 7 gave selection questions from engineering constraints (data volume, whether a real robot exists, frequency, whether language is needed). This chapter takes a different angle: ignore which layer a method belongs to, and look at what trade-off it makes at the mechanism level. After reading it you should be able to answer one question — when someone recommends a new model, you can tell which class it belongs to, where its cost lies, and under what conditions you should not use it.
11.1 One Table to See the Mechanism Differences
The master table in Chapter 7 answers “how much data, compute, and latency”; this table answers “what it learns from, what it relies on for generalization, and when there is no substitute for it”.
| Method | Learning signal | Where the data comes from | How the policy is represented | What generalization relies on | Fatal weakness | Scenarios with no substitute |
|---|---|---|---|---|---|---|
| Behavior cloning (BC) | Supervised loss (action regression or negative log-likelihood) | Human demonstrations | Single-step action | The state distribution covered by the demonstrations | Compounding error (covariate shift); error accumulates with steps | Very few demonstrations, fixed task, extremely latency-sensitive |
| ACT | Action-chunk regression (L1/MSE, optionally CVAE) | Human demonstrations (50–500) | -step chunk per forward pass + temporal ensembling | Intra-chunk consistency and demonstration diversity | Chunk-boundary jitter, long-horizon error accumulation | Dozens of demonstrations + desktop manipulation at 10–50 Hz |
| Diffusion Policy (DP) | Denoising loss (predicting noise or the velocity field) | Human demonstrations | Multi-step denoising to generate action chunks | Multimodal expression of the generative distribution | Multiple forward passes at inference, high latency | The same observation corresponds to several reasonable actions (multimodal tasks) |
| RT-2 | Next-token cross-entropy | Internet vision-language data + robot trajectories | Discrete action tokens, autoregressive | Semantic grounding from vision-language pretraining | Actions are discretized, precision is limited; autoregressive latency is high | Task switching that needs open vocabulary and semantic generalization |
| OpenVLA | Same as RT-2 (7B scale) | Same as above, at larger scale | Discrete tokens, autoregressive | Large-scale vision-language pretraining | Many parameters, hard to deploy on edge devices | An open-source, fine-tunable general semantic base |
| FAST | Token cross-entropy after frequency-domain compression | High-frequency action sequences | Frequency-domain tokens, autoregressive decoding | Sequence efficiency after compression | Still autoregressive; latency not fundamentally solved | Tokenization of high-frequency, long-sequence actions |
| π₀ | Flow-matching velocity-field regression | Large-scale multi-embodiment trajectories | Continuous action chunks, few-step integration | Vision-language backbone semantics + multi-embodiment data | Extremely high data and compute thresholds | Needs semantic generalization + continuous high-precision actions |
| Octo | Diffusion or regression action head | Multi-embodiment dataset (Open X-Embodiment) | Action chunks | Breadth of multi-embodiment data, realized through fine-tuning | Small capacity, limited zero-shot ability | Wants a lightweight open-source baseline for fast fine-tuning |
| GR-2 | Video prediction + action generation | Video pretraining + robot data | Action chunks | Physical and motion priors in video | The gap between the video domain and the robot domain | Wants to transfer motion skills from human video |
| HPT | Multi-embodiment action prediction | Heterogeneous multi-embodiment data | Per-embodiment actions (shared trunk + embodiment head) | Shared representation + embodiment-specific output | Complex embodiment-head design, sensitive data mixing | One trunk serving multiple robot morphologies |
| RDT-1B | Diffusion action head | Million-level dual-arm trajectories | Continuous action chunks | Large-scale dual-arm data + unified action space | The task domain is concentrated on dual arms, narrow generalization boundary | Dual-arm manipulation that needs a large-scale pretraining starting point |
| PPO | Clipped surrogate objective + GAE | Autonomous interaction with a simulator | Single-step action (stochastic policy) | Reward-driven trial and error, not limited by demonstrations | Large sample demand, hard reward design, risky real-robot exploration | Simulation with massive parallelism, rewards that can be computed automatically |
| SAC | Maximum-entropy objective + double Q | Simulation, or real interaction under safe conditions | Single-step continuous action | Entropy-driven exploration + off-policy data reuse | The entropy coefficient needs tuning, risk of Critic overestimation | Expensive interaction samples, need for robust exploration |
| DreamerV3 | Latent imagination + λ-return | Simulation interaction | A policy trained in latent space | Cheap “imagined” samples provided by the world model | Compounding model error, long-horizon prediction distortion | Sample efficiency first, interaction extremely expensive |
| TD-MPC2 | Latent-space planning (CEM) + temporal difference | Simulation interaction | Action sequences produced by online planning | The learned latent dynamics | Planning at every decision, high latency | Short horizon, tasks that need online replanning |
| JEPA | Prediction in representation space (no action output) | Video or observations, possibly unlabeled | Produces no actions, only representations | Large-scale unlabeled video | Cannot close the loop directly; must attach a planner or policy | Pretrained representations for downstream use |
| Domain randomization / system identification | No extra learning signal (change environment parameters or identify them) | Simulation + a small amount of real data | Does not change the policy structure | The training distribution covering the real distribution | The randomization range is hard to set; real friction and latency may not be coverable | The mandatory step before a simulated policy goes onto a real robot |
Key points for reading the table:
- The “learning signal” column distinguishes the three paradigms. Supervised losses (BC, ACT, DP, all VLAs) only need demonstrations; reward signals (PPO, SAC, DreamerV3, TD-MPC2) need a reward that can be computed automatically; representation prediction (JEPA) does not even need actions. When you meet a new method, first look at what signal it consumes — this decides whether you can use it.
- “How the policy is represented” determines latency and precision. A single forward pass is fastest; action chunks amortize steps over one forward pass; generative approaches (diffusion, flow matching) can express multimodality but need multiple forward passes; autoregressive tokens have the highest latency. The stronger the precision and multimodal capability, the higher the latency usually is — this is the root of the triangle in 11.6.
- “What generalization relies on” determines how much data you need. Relying on pretrained semantics (RT-2, OpenVLA, π₀) requires massive data; relying on inductive bias (ACT’s chunk structure, DP’s generative prior) works with dozens of demonstrations; relying on reward-driven trial and error (PPO) requires a parallelizable high-fidelity simulator. Model capacity must match data scale — the number-one mismatch already emphasized in 7.2 and emphasized again here.
11.1.1 Cross-Method Quick Reference: The Quantities That “Must Stay Outside the Gradient” in Every Algorithm
Each algorithm above has its own detach (gradient truncation) or sg (stop-gradient) checklist. Putting them side by side shows that all cases fall into only three classes, and this table can be used directly as a troubleshooting manual:
| Method | Quantities that must be detached / sg | Category | Typical symptom if not done |
|---|---|---|---|
| PPO | logp_old, v_old, Adv, Ret | Old values | The probability ratio is distorted, the value chases a moving target |
| SAC | The TD target (including and ), the logp in the temperature loss | Labels | Q values diverge, drifts |
| DreamerV3 | The latent states on the imagination chain, the prior side of the KL, the path from the policy loss to the world model | Labels + slow anchor | The model is exploited by the policy, evaluation return collapses later |
| TD-MPC2 | The encoded output of the consistency target, the TD target | Labels | Latent-space collapse, value scale drift |
| JEPA | The output of the target encoder; the target encoder parameters never enter the optimizer, only EMA | Slow anchor | Representation collapse |
| ACT | The action labels; the at inference needs no gradient | Labels | (Usually not wrong; mistakes are in and posterior/prior matching) |
| Diffusion Policy | The noise target ; the observation condition is not noised | Labels | Generated actions shift, the conditioning information is destroyed |
| π₀ | The target velocity , the starting noise | Labels | Velocity-field regression becomes meaningless |
| RT-2 / OpenVLA | The action token id | Labels | The cross-entropy target is wrong |
| FAST | The quantized coefficient labels | Labels | Abnormal decoded amplitude |
Three criteria can be memorized:
- Labels do not move. Any “target we want the network to fit” must carry no gradient, including returns, TD targets, noise, velocity fields, and token ids.
- Old values do not move. Any quantity “describing the previous policy or the previous model” must carry no gradient, including old log-probabilities, old values, and old latent states.
- Slow anchors do not move. Any “copy designed to follow slowly” must not enter the optimizer and can only be written in place by the EMA formula, including target Q networks and target encoders.
Conversely, only two classes of quantities must carry gradients: the network parameters being optimized, and the intermediate quantities “kept in the computation graph so that gradients can pass through” (such as reparameterized sampling, the actions output by the policy, and the predicted velocity field of flow matching). Detach everything outside these two classes and most “training runs but learns the wrong thing” problems disappear.
11.2 Six Key Divergences: Where Do Methods Actually Differ?
(1) Learning actions or learning representations
This is the most easily confused line. DreamerV3 and TD-MPC2 learn “how the environment evolves” and derive actions from it; JEPA learns only “what the future representation looks like” and does not output actions itself.
| Dimension | Learns actions (BC, ACT, DP, VLA, PPO, SAC) | Learns a world model (DreamerV3, TD-MPC2) | Learns only representations (JEPA) |
|---|---|---|---|
| Output | Actions or action distributions | Latent dynamics + policy/planning | Representation vectors |
| Can it close the loop directly | Yes | Yes (via imagination training or online planning) | No, it must attach a planner |
| Data efficiency | Medium (demonstrations or interaction) | High (one interaction is repeatedly imagined) | Extremely high (can be unlabeled) |
| Main risk | Distribution shift, sample demand | Compounding model error | Zero gain if the downstream task is poorly designed |
The criterion: do you want “a policy that can move right away”, or “reusable environment understanding”? For the former, choose an action-learning method directly; for the latter, choose a world model or JEPA, but be prepared to attach a downstream planner or policy head.
(2) Single step, action chunk, or generative multi-step
| Representation | Examples | Latency | Multimodal capability | Suitable action characteristics |
|---|---|---|---|---|
| Single-step regression/classification | BC, PPO, SAC | Lowest (one forward pass) | Weak (regression averages multiple peaks) | Smooth, unimodal, high frequency |
| Action chunks | ACT, Octo, π₀ | Low (one forward pass amortizes steps) | Medium | Manipulation that needs temporal consistency |
| Generative (diffusion/flow matching) | Diffusion Policy, π₀ action expert, RDT-1B | Medium to high (multiple denoising or integration steps) | Strong (can preserve multiple peaks) | Contact-rich, several reasonable actions exist |
| Autoregressive tokens | RT-2, OpenVLA, FAST | High (token-by-token decoding) | Medium | Many semantic switches, low frequency requirements |
The criterion: write down the frequency requirement first, then choose the representation. For force control and balancing tasks above 50 Hz, only “one forward pass” representations are possible (single step, action chunks, or very few integration steps); both autoregressive and multi-step denoising are ruled out.
(3) Discrete tokens or continuous generation
| Dimension | Discrete tokens (RT-2, OpenVLA, FAST) | Continuous regression/generation (ACT, DP, π₀, RDT-1B) |
|---|---|---|
| Precision | Limited by discretization granularity, usually centimeter level | Can reach below millimeter level |
| Interface with language models | Naturally unified: an action is just a word | Needs an extra action head |
| Multimodality | Depends on sampling temperature, limited expression | Generative models can express the full distribution |
| Main cost | Tokenization scheme design, decoding latency | Action-head training, number of generation steps |
The criterion: for contact-rich, millimeter-precision tasks such as peg insertion, screw driving, and pouring water, do not use discrete tokens; for centimeter-level tasks such as transport and coarse placement, discrete tokens are simpler and easier to unify with language models.
(4) Semantic grounding or a pure motion policy
| Dimension | VLAs with language (RT-2, OpenVLA, π₀, GR-2, HPT) | Pure vision-motion policies (BC, ACT, DP) |
|---|---|---|
| Task switching | Just change one instruction | Must change the model or the weights |
| Generalization to new objects/scenes | Relies on vision-language pretraining | Relies on demonstration diversity |
| Latency | Relatively high (large model + autoregressive or generative head) | Low |
| Debugging cost | High (data mixing, instruction templates, action space) | Low |
The criterion: in production-line scenarios with a fixed workstation and a fixed task, a pure motion policy usually has a higher success rate and lower latency; the semantic cost of a VLA is only worth paying when “switching tasks with one sentence” is a product requirement.
(5) Simulation trial and error or real demonstrations
| Dimension | Reinforcement learning (PPO, SAC, DreamerV3, TD-MPC2) | Imitation learning (BC, ACT, DP, VLA) |
|---|---|---|
| Reward | Must be computable automatically | Not needed |
| Data cost | Simulation compute (cheap) or real-robot trial and error (expensive and dangerous) | Human teleoperation time (expensive but safe) |
| Upper bound | May exceed the demonstrations and discover better policies | Does not exceed demonstration quality |
| Main risk | Reward hacking, the simulation-to-reality gap | Compounding error, insufficient demonstration coverage |
The criterion: if the reward can be computed automatically, the simulation is realistic enough, and it can be parallelized → reinforcement learning; if the reward is hard to design and you dare not let a real robot explore → imitation learning. The two are not mutually exclusive: pre-training with demonstrations first and then fine-tuning with a small amount of RL is currently a relatively stable combination.
(6) Scale matching: how large should model capacity be
This is not a “divergence between methods” but a constraint shared by all methods; yet in embodied AI it is more fatal than in pure vision, because robot data cannot be crawled.
| Data scale | Reasonable method scale | What not to do |
|---|---|---|
| Tens to hundreds of demonstrations | BC, ACT, DP (10M–100M parameters) | Fine-tuning a 7B VLA, training a base model from scratch |
| Thousands to tens of thousands | ACT/DP with more capacity, or lightweight VLA fine-tuning (Octo class) | Pretraining a large model from scratch |
| Million-level multi-embodiment trajectories | VLA pretraining (RT-2, OpenVLA, π₀, RDT-1B class) | Only doing single-task fine-tuning, wasting the pretraining value |
The criterion: count your trajectories first, then decide the model scale. The typical result of fine-tuning a 7B model on 100 trajectories is: it memorizes the background and object positions, fails as soon as the workstation changes, and generalizes worse than a 60M-parameter ACT.
11.3 Reverse Lookup by “Capability Gap”: Fill In Whatever You Lack
Section 7.2 is a decision chain starting from constraints; here we add a reverse-lookup table starting from the “capability gap”. The two are used together: first use 7.2 to rule out impossible options, then use this table to confirm which method corresponds to the gap.
Which capability am I missing right now?
├── Missing "can perform this action"
│ ├── Have demonstrations → BC / ACT / DP (choose by precision and multimodality needs)
│ └── No demonstrations, but there is a reward computable automatically
│ ├── Simulation can be parallelized → PPO (stable) or SAC (higher sample efficiency)
│ └── Interaction is extremely expensive → DreamerV3 (imagination) or TD-MPC2 (online planning)
├── Missing "understand human language, switch tasks"
│ └── Fine-tune an open-source VLA (OpenVLA / π₀ / Octo); data volume decides scale
├── Missing "millimeter-level contact precision"
│ └── Continuous action head (π₀ flow matching / DP diffusion / RDT-1B); give up discrete tokens
├── Missing "high-frequency closed loop"
│ └── One-forward-pass route (ACT / π₀ few-step integration / Dreamer policy); rule out autoregressive and online MPC
├── Missing "does not collapse on the real robot"
│ └── Robustness layer: domain randomization → system identification → domain adaptation → real-world fine-tuning (in the order of 6.3)
└── Missing "reusable environment understanding"
└── World model or JEPA (note that JEPA produces no actions and needs an attached planner)
The matching “gap → minimal-cost plan” table:
| Gap | Minimal-cost plan | Higher-cost upgrade | Common waste |
|---|---|---|---|
| A single fixed task with sufficient demonstrations | ACT (50–500 demonstrations, single GPU) | Diffusion Policy (when multimodality is needed) | Going straight to a VLA |
| Many tasks, needs language switching | Octo / small VLA fine-tuning | π₀ / RDT-1B (stronger precision and embodiment coverage) | Building your own base model |
| Cannot learn in simulation | PPO + reward shaping | SAC / DreamerV3 (sample efficiency) | Trial and error on the real robot |
| Works in simulation, collapses on the real robot | Domain randomization + system identification | Real-world fine-tuning (small amount of data) | Only widening the randomization range |
| Latency over budget | Action chunks + model quantization | Separating the action expert, distillation | Switching to a larger model |
11.4 The Six Most Easily Mismatched Combinations
Each corresponds to a mechanism in an earlier section. These are not “theoretically forbidden” but repeatedly occurring wastes in practice:
- Fine-tuning a 7B VLA on 100 demonstrations. Parameter count and data volume are severely mismatched, so the model fits the background and object positions in the demonstrations and fails as soon as the workstation changes. In this case ACT/DP usually generalize better.
- Using an autoregressive VLA for force control above 50 Hz. Token-by-token decoding latency cannot meet the closed-loop frequency of force control and dynamic balancing; no amount of semantic capability helps. Such tasks must take the “one forward pass” route.
- Using discrete action tokens for millimeter-level tasks such as peg insertion. Tokenization granularity determines the precision ceiling; discretization error cannot be eliminated by training. Contact-rich tasks should use continuous generative action heads.
- Deploying a VLA on a fixed workstation. On fixed tasks ACT/DP usually have a higher success rate, lower latency, and simpler debugging; the semantic capability of a VLA brings no benefit on a fixed workstation and only adds cost.
- Doing only domain randomization without system identification. Randomization covers parameter uncertainty, but the real system’s latency, friction nonlinearity, and actuator dead zone are often outside its range; the order in 6.3 is “identify first, then decide what to randomize”.
- Deploying JEPA directly as a policy. JEPA outputs representations, not actions; without an attached planner or policy head it cannot close the loop. Its benefits during pretraining must be realized on a downstream task.
11.5 One-Page Quick Notes: One Sentence per Method
- BC: the plainest supervised learning, mapping observations to actions; cheap, but compounding error grows with the number of steps.
- ACT: predicts a -step action chunk at once and smooths it with temporal ensembling; the chunk structure buys high-frequency control under little data.
- Diffusion Policy: treats action generation as a denoising process, trading multiple forward passes for multimodal expression and high precision.
- RT-2: discretizes actions into tokens and borrows vision-language pretraining for semantic generalization, at the cost of precision and latency.
- OpenVLA: the open-source 7B version of the RT-2 idea; its main use is fine-tuning on your own data.
- FAST: compresses long action sequences into short token strings in the frequency domain, easing the action-sequence burden of autoregression.
- π₀: the vision-language backbone handles semantics and the flow-matching action expert handles high-frequency continuous chunks; a composite of “semantics + actions”.
- Octo: a lightweight multi-embodiment baseline with few parameters, mainly used by fine-tuning; not a zero-shot general model.
- GR-2: obtains physical and motion priors from video pretraining, then transfers from video to robot actions.
- HPT: a shared trunk plus per-embodiment output heads, serving multiple robot morphologies with one model.
- RDT-1B: a large-scale diffusion action model for dual arms; strong in data scale, bounded in task domain.
- PPO: clipped objective + GAE, relying on large-scale parallel simulation trial and error; the default baseline for continuous control.
- SAC: maximum-entropy objective + double Q + off-policy replay; saves interaction compared with PPO when samples are expensive.
- DreamerV3: trains the policy by “imagining” in latent space, with the highest sample efficiency, at the cost of compounding model error.
- TD-MPC2: no decoding, model predictive control only in latent space; strong on short horizons, high latency.
- JEPA: predicts only representations, not pixel details; a pretraining tool rather than a controller.
- Domain randomization / system identification: makes the simulation distribution cover the real distribution; the mandatory step before a simulated policy goes onto a real robot.
11.6 Three General Principles Worth Taking Away
First, all methods solve the same objective; the difference is in “data” and “priors”. The objective is always to maximize the expected discounted return; the paths diverge in only two places: whether the expectation is estimated with demonstrations, interaction, or unlabeled data; and what structure is written into the model (chunk structure, generative priors, vision-language pretraining, latent dynamics). When you see a new method, answer these two questions first, then look at its implementation details.
Second, capability can only come from three places; there is no fourth. Inductive bias (chunk structure, generative models, hierarchy), data scale (multi-embodiment, internet video), and pretraining transfer (VLM semantics). Every method is limited on these three: ACT relies on inductive bias, RT-2 on pretraining, and π₀ needs both. When someone claims a model is “zero-shot general”, what you should look for is which of these three it has invested in.
Third, precision, frequency, and generalization form a triangle; any method can occupy only two corners. This is also the biggest difference between embodied AI and pure vision tasks — pure vision can talk about precision alone, while embodied AI is simultaneously constrained by the physical closed loop.
| Two corners you want | The corner to give up | Representative methods | Engineering implication |
|---|---|---|---|
| Precision + frequency | Generalization | ACT, DP (on task-specific data) | Optimal for a fixed workstation; retraining is needed when the task changes |
| Precision + generalization | Frequency | π₀, RDT-1B (generative action experts) | Needs few-step integration and more compute; trading latency for capability |
| Frequency + generalization | Precision | RT-2, OpenVLA (discrete tokens) | Flexible semantic switching, but only centimeter-level tasks |
The most common engineering mistake is imposing requirements on all three corners at once: 50 Hz, millimeter level, and task switching with one sentence. No current method satisfies all three; the correct approach is to decide which corner can be compromised first, and then choose the method.
Finally, back to the sentence from Chapter 7: selection follows constraints, not paper popularity. Chapter 7 gives you the constraint checklist; this chapter gives you the mechanism comparison and the capability reverse lookup. Cross-referencing the two basically rules out most wrong options.
12. Quick-Reference Summary: Core Differences and Applicable Scenarios of Each Algorithm
Chapter 11 answered “where the mechanisms differ”; this chapter answers only two questions that come up when you start working: how is it actually different from the nearest method, and should I use it under my conditions? The whole chapter is organized as “one matrix → constraint reverse lookup → default combinations by task family → four-step decision”, and can be flipped through directly as a comparison table during selection.
12.1 One Matrix: Positioning, Key Differences, Applicability and Forbidden Zones
The “key difference from the nearest neighbor” column is the focus of this table: each algorithm looks like “yet another end-to-end model” when viewed in isolation; the difference only shows when it is placed next to the one most easily confused with it.
| Algorithm | One-sentence positioning | Key difference from the nearest neighbor | Data threshold | Typical inference frequency | Best for | Explicitly do not use |
|---|---|---|---|---|---|---|
| Behavior cloning (BC) | The plainest supervised mapping from observations to actions | Versus ACT: single-step prediction, no chunk structure, no latent variables | 50–500 demonstrations | Same order as a network forward pass | Fixed tasks, extremely latency-sensitive, very few demonstrations | Long horizons, multimodal demonstrations, state distribution shift |
| ACT | Predicts a -step action chunk at once + temporal ensembling | Versus BC: the chunk structure truncates compounding error to the chunk length | 50–500 demonstrations | 10–50 Hz (amortized by chunks) | Desktop low-to-medium-speed manipulation, single GPU, limited demonstrations | High-speed abrupt tasks, entirely new objects, force control |
| Diffusion Policy (DP) | Treats action generation as multi-step denoising | Versus ACT: generative modeling, naturally expresses multiple peaks | 200–2000 demonstrations | 10–20 Hz (multi-step sampling) | Multimodal demonstrations, fine manipulation, deformable objects | Edge devices with low compute, >50 Hz, very little data |
| RT-2 | Discretizes actions into tokens and uses a vision-language model for decisions | Versus DP: discrete bins buy semantic generalization at the cost of precision | Internet vision-language data + robot trajectories | 3–10 Hz (autoregressive) | Open vocabulary, semantic switching, low-to-medium-speed tasks | Millimeter-level assembly, >30 Hz, fine-tuning on small data |
| OpenVLA | The open-source 7B version of the RT-2 idea | Versus RT-2: larger scale, open weights, easier to fine-tune | Same as above, 7B scale | 3–5 Hz | Open-source starting point, fine-tuning on own data, semantic generalization | Single-GPU small data, edge deployment, high-frequency closed loops |
| FAST | Compresses long action sequences into short tokens in the frequency domain | Versus RT-2: still autoregressive, but the token count drops to about 1/3–1/5 | An existing autoregressive VLA + high-frequency action data | 5–15 Hz | Long action chunks, low-dimensional actions, wanting shorter sequences | High-dimensional dexterous hands, extremely high-frequency abrupt tasks, millimeter level |
| π₀ | Vision-language backbone + flow-matching action expert | Versus DP: the backbone brings semantics, few-step integration brings high frequency | Large-scale multi-embodiment trajectories (million level) | 20–50 Hz (few-step integration) | High frequency + high precision + semantic generalization | Small teams with little data, edge compute, rapid validation |
| Octo | Lightweight multi-embodiment general baseline | Versus π₀: fewer parameters, mainly used by fine-tuning | Open X-Embodiment-scale multi-embodiment data | 10–20 Hz | Quickly obtaining a reproducible baseline, secondary development | Zero-shot generality, sub-centimeter precision |
| GR-2 | Video prediction first, then converted into a policy | Versus JEPA: outputs actions, using a generative action head | Video + robot action data | 10–20 Hz | Contact-rich, needs physical and motion priors | No video data, purely semantic tasks, strict real-time requirements |
| HPT | Shared trunk + independent input/output heads per embodiment | Versus Octo: models “embodiment differences” explicitly in the structure | Heterogeneous multi-embodiment data | 10–20 Hz | One model serving multiple robot morphologies | A single embodiment, extreme precision, hard-to-control data mixing |
| RDT-1B | A large-scale diffusion action base for dual arms | Versus π₀: diffusion head, unified action space, focused on dual arms | Million-level dual-arm trajectories | 10–20 Hz | Dual-arm manipulation, a large-scale pretraining starting point | Small single-arm tasks, edge devices, non-dual-arm domains |
| PPO | On-policy RL with a clipped objective + generalized advantage estimation | Versus SAC: on-policy, trading parallel sampling for sample efficiency | Million-level simulation interactions | Simulation step level | Walking/locomotion, large-scale parallel simulation, writable rewards | Real-robot online learning, sparse rewards, only demonstrations and no reward |
| SAC | Maximum-entropy objective + double Q + off-policy replay | Versus PPO: reuses historical data, an order of magnitude higher sample efficiency | Hundred-thousand-level interactions | Control step level | Real-robot servoing, expensive interaction, continuous actions | Thousands of parallel environments, multimodal actions, purely offline settings |
| DreamerV3 | “Imagines” in latent space and trains a policy | Versus TD-MPC2: trains a policy network, deployment needs only one forward pass | Hundred-thousand-level interactions | One forward pass (extremely fast at deployment) | Low data budget, visual input, reward magnitudes that vary widely | Sub-centimeter contact, long horizons, real-robot online training |
| TD-MPC2 | No decoding; model predictive control only in latent space | Versus Dreamer: online planning at deployment, no observation decoding | Hundred-thousand-level interactions | Planning at every step (slower) | Short-horizon precise local control, frequent task switching | High-dimensional actions, >50 Hz, long horizons |
| JEPA | A pretraining architecture that predicts only in representation space | Versus Dreamer: outputs no actions, just a representation tool | Unlabeled video or observations | Depends on the downstream component | Visual-backbone initialization, data without action labels | Direct closed-loop deployment, millimeter-level geometric tasks |
| Domain randomization / system identification | Makes the training distribution cover the real distribution | Not a policy algorithm but a step before real-robot deployment | Simulation + a small amount of real data | Does not change the policy frequency | Transferring simulated policies, large parameter uncertainty | Replacing contact modeling, replacing calibration and time synchronization |
12.2 Reverse Lookup by Constraint: Which One Should I Choose Under My Conditions
This section treats “resources and constraints” as the search key. Usage: find the row closest to your situation, then look at the “first choice / second choice / do not choose” columns. If several rows hit at the same time, the stricter one wins (for example, when “only 50 demonstrations” and “need 30 Hz” both hold, only ACT satisfies both).
| Your constraint | First choice | Second choice | Do not choose |
|---|---|---|---|
| Only 50–200 demonstrations, single GPU | ACT | Behavior cloning (when the task is extremely simple) | Fine-tuning a 7B VLA, training π₀ from scratch |
| 500–2000 demonstrations, several reasonable ways exist | Diffusion Policy | ACT + data augmentation | Plain BC with unimodal regression |
| No demonstrations, but simulation and a writable reward | PPO (large-scale parallel) | SAC (few environments, expensive samples) | Imitation learning (no demonstrations) |
| No demonstrations, interaction extremely expensive | DreamerV3 | SAC + a demonstration-warmed replay buffer | PPO (million-level interaction is unaffordable) |
| Learned in simulation, collapses on the real robot | Domain randomization + system identification | Fine-tuning with a small amount of real data | Only widening the randomization range |
| Needs language instructions and open vocabulary | OpenVLA / Octo fine-tuning | π₀ (stronger precision and embodiment coverage) | Building your own base model, plain ACT |
| Needs a closed loop above 30 Hz | ACT / π₀ few-step integration / Dreamer policy | A distilled small model | Autoregressive VLA, online MPC |
| Needs millimeter level (peg insertion, screw driving) | DP / π₀ continuous action head | ACT + a force-control low level | Discrete-token VLA, FAST |
| Long action sequences, low-dimensional actions, limited compute | FAST | ACT | Frame-by-frame per-dimension discrete tokens |
| One model serving multiple robots | HPT | RDT-1B / Octo | Training a separate set for each embodiment |
| Plenty of unlabeled video | JEPA pretraining → attach a action head | GR-2 (video-pretrained policy) | Using JEPA directly as a controller |
| Dual arms, large-scale data | RDT-1B | π₀ | Forcing a small single-arm model to scale up |
| Deployed on edge devices with limited compute | ACT / a quantized small VLA | Distilled DP | Deploying a 7B-class VLA as is |
12.3 Default Combinations by Task Family
Real projects rarely use only one method; the following are “default combinations when there are no special constraints”, usable directly as a starting point and then adjusted according to 12.2.
| Task family | Default combination | Key reason | Common alternative |
|---|---|---|---|
| Desktop grasping and organizing | ACT or DP + fixed camera | Dozens to hundreds of demonstrations suffice, and 10–30 Hz is enough | Add a lightweight VLA for subtask selection when multi-task |
| Folding clothes, deformable objects | DP + relatively high control frequency | Several reasonable actions exist for the same state; multimodal expression is needed | ACT + demonstrations of multiple styles |
| Peg insertion, assembly, contact-rich | DP / π₀ continuous head + low-level force control | Millimeter precision and contact stability come first | TD-MPC2 (short-horizon precise control) |
| Humanoid walking | PPO + domain randomization | Thousands of parallel environments; rewards (speed, posture) are easy to write | SAC (when there are few environments) |
| Quadruped locomotion | PPO + automatic domain randomization | Parallel sampling is cheap and disturbance rejection is needed | DreamerV3 (when the sample budget is tight) |
| Dexterous multi-finger manipulation | Simulation PPO/SAC + demonstration fine-tuning | High-dimensional actions rely on simulation trial and error as a base, with demonstrations fixing precision | DP (mind the cost of sampling in high dimensions) |
| Dual-arm coordinated manipulation | RDT-1B pretraining + DP/ACT fine-tuning | Dual-arm data and a unified action space are key | π₀ multi-embodiment pretraining |
| Open-vocabulary sorting | VLA high level selects targets + ACT/DP low level executes | Semantics and precision divide the work, avoiding forcing one model to do everything | FAST to shorten the high-level sequence |
12.4 Four-Step Decision: From Constraints to a Plan
Compressing the tables above into a sequence you can follow, where each step answers only one question:
- Are there demonstrations? Yes → go to the skill layer (BC / ACT / DP); no → go to the basic layer (PPO / SAC / world models); only unlabeled video → do representation pretraining first (JEPA), then attach an action head.
- How high a closed-loop frequency is needed? Above 30 Hz → only the “one forward pass producing action chunks” route (ACT, π₀ few-step, Dreamer policy); around 10 Hz → DP and VLA are both fine; 3–10 Hz → autoregressive VLA is acceptable too.
- How strong a generalization is needed? Fixed workstation → no need for a VLA; ACT/DP are faster and more accurate; multi-task, open vocabulary → pretrained semantics are required (OpenVLA, π₀, RDT-1B).
- How much deployment compute is available? Edge device → ACT or a quantized small model; a server available → generative action heads and 7B-class VLAs are possible.
After the four steps, if several candidates remain, use the “do not choose” column of 12.2 to exclude them, then check the data volume, real-robot conditions, and safety requirements against the constraint checklist in Chapter 7. If two candidates are both feasible on paper, choose the one that is simpler to implement, faster at inference, and more interpretable to debug — in embodied projects, a plan that can run and iterate quickly usually ends up performing better than one with higher paper metrics.
12.5 Five Cross-Cutting Conclusions
- If there are demonstrations, use the skill layer; only without demonstrations use reinforcement learning. The sample efficiency of imitation learning is usually an order of magnitude higher, and the value of reinforcement learning lies in “the places demonstrations do not cover” and “rewards that can be computed automatically”.
- Precision, frequency, and generalization form a triangle; any method can occupy only two corners. A fixed workstation chooses “precision + frequency”; open vocabulary chooses “frequency + generalization”; high-precision generalization chooses “precision + generalization” and accepts the latency.
- Layering is inevitable, not optional. The high level runs slowly for semantics and subtasks, the middle level produces action chunks, and the low level runs the servo loop; trying to make one model handle all three layers almost always fails on frequency or precision.
- Each of the three kinds of pretraining buys a different capability. Vision-language pretraining buys “semantics”, video/world-model pretraining buys “physical intuition”, and action-data pretraining buys “embodiment and skill coverage”. The three cannot substitute for each other.
- The last mile before the real robot is data and calibration, not algorithms. If the four things — unified action space, time synchronization, camera calibration, and latency compensation — are not done well, no algorithm can save it.
Appendix A: Abbreviations Quick Reference
| Abbreviation | Full English name | Explanation |
|---|---|---|
| ACT | Action Chunking with Transformers | Transformer-based action-chunking imitation learning |
| ADR | Automatic Domain Randomization | Automatic domain randomization |
| BC | Behavior Cloning | Behavior cloning (the most basic imitation learning) |
| CEM | Cross-Entropy Method | Cross-entropy method (gradient-free sampling optimization) |
| CMA-ES | Covariance Matrix Adaptation Evolution Strategy | Covariance matrix adaptation evolution strategy |
| CNN | Convolutional Neural Network | Convolutional neural network |
| CVAE | Conditional Variational Autoencoder | Conditional variational autoencoder |
| DANN | Domain-Adversarial Neural Network | Domain-adversarial neural network |
| DCT | Discrete Cosine Transform | Discrete cosine transform |
| DP | Diffusion Policy | Diffusion policy (also Dynamic Programming; distinguished by context) |
| DR | Domain Randomization | Domain randomization |
| ELBO | Evidence Lower Bound | Evidence lower bound (the objective of variational inference) |
| EMA | Exponential Moving Average | Exponential moving average |
| FAST | Frequency-space Action Sequence Tokenization | Frequency-space action-sequence tokenization |
| GAE | Generalized Advantage Estimation | Generalized advantage estimation |
| GRU | Gated Recurrent Unit | Gated recurrent unit |
| HPT | Heterogeneous Pre-trained Transformer | Heterogeneous pretrained Transformer (shared trunk across embodiments) |
| IL | Imitation Learning | Imitation learning |
| JEPA | Joint-Embedding Predictive Architecture | Joint-embedding predictive architecture |
| KL | Kullback-Leibler divergence | KL divergence (a measure of the difference between two distributions) |
| LLM | Large Language Model | Large language model |
| MDP | Markov Decision Process | Markov decision process |
| MPC | Model Predictive Control | Model predictive control |
| MSE | Mean Squared Error | Mean squared error |
| ODE | Ordinary Differential Equation | Ordinary differential equation |
| OT | Optimal Transport | Optimal transport |
| POMDP | Partially Observable Markov Decision Process | Partially observable Markov decision process |
| PPO | Proximal Policy Optimization | Proximal policy optimization |
| RSSM | Recurrent State Space Model | Recurrent state space model |
| RT-2 | Robotic Transformer 2 | Second-generation robotic Transformer (the representative of “actions as tokens”) |
| SAC | Soft Actor-Critic | Soft actor-critic (maximum-entropy reinforcement learning) |
| Sim-to-Real | Simulation to Reality | Simulation-to-reality transfer |
| SysID | System Identification | System identification |
| TD | Temporal Difference | Temporal difference |
| TD-MPC2 | Temporal Difference Model Predictive Control v2 | Temporal-difference model predictive control (second generation) |
| TV | Total Variation | Total variation (a kind of distribution distance) |
| VAE | Variational Autoencoder | Variational autoencoder |
| VICReg | Variance-Invariance-Covariance Regularization | Variance-invariance-covariance regularization |
| ViT | Vision Transformer | Vision Transformer |
| VLA | Vision-Language-Action model | Vision-language-action model |
| VLM | Vision-Language Model | Vision-language model |
Supplementary terminology notes (not abbreviations, but easily misunderstood):
- Action chunking: predicting the next actions at once instead of only one step.
- Temporal ensembling: exponentially weighted averaging of several overlapping action chunks to smooth chunk boundaries.
- Imagination: rolling out multiple trajectories in the latent space of a world model without interacting with the environment.
- Model exploitation: the policy learns to use the world model’s prediction errors to obtain high returns instead of actually completing the task.
- Representation collapse: the encoder maps all inputs to the same (or extremely low-rank) representation, making the prediction loss degenerate to zero.
- Bootstrapping: using one’s own value estimate as part of the update target.
- Stop-gradient: truncating the gradient of a certain path during backpropagation, commonly used for target networks.
Conclusion: How to Use This Document
The structure of this document is a “four-layer map”, but the real way to use it is to look things up backward:
- First clarify your constraints (data volume, whether a real robot exists, frequency, whether language is needed) and go through the decision questions in Chapter 7; if you are still unsure, do the reverse lookup by “capability gap” in Chapter 11 (11.3);
- Locate the corresponding layer and go back to that chapter for the “principle + pseudocode”;
- Before starting, copy the “acceptance criteria” of the corresponding stage in Chapter 8 as a checklist;
- When it does not work, check the pitfall list in Chapter 9 first — eighty percent of the problems are on that list;
- When you need mathematical details, expand the collapsible derivation in the corresponding section, where there is a complete chain of reasoning rather than only the conclusion.
One last reminder: the bottleneck of embodied AI is usually not the algorithm but data, latency, and contact physics. Algorithms determine the ceiling; engineering determines how far you can go.
Comments
Loading comments…
Want to leave a note? Sign in first — comments are open to every signed-in reader.