# Control paradigms on StateLeWM

FlatWorld uses one state + tactile latent world model (StateLeWM), then plugs in three different controllers. Same engine, same latent dynamics idea; different when you plan online, imitate through imagination, or explore with RL.

# Paradigm Flagship tasks Decision time Needs demos?
1 WM + CEM PushToGoal, Two-room, Reacher online planning no
2 WM + BPTT SuperMimic-2D (LAFAN-like skills) offline improve π yes (refs)
3 WM + PPO Push-T offline train π no
                 ┌── CEM / MPC ──► act in FlatWorld     (1)
 observe ─► WM ──┤
                 ├── BPTT through imag. ─► policy π     (2)
                 └── encode z ─► PPO in sim ─► policy π (3)

1. WM + CEM (reacher · push · two-room)

Idea. Freeze a goal-free world model. At every replan, sample force / joint-target sequences in latent space, score a task cost on xy_head (and typed readouts), execute the first action, repeat.

Traits

When to use

Generalizes to

Weak when

Entry points

python -m learning.data.collect --out learning/data/rollouts_500 ...
python -m learning.train --data learning/data/rollouts_500 --out learning/checkpoints/push_game
python -m learning.eval_task --checkpoint learning/checkpoints/push_game --target-mode random
python -m game --checkpoint learning/checkpoints/push_game

Weights: learning/checkpoints/{push_game,two_room,reacher}.


2. WM + BPTT (SuperMimic-2D)

Idea. Fit a shared rigid-body WM from on-policy (or mixed) rollouts. Improve a goal-conditioned policy by backprop through short imagined horizons with a mimic reward / critic — SuperMimic-style, not model-free PPO in the physics loop for the improve step.

Traits

When to use

Generalizes to

Weak when

Entry points

python -m supermimic2d.bake_refs
python -m supermimic2d.train --out supermimic2d/runs/lafan2d --library lafan2d --iters 80
python -m supermimic2d.render_promo --ckpt supermimic2d/runs/lafan2d/best.pt

3. WM + PPO (Push-T)

Idea. Train a frozen StateLeWM on goal-free Push-T contact data. Policy observations are z ‖ task_features (WM encode + pose features); rewards and transitions stay on real FlatWorld physics. PPO via rsl-rl on a vectorized env (multiprocess workers).

Traits

When to use

Generalizes to

Weak when

Entry points

# WM
python -m learning.data.collect ... --out learning/data/push_t_500
python -m learning.train --data learning/data/push_t_500 learning/data/push_t_contact500 \
    --out learning/checkpoints/push_t ...

# WM-obs PPO (tune --num-workers to machine memory / Warp stability)
python -m learning.train_rsl_wm_push_t \
    --wm learning/checkpoints/push_t \
    --out learning/checkpoints/push_t_wm_rsl \
    --num-envs 128 --num-workers 6 --target-rate 0.9

# report eval
python -m learning.eval_rl_push_t_report \
    --policy learning/checkpoints/push_t_wm_rsl/best.pt \
    --wm learning/checkpoints/push_t \
    --out learning/results/wm_rl --tag wm_rsl

Result (40 ep, seed 1000): 36/40 = 90%, mean settle ~127 frames. Weights: learning/checkpoints/push_t, learning/checkpoints/push_t_wm_rsl.


Choosing a stack

Question Prefer
Interactive / replan online, clear xy cost? WM + CEM
Have mocap / style refs, high DoF? WM + BPTT
Underactuated contact, CEM fails, need exploration? WM + PPO
Want one latent front-end for several controllers? Train StateLeWM once; swap (1)–(3)

Roadmap

  1. Unify task API — done. learning/tasks/base.py (FlatWorldTask: observe / sample_goal / potential Φ / metric / succeeded) + adapters.py (CEM / PPO / Mimic helpers). CEM tasks via CEMWorldTask / PushToGoalTask; Push-T overrides potential to match RL progress reward.
  2. Push-T follow-ups — multi-goal T, friction / soft T, CEM residual on PPO; revisit imagination RL only with calibrated long-horizon WM losses.
  3. New CEM scenes — variable-N rearrange, height-field / soft push with the same recipe.
  4. SuperMimic breadth — more clips, contact-rich fight / getup stress tests, WM–sim gap dashboards.
  5. Productization — done. Push-T You vs AI split-screen (python -m game --mode pusht: WASD left, WM+PPO right, 3s countdown, first to seat the T wins). Promo helper: python -m learning.render_pusht_promo. Paradigm write-up = this file; full manuscript is local-only (arXiv cs.RO by author).
  6. Engine — done (isolation) / open (mesh). Parallel env + env_id documented in ENGINE_PARALLEL.md with test2D/test_env_id_isolation.py. Mesh contact batching remains on the backlog in improvement.md.

Cleanup note. Failed imagination-PPO experiment entrypoints were removed from learning/; the takeaway stays here: pure imagination RL on Push-T drifted (~8%), so shipped Push-T uses physics-loop PPO with a frozen WM encoder.

Content backlog (P5)

track next demos
Push-T variants multi-goal T pose, friction / soft-T, CEM residual on PPO
New CEM scenes variable-N rearrange; height-field / soft push with the same StateLeWM recipe
SuperMimic more clips; contact-rich fight / getup stress; WM–sim gap dashboards

These do not block shipping; track progress in this file.