LpWM
INFO
Esta página aún no está traducida. Leer en inglés
Kuang et al., LpWM: A Case for Sparse Representations in World Models, 2026. Paper · Code · Notebook
LpWM is a LeWM-style world model whose latents are non-negative and sparse. Each frame is encoded to one embedding (the encoder's CLS token), projected and passed through a RepReLU link history frames, through the same link. In place of SIGReg, RDMReg matches the codes of each timestep to a rectified Laplace with a sliced 2-Wasserstein distance, which prevents collapse and sets the share of active units:
With p = 1 and mu = 0 half of the target's units are zero. The paper finds that which units fire encodes the discrete regime of the dynamics, and their magnitudes the continuous state within it. Planning is LeWM's: CEM toward the code of a goal image.
Usage
from torch_world.models import LpWM
from torch_world.nn import CLSEncoder
model = LpWM(CLSEncoder(img_size=64, patch_size=8, embed_dim=192), action_dim=2, history=1, depth=6, num_heads=8,
head_dim=32, mlp_dim=768, proj_dim=768, lamb=10.0)
out = model(pixels, actions) # (B, history + 1, C, H, W), (B, history + 1, A)
# out: {"loss", "pred_loss", "rdmreg_loss"}
z = model.encode(pixels) # (B, T, embed_dim), non-negative with exact zeros
active = z > 0 # which units fireencoder maps images (N, C, H, W) to embeddings (N, embed_dim); a ViT-tiny CLS token in the paper, which CLSEncoder provides. RDMReg(num_slices, p, mu, rectify) sets the target: p = 1 is the paper's sparse default, mu < 0 makes codes sparser, and p = 2, rectify=False recovers LeWM's isotropic Gaussian. The paper uses history = 1 on its Wall environment and 3 elsewhere, and lamb = 10 with 1024 slices.
The projectors use BatchNorm: call recompute_batchnorm before planning.
Reference
Arguments and methods: LpWM in the API reference.
