Skip to content

CF-JEPA ​

INFO

このページはまだ翻訳されていません。 英語版を読む

Byrd, Wright and Ha, CF-JEPA: Improving Robustness of JEPA World Models via Controllability Factorization, 2026. Paper · Code: not released · Notebook

CF-JEPA (controllability factorization) is LeWM with its latent split in two, z=[zc,zu]. The paper's setting is an exogenous block MDP: actions move only part of the state, and distractors move on their own. An action-conditioned causal transformer g predicts the next zc from zc alone. A smaller action-free causal transformer h predicts the next zu from zu alone. Two small MLPs try to recover the action from consecutive latents. The inverse model ψ reads zc and is trained normally, so zc must hold what the agent controls. The adversary ϕ reads zu behind a gradient reversal layer, so the encoder learns to strip action information out of zu. SIGReg, as in LeWM, keeps the latent from collapsing. Planning compares only zc with the goal, so a disc drifting through the goal image does not count as distance.

L=‖[g(ztc,at),h(ztu)]−zt+1‖2+α‖ψ(ztc,zt+1c)−at‖2+β‖ϕ(GRL(ztu,zt+1u))−at‖2+λSIGReg(z)

Usage ​

python
from torch_world.models import CFJEPA
from torch_world.nn import CLSEncoder

model = CFJEPA(CLSEncoder(img_size=64, patch_size=8, embed_dim=128, depth=4, num_heads=4), action_dim=2,
               embed_dim=128, ctrl_dim=96, history=3, depth=4, num_heads=4, head_dim=32, mlp_dim=512, proj_dim=512)

out = model(pixels, actions)              # (B, history + 1, C, H, W), (B, history + 1, A)
# out: {"loss", "pred_loss", "inverse_loss", "adversary_loss", "sigreg_loss"}

z = model.encode(pixels)                  # (B, T, embed_dim), controllable dims first
zc, zu = model.split(z)                   # (B, T, ctrl_dim), (B, T, embed_dim - ctrl_dim)
cost = model.cost(model.rollout(z[:, :1], plan), goal)  # distance on z^c only

The paper uses α=3 on Two-Room and Push-T and α=10 on Reacher and Cube, with β=1 and λ=0.09 throughout. These are the defaults, with alpha = 3. rollout advances both parts, and CEM uses the model's cost, which reads only zc, so the planners work unchanged. The adversary's loss should stay high during training: it measures how much action information is left in zu.

The paper does not give every detail, so these are this implementation's choices:

  • The encoder output goes through LeWM's projector before the split. The paper mentions no projector, but it builds on the LeWM code, and keeping the projector makes CF-JEPA match the LeWM baseline.
  • SIGReg runs on the whole latent. The paper says only that it uses LeWM's SIGReg.
  • h has half of g's depth. The paper says only that h is smaller.
  • ψ and ϕ are two-layer GELU MLPs with inv_dim hidden units. The paper gives the depth and activation but not the width.
  • The gradient reversal scale is reversal = 1. The paper does not state it.
  • Both predictors use the same history window as LeWM.

The paper splits ViT-tiny's 192 dimensions into 128 for zc and 64 for zu. The notebook uses a 128-dimensional latent split 96/32. The projectors use BatchNorm: call recompute_batchnorm before planning.

Reference ​

Arguments and methods: CFJEPA in the API reference.