Robohouse ’26 Library
Contents

Chapter 12

Data flow, tensor shapes, and the code map for this repository

2 sections · about 2 minutes

12.1 Rollout buffer record, per macro-step

FieldShape / typeProducerConsumer
imageuint8 [3, 224, 448]workerlearner (cache recompute, imagination)
propriofloat32 [8] (normalised)workerlearner
task_id, seed, group_idintsworkeradvantage grouping, context lookup
chainfloat32 [K+1, 32, 7]workeractor log-prob recompute
k_starint (or [K_sde] ints for the variant)workerwhich step(s) are stochastic
logp_oldfloat32 [1] (or [K_sde])workerPPO ratio
future_framesuint8 [2, 3, 224, 448] at +4, +8workerreconstruction reward
r_task, donefloat, boolworkerreturns
r_recfloatlearnerreturns
RR, A_hatfloatlearneractor loss

Per successful episode, additionally: frames uint8 [T, 3, 224, 448] and executed_actions float32 [T, 7] for video SFT.

12.2 Proposed module layout

All new code goes under src/fastwam/rl/ so the existing training and evaluation paths are untouched.

  • flow_sde.pysample_chain(model, state, K, a, generator, stochastic_steps="one_random") returning (A, chain, k_star, logp_old), used by workers; and logprob_chain(model, states, chains, k_star, a) returning the stochastic-step log-probabilities with gradients, used by the learner. Both must build their σ schedule through model.infer_action_scheduler.build_inference_schedule(K, …) so that the σ and Δ values are bit-identical between rollout and learner.
  • rollout_worker.py — a fork of experiments/libero/eval_libero_single.py in which _predict_action_chunk calls sample_chain instead of infer_action, the frames at the required offsets are captured, and episodes are serialised. experiments/libero/worker_pool.py can be reused for GPU scheduling and fault tolerance.
  • reward.pyreconstruction_reward(model, batch, use_frozen) running the imagination path and the VAE decode, frame matching, pixel MSE, and a running normaliser.
  • advantage.py — grouped returns, group normalisation, degenerate-group dropping, and the hard-task sampling weights.
  • losses.pyppo_flow_loss, feature_kl_loss (with forward hooks capturing the per-layer cache of the live and frozen video expert), and a wrapper that calls model.training_loss with the chosen λaction\lambda_{\mathrm{action}}.
  • learner.py — the iteration loop of Chapter 11, LoRA injection on model.video_expert (via peft), the two optimisers, checkpointing, and weight broadcast.
  • configs/rl/libero_wamrl.yaml — a Hydra config extending sim_libero and libero_optional_idm_2cam224_1e-4, with an RL: block holding the Chapter 11 table.