TL;DR
LLM-based web agents often fail when navigating unfamiliar websites because their memories entangle high-level task logic with site-specific details like element IDs. To solve this, the Hierarchical Memory Tree (HMT) explicitly decouples logical planning from action execution by organizing past experiences into a tree of standardized intents, semantic subgoals, and abstract action patterns. This structural separation yields significant performance boosts in cross-website generalization while slashing token costs and latency.
What Problem Does This Paper Address?
Large Language Model (LLM) web agents are great at following instructions to automate tasks like booking flights or buying products. To handle complex, long-horizon tasks, modern agents rely on retrieval-based memory systems that store past successful interaction trajectories to use as in-context demonstrations.
However, existing memory mechanisms usually store these trajectories as flat, linear sequences of raw observations and actions. This creates a major bottleneck called intention-execution entanglement. High-level user intents (e.g., "search for a flight") are highly transferable across websites, but low-level execution details (e.g., clicking a button with the specific ID #btn-123) are not. When an agent retrieves a flat memory in a novel environment, it suffers from workflow mismatch and context pollution—trying to execute sequentially invalid steps or looking for element identifiers that simply do not exist on the new site.
Methods
The authors introduce the Hierarchical Memory Tree (HMT), a framework that restructures raw interaction trajectories into a three-level hierarchy via an automated abstraction pipeline:
- Intent Level (Root): Maps diverse, natural language user instructions into standardized, canonical task goals and constraints (e.g., normalizing "I need a flight to NYC" to
Intent: Book Flight; Constraints: {Dest: "NYC"}). - Stage Level (Middle): Breaks the workflow down into reusable semantic subgoals (e.g., "Search Flights", "Select Flight"). Crucially, each stage is defined by observable pre-conditions and post-conditions based on the UI state.
- Action Level (Leaves): Instead of storing raw DOM IDs or coordinates, this level stores abstract action patterns paired with transferable semantic element descriptions (e.g.,
Role: button, Text: contains 'Search', Position: bottom-right of form).
During inference, HMT utilizes a stage-aware mechanism split into two specialized components:
- The Planner: Evaluates the current page state against stored pre- and post-conditions to align the agent with the correct functional subgoal, preventing it from skipping ahead or getting lost. It also includes a Confidence-Aware Fallback to revert to a baseline policy if retrieval is highly uncertain.
- The Actor: Takes the abstract action pattern from the selected stage and grounds it onto the target page by matching the semantic descriptions to the current page's candidate elements.
Datasets
The authors evaluated HMT across two distinct memory-induction settings using standard web agent benchmarks:
- Mind2Web: Used to test the offline setting, where memory is pre-built from a static corpus of successful trajectories. Evaluation was performed across three splits: Cross-Task, Cross-Website (unseen sites, familiar domains), and Cross-Domain (entirely unseen top-level domains).
- WebArena: Used to test the online setting, where the agent starts with an empty memory and incrementally accumulates knowledge from its own successful runs during deployment. This benchmark spans complex domains like Shopping, CMS, Reddit, GitLab, and Maps.
Key Insights and Ideas
- Decoupling is Essential for Transfer: Separating what the agent wants to achieve (planning) from how it interacts with a specific webpage (grounding) is the key to making web agents generalizable.
- State-Based Alignment Beats Sequence Matching: Instead of blindly following a linear history, agents perform better when they align their memory retrieval with the current visual evidence on the page via explicit pre- and post-conditions.
- Memory Compression Drives Efficiency: Storing abstract semantic descriptions rather than raw, verbose HTML DOM trees drastically condenses the context window. HMT reduces average context tokens by 72.7%, which translates directly to faster execution and lower API costs.
Key Results
- Cross-Website Superiority: On Mind2Web's challenging Cross-Website split, HMT improved the step success rate (StepSR) to 39.7%, significantly outperforming the state-of-the-art flat memory baseline, Agent Workflow Memory (AWM), which scored 33.9%.
- WebArena Breakthroughs: HMT achieved the highest total success rate on WebArena (38.7%), showing substantial improvements in logic-heavy, long-horizon domains like GitLab (+5.8%) and CMS (+5.0%).
- Efficiency Gains: Beyond accuracy, HMT reduced per-step latency from 5.2 seconds to 3.5 seconds and slashed the average inference cost per task by 71.0% ($0.38 vs $0.11).
Limitations and Future Work
Despite its success, HMT exhibits a few notable limitations:
- Spatial-Heavy Tasks: HMT performed slightly worse than baselines in the WebArena Maps domain. This is because map interactions rely heavily on precise spatial coordinates, where text-based semantic abstractions offer less utility than raw trajectory replays.
- Ambiguous Grounding: In complex interfaces with multiple identical elements (e.g., multiple "Show more replies" buttons in a comment thread), the Actor can still make mistakes if the memory lacks fine-grained parent-child structural context.
- Single Page Applications (SPAs): The Planner's verification logic occasionally fails on SPAs where visual updates occur via modal popups without changing the URL, leading the agent into unnecessary retry loops.
The authors suggest that future iterations should incorporate richer structural context descriptors and more versatile state verification mechanisms to handle these edge cases.
Summary updated