PaperLeet

DreamerV3 Symlog and Two-Hot Value Encoding

DreamerV3 · arXiv 2023 · Medium · 30 minutes

DreamerV3 Symlog and Two-Hot Value Encoding: implement the interfaces below and verify numerical, boundary and experimental behavior.

Implement scale-robust scalar transforms and discrete-support encoding; omit the RSSM, imagined policy and Minecraft. two_hot receives values already in symlog space and caller-supplied centers.

Functions to implement

DreamerV3 Symlog and Two-Hot Value Encoding

1. Exercise goal

DreamerV3 Symlog and Two-Hot Value Encoding: implement the interfaces below and verify numerical, boundary and experimental behavior.

Implement scale-robust scalar transforms and discrete-support encoding; omit the RSSM, imagined policy and Minecraft. two_hot receives values already in symlog space and caller-supplied centers.

2. Core equations

$$ \operatorname{symlog}(x)=\operatorname{sign}(x)\ln(1+|x|),\quad \operatorname{symexp}(y)=\operatorname{sign}(y)(e^{|y|}-1),\quad p_i=\frac{b_{i+1}-y}{b_{i+1}-b_i},\quad p_{i+1}=1-p_i. $$

3. From equations to code

  • symlog(values: Tensor) -> Tensor
  • symexp(values: Tensor) -> Tensor
  • two_hot(values: Tensor, bins: Tensor) -> Tensor

Apply symlog to raw scalars, then interpolate mass between adjacent centers. Encoded expectation equals the clipped transformed value. Decode the expectation in transformed space with symexp; averaging symexp of centers is a different operation.

4. Contract and boundaries

Symlog/symexp accept nonempty floating tensors. two_hot values have any nonempty shape, bins are strictly increasing 1-D, length>=2, same dtype/device. Labels detach and values outside support clip to endpoints; output shape is values.shape+(N,).

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

Related exercises