Vision-Language-Action Models › Temporal alignment and action chunking
Language AI HandbookAll chapters The servo update rate, controller's command-consumption rate and policy inference rate need not match. A servo can run at 100 Hz while a slower policy refreshes commands at 10 Hz. If the controller consumes one planned action every 20 ms, a five-action prefix represents 100 ms of scheduled control. The low-level servo may take two inner updates per action. Record these intervals separately; a claimed 100 Hz control loop alone does not establish that vision is refreshed every 10 ms.
A chunk predicts future actions. Executing a prefix of steps before querying again gives a replanning interval of at action consumption rate , assuming no missed deadlines. The policy can overlap inference with execution, and a separate supervisory rule can interrupt the prefix. Fewer committed steps let the learned policy incorporate fresh observations sooner when computation permits. ACT distinguishes chunk prediction from temporal ensembling, which queries frequently and combines overlapping predictions for the same action time.
Predicting a longer chunk and executing a shorter prefix
Perception latency, planning latency and servo cadence enter a closed loop through different mechanisms. A fast servo can update the response to the last target while the slower policy is still reading data or producing the next target. A chunk lets the controller consume several previously predicted commands during that gap. If the old chunk remains valid, later accepted commands may arrive on time. If a new observation invalidates it, consuming more of that chunk can increase the length of time the learned policy acts on stale evidence. An independent supervisory stop, if present, has its own input and latency path. Measure the response to that supervisory signal separately.
Take a hypothetical command consumer running at 50 Hz. It consumes one action every 20 milliseconds. A predicted horizon of eight actions covers 160 milliseconds from the start of consumption if deadlines are met. Consuming only the first three actions before the next policy request gives a nominal consumption prefix of 60 milliseconds. A concurrent policy that asks for a new chunk earlier can finish inference before the active commands are exhausted. A policy that waits until all three actions are consumed before requesting a new chunk must also account for the next inference duration. That sequential schedule adds the inference duration to the 60-millisecond prefix.
In temporal ensembling, several previously predicted chunks can include a prediction for the same future time. The ensemble combines predictions made for that time. Define the average across overlapping chunks in a command representation where such averaging is meaningful. Averaging nearby scalar increments can be straightforward. Averaging rotations or combining plans that choose opposite sides of an obstacle has additional structure. A controller that selects the latest valid prefix discards earlier proposals. Check the resulting trajectory when choosing between these policies, especially near a contact boundary.
An action-replay evaluation should record the tick that would have used each element of the plan and which elements were actually consumed. A head can emit eight planned commands consistently and still have its last five proposals discarded almost every episode. Comparing unused commands to expert labels measures planned sequence agreement as a training diagnostic. A policy that uses open-loop predictions in a simulator without paying inference latency may look responsive despite its planned prefix being old by the time a real system could apply it. Keep offline sequence loss, closed-loop per-step evaluation and actual command timing as distinct measurements.
Registering observations and commands
The nominal policy period is only one input to a timing analysis. A frame can wait for preprocessing. The backbone can compute on queued work. The action decoder can make several calls before producing the sequence. An action can then wait for the controller to accept it. If all of those stages are serial, the durations add. If they overlap, a trace needs to say which parts lie on the critical path for the particular issued command. Measure latency using individual commands and their originating observations. Batch throughput answers a separate capacity question.
Suppose a trace uses a frame captured at time zero, begins policy inference 12 milliseconds later, and accepts the first command at 70 milliseconds. The observation age when that command is accepted is 70 milliseconds. The 58 milliseconds from inference start to controller acceptance omits the first 12 milliseconds of age. If another command from the same prefix is accepted 20 milliseconds later, that command uses the same 90-millisecond-old observation unless the plan has been updated. Both actions can meet a controller's consumption deadline while relying on observations of different ages. A latency review therefore needs expected freshness as well as delivery deadlines.
A deliberately deterministic offline schedule makes such arithmetic reproducible. For a timing evaluation of an actual system, record the all-attempt latency distribution including timeouts and stopped tasks, distinguish warm and cold runs if initial inference changes behavior, and report the clock used at each stage. When a timestamp comes from another clock, synchronize the clocks or bound the measurement error before subtracting it from local values. Record missing ages explicitly.
The tabletop program advances one simulator step per command. Camera acquisition and servo updates are outside this abstraction. Interpreting a trajectory of 13 steps as a 130-millisecond manipulation would require imposing a 100 Hz command rate externally. The earlier 100 Hz example was a servo rate and used a different command period. The notebook can report applied steps and clipping frequencies exactly. A time-and-motion experiment would need timestamps and calibrated dynamics before interpreting those steps as robot latency.
A tabletop push in simulation
PythonIn [4]Expand
import numpy as np
import torch
from torch import nn
from torch.nn import functional as F
SEED = 19
LIMIT = 0.045
GOAL = 0.72
TARGETS = ("red", "blue")
torch.manual_seed(SEED)
torch.set_num_threads(1)
class TabletopPush:
"""Two lanes and a bounded hand in a dimensionless unit square."""
def __init__(self, seed, radius=0.055):
rng = np.random.default_rng(seed)
self.hand = np.array([0.15, rng.uniform(0.25, 0.75)])
self.blocks = np.column_stack(
[rng.uniform(0.34, 0.47, size=2), rng.permutation([0.34, 0.66])]
)
self.radius = radius
def observe(self, target):
color = np.eye(2, dtype=np.float32)[target]
offset = self.blocks[target] - self.hand
return np.concatenate(
(self.hand, self.blocks.ravel(), color, offset)
).astype(np.float32)
def step(self, action):
dx, dy = np.clip(action, -LIMIT, LIMIT)
x, y = self.hand
proposed = np.clip([x + dx, y + dy], 0.09, 0.91)
near_lane = np.abs(self.blocks[:, 1] - proposed[1]) <= self.radius
face = self.blocks[:, 0] - self.radius
approaching = (x <= face + 1e-10) & (proposed[0] > face)
contacts = near_lane & approaching
if contacts.any():
advance = np.maximum(0.0, proposed[0] - face[contacts])
self.blocks[contacts, 0] = np.minimum(
0.91, self.blocks[contacts, 0] + advance
)
proposed[0] = min(
proposed[0], np.min(self.blocks[contacts, 0] - self.radius)
)
self.hand = proposed
def scripted_action(env, target):
lane_y = env.blocks[target, 1]
error = lane_y - env.hand[1]
forward = LIMIT if abs(error) <= env.radius * 0.45 else 0.0
return np.array([forward, np.clip(error, -LIMIT, LIMIT)], dtype=np.float32)
def collect(seeds, radius_range=None):
radius_rng = np.random.default_rng(202)
features, actions = [], []
successes = []
for seed in seeds:
radius = (
0.055 if radius_range is None else radius_rng.uniform(*radius_range)
)
target = seed % 2
env = TabletopPush(seed, radius=radius)
for _ in range(48):
action = scripted_action(env, target)
features.append(env.observe(target))
actions.append(action)
env.step(action)
if env.blocks[target, 0] >= GOAL:
break
successes.append(env.blocks[target, 0] >= GOAL)
return (
torch.tensor(np.asarray(features)),
torch.tensor(np.asarray(actions)),
int(sum(successes)),
)The simulator uses two horizontal lanes. The red and blue blocks can appear in either lane. The observation carries the hand and both block coordinates, a one-hot instruction, and the relative offset to the selected block. This last quantity is computed from simulator state. The scripted expert aligns the hand with the selected lane, then moves the hand to the right. When its next move crosses a block's left face in the permitted lane, the hand and block move together. The contact rule omits friction, rotation and dynamics between discrete ticks. Neither policy reads an image or interprets free-form text.
PythonIn [5]Expand
class ActionHead(nn.Module):
def __init__(self, bins=None):
super().__init__()
self.bins = bins
self.backbone = nn.Sequential(
nn.Linear(10, 56), nn.Tanh(), nn.Linear(56, 56), nn.Tanh()
)
self.projection = nn.Linear(56, 2 * bins if bins else 2)
def forward(self, features):
score = self.projection(self.backbone(features))
if self.bins is None:
return LIMIT * score.tanh()
return score.reshape(-1, 2, self.bins)
def encode_bins(actions, bins):
return (
(((actions + LIMIT) / (2 * LIMIT)) * bins)
.floor()
.long()
.clamp(0, bins - 1)
)
def decode_bins(indices, bins):
return -LIMIT + (indices + 0.5) * (2 * LIMIT / bins)
def decoded_actions(model, features):
score = model(features)
if model.bins is None:
return score
return decode_bins(score.argmax(dim=-1), model.bins)
def train(data, bins=None, epochs=165):
torch.manual_seed(SEED)
model = ActionHead(bins)
opt = torch.optim.Adam(model.parameters(), lr=0.005)
features, actions, _ = data
for _ in range(epochs):
scores = model(features)
if bins is None:
loss = F.mse_loss(scores / LIMIT, actions / LIMIT)
else:
loss = F.cross_entropy(
scores.reshape(-1, bins), encode_bins(actions, bins).reshape(-1)
)
opt.zero_grad()
loss.backward()
opt.step()
return model.eval()The two heads use the same state representation and hidden layer widths. The regression head bounds each output component with tanh. The nine-bin head predicts two independent categorical distributions and decodes their greedy bins to midpoints. Both train with Adam for a fixed 165 epochs. The regression loss is rescaled by the squared action limit, while the held-out comparison reports unscaled decoded action MSE in the same units for both heads. These are two implementations under a shared protocol. The head parameter counts and objectives differ.
PythonIn [6]Expand
@torch.no_grad()
def rollout_one(model, seed, *, radius=0.055, noise=0.0):
env = TabletopPush(seed, radius=radius)
target = seed % 2
other_x = env.blocks[1 - target, 0]
rng = np.random.default_rng(10000 + seed)
hand = [env.hand.copy()]
block = [env.blocks[target].copy()]
clippings = 0
for _ in range(48):
features = torch.from_numpy(env.observe(target)).unsqueeze(0)
action = decoded_actions(model, features)[0].numpy()
action = action + rng.normal(0.0, noise, size=2)
clippings += int(np.any(np.abs(action) > LIMIT))
env.step(action)
hand.append(env.hand.copy())
block.append(env.blocks[target].copy())
if env.blocks[target, 0] >= GOAL:
break
return dict(
success=bool(env.blocks[target, 0] >= GOAL),
wrong_block=bool(env.blocks[1 - target, 0] - other_x > 0.02),
time_steps=len(hand) - 1,
clips=clippings,
hand=np.asarray(hand),
block=np.asarray(block),
)Use a disjoint episode split for the training, development and execution sets. Comparing rows that came from the same trajectory across a random split would test interpolation within familiar episodes. Here the split is by initial-state seed. The development set contains scripted state-action pairs from 20 separate episodes. The closed-loop set uses 24 other seeds in each condition, and every head starts the corresponding episode from the same initial state.
PythonIn [7]Expand
nominal = collect(range(80))
dev = collect(range(80, 100))
randomized = collect(range(80), radius_range=(0.045, 0.100))
regression = train(nominal)
tokenized = train(nominal, bins=9)
regression_randomized = train(randomized)
conditions = {
"Nominal": {},
"Larger radius": {"radius": 0.085},
"Actuation noise": {"noise": 0.012},
"Both shifts": {"radius": 0.085, "noise": 0.012},
}
models = {
"Regression": regression,
"Binned": tokenized,
"Radius-trained": regression_randomized,
}
results = {
name: {
condition: [
rollout_one(model, seed, **settings) for seed in range(100, 124)
]
for condition, settings in conditions.items()
}
for name, model in models.items()
}
with torch.no_grad():
dev_mse = {
name: F.mse_loss(decoded_actions(model, dev[0]), dev[1]).item()
for name, model in models.items()
}ConsoleOut [8]Expand
Nominal training: 1279 transitions, expert 80/80 Development: 333 transitions, expert 20/20 Radius training: 1234 transitions, expert 80/80 Regression: decoded development MSE 0.0000560 Nominal: 18/24 reach goal; 0/24 move other block by >0.02; 0/549 steps clipped Larger radius: 18/24 reach goal; 0/24 move other block by >0.02; 0/535 steps clipped Actuation noise: 19/24 reach goal; 0/24 move other block by >0.02; 156/593 steps clipped Both shifts: 19/24 reach goal; 0/24 move other block by >0.02; 149/580 steps clipped Binned: decoded development MSE 0.0000515 Nominal: 14/24 reach goal; 0/24 move other block by >0.02; 0/718 steps clipped Larger radius: 14/24 reach goal; 0/24 move other block by >0.02; 0/718 steps clipped Actuation noise: 12/24 reach goal; 0/24 move other block by >0.02; 264/854 steps clipped Both shifts: 17/24 reach goal; 0/24 move other block by >0.02; 215/707 steps clipped Radius-trained: decoded development MSE 0.0000551 Nominal: 18/24 reach goal; 0/24 move other block by >0.02; 0/545 steps clipped Larger radius: 18/24 reach goal; 0/24 move other block by >0.02; 0/533 steps clipped Actuation noise: 19/24 reach goal; 0/24 move other block by >0.02; 155/577 steps clipped Both shifts: 19/24 reach goal; 0/24 move other block by >0.02; 148/562 steps clipped
The decoded development MSE is smaller for the binned head in this run, yet the regression head completes more nominal rollouts. Those measures weight different events. The development loss weights individual scripted transitions, while success asks whether a learned trajectory reaches the goal. The rollout can also count off-target movement and command clipping. No rollout moved the other block more than 0.02 in this experiment. That is an observed result for these seeds and this two-lane contact rule.
The noise perturbation uses a separate per-episode generator. Each model sees the same sequence of noise draws up to the length of its rollout on the corresponding seed. Noise results therefore compare paired initial states and noise streams. A rollout that finishes early consumes fewer commands; the clipping denominator counts only applied steps and differs across policies. The radius change affects whether a hand position counts as being in contact. The fixture keeps initial states fixed across radius conditions.
VisualizationOut [9]Expand

The displayed seed was selected by its index in the fixed closed-loop range. The full output gives the denominator and outcomes for the other initial states. A plotted path can show where contact was made or missed, but one path cannot establish what caused the aggregate ranking.
VisualizationOut [10]Expand

Radius randomization matches the baseline on demonstration episode count and seed identities, and both train with the same number of gradient updates. Earlier completion gives different transition counts. The radius-trained policy ties nominal regression on all four success counts here, so this run provides no evidence of an improvement in success count from that training change. The shifts are changes inside a simulator; they are not a physical transfer result.
Comments
Add to the conversation
A question, a correction, or an example from your own work.
No comments yet. Be the first to share your thoughts!