X-Tree: Tokenizing Reusable Experience for Efficient Agent Generalization
Organizations: University of Waterloo · Duke University · National University of Singapore
Abstract
Multi-step agents are trained on flat action streams: SFT and RLVR weight every token uniformly and ignore the sub-procedures that recur across tasks, the hierarchy that lets humans plan top-down from reusable routines. This structure sits unused, and flat training uses each scarce trajectory less fully than its content allows. Recent agents do use that structure, but only as LLM-written skills in context, never in the weights, so their gains do not generalize beyond retrieval. We instead recover this hierarchy from the data itself and train on it, with no LLM calls. Following text tokenizers, which build a vocabulary by counting alone, we score action spans by reusability and merge canonicalized actions into a reusable eXperience tree (X-Tree). Each X-Tree node captures how a frequent and success-bearing skill is composed from sub-skills, guiding efficient generalization. We integrate X-Tree into three training settings: offline RL, with each node as a training instance; online RLVR, with an adaptive skill bonus; and on-policy self-distillation, with X-Tree as the self-teacher's privileged context. Across WebArena, ScienceWorld, and WebShop at three model scales, X-Tree improves over standard recipes at matched data and budget by up to 4.5% SR on WebArena, 5.8% SR on ScienceWorld and 4.1% success on WebShop. Matched analyses attribute the gains to the X-Tree structure and the three integrations.
Figures & tables
| Method | gitlab (187) | shopping (158) | admin (156) | reddit (112) | map (67) | wiki (14) | All (694) |
|---|---|---|---|---|---|---|---|
| w/o RL | |||||||
| Qwen2.5-7B-Instruct (base) | 6.4 | 7.8 | 7.7 | 2.4 | 9.0 | 2.4 | 6.5 |
| Go-Browse (SFT-Full w/ 2 epochs) | 16.8 | 21.7 | 22.9 | 16.4 | 10.4 | 7.1 | 18.4 |
| w/ 4 epochs (matched compute) | 17.5 | 19.4 | 24.4 | 16.1 | 13.4 | 11.9 | 18.8 |
| SFT offline RL (Ours) | |||||||
| Offline RL w/ Outcome reward | 15.5 | 23.4 | 23.1 | 15.2 | 7.5 | 14.3 | 18.2 |
| Method | SR | |
| X-Tree Full | 22.9 | – |
| Tree Structure Validation | ||
| Whole trajectory (no tree) | 19.9 | |
| Random span | 19.5 | |
| Random tree | 17.9 | |
| Offline RL Validation | ||
| Setting | G0 | G1 | G2 | |
|---|---|---|---|---|
| 2 | outcome-only | 12.9 | 13.7 | 11.8 |
| + X-Tree bonus | 14.6 | 15.5 | 13.0 | |
| 4 | outcome-only | 24.2 | 23.9 | 12.1 |
| + X-Tree bonus | 28.0 | 27.5 | 16.5 | |
| 8 | outcome-only | 38.6 | 36.2 | 22.8 |
| + X-Tree bonus | 39.8 | 39.5 | 25.6 |
| Warm start | outcome | X-Tree ( ) |
|---|---|---|
| 500 Samples | 73.8 | 74.9 |
| 1,016 Success | 74.9 | 78.1 |
| 1,824 All | 76.4 | 77.4 |
| # Traj | Skills | Success (%) |
|---|---|---|
| 50 | 9 | 68.7 |
| 100 | 11 | 75.2 |
| 200 | 16 | 72.9 |
| 500 | 24 | 74.4 |
| 1,824 | 48 | 76.5 |
Appendix figures & tables24 assets
Supplementary material from the paper’s appendix.
Appendix
| Setting | WebArena | ScienceWorld | WebShop |
|---|---|---|---|
| X-Tree Mining (Eq. 1 ) | |||
| , | 1, 1 | 1, 1 | 1, 1 |
| Success floor | 0.001 | 0.001 | 0.001 |
| 0.3 | 0.5 | 0.5 | |
| Skill cap | 256 | 80 | 60 |
| Max. skill length (actions) | 12 | 8 | 8 |
| Setting | WebArena (offline) | ScienceWorld | WebShop |
|---|---|---|---|
| Rollouts per group | 2 | 8 | 8 |
| Optimizer steps | 805 | 100 | 150 |
| Units per step | 6 nodes | 8 tasks | 16 tasks |
| Learning rate | |||
| KL to the warm start | none | 0.01 | 0.01 |
| Mini-batch | 2 | 256 | 64 |
| Setting | MiniWoB++ |
|---|---|
| Backbones | Qwen2.5-7B, Qwen3-8B, Qwen3-14B |
| Mining corpus | episodes of the evaluated backbone on the 53 training task families, 40 per family |
| Trajectories (successful) | 2,125 (886) / 2,120 (1,116) / 2,120 (1,239) |
| Filtering | none, failures kept with their label |
| Canonical action | verb role , role from the DOM (Table 10 ) |
| , | 1, 1.5 |
| Raw action | Canonical | Kept in slots |
| Verb , from the BrowserGym function name | ||
| click(bid) , dblclick(bid) | click | element id |
| fill(bid, text) , type(bid, text) | type | element id, typed text |
| select_option(bid, opt) | select | element id, option value |
| press(bid, key) , keyboard_press(key) | key | element id, key name |
| hover , focus , clear , scroll | unchanged | element id |
| Raw action or element | Canonical | Kept in slots |
| Verb | ||
| click(ref) , submit(ref) , clear(ref) | click , submit , clear | element label |
| noop | noop | — |
| type(ref, text) | type | typed text, element label |
| select(ref, value) | select | option value, element label |
| key(k) | key | key name |
| Command | Canonical primitive | Kept in slots |
| ScienceWorld | ||
| focus on | focus | |
| go to , teleport to | navigate if is a room, else navigate | , teleport flag |
| open , close | open , close | |
| pick up | take | |
| put down , drop | put ground | , surface form |
| Canonical node | Depth | Occ. | Grounded occurrence | Reading |
|---|---|---|---|---|
| type text_input type text_input click button | 2 | 209 | fill “From *” 01/01/2025; fill “To *” 03/24/2025; click “Show Report” (shop admin); fill “From” Times Square; fill “To” Central Park; click “Go” (map) | complete a two-field form and submit: a report filter and a route query are the same node |
| type text_input click button | 1 | 430 | fill searchbox “Search for projects, issues, etc.” project ; click “Search” (GitLab) | type a query and submit it |
| type text_input type text_input | 1 | 88 | fill “From” Grand Central Station; fill “To” Empire State Building (map) | the two-field entry that recurs inside the first row |
| click link click link click link | 2 | 161 | click “Forums”; click a page link; click the next page (Reddit) | navigate, then paginate |
| click link click link | 1 | 1,219 | click “SALES”; click a submenu entry (shop admin) | menu navigation |
| Canonical node | Depth | Occ. | Grounded occurrence | Reading |
|---|---|---|---|---|
| S8 S2 navigate kitchen | 3 | 415 | open door to hallway; go to hallway; open door to kitchen; go to kitchen | go to the kitchen via the hallway |
| S31 put device S30 | 4 | 151 | move metal pot containing gallium to stove; activate stove; examine gallium; use thermometer on gallium; examine; use thermometer | heat a substance and monitor its temperature |
| S60 navigate foundry S59 | 6 | 25 | go to foundry; open blast furnace; move metal pot to blast furnace; activate blast furnace; examine lead; use thermometer on lead; examine; use thermometer | melt a metal and monitor it |
| S5 observe room S4 | 4 | 381 | look around; connect battery anode to black wire terminal 1; connect battery cathode to blue wire terminal 1; connect black wire terminal 2 to cathode in buzzer; … | wire a circuit from battery through wires to a load |
| S27 S26 take animal | 4 | 241 | open door to outside; go to outside; look around; focus on baby wolf; pick up baby wolf | find and collect an animal outdoors |
| S43 S7 put container | 4 | 90 | open door to hallway; go to hallway; open door to workshop; go to workshop; move baby wolf in inventory to blue box | carry the animal to a container in another room |
| Canonical node | Depth | Occ. | Success | Reading |
|---|---|---|---|---|
| search query click item click option-color click buy | 3 | 94 | 0.81 | engage the goal’s color option before buying |
| search query click item click option-size click option-color click buy | 4 | 25 | 0.92 | two typed options, both named by the goal |
| search query click item click option-flavor-name | 2 | 31 | 0.97 | a typed option the goal names |
| click option-color click buy | 1 | 139 | 0.84 | the closing move once the right option is set |
| search query click item click buy | 2 | 741 | 0.57 | buy without touching options: a universal macro at the corpus mean |
| search query click item | 1 | 1,770 | 0.57 | a universal macro |
| Skill bank | Qwen2.5-7B | Qwen3-8B | Qwen3-14B |
|---|---|---|---|
| no skills | 44.9 | 60.4 | 68.1 |
| AWM | 41.4 | 59.9 | 69.0 |
| SkillWeaver | 47.6 | 61.3 | 68.3 |
| WALT | 46.3 | 58.1 | 68.5 |
| WebXSkill | 43.8 | 59.8 | 68.6 |
| X-Tree | 49.8 | 65.1 | 72.6 |
| SFT row | 1.5B | 3B | 7B |
|---|---|---|---|
| one standard action | 11.7 | 16.7 | 20.8 |
| length-matched span | 12.0 | 17.4 | 19.3 |
| an X-Tree node | 16.6 | 19.1 | 29.9 |
| Method | official SR | SR (main text) |
|---|---|---|
| base model | 5.8 | 6.5 |
| SFT-Full (Go-Browse), 2 epochs | 17.2 | 18.4 |
| SFT-Full, 4 epochs | 17.4 | 18.8 |
| whole-trajectory GRPO | 18.7 | 19.9 |
| whole-trajectory GRPO, binary outcome reward | 17.6 | 18.2 |
| random-node GRPO | 18.5 | 19.5 |
| Backbone | SFT-Full | X-Tree recipe | |
|---|---|---|---|
| Qwen2.5-7B | 18.4 | 22.9 | |
| Qwen2.5-14B | 24.1 | 25.7 | |
| GLM-4-9B | 14.9 | 16.9 |
| Setting | G0 / G1 | ||
|---|---|---|---|
| outcome-only GRPO | – | – | 38.6 / 36.2 |
| gentler weight | 0.5 | 0.4 | 39.4 / 37.6 |
| front-loaded, anneals sooner | 1.5 | 0.25 | 38.9 / 36.4 |
| selected (Ours) | 0.75 | 0.4 | 39.8 / 39.5 |
| Skills | # Match | G0 | G1 | G2 |
|---|---|---|---|---|
| Empty (outcome-only) | – | 38.6 | 36.2 | 22.8 |
| Random spans | 576 | 38.4 | 38.4 | – |
| Random tree | 2,109 | 38.1 | 36.8 | 26.7 |
| X-Tree | 2,698 | 39.8 | 39.5 | 25.6 |
| full corpus | testing task types removed | |
| trajectories after the length filter | 1,673 | 1,248 |
| # X-Tree nodes | 80 | 80 (66 kept, 14 new) |
| grounded skills the bonus reward can match | 2,698 | 1,305 |
| G2 SR, outcome X-Tree bonus (three runs) | 25.6 | 24.8 |
| G2 SR, outcome-only GRPO | 22.8 | |
| ### TASK: goal requires a color option ### |
| The instruction names a color. Expert episodes that selected the goal’s color on the product page before buying, and how they fared: |
| - search<query> -> click<item> -> click<option-color> -> click<buy>: 81% success (94 episodes, ABOVE base) – search for the product; open a result item; select the goal’s color option; click Buy Now. |
| - click<option-color> -> click<option> -> click<buy>: 62% success (34 episodes, ABOVE base) – select the goal’s color option; select an option the goal does NOT ask for (wasted step); click Buy Now. |
| [four more chains] |
| Plan: search with the product words plus the color value; open a matching item; click the exact color value the instruction asks for (it must be visible on the page); select any other required options the same way; then Buy Now. |
| Teacher’s bank | Success |
|---|---|
| outcome-only RLVR: | |
| Empty (no privileged text) | 74.2 |
| X-Tree, words scrambled | 76.5 |
| Mined X-Tree | 77.1 |
| Scale | Setting | G0 | G1 | held-out G2 |
|---|---|---|---|---|
| 1.5B | Outcome-only GRPO | |||
| + X-Tree bonus | ||||
| + OPSD, LLM-written bank | ||||
| + OPSD, X-Tree bank | ||||
| 3B | Outcome-only GRPO | |||
| + X-Tree bonus |
| Scale | Setting | Success | Graded | ( ) |
|---|---|---|---|---|
| 1.5B | RLVR, outcome-only | — | ||
| X-Tree bonus | (7.0) | |||
| OPSD, LLM-written bank | (0.8) | |||
| OPSD, X-Tree bank | (0.1) | |||
| 3B | RLVR, outcome-only | — | ||
| X-Tree bonus | (2.4) |
| Anchor | outcome-only | X-Tree | |
| X-Tree mined from the warm start trajectories | |||
| 500 samples | 24.2 | ||
| 1,016 successful | 33.1 | ||
| 1,824 all | 32.5 | ||
| trajectories in mining corpus. All trained from the -sample warm start | |||
| , 9 skills | - | - | |
LLM Agent Skill Learning
Large language model agent skill learning studies how agents acquire, represent, reuse, and refine procedures for multi-step tasks.
See all 402 papers