Step 7: Action Chunking
Instead of predicting one action at a time, predict a sequence of actions (chunk). This captures temporal structure and is a key idea from ACT (Action Chunking with Transformers) that carries into Pi0.
Step 7: Action Chunking
Goal
Instead of predicting one action at a time, predict a sequence of actions (chunk). This captures temporal structure and is a key idea from ACT (Action Chunking with Transformers) that carries into Pi0.
Concept
Before (single action):
- Input: observation
- Output: action (2D)
- Execute, get new obs, repeat
After (action chunk):
- Input: observation
- Output: action sequence [a₁, a₂, ..., aₖ] (k×2D)
- Execute all k actions (open-loop), then get new obs and predict again
Implementation
- Same CNN encoder as BC
- Output layer predicts
chunk_size * action_dimvalues - Reshape to
(chunk_size, 2)for execution - Dataset pairs each observation with next
chunk_sizeactions
Execution Modes
Controlled via actions_per_inference parameter:
Open-loop: actions_per_inference=8 (default)
- Execute entire chunk blindly, then re-observe
- Simple, but errors compound over k steps
Receding horizon: actions_per_inference=1
- Predict chunk every step, only use first action
- More reactive, more compute
Partial: actions_per_inference=4
- Middle ground - predict 8, execute 4, then re-predict
- Good balance of reactivity and efficiency
Episode Boundary Handling
Problem: Original data collection flattened all episodes into one array. Action chunks near episode boundaries would include actions from the next episode.
Solution:
- Data collection now saves
episode_endsarray marking where each episode ends - Dataset pads chunks with zeros at episode boundaries instead of crossing into next episode
- This teaches the model to predict "do nothing" near success states
Training Setup
- chunk_size: 8
- Same hyperparameters as BC (lr=1e-3, batch_size=64)
- Data: expert + dagger (10k samples)
- Train/val split: 0.7
- Best checkpoint: epoch 6 (val_loss=3.25)
- Observed overfitting after epoch 6 (train kept dropping, val plateaued ~3.5)
Results
Without episode_ends (v1):
- Policy works but shows jittering/overshooting
- Open-loop errors compound, expert data noise amplified
With episode_ends + receding horizon (v2):
actions_per_inference=4smooths out jitter- Cleaner data + more frequent re-prediction helps
Honest assessment:
- Episode ends training improved data quality
- Receding horizon (4) made execution noticeably smoother
- But overall performance is not dramatically better than BC + DAgger for this simple task
- Action chunking likely shines more on complex tasks with temporal structure (multi-step manipulation, longer horizons) rather than this simple ball-catching task
Videos
| Description | Video |
|---|---|
| Initial open-loop, some jitter | 07_action_chunking_policy.mp4 |
| Receding horizon (4), smoother | 07_action_chunking_policy_rh4.mp4 |
| With episode ends | 07_action_chunking_policy_episode_ends.mp4 |
| Episode ends + RH4 | 07_action_chunking_policy_rh4_episode_ends.mp4 |
| Episode ends + zero padding | 07_action_chunking_policy_episode_ends_padded.mp4 |
| Episode ends + zero padding + RH4 | 07_action_chunking_policy_rh4_episode_ends_padded.mp4 |
Status
Complete
Location: policy/action_chunking_policy.py, data/dataset.py
Related Documents
基于命题分块以增强RAG
命题分块技术(Proposition Chunking)——这是一种通过将文档分解为原子级事实陈述来实现更精准检索的先进方法。与传统仅按字符数分割文本的分块方式不同,命题分块能保持单个事实的语义完整性。
TileMap Chunk Manager
**Category:** Performance - 2D Rendering & Memory Management
🤖 n8n AI Agent Mastery Course 2025
Welcome to the most comprehensive n8n AI Agent course! Build powerful automation workflows and intelligent AI agents using n8n's visual workflow builder.
Document Chunking/Splitting in Langroid
Langroid's [`ParsingConfig`][langroid.parsing.parser.ParsingConfig]