arXiv:2610.22364cs.ROOct 2026

Manuscript Offprint

arXiv:2610.22364

T2-z: Test-Time Optimization of Environment Latents for Robotic World Models

Chenyuan Zhou, Yining Hong, Huang Huang, Yunfan Jiang, Wenlong Huang, David Held, Vitor Campagnolo Guizilini, Yue Wang, Li Fei-Fei, Jiajun Wu, Leonidas Guibas, Yejin Choi

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Chenyuan Zhou 1∗^{1*}, Yining Hong 1∗^{1*}, Huang Huang 1♡^{1\heartsuit}, Yunfan Jiang 1♡^{1\heartsuit}, Wenlong Huang 1♡^{1\heartsuit}, David Held 2^{2}, Vitor Campagnolo Guizilini 3^{3}, Yue Wang 4^{4}, Li Fei-Fei 1^{1}, Jiajun Wu 1†^{1\dagger}, Leonidas Guibas 1†^{1\dagger}, Yejin Choi 1†^{1\dagger}

  • Co-First Contribution ♡ Co-Second Contribution † Equal Advising

1^{1}Stanford University 2^{2}CMU

3^{3}Toyota Research Institute 4^{4}University of Southern California

Website: https://t2-z-latent-optimization.github.io/

Code: https://github.com/T2-z-latent-optimization/T2-z

Data: https://huggingface.co/datasets/huagailuowen/T2-z-datasets

(a) T2-Z captures environmental variation through latent optimization.

Same Observation & Action,

Different Environments (mass)

Predictions under Different Unobserved Environments

Figure

(b) Emergent Latent Structure

Figure

Two-dimensional latent structure naturally emerges, without predefined factors or their supervision.

(c) Real-World Adaptation on Unobserved Environmental Factors

Frictional Resistance

Deformability

Mass Distribution

Lock Spring Stiffness

Figure

(d) Unified Latent Structure Across Diverse Visual Scenes

Figure

Figure 1: T2-z for Test-Time Environment Latent Optimization. (a) Given the same observation and action, T2-z directly optimizes environment latents to capture different environmental conditions (e.g., ball mass), leading the world model to predict different outcomes. (b) Without knowing how many factors exist or what they represent, PCA of the learned environment latents reveals a two-dimensional structure that closely reflects the underlying factor distribution. (c) We evaluate T2-z on real-world robotic tasks spanning diverse unobserved environmental factors. (d) Across diverse visual scenes, the learned latents reveal a unified structure that reflects the same underlying environmental factor without being entangled with visual appearance.

ABSTRACT

Predicting how the world responds to an action requires more than what can be seen: robots must account for environmental factors that are neither directly observable nor explicitly specified, from physical properties such as friction and mass to human-defined environmental rules. We introduce T2-Z for test-time optimization of environment latents, which augments a robotic world model with a learnable environment latent to condition world predictions. This compact latent captures underlying environmental variation without supervision of what environmental factors exist or what values they take. During training, T2-Z alternates between two stages: a world-model optimization stage that fixes the la-tents and learns general action-conditioned dynamics across environments; and an environment-latent optimization stage that freezes the world model and optimizes the conditioning latents, allowing latent structure to emerge purely through world prediction. At test time, the world model remains frozen and a newly initialized environment latent is optimized from one or more test-time interactions, adapting the model to previously unseen environmental configurations. Across 7 simulated settings and 4 real-world robotic tasks, T2-Z reduces object prediction error metric from 15.20 to 7.00 and raises action success from 33.73% to 72.96%. Its emergent latents capture structured representations of individual and compounded factors across diverse visual scenes. Ablations further show that T2-Z can efficiently infer environment latents from as little as a single test-time interaction trajectory.

1 INTRODUCTION

What a robot observes is insufficient to determine how the world will respond. Beneath visually similar scene configurations reside hidden environmental factors, such as friction, mass distribution, and unobserved human-defined interaction rules, that can fundamentally alter the consequences of the same action (fig. 1 (a)). Such factors are often revealed only through interaction with the target environments, as their influence becomes observable through the outcomes they induce. Explicitly representing these factors (Kumar et al., 2021), however, requires specifying in advance what factors may vary, their exact values, and how they should be parameterized, which is difficult to scale to unknown or compounded environmental variation. On the contrary, humans reason through “analysis by synthesis” (Yuille & Kersten, 2006), using internal generative models not only to anticipate future outcomes, but also in reverse to infer latent structure that best accounts for what they observe. This raises a natural question: can hidden environmental factors be similarly captured in a latent representation that is directly optimized from test-time interactions?

We introduce T2-Z for test-time optimization of environmental latents, which augments an action-conditioned robotic world model with a learnable environment latent zez_e. zez_e is a randomly-initialized compact representation that is expected to encode the unobserved factors governing how an environment responds to interaction, with no supervision about what environmental factors it should represent. The world model predicts future visual observations conditioned jointly on the action and zez_e. We iteratively optimize the world model and zez_e in an alternating two-stage procedure: 1) world-model optimization: with zez_e fixed, we train the world model across all trajectories to learn shared action-conditioned dynamics across environments; 2) environment-latent optimization: with the world model frozen, we optimize the conditioned latent zez_e through prediction error, so that it captures underlying environment-specific variation not explained by the general world model alone. Both stages are optimized with the same flow-matching loss and alternated for multiple rounds until convergence, allowing the environment representation to emerge directly through prediction without predefined physical-factor supervision or a separate environment encoder.

At test time, the world model is frozen and T2-Z turns environment inference into a direct optimization problem. For a previously unseen environmental configuration, we initialize a new zez_e and optimize zez_e to explain the outcomes of one or more observed test-time interactions. Specifically, we update zez_e for multiple optimization steps through the same flow-matching objective used during stage-two training, minimizing prediction error on the observed interactions. Because inference is optimization-based rather than amortized through a learned history encoder, T2-Z is not tied to the trajectory count used for training and can flexibly incorporate any number of test-time trajectories. Once optimized, the latent turns the frozen world model into an environment-adapted test-time simulator, enabling prediction and comparison of candidate action outcomes before execution.

We evaluate T2-Z across 7 simulated settings and 4 real-world robotic tasks. Quantitatively and qualitatively, T2-Z improves world-model prediction across visual quality, physical prediction metrics (e.g., relevant object locations), and downstream action selection. T2-Z reduces physical prediction error from 12.86 to 4.80 in simulation and tracked-state error from 19.30 to 10.85 pixels in the real world, while improving action success from 37.9% to 74.2% and from 26.5% to 70.8%, respectively. PCA of the learned latents reveals structured representations that reflect the underlying environmental factors, including a multi-dimensional organization when more than one factors vary jointly, despite the model never knowing how many factors are present or what they represent (fig. 1(b)). In our multi-background setting, a unified latent structure emerges across diverse scene setups, revealing that the learned representation captures environmental dynamics without becoming entangled with scene appearance (fig. 1(d)). Ablations further show that T2-Z can infer useful environment representations from as few as a single test-time interaction trajectory.