Learning Agent States for Latent Action Modeling

Shaoan Xie1 Fan Feng2 Peiyuan Zhu3 Peter Spirtes1 Kun Zhang1,3

1Carnegie Mellon University 2University of California, San Diego 3Mohamed bin Zayed University of Artificial Intelligence

Agent-State LAM jointly learns a compact agent-state representation and latent actions that model its transitions. Spatially matched temporal discrimination (SMTD) guides what the state retains, without action labels, masks, or optical-flow targets.

Two-minute overview: latent action models, the four visual factors, the compact state, SMTD and the results. Silent, with on-screen captions.

Abstract

Latent action models (LAMs) learn action-like latents from unlabeled video by coupling frame-pair inference with latent-conditioned prediction, enabling policy and world-model pretraining. However, what the latent must explain depends on the representation space used for action inference and transition prediction. When this space entangles the agent's evolving physical state with visual context, such as background and persistent agent appearance, inferred latents can encode information unrelated to the agent's actions. To address this challenge, we propose Agent-State LAM, which jointly learns a compact agent-state representation and latent actions modeling its transitions. The compact state aggregates dense visual features into a shared space for both action inference and forward prediction. To guide what this state retains, we introduce spatially matched temporal discrimination (SMTD), which trains the state to distinguish its source frame from nearby frames through spatially flexible matching with frozen local visual features. Rather than comparing global frame representations, SMTD scores each frame by emphasizing its strongest local feature matches across spatial locations. This scoring allows background and persistent agent appearance to remain matched across frames despite displacement, making these shared cues less informative for identifying the source frame and encouraging the representation to capture the agent's evolving physical state. Extensive experiments on distracting control tasks and six real robot video datasets demonstrate improved action recovery, downstream control, and world-model prediction.

Motivation

What Should a Latent Action Explain?

Constraining latent capacity via VQ or KL limits how much information a latent action encodes, not which visual factors it captures. When action inference and forward prediction operate on pixels or dense features that entangle the agent's state with visual context, the inferred latent can encode changes unrelated to the agent's actions.

Four Visual Factors in One Robot Transition

Visual features used to infer latent actions can entangle the agent's physical state 1 with visual context 2–4 (Figure 1). Select a factor to see it outlined in the robot clip.

Figure 1: the agent's state, non-agent change, static background and persistent agent appearance in one robot transition

Between \(o_t\) and \(o_{t+k}\), the arm's physical pose changes (1), while its surface material persists (4), arm motion reveals previously occluded objects (2), and static scene content stays unchanged (3).

Method

Agent-State LAM & Spatially Matched Temporal Discrimination

Agent-State LAM jointly trains a state encoder and inverse and forward dynamics models on unlabeled video. Both dynamics models operate on a compact agent state, whose content is shaped by latent-conditioned prediction and SMTD.

Figure 2a: a shared encoder of backbone and attention pooling maps two frames to compact states; the inverse model infers the latent action and the forward model predicts the later state against an EMA target.
Step 1 · Figure 2a

A compact agent state for both dynamics models

The shared encoder \(E_\theta = R_\theta \circ B_\theta\) runs a visual backbone \(B_\theta\), and an attention-pooling map \(R_\theta\) aggregates its \(N\) spatial features of width \(c\) into one compact state \(s_t \in \mathbb{R}^d\) with \(d \ll Nc\): \(d = 384\) vs. \(Nc = 12{,}288\) on DCS, and \(768\) vs. \(196{,}608\) on real robot video.

The inverse dynamics model (IDM) \(I_\phi\) infers a latent action from two states \(k\) steps apart, and the forward dynamics model (FDM) \(F_\psi\) uses it to predict the later state, against a target \(\bar{s}_{t+k}\) from an EMA copy of the encoder:

$$\begin{gathered} z_{t,k} = Q\big(I_\phi(s_t, s_{t+k})\big) \\ \hat{s}_{t+k} = F_\psi(s_t, z_{t,k}) \end{gathered}$$
Sharing one compact state limits how much visual context the representation can retain. On DCS hopper, replacing the compact states with dense features raises action error from 1.14 to 3.46 (Table 3).
Step 2 · Figure 2b

Spatially matched temporal discrimination (SMTD)

Compactness alone does not decide what the state keeps: a state that encodes only static background can stay constant within a video and be copied forward with zero prediction loss. SMTD therefore trains each state \(s_t\) to identify its source frame among nearby frames of the same video.

