hybrid_aif.reference.raif.world#
Reference world models as declared Systems: R-AIF’s tiny RSSM and its CRSPP.
The placement of tiny_core()’s parts into slots:
state factors deter = the Deterministic GRU carry (controlled: the action)
stoch = the 32x32 categorical code (parent: deter, same step)
transition transition:deter GRU(deter, flat stoch_{t-1}, action)
transition:stoch p(stoch | deter_t)
initial priors initial_state_prior:deter LearnedVector
initial_state_prior:stoch DerivedInitial()
modalities likelihood:state symlog_mse over [deter, flat stoch]
likelihood:reward symlog_disc, 255 bins over [-20, 20]
likelihood:cont binary (continuation, not termination)
recognition recognition:embed MLP over the state observation (symlog inputs)
recognition:stoch q(stoch | deter_t, embed)
deter is declared first because stoch’s transition parent is the carry at the same
step. The G side is not part of the world model; the agent mounts it
(hybrid_aif.reference.raif.agent.raif_mountain_car()).
Design: docs/design/amortization-p0-addendum.md §§1–3.
Functions
|
The name of the control node the sugar creates for |
|
R-AIF's CRSPP prior-preference model: |
|
The engine's |
|
R-AIF's |
|
R-AIF's |
Classes
|
Array base class for JAX |
|
A continuous control node's support: |
|
"This state factor's initial belief is its own transition, at the episode start." |
|
A deterministic node: a pure map, optionally with trainable parameters. |
|
A trainable vector behind an activation: a parametrized constant, with no parents. |
|
MLP over concatenated parents → a factored categorical child. |
|
MLP over concatenated parents → a raw output vector, with no density of its own. |
|
An |
|
An RSSM world model: GRU carry, categorical prior/posterior, three heads. |
|
One amortized variable's structural declaration: its recognition slot. |
|
Static structure of a System: discrete, continuous or mixed. |
|
All numeric state of a System: generative tensors, designations and the closed-loop factors. |
- hybrid_aif.reference.raif.world.init_of(winit)[source]#
The engine’s
init=for theirwinit("default"|"normal").
- hybrid_aif.reference.raif.world.tiny_core(
- obs_dim,
- action_dim,
- *,
- key,
- deter=128,
- num_vars=32,
- num_classes=32,
- units=32,
- mlp_units=64,
- mlp_layers=2,
- embed=64,
- unimix=0.01,
- num_bins=255,
- bin_low=-20.0,
- bin_high=20.0,
- activation='silu',
- norm=True,
- winit='default',
R-AIF’s
tinyworld model as anRSSMCore, state-based.rssm {deter 128, stoch 32, classes 32},units 32inside the RSSM and on the reward/continuation heads,mlp_units 64/ 2 layers on the encoder and decoder,unimix 0.01, a 255-binsymlog_discreward over [-20, 20].winitreaches every block:"normal"is theirwinit: normal, fan: avgwith no bias where a layer is normed;"default"is eqx’s initializer with every bias kept.Design:
docs/experiments/raif-mountain-car/divergence-register.md(divergences 17, 26).
- hybrid_aif.reference.raif.world.tiny_rssm(
- obs_dim,
- action_dim,
- *,
- key,
- action_low=-1.0,
- action_high=1.0,
- policy_len=8,
- learned_initial=True,
- **tiny,
R-AIF’s
tinyworld model as a(System, SystemParams)pair.obs_dim/action_dimare the environment’s (Mountain Car: 2 and 1).keyand the extra keyword arguments (deter,num_vars,units,unimix, …) go totiny_core().learned_initial=Falsefreezes the initial carry at zero (theirinitial: 'zeros').policy_lenis theirimag_horizon: the explicit rollout steps before theg_tailcritic closes the horizon. The carry reads a continuous control node, its box[action_low, action_high]inparams.control; its action node emits the value to the env. The G side is mounted on the returned pair by the agent.
- hybrid_aif.reference.raif.world.crspp_rssm(
- *,
- key,
- policy_len=8,
- deter=128,
- num_vars=32,
- num_classes=32,
- units=32,
- embed=64,
- unimix=0.01,
- activation='silu',
- norm=True,
- winit='default',
R-AIF’s CRSPP prior-preference model:
tiny_rssmwithout the action or the heads.A separate parameter set with its own GRU and prior and no modality, so it is only rolled forward, never observed. Its
recognition:stochconditions on(deter, external:embed):embed’s width is declared inSystem.external_inputsand must match the agent’s encoder (tiny_rssm’sembed, 64 by default); its value is supplied per call byhybrid_aif.reference.raif.crspp.crspp_recognize(). Thecosine_sim_to_pref_rolloutrow owns it throughSystem.scoringandSystemParams.scoring.policy_lenis carried but unused: the row rolls the agent’s horizon.Design:
docs/design/amortization-debt-ledger.mdentry 5.