OpenVLA Action Tokens and Quantile Unnormalization
OpenVLA · CoRL 2024 · Medium · 30 minutes
OpenVLA Action Tokens and Quantile Unnormalization: implement the interfaces below and verify numerical, boundary and experimental behavior.
Reproduce official ActionTokenizer conventions and action unnormalization without a 7B model. Smaller edge arrays make examples inspectable; the official default has 256 edges and 255 centers.
Functions to implement
encode_actions(actions: Tensor, edges: Tensor, vocab_size: int) -> Tensordecode_actions(tokens: Tensor, edges: Tensor, vocab_size: int) -> Tensorunnormalize_actions(actions: Tensor, q01: Tensor, q99: Tensor, mask: Tensor) -> Tensor
OpenVLA Action Tokens and Quantile Unnormalization
1. Exercise goal
OpenVLA Action Tokens and Quantile Unnormalization: implement the interfaces below and verify numerical, boundary and experimental behavior.
Reproduce official ActionTokenizer conventions and action unnormalization without a 7B model. Smaller edge arrays make examples inspectable; the official default has 256 edges and 255 centers.
2. Core equations
$$ d=\sum_j\mathbf1[\operatorname{clip}(a,-1,1)\ge e_j],\quad t=V-d,\quad \hat a=(e_i+e_{i+1})/2,\ i=\operatorname{clip}(V-t-1,0,N-2). $$
3. From equations to code
encode_actions(actions: Tensor, edges: Tensor, vocab_size: int) -> Tensordecode_actions(tokens: Tensor, edges: Tensor, vocab_size: int) -> Tensorunnormalize_actions(actions: Tensor, q01: Tensor, q99: Tensor, mask: Tensor) -> Tensor
Encoding reverses IDs from the vocabulary end. The official np.digitize right=False convention assigns exact edges to the bin on their right. The maximum edge receives the last code and decoding clips it to the last center. Unnormalization transforms only masked coordinates.
4. Contract and boundaries
Actions are any nonempty floating tensor; edges is strictly increasing 1-D with endpoints -1/+1, vocab_size>=number of edges. Tokens are int64 in [0,V); non-action vocabulary IDs clip to endpoint centers on decoding. Unnormalization takes (B,D), q01/q99 (D,) with q99>q01, and bool mask (D,).
Validation helpers are provided. All floating inputs are finite CPU float32/float64; do not mutate inputs. Invalid shape, dtype, range or mask arguments raise ValueError.
5. Deterministic experiment and visualization
experiment.py calls every submitted interface on fixed inputs and records a learning or sampling curve and terminal metrics. T3 states the behavioral thresholds; the visualization uses the same outputs.
The visualization is generated by viz/gen.py; T3 runs the same experiment with your functions and records its actual metrics. These are small deterministic teaching results, not a robot benchmark.
6. Run your implementation
Complete the functions in the Python editor on the right, then click Run tests. Inspect each failed check, update your implementation, and run again. Passing every required check marks the problem as solved and unlocks the notes.
7. Sources and extensions
- OpenVLA: An Open-Source Vision-Language-Action Model — Official action_tokenizer.py digitize / reversed IDs; OpenVLA.predict_action quantile unnormalization
- Verified source
- Verified source
Verified 2026-10-28. Extending this operator to the full paper requires the omitted model, data and environment described in the scope above.