PaperLeet

DayDreamer Balanced Categorical World-Model KL

DayDreamer · CoRL 2022 · Medium · 30 minutes

DayDreamer Balanced Categorical World-Model KL: implement the interfaces below and verify numerical, boundary and experimental behavior.

Isolate the DreamerV2-style KL balancing used by DayDreamer, with default alpha=0.8. Compute KL before free-nats clipping; omit the RSSM and online robot training.

Functions to implement

DayDreamer Balanced Categorical World-Model KL

1. Exercise goal

DayDreamer Balanced Categorical World-Model KL: implement the interfaces below and verify numerical, boundary and experimental behavior.

Isolate the DreamerV2-style KL balancing used by DayDreamer, with default alpha=0.8. Compute KL before free-nats clipping; omit the RSSM and online robot training.

2. Core equations

$$ L=\alpha D_{KL}(\operatorname{sg}(q)\Vert p)+(1-\alpha)D_{KL}(q\Vert\operatorname{sg}(p)). $$

3. From equations to code

  • balanced_kl(posterior_logits: Tensor, prior_logits: Tensor, alpha: float=0.8) -> Tensor

Use log_softmax for logq/logp. The dynamics term freezes all of q, both probabilities and logq; the representation term freezes logp. Alpha one updates only the prior, alpha zero only the posterior. A weighted undetached KL cannot reproduce this split.

4. Contract and boundaries

Posterior/prior logits are (B,K,C), C>=2, alpha in [0,1]. Sum KL over K categorical latents and average B. Forward values are alpha-invariant while gradient allocation depends on alpha.

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:2206.14176

Related exercises