arXiv:2608.29305cs.CLAug 2026

Manuscript Offprint

arXiv:2608.29305

Learning Simple Test-Time Environments for LLM Web Agents

Junxuan Li, Zijun Liu, Ziyi Huang, Peng Li, Yuzhou Liu, Ming Yan, Yang Liu

Abstract

Large language model (LLM) agents have demonstrated remarkable proficiency in manually constructed environments, yet their performance frequently collapses when transitioned to complex real-world settings. Existing research largely attribute this degradation to the compositional generalization gaps in LLMs on combinations of multiple simple, well-structured environments. In this work, we propose that LLM web agents can learn simple environment observations at test time. Specifically, we introduce trial steps for agents to decompose a complex environment observation into sub-modules, and implement a label-free learning method, Test-Time Environment Decomposition (TTED), to adapt agent behaviors with experience during inference. Our empirical evaluations demonstrate the framework's efficacy across both synthetic and realistic benchmarks, showing (1) experience gains acquired within simpler sub-environments can be effectively composed to improve performance in the full one, and (2) test-time training on sub-environments can significantly enhance the compositional generalization of agents in real-world web automation tasks. We also provide key insights in the design of the label-free learning algorithm. As more complex environments are accessed by LLM agents, we believe learning environment decomposition skills at test time will be critical for robust real-world deployment. 1^{1}

Introduction

Large language model (LLM) agents have recently shown strong capabilities in sequential decision making (Xi et al. 2025; OpenAI 2026a), especially in environments where the state space is manually curated, interface layouts are regularized, and task structure is relatively local (Shi et al. 2017; Deng et al. 2023; Towers et al. 2025; Liu et al. 2025b). Such progress has led to growing optimism that language agents can serve as a general interface for web automation (He et al. 2024; Wei et al. 2025) and other tasks in diverse interactive environments (Wang et al. 2025; He et al. 2025).

However, a substantial gap remains between performance in these controlled settings and performance in realistic environments (Zhou et al. 2024; Drouin et al. 2024). A central reason for this failure is that real-world environments are compositionally more complex than synthetic ones. In realistic web websites, a single observation may simultaneously contain multiple functional sub-structures, including search panels, form fields, content containers, modal windows, and other task-specific widgets. While each sub-structure may be easy to handle in isolation, their joint presence challenges the compositional generalization ability of current LLM agents. As a result, an agent that succeeds in individual sub-environments may still collapse in a cluttered interface (Furuta et al. 2024; Boisvert et al. 2024).

Through large-scale post-training (Shen et al. 2025; OpenAI 2026a), the base policy can be substantially improved, but further scaling is ultimately constrained by the limited availability of reliable ground-truth reward signals. Existing approaches seek to address this problem through more sophisticated test-time learning strategies (Pan et al. 2024; Yang et al. 2025b; Erdogan et al. 2025; Chae et al. 2025; He et al. 2025; Lee et al. 2026), including prompting, sampling, planning, etc. These methods improve task performance during inference, without external reward feedback. However, the core compositional generalization gap remains. As shown in the example in Figure 1 (a), (1) the agent's exploration success rate degrades when the environment is compositionally complex, resulting in bottlenecked exploration capabilities; and (2) the agent's self-assessment (Zheng et al. 2023) accuracy also degrades, co-leading to ineffective test-time learning. These limitations become particularly severe in web automation, where relevant decision variables are often localized, while irrelevant context is abundant. However, as an intuitive but unexplored solution, it remains unclear whether an agent can learn to simplify environment observations at test time and thus mitigate these failures.

In this work, we propose Test-Time Environment Decomposition (TTED), a label-free learning framework that adapts agent behavior within decomposed sub-environments during inference. Instead of asking the agent to directly solve the full environment in one pass, we introduce an explicit trial step that the agent partitions a complex observation into a set of specialized and manageable sub-modules. These sub-modules serve as local decision contexts in which the agent can refine its behavior before returning to the full task. Specifically, TTED adapts the agent policy using self-assessment feedback derived from interaction experience within the sub-environments, either by in-context

1^{1}Code and data are released at https://github.com/THUNLP-MT/TTED.

(a) Environment Decomposition

Figure

(b) TTT vs. TTED

Figure 1: An overview of (a) environment decomposition and a performance comparison of (b) test-time training (TTT) and TTED. “SR” denotes success rate. “GT” denotes ground truth. (a) In complex real-world tasks, e.g., writing academic papers, the environment is often compositionally complex. Decomposing into simple test-time environments can help the agent explore and self-assess more effectively, resulting in improved performance after test-time learning. (b) TTED recovers performance degradation of TTT and outperforms RL on full ground-truth rewards. *We only use a subset of WebArena for evaluation.

learning (ICL) (Brown et al. 2020; Dong et al. 2024), which works for single-turn, static webpages, or by reinforcement learning (RL), which collects experience across multiple steps and tasks to fit multi-turn realistic web environments.

We evaluate TTED on both synthetic and realistic web benchmarks. We extend task quantity in CompWoB (Furuta et al. 2024) with an automated synthesis engine to feature more complex environment compositions, resulting in CompWoB+. Empirically, we show that TTED with ICL can substantially alleviate the performance degradation when environment complexity increases, showing the capacity of LLMs to perform effective decomposition. We further show that TTED with RL can significantly improve generalization on realistic web automation tasks on WebArena (Zhou et al. 2024), even outperforming RL trained with ground-truth rewards (Figure 1 (b)). We also provide detailed analysis on LLM self-assessment quality, out-of-distribution generalization on WorkArena (Drouin et al. 2024), data and environment scaling effects, and the design of RL algorithms.

In summary, our key contributions are as follows:

• We introduce TTED as a test-time learning solution to compositional generalization failures in LLM web agents.

• We extend a larger synthetic benchmark, CompWoB+, to systematically evaluate the impact of environment composition on agent performance and show that TTED can effectively mitigate the resulting generalization gap.

• We demonstrate TTED with proper RL design is effective in realistic web automation tasks such as WebArena, even outperforming RL trained with ground-truth rewards.

• We analyze several key factors that drive the success of test-time adaptation under environment decomposition.

References (22)