Flow-JEPA
INFO
このページはまだ翻訳されていません。 英語版を読む
Huo, Luo and Song, Flow-JEPA: Robust Latent Dynamics for JEPA World Models via Flow Matching, 2026. Paper · Code · Notebook
Flow-JEPA keeps LeWM's encoder and SIGReg, and replaces its one-step predictor with a conditional flow-matching model of the whole future. From the current embedding
Usage
from torch_world.models import FlowJEPA
from torch_world.nn import CLSEncoder
model = FlowJEPA(CLSEncoder(img_size=64, patch_size=8, embed_dim=128, depth=4, num_heads=4), action_dim=10,
embed_dim=128, num_preds=5, depth=4, num_heads=4, head_dim=32, mlp_dim=512, proj_dim=512)
out = model(pixels, actions) # (B, num_preds + 1, C, H, W), (B, num_preds + 1, A)
# out: {"loss", "flow_loss", "sigreg_loss"}
z = model.encode(pixels[:, :1]) # (B, 1, embed_dim)
future = model.rollout(z, plan) # one sampled future, (B, T + 1, embed_dim)
futures = model.sample(z, plan, 16) # (B, 16, T + 1, embed_dim)Z_0 is standard noise by default; source="current", source_std=0.5 centers it on steps Euler steps (8 in the paper). predict and rollout draw a fresh sample on every call (pass generator or noise to fix it), so CEM scores each candidate on one sampled future, as the reference does. The predictor generates the whole trajectory from the last context embedding (history = 1); plan over num_preds steps, the horizon it was trained on. The paper uses a frameskip of 5 with num_preds = 5, and lamb = 0.09 on Push-T, 0.1 elsewhere.
Self-attention among future tokens is bidirectional, as in the paper's Two-Room and Cube runs; causal=True gives the Reacher and Push-T setting. The reference cross-attends from future tokens to the context and actions. Here they share one masked self-attention, with the same visibility. The projector uses BatchNorm: call recompute_batchnorm before planning.
Reference
Arguments and methods: FlowJEPA in the API reference.
