LeMario: Training a JEPA World Model on Super Mario Bros — Technical Walkthrough and Postmortem

Benjamin Bai's LeMario project reproduces LeWorldModel — a small Joint-Embedding Predictive Architecture (JEPA) — from scratch and trains it on Super Mario Bros. The detailed technical walkthrough covers the full architecture, training setup, and a frank postmortem of what worked and what didn't.
Architecture Overview
The model processes four consecutive Mario frames. A vision encoder compresses each frame into a 192-dimensional latent vector: z_t = E_θ(x_t), z_t ∈ R^192. Actions (button states for Left, Right, Up, Down, A, B over five emulator frames) are encoded separately into another 192-dimensional vector via an action encoder.
The frame and action latents feed into a causal predictor with six transformer blocks. Actions are injected via Adaptive LayerNorm Zero (AdaLN-Zero), which produces shift, scale, and gate controls per branch (attention and MLP). The gate controls how strongly updates affect the predicted state. Weights start at zero so the predictor learns gradually.
The predictor outputs three predicted future latents: ẑ₁, ẑ₂, ẑ₃. These are compared with the latents of the three real next frames using MSE loss: L_pred = MSE([ẑ₁,ẑ₂,ẑ₃], [z₁,z₂,z₃]). To prevent representation collapse, SIGReg regularization is added: L = L_pred + 0.1 * L_SIGReg.
What Worked
- Model generalized to held-out episodes.
- Used action information effectively.
- Predicted five-step futures better than strong baselines.
- Raw reward-free planning could move Mario within 2-5 pixels of nearby image goals.
What Failed
- When goals were placed farther into the level, Mario couldn't reliably jump over the first major obstacle.
- Could not navigate toward a single distant goal image.
- Conclusion: predicting the game ≠ learning to make progress. The model learned pixel-level dynamics but not long-horizon planning or goal-directed behavior.
Key Lessons
Bai notes that most lessons seem obvious in hindsight. The gap between short-term prediction and long-horizon planning is critical — and not captured by standard prediction loss. The post details experiments that gradually exposed this limitation.
📖 Read the full source: HN AI Agents
👀 See Also

DeepSeek Withholds Latest AI Model from Nvidia and AMD
DeepSeek is withholding its latest AI model from U.S. chipmakers including Nvidia and AMD, according to Reuters sources. The article has 19 points and 3 comments on Hacker News.

GitHub disables Copilot's ability to insert ads into pull requests after developer backlash
GitHub has removed Copilot's ability to insert promotional 'tips' into pull requests after developers discovered it was adding ads for tools like Raycast. The feature, which allowed Copilot to edit PRs it didn't create when mentioned, was disabled following community feedback.

Agent Infrastructure for SMB Operations: A White Paper from a QSR Operator-Turned-Builder
A 16-year QSR operator published a white paper arguing for a missing infrastructure layer between generic AI chat and vertical SaaS dashboards, with 8 skills on ClawHub, 1,500+ downloads, and one live deployment outside QSR.

Unlocking OpenClaw's Potential: Integrating with CodeX
Discover how OpenClaw users can seamlessly invoke CodeX for enhanced functionality. Explore user discussions and key methods in this engaging tutorial.