Figure 2b: the state is compared with the patch features of the source frame and three nearby frames, and a smooth maximum gives each frame's score; illustrative scores on the right for a state that encodes a single factor.

Score each frame by its best local matches

The projected state \(q_t = q(s_t)\) is compared with every frozen DINOv2 patch feature \(f_{u,p}\) of a frame \(o_u\). A smooth maximum over patch locations gives the frame score, so a match counts wherever it appears (solid boxes), not only at its place in \(o_t\) (dashed):

$$r_{t,u} = \tau_p \log \sum_{p=1}^{N_p} \exp\!\left(\frac{\cos(q_t, f_{u,p})}{\tau_p}\right)$$

Pick out the source frame

With the source time \(t\) as the positive and nearby times \(u\) of the same video as negatives, SMTD minimizes:

$$\mathcal{L}_{\mathrm{SMTD}} = -\mathbb{E}_{\mathcal{V}, t} \log \frac{\exp(r_{t,t}/\tau)}{\sum_{u \in \mathcal{C}_{\mathcal{V}}(t)} \exp(r_{t,u}/\tau)}$$

Why shared context does not help

The scores on the right of the figure are illustrative, for a state that encodes a single factor. Static background 3 and persistent appearance 4 are matched in every frame, and the pepper 2, hidden by the arm in \(o_t\), only in \(o_{u'}\) and \(o_{u''}\): none scores the source higher, so the loss stays high. The agent's state 1 is matched best at the source pose, which gives a low loss.

The gray maps in the figure use the gripper's frozen feature from \(o_t\) in place of the projected state; darker is more similar. On DCS hopper, matching across locations roughly halves the measured change of distractor patches, leaving it below the agent's change in nine of ten trajectories.
Downstream World Modeling

Conditioning Frozen Video World Models from Decoded Latent Actions

A linear ridge decoder maps each model's quantized latents \(z_q\) to native robot commands that condition frozen Cosmos-Predict2 (2B) on IRASim and Cosmos 3 Edge (4B) on Bridge V2 and RT-1—with no text prompt and identical initial frames and seeds.

Motion transfer

Cross-Context Motion Transfer Driving Frozen Cosmos-Predict2 (IRASim)

Initial frame of video B Video B · Initial Frame
Video A · Source Motion Reference

Unlabeled source clip: the arm moves onto the pot.

UniVLA (fine-tuned) Baseline

The generated arm stays over the towel.

UniVLA + CoMo Baseline

The generated arm also stays over the towel.

+ Agent-State LAM Proposed

The generated arm moves onto the pot, as in Video A.

Latent actions inferred from Video A are mapped to robot commands by a linear decoder fitted on training data, and the commands drive frozen 2B Cosmos-Predict2 from the initial frame of Video B (same generator and random seed in every row).

On the test clips, Agent-State LAM gives the highest PSNR of all latent action models on IRASim, Bridge V2 and RT-1, and the highest WorldArena trajectory accuracy of the tracked arm on IRASim and Bridge V2 (Table 5 of the paper).

Same-Clip Rollouts: All Eight Conditionings Side by Side

Same initial frame, frozen generator and random seed for every model; only the conditioning commands differ.

More Cross-Context Motion-Transfer Examples

Commands decoded from video A drive the generator from the first frame of video B (Figures S3 and S4).

Figure S3: cross-context motion transfer, example 1 on IRASim

Video A's arm moves down onto the orange cloth. Only Agent-State LAM reproduces this downward reach in scene B; the baselines stop short.

Experimental Results

Action Recovery & Control

Evaluated under shared architectures and identical training budgets across six real robot datasets and four Distracting Control Suite tasks.

Normalized Action-Probe Test Error (↓ Lower is Better)

Linear ridge probes predicting held-out end-effector translation from quantized (\(z_q\)) or continuous (\(z\)) latents.

Fine-tuned UniVLA and its variants; the released models and the true-action reference are in Table 4 of the paper.

Representation Geometry

Pose Retrieval Across Visual Contexts

Does cosine similarity in the learned state retrieve frames with the same physical pose across episodes, backgrounds and agent appearances?

Citation

BibTeX

@article{xie2026agentstate,
  title   = {Learning Agent States for Latent Action Modeling},
  author  = {Xie, Shaoan and Feng, Fan and Zhu, Peiyuan and Spirtes, Peter and Zhang, Kun},
  journal = {arXiv preprint arXiv:2611.32017},
  year    = {2026},
  url     = {https://agent-state-lam.github.io}
}