PaperLeet

RT-2 Action-Vocabulary Constrained Decoding

RT-2 · CoRL 2023 · Medium · 30 minutes

RT-2 Action-Vocabulary Constrained Decoding: implement the interfaces below and verify numerical, boundary and experimental behavior.

Implement output constraints for robot and vision-language rows sharing logits; callers supply action-token identities. Omit PaLI-X, PaLM-E and semantic reasoning.

Functions to implement

RT-2 Action-Vocabulary Constrained Decoding

1. Exercise goal

RT-2 Action-Vocabulary Constrained Decoding: implement the interfaces below and verify numerical, boundary and experimental behavior.

Implement output constraints for robot and vision-language rows sharing logits; callers supply action-token identities. Omit PaLI-X, PaLM-E and semantic reasoning.

2. Core equations

$$ p_{bv}=\frac{\mathbf1[v\in A_b]e^{z_{bv}}}{\sum_{u\in A_b}e^{z_{bu}}},\quad A_b=A\ \text{(robot)},\ A_b=V\ \text{(VLM)}. $$

3. From equations to code

  • action_probabilities(logits: Tensor, action_tokens: Tensor, is_robot: Tensor) -> Tensor

Construct the allowed set per row, replace disallowed logits with negative infinity, then apply stable softmax. Zeroing probabilities afterward breaks normalization. Disallowed robot logits have zero output probability and gradient.

4. Contract and boundaries

Logits are (B,V), action_tokens is bool (V,) with at least one true, is_robot bool (B,). Robot rows allow action tokens only; other rows allow the full vocabulary.

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

Verified 2026-10-28. Extending this operator to the full paper requires the omitted model, data and environment described in the scope above.

Read paper · arXiv:2307.15818

Related exercises