Add model card
Browse files
README.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
tags:
|
| 4 |
+
- jepa
|
| 5 |
+
- world-model
|
| 6 |
+
- reinforcement-learning
|
| 7 |
+
- latent-planning
|
| 8 |
+
- cem
|
| 9 |
+
library_name: pytorch
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
# relay — JEPA plans a turn-based contact-push puzzle in latent space
|
| 13 |
+
|
| 14 |
+
A 26M-parameter Joint Embedding Predictive Architecture (JEPA) trained
|
| 15 |
+
to play a 2-player turn-based T-block puzzle against humans. Plans
|
| 16 |
+
each turn via CEM in pure embedding space — no physics simulator on
|
| 17 |
+
the model's side at inference.
|
| 18 |
+
|
| 19 |
+
- **Code**: <https://github.com/SotoAlt/relay>
|
| 20 |
+
- **Live demo**: <https://sotoalt.dev/experiments/relay.html>
|
| 21 |
+
- **Paper recipe**: [LeWorldModel](https://arxiv.org/abs/2603.19312) (LeCun et al., 2026)
|
| 22 |
+
+ [DexWM](https://arxiv.org/abs/2512.13644) joint state head
|
| 23 |
+
|
| 24 |
+
## Architecture
|
| 25 |
+
|
| 26 |
+
- ViT-Tiny encoder (`vit_tiny_patch14_224`, trained from scratch, **unfrozen**, 192-dim)
|
| 27 |
+
- Projector MLP(192→2048→192) + BatchNorm
|
| 28 |
+
- AR causal Transformer predictor (AdaLN, 6 layers, 16 heads, mlp_dim=2048)
|
| 29 |
+
- DexWM-style joint state head MLP(192→256→256→8) trained alongside the predictor
|
| 30 |
+
- Loss: `MSE_pred + 0.09·SIGReg + 10·MSE_state`
|
| 31 |
+
|
| 32 |
+
## Training data
|
| 33 |
+
|
| 34 |
+
12,500 episodes × 40 steps × 5 regimes (contact_push 40%,
|
| 35 |
+
approach_no_push 25%, null_thrust 15%, near_t 10%, far_from_t 10%).
|
| 36 |
+
500K frames at 224×224 RGB with 5-frame action chunks (matches
|
| 37 |
+
gameplay turn structure).
|
| 38 |
+
|
| 39 |
+
## Quick start
|
| 40 |
+
|
| 41 |
+
```bash
|
| 42 |
+
git clone https://github.com/SotoAlt/relay.git
|
| 43 |
+
cd relay
|
| 44 |
+
pip install torch torchvision timm einops pymunk pygame opencv-python-headless \
|
| 45 |
+
shapely fastapi 'uvicorn[standard]' numpy pillow h5py
|
| 46 |
+
|
| 47 |
+
huggingface-cli download sotoalt/relay relay_stage1_v9_trackE_ep02_uhead.pt \
|
| 48 |
+
--local-dir checkpoints/
|
| 49 |
+
|
| 50 |
+
PYTHONPATH=. python -m world_model.infer_relay \
|
| 51 |
+
--port 8800 --device cpu \
|
| 52 |
+
--checkpoint-v9 checkpoints/relay_stage1_v9_trackE_ep02_uhead.pt \
|
| 53 |
+
--model-execute-jepa
|
| 54 |
+
```
|
| 55 |
+
|
| 56 |
+
Open `http://localhost:8800/`.
|
| 57 |
+
|
| 58 |
+
## Results
|
| 59 |
+
|
| 60 |
+
Phase A joint training, λ_state=10, 5-epoch fine-tune validation:
|
| 61 |
+
|
| 62 |
+
| metric | pre-joint v9 | post-joint v9 |
|
| 63 |
+
|---|---|---|
|
| 64 |
+
| `val_pred` | 0.0071 | 0.036 |
|
| 65 |
+
| `val_state` | 0.032 (Phase B) | **0.007** (4.6× better) |
|
| 66 |
+
| pymunk calibration probe `agent_mae` | ~113 px | **~54 px (-52%)** |
|
| 67 |
+
|
| 68 |
+
Match-play (model-execute-jepa, 12 × 4 opponent policies):
|
| 69 |
+
|
| 70 |
+
| opponent | win % | net progress |
|
| 71 |
+
|---|---|---|
|
| 72 |
+
| random | 92% | +126 |
|
| 73 |
+
| passive | 100% | +149 |
|
| 74 |
+
| chase_t | 0% | -67 |
|
| 75 |
+
| adversarial | 25% | -10 |
|
| 76 |
+
|
| 77 |
+
## License
|
| 78 |
+
|
| 79 |
+
MIT
|