Skip to main content
Open In Colab In Behavioral cloning and RL on a claw machine the operator had one right answer in every state, and MiniVLA learned it. Human demonstrations often are not like that. Two operators reach around an obstacle on different sides, and one operator picks whichever of two identical objects is closer to hand that day. The demonstrations then hold several correct actions for the same observation, and the policy has to represent them. In this section the claw machine holds two squares of the named color, and the operator fetches one of them at random. You put six action heads on the same backbone, train them on the same demonstrations, and compare what each does when the two choices pull in opposite directions. Three of the heads are the generative models behind recent robot policies: the conditional VAE of ACT (Zhao et al., 2023), the denoising diffusion of Diffusion Policy (Chi et al., 2023), and flow matching (Lipman et al., 2022).

Two right answers

The machine is the Newton simulation of the claw machine used throughout this chapter: the squares are rigid boxes under gravity, and a released box falls over a few control steps and can slide. The floor holds two squares, both of the color the instruction names, at least 0.35 apart. The instruction asks for “a” red square, and delivering either square earns reward 1. With no square of another color, the policy never has to tell colors apart to pick a correct square. Slips are switched off. The claw starts midway between the two squares, at a random height. The operator decides at the start of each episode which square to fetch, with equal probability, and moves toward it. It aims at the square’s center with an error of at most 0.015, so a few of its catches fail and the demonstrations also show the recovery: open, rise one step and try again.
Sixteen operator episodes on each of four layouts. Blue paths go to the left square and orange paths to the right one. Every path starts at the same point, so the first image of an episode is the same whichever square the operator picked. After one move the claw is on one side, and from then on each image belongs to one of the two choices. Four layouts, each with two squares of the named color on either side of the claw start. Each panel shows sixteen operator paths from the same start point: blue paths go to the left square and orange paths to the right square.

Action chunks

Three of the heads predict an action chunk per query, as defined in Action representations II: regression and chunks: a chunk At=(at,…,at+H−1)A_t = (a_t, \ldots, a_{t+H-1}) of length HH, of which the policy executes the first E≤HE \le H actions before it looks at the camera again. Here H=8H = 8 and E=4E = 4. Each action is rescaled to [−1,1]3[-1, 1]^3: the two moves in units of the largest step, and the grip as −1-1 (open) or 11 (closed).

One backbone, different heads

Every policy uses the MiniVLA backbone of the behavioral cloning section: FiLM-conditioned convolutions and a small transformer that reduce the image and the instruction to a summary vector hh. The backbone is trained once, end to end with the token head, and then frozen. Each head is trained on the frozen hh of the demonstration steps, which plays the role of a pretrained VLA backbone with a new action head on top. All heads get the same 20,000 training steps.

Five ways to turn hh into an action

The regression head is a perceptron trained with the squared error on the next action. For an observation oo, the function that minimizes the expected squared error is the conditional mean, f⋆(o)=arg⁡min⁡fE[∥a−f(o)∥2]=E[a∣o].f^\star(o) = \arg\min_f \mathbb{E}\big[\lVert a - f(o) \rVert^2\big] = \mathbb{E}[a \mid o]. At the start state half the demonstrations move left and half move right, so the conditional mean of the first move is zero, a move that no demonstration makes. The token head is the one from the behavioral cloning section: dxdx, dzdz and the grip become three tokens, and the head outputs a categorical distribution over each, conditioned on the tokens before it. A categorical distribution can put its mass on two separate bins. Taking the most likely token picks one of them; sampling can pick either. The conditional VAE follows ACT. An encoder qϕ(z∣h,At)q_\phi(z \mid h, A_t) compresses the demonstrated chunk into a latent zz, and a decoder DθD_\theta maps (h,z)(h, z) back to a chunk. Training minimizes L=∥At−Dθ(h,z)∥1+β KL(qϕ(z∣h,At) ∥ N(0,I)).\mathcal{L} = \lVert A_t - D_\theta(h, z) \rVert_1 + \beta\, \mathrm{KL}\big(q_\phi(z \mid h, A_t) \,\Vert\, \mathcal{N}(0, I)\big). The latent can carry the operator’s choice, which the start image cannot. ACT uses the L1 error, weights the KL term with β=10\beta = 10, discards the encoder after training and sets zz to the prior mean, zero, at test time (Zhao et al., 2023). You run that variant, and one that draws zz from the prior. The VAE architecture section derives the same objective for images. The diffusion head follows Diffusion Policy, which uses a DDPM (Chi et al., 2023; Ho et al., 2020). Write x0=Atx^0 = A_t for a demonstrated chunk, flattened, and k=1,…,Kk = 1, \ldots, K for the diffusion step, so that it does not clash with the time step tt. The forward process adds Gaussian noise in the closed form of the DDPM section, xk=αˉk x0+1−αˉk ϵ,ϵ∼N(0,I),x^k = \sqrt{\bar\alpha_k}\, x^0 + \sqrt{1 - \bar\alpha_k}\, \epsilon, \qquad \epsilon \sim \mathcal{N}(0, I), and a network ϵθ(xk,k,h)\epsilon_\theta(x^k, k, h) learns to predict the noise with the loss ∥ϵ−ϵθ(xk,k,h)∥2\lVert \epsilon - \epsilon_\theta(x^k, k, h) \rVert^2. Sampling starts from pure noise and runs K=50K = 50 denoising steps. Different starting noise ends in different chunks, so the head can return either choice. You run it with chunks and with single actions (H=E=1H = E = 1). The flow-matching head uses the straight path of the flow matching section. With flow time τ∈[0,1]\tau \in [0, 1], noise x0x_0 and a demonstrated chunk x1x_1, xτ=(1−τ) x0+τ x1,x_\tau = (1 - \tau)\, x_0 + \tau\, x_1, and a network vθ(xτ,τ,h)v_\theta(x_\tau, \tau, h) learns the velocity x1−x0x_1 - x_0 with a squared error. Sampling integrates vθv_\theta from noise in 10 Euler steps. Like diffusion, it maps different noise to different chunks.

Training and rollouts

The code below trains the backbone and the heads, and runs a policy on a batch of machines. A policy that returns a chunk executes its first four actions and then queries again. The rollout records whether a square was delivered and which way the claw went in its first ten steps.

Delivery and choice

Each policy runs on 20 layouts, 16 times per layout, with fresh grasp outcomes and fresh samples on every run. The table reports the delivery rate over the 320 episodes. It also reports how often both squares were chosen across the 16 runs of a layout, and the minority share: the fraction of runs that went to the less chosen square, averaged over layouts. A policy that splits evenly on every layout has a minority share of 0.5.
The histograms show the first move dxdx that each head returns on 256 new start states, with eight samples per state. Eight histograms, one per policy: regression, greedy tokens, sampled tokens, CVAE with z set to zero, CVAE with sampled z, diffusion with one action, diffusion with chunks, and flow matching with chunks. Each shows the first horizontal move, from -1 to 1 in units of the largest step. Diffusion and flow matching show two separate peaks, and regression spreads its moves across the range. Sixteen runs of each policy on one layout. Blue paths delivered a square and orange paths did not. Eight panels, one per policy, each with sixteen claw paths on the same layout. Blue paths delivered a square and orange paths did not. Regression, greedy tokens and the CVAE send every run toward the same square, while diffusion and flow matching send runs toward both squares.

What the heads did

Delivery does not separate the heads much. Regression delivers 0.93 of the episodes, and most of the other heads between 0.73 and 0.90. With 320 episodes per policy, differences of a few points are within the evaluation noise. Delivery also moves between training runs. In an earlier run of the same code, the delivery of single heads changed by more than ten points, while the choice of square did not, so the table does not rank the heads by delivery. Most failures come from the physics of the grab: a square released outside the chute, or catches that fail repeatedly. The chunked diffusion head is lowest at 0.65. It executes four actions without looking, and its moves are less precise than those of the closed-loop heads, so more of its catches land off center. The square each head chose separates them more clearly. Regression, greedy tokens and the conditional VAE always went to the same square on a given layout. Diffusion and flow matching went to both squares on 85% to 100% of the layouts, and sampled tokens on 25%. None of the generative heads split evenly: the minority share of diffusion and flow matching is 0.25 to 0.31, and that of sampled tokens 0.04, against 0.5 for the operator. Regression did not get stuck midway, although its training target at the start state is a zero move. Its first moves in the histogram are spread between the two modes, and many are far from zero. Each training layout contributes one start state with one direction, so the network does not see the even split on any single layout, and on a new layout it returns some value between the modes. It is rarely exactly zero, and one move away from the midpoint, the image belongs to one of the two choices, and the regression head follows it. The midway point is an unstable balance, and in this task the averaged action costs little. When the two choices stay ambiguous for many steps, as when a robot can pass an obstacle on either side, the conditional mean points between them for as long as the ambiguity lasts. The conditional VAE ignored its latent. Drawing zz from the prior gives the same first moves and the same choices as setting it to zero, so the decoder learned to predict the chunk from hh alone. On the layout in the paths figure, both variants sent all 16 runs to the right square, and none of them delivered. ACT notes that a larger β\beta transmits less information through zz (Zhao et al., 2023). With β=10\beta = 10 and demonstrations whose only variation is one binary choice, the KL term made it cheaper to ignore zz. ACT motivates the CVAE with noisy human demonstrations, and reports the objective as essential for learning precise tasks from them. Diffusion with single actions can switch modes between steps, because each step draws fresh noise. In the paths above, most of its runs keep the direction of their first move, since after one move the image no longer looks like the start. Chunks commit to a choice for EE steps by construction, which is how Diffusion Policy keeps one mode within a rollout in its Push-T example (Chi et al., 2023). The heads also differ in cost per action. Diffusion with single actions runs the denoiser 50 times per executed action, and the chunked version 12.5 times, since each query of 50 steps yields four actions. Flow matching needs 2.5 velocity evaluations per action, and the conditional VAE one decoder pass per four actions. Diffusion Policy reduces this cost with DDIM, training with 100 diffusion steps and sampling with 10 (Chi et al., 2023). These results come from one task, one scripted operator whose two modes are clean, and heads that were not tuned individually. The backbone was trained with the token loss, which may favor the token head. The minority shares come from 16 runs per layout, so each layout’s share has a standard error of about 0.12, and only the average over 20 layouts is stable.

References

  • Chi, C., Xu, Z., Feng, S., Cousineau, E., Du, Y., et al. (2023). Diffusion Policy: Visuomotor policy learning via action diffusion. arXiv [cs.RO]. Link
  • Ho, J., Jain, A., Abbeel, P. (2020). Denoising Diffusion Probabilistic Models. arXiv [cs.LG]. DOI
  • Lipman, Y., Chen, R., Ben-Hamu, H., Nickel, M., Le, M. (2022). Flow Matching for generative modeling. arXiv [cs.LG]. Link
  • Zhao, T., Kumar, V., Levine, S., Finn, C. (2023). Learning fine-grained bimanual manipulation with low-cost hardware. arXiv [cs.RO]. DOI

Found an error on this page? Report an issue.