Skip to main content

Embodied Intelligence and World Models

The Embodied Cognition Hypothesis​

Embodied Intelligence rejects the classical AI view that the mind is pure computation, independent of the body. Instead, cognition is grounded in sensorimotor experience: how we think, learn, and reason emerges from interaction with the physical world through our bodies.

For robots, this means:

  1. Perception is Action-Oriented: A robot doesn't passively observe; it actively positions sensors to gather relevant information.
  2. Learning is Multimodal: The robot learns by doing—proprioceptive feedback (where body parts are) couples with visual and tactile perception.
  3. Semantics are Physical: Concepts like "grasping," "pushing," and "balance" are understood through enacted experience, not symbolic rules.

This shift has profound implications for building AI systems that genuinely understand the physical world.

World Models and Predictive Learning​

A world model is a learned, internal representation of how the environment evolves. Rather than predicting the final outcome of an action, a world model predicts the next sensory state given the current state and action.

Why World Models?​

  • Sample Efficiency: By predicting what happens next, robots learn physics without millions of trial-and-error experiments.
  • Planning Offline: A learned model enables planning and reasoning before acting, crucial for safety.
  • Generalization: Models that capture the underlying dynamics can generalize to new objects, scenes, and tasks.
  • Intrinsic Motivation: Surprises (prediction errors) signal where the model is weak, enabling curiosity-driven exploration.

Technical Deep Dive: Latent Dynamics Models​

Modern world models operate in a learned latent space—a compressed representation of high-dimensional sensory data.

Architecture Overview​

RGB Image → CNN Encoder → Latent State → Dynamics MLP → Next Latent State → CNN Decoder → Next RGB Image

The process:

  1. Encode high-dimensional observations (e.g., 224×224 RGB images) into a compact latent vector
  2. Predict how the latent state evolves under an action
  3. Decode the predicted latent state back to sensory space for validation

Code Example: A Simple Latent Dynamics Model​

import torch
import torch.nn as nn

class LatentDynamicsModel(nn.Module):
"""Learns to predict next latent state from current state and action."""

def __init__(self, latent_dim=64, action_dim=4, hidden_dim=256):
super().__init__()
self.latent_dim = latent_dim
self.action_dim = action_dim

# Encoder: RGB image -> latent vector
self.encoder = nn.Sequential(
nn.Conv2d(3, 64, kernel_size=4, stride=2, padding=1),
nn.ReLU(),
nn.Conv2d(64, 128, kernel_size=4, stride=2, padding=1),
nn.ReLU(),
nn.AdaptiveAvgPool2d((1, 1)),
nn.Flatten(),
nn.Linear(128, latent_dim)
)

# Dynamics: predict next latent from current latent + action
self.dynamics = nn.Sequential(
nn.Linear(latent_dim + action_dim, hidden_dim),
nn.ReLU(),
nn.Linear(hidden_dim, hidden_dim),
nn.ReLU(),
nn.Linear(hidden_dim, latent_dim)
)

# Decoder: latent vector -> RGB image
self.decoder = nn.Sequential(
nn.Linear(latent_dim, 128 * 8 * 8),
nn.ReLU(),
nn.Unflatten(1, (128, 8, 8)),
nn.ConvTranspose2d(128, 64, kernel_size=4, stride=2, padding=1),
nn.ReLU(),
nn.ConvTranspose2d(64, 3, kernel_size=4, stride=2, padding=1),
nn.Sigmoid()
)

def encode(self, image):
"""Image (B, 3, H, W) -> latent (B, latent_dim)"""
return self.encoder(image)

def predict_next_latent(self, latent, action):
"""Predict next latent state."""
combined = torch.cat([latent, action], dim=-1)
next_latent = self.dynamics(combined)
return next_latent

def decode(self, latent):
"""Latent (B, latent_dim) -> image (B, 3, H, W)"""
return self.decoder(latent)

def forward(self, image, action):
"""Full pipeline: image + action -> predicted next image."""
latent = self.encode(image)
next_latent = self.predict_next_latent(latent, action)
predicted_next_image = self.decode(next_latent)
return predicted_next_image, next_latent

# Usage
model = LatentDynamicsModel(latent_dim=64, action_dim=4)
current_image = torch.randn(4, 3, 64, 64) # Batch of 4 images
action = torch.randn(4, 4) # Batch of 4 actions
predicted_next, latent_pred = model(current_image, action)
print(f"Predicted next image shape: {predicted_next.shape}") # (4, 3, 64, 64)

Training Objective​

The loss function encourages accurate prediction:

criterion = nn.MSELoss()
# Assume `next_image` is the ground truth next observation
loss = criterion(predicted_next, next_image)

This simple objective—predict the next frame—drives learning of meaningful physics representations.

Case Study: PlaNet and Dreamer​

PlaNet (Dreamer's predecessor) learns a world model in a latent space and uses it for model-based RL. The process:

  1. Collect Experience: Interaction in the environment yields (image, action, reward) tuples
  2. Learn Latent Dynamics: Train encoder-dynamics-decoder on image prediction
  3. Plan in Imagination: Use the learned model to imagine action sequences and evaluate them without real interaction
  4. Execute Best Plan: Act in the real world according to the plan

Dreamer extends this with:

  • Variational autoencoders (VAEs) for richer latent distributions
  • Actor-critic learning in the learned model
  • Improved exploration strategies

The result: Robots learn complex behaviors like robotic manipulation from just 100 hours of real experience, by leveraging model-based planning.

Embodied Semantic Understanding​

Recent work bridges vision-language models with robotics. A robot equipped with a world model can now answer questions like "where would the object be if I pushed it to the left?" by simulating in imagination before acting.

Minimal Example: VLM-Informed World Model​

# Pseudo-code showing integration with vision-language models
from transformers import CLIPVisionModel, CLIPTextModel

class SemanticWorldModel(nn.Module):
def __init__(self, latent_dynamics_model, vlm_vision_encoder):
super().__init__()
self.dynamics = latent_dynamics_model
self.vlm = vlm_vision_encoder # Frozen CLIP vision encoder

def encode_semantic(self, image):
# Get CLIP embeddings for semantic grounding
clip_features = self.vlm(image)
# Also learn task-specific dynamics
task_latent = self.dynamics.encode(image)
return torch.cat([clip_features, task_latent], dim=-1)

Challenges and Open Questions​

  1. Compounding Error: As predictions extend into the future, small errors accumulate. Longer planning horizons become unreliable.
  2. Stochasticity: Many physical processes are inherently random (e.g., cloth simulation). Deterministic models are insufficient.
  3. High Dimensionality: Learning in pixel space remains computationally expensive. Abstraction is needed.
  4. Sim-to-Real Gap: Models trained on simulation often fail on real robots due to unmodeled physics.

Exercises​

Exercise 2.1: Design a world model architecture for predicting robot gripper position in latent space. Sketch the encoder, dynamics, and decoder modules.

Exercise 2.2: Implement a training loop for a latent dynamics model. Use a simple simulation (e.g., MuJoCo or PyBullet) to generate image, action, and next-image tuples. Train and visualize predictions for 10 steps ahead.

Exercise 2.3: Discuss: Can a world model trained only on visual prediction (without reward signals) learn task-relevant representations? What additional signals might help?


Next Chapter: Chapter 3: Sensor Fusion and Perception