CausalVAE as a Plug-in for World Models: Towards Reliable Counterfactual Dynamics
Organizations: Tsinghua Shenzhen International Graduate School, Tsinghua University · The University of Hong Kong · INFIFORCE Intelligent Technology
Abstract
In this work, CausalVAE is introduced as a plug-in structural module for latent world models and is attached to diverse encoder-transition backbones. Across the reported benchmarks, competitive factual prediction is preserved and intervention-aware counterfactual retrieval is improved after the plug-in is added, suggesting stronger robustness under distribution shift and interventions. The largest gains are observed on the Physics benchmark: when averaged over 8 paired baselines, CF-H@1 is improved by +102.5%. In a representative GNN-NLL setting on Physics, CF-H@1 is increased from 11.0 to 41.0 (+272.7%). Through causal analysis, learned structural dependencies are shown to recover meaningful first-order physical interaction trends, supporting the interpretability of the learned latent causal structure.
Figures & tables
| 1 Step | 5 Steps | 10 Steps | |||||
|---|---|---|---|---|---|---|---|
| Benchmark | Method | H@1 | MRR | H@1 | MRR | H@1 | MRR |
| Physics 3-body | AE_Contrastive | / | / | / | / | / | / |
| AE_NLL | / | / | / | / | / | / | |
| VAE_Contrastive | / | / | / | / | / | / | |
| VAE_NLL | / | / | / | / | / | / | |
| Modular_Contrastive | / | / | / | / | / | / | |
| Benchmark | Method | CF-H@1 | H@1 | CF-MRR | MRR |
|---|---|---|---|---|---|
| Physics 3-body | AE_Contrastive | 10.00/24.00 | +14.00 | 49.33/51.77 | +2.44 |
| AE_NLL | 10.50/41.00 | +30.50 | 52.25/66.92 | +14.67 | |
| VAE_Contrastive | 8.50/8.50 | – | 46.00/45.40 | – | |
| VAE_NLL | 10.50/13.00 | +2.50 | 51.75/51.00 | – | |
| Modular_Contrastive | 22.50/25.00 | +2.50 | 59.83/50.62 | – | |
| Modular_NLL | 14.50/22.00 | +7.50 | 55.83/57.50 | +1.67 |
| Variant | H@1 | MRR | CF-H@1 | CF-MRR |
| three-stage training (ours) | 91.00 | 95.16 | ||
| joint training (w/o stage split) | ||||
| Baseline (GNN_Contrastive) | 52.96 | |||
| w/o CausalVAE branch | ||||
| w/o state align loss | ||||
| single-step rollout |
Appendix figures & tables6 assets
Supplementary material from the paper’s appendix.
Appendix
| Setting | Default | Scope |
| Baseline script | train_baselines.py | all baseline / +CausalVAE paired runs |
| Seed | 42 | shared within each paired comparison |
| Optimizer | Adam | shared within each paired comparison |
| Batch size | 1024 | train_baselines.py default |
| Learning rates | slr=lr=transit-lr=finetune-lr =5e-4 | train_baselines.py default |
| Epoch settings | epochs=100 , pretrain-epochs=100 , finetune-epochs=100 | train_baselines.py default |
| Component | Ke et al . [ 9 ] reference setup | Our implementation defaults |
|---|---|---|
| Baseline families | AE, VAE, GNN, Modular | AE, VAE, GNN, Modular (same family split) |
| Encoder/decoder backbone | Kipf-style CNN + MLP encoder/decoder; medium setting; object-wise latents for structured models [ 12 ] . | encoder=small ; shared world-model backbone in train_baselines.py . |
| Latent representation | Fixed per-object embedding (reported as 32 per object in reference setup). | embedding-dim-per-object =5, num-objects =5 (domain-adjusted when needed). |
| Transition parameterization | AE/VAE: MLP transition; GNN: pairwise message passing; Modular: object-wise modular transition. | Model-type-specific transitions selected by --vae , --gnn , --modular . |
| Training objectives | NLL and contrastive settings; ranking metrics at 1/5/10-step horizons. | NLL (default) and contrastive route ( --contrastive ); factual metrics reported at . |
| NLL-type optimization budget | Adam, lr , batch size 512, 100-epoch settings (reported). | pretrain-epochs =100, epochs =100, finetune-epochs =100. |
| Model | Latent structure | Transition module | Key implementation defaults |
|---|---|---|---|
| AE | Monolithic latent vector. | MLP transition over latent + action. | hidden-dim =512, embedding-dim-per-object =5, num-objects =5. |
| VAE | Monolithic latent with posterior . | Same as AE for transition; stochastic latent sampling. | --vae flag; same transition width and action interface as AE. |
| GNN | Object-wise factored latents. | Graph message passing transition (pairwise interaction bias). | --gnn flag; action-conditioned transition with optional --ignore-action / --copy-action . |
| Modular | Object-wise factored latents. | Object-wise modular transition (higher-order interaction capacity). | --modular flag; per-object embedding and shared action interface. |
| Item | Default value | Where used |
|---|---|---|
| Optimizer | Adam | all baseline runs |
| Base learning rates | slr=lr=transit-lr=finetune-lr =5e-4 | baseline NLL and contrastive routes |
| Batch size | 1024 | train_baselines.py |
| Epoch setting A | 100 | baseline NLL-type training budget |
| Epoch setting C | 100 | implementation default retained for reproducibility |
| Contrastive hinge | 1.0 ( --hinge ) | decoder-free contrastive route |
| Benchmark | Query groups (default) | Intervention variables | Notes |
|---|---|---|---|
| Physics (3-body) | Up to 2000 per run. | Object id , axis (x/y), magnitude . | Evaluator default includes obj-idx =0, axis =x, delta =3.0; axis/magnitude sweeps follow protocol settings. |
| 2D Shapes / 3D Cubes | Up to 2000 per run. | Object-level pose/push-related factors. | Single- and multi-target variants; intervention index maps to object-slot metadata. |
| Chemistry | Up to 2000 per run. | Mechanism/factor id and magnitude . | Mechanism-level intervention metadata when available; otherwise use global structural protocol. |
| Component | Choice | Variants | Notes |
|---|---|---|---|
| Intervention time | sampled over prefix window | consistent across methods | |
| Targets | object / variable | single, multi | physics: pos/vel; pushing: pose/push |
| Magnitude | small/med/large | robustness check under intervention strength | |
| Rollout horizon | short/long | drift stress-test at long | |
| Retrieval set | , | fixed per benchmark | negatives from other episodes; for factual metrics |
| Scoring | NLL / similarity | model-dependent | paired comparison protocol |