Source-linked AI summary

STeCa: Step-level Trajectory Calibration for LLM Agent Learning

Hanlin Wang, Jian Wang, Chak Tou Leong, Wenjie Li

arXiv:2502.14276v2cs.LGcs.AIcs.CL

TL;DR

Long-horizon agent learning must address suboptimal actions that accumulate before terminal outcomes reveal errors. STeCa detects deviations through step-level reward comparisons, constructs reflective calibrated trajectories, and reports stronger benchmark performance with more robust task completion.

  • Problem

    In long-horizon agent tasks, errors may become evident only at the terminal state, leaving early deviations to accumulate; existing approaches rely on successful demonstrations or explicit error signals and rewards.

    Source: §1 · p. 2
  • Method

    STeCa compares step-level rewards to identify deviated actions, uses LLM reflection to construct calibrated trajectories, and combines them with successful trajectories for reinforced training.

    Source: §1 · p. 2
  • Results

    STeCa achieves higher success rates across a variety of tasks; its average final reward is 70.9 versus IPR's average reward of 68.6, a 3.4% gain.

    Source: §1 · p. 2, §4.2 · p. 6
  • Takeaways & Limitations

    The paper reports that real-time deviation detection helps mitigate accumulated suboptimal actions and supports more robust handling of long-horizon tasks.

    Source: §1 · p. 2, §7 · p. 9

    The framework does not explicitly address multi-step calibration for multiple deviated actions.

    Source: Limitations · p. 9

Abstract

from arXiv · show

Large language model (LLM)-based agents have shown promise in tackling complex tasks by interacting dynamically with the environment. Existing work primarily focuses on behavior cloning from expert demonstrations or preference learning through exploratory trajectory sampling. However, these methods often struggle to address long-horizon tasks, where suboptimal actions accumulate step by step, causing agents to deviate from correct task trajectories. To address this, we highlight the importance of timely calibration and the need to automatically construct calibration trajectories for training agents. We propose Step-Level Trajectory Calibration (STeCa), a novel framework for LLM agent learning. Specifically, STeCa identifies suboptimal actions through a step-level reward comparison during exploration. It constructs calibrated trajectories using LLM-driven reflection, enabling agents to learn from improved decision-making processes. We finally leverage these calibrated trajectories with successful trajectories for reinforced training. Extensive experiments demonstrate that STeCa significantly outperforms existing methods. Further analysis highlights that timely calibration enables agents to complete tasks with greater robustness. Our code and data are available at https://github.com/WangHanLinHenry/STeCa.

1 Introduction

Long-horizon LLM agents can accumulate early deviations, while existing training approaches leave timely correction difficult. STeCa detects deviations stepwise, constructs reflective calibrated trajectories, and uses them with successful trajectories for reinforced training.

1 Introduction

  • Behavior cloning from successful demonstrations limits proactive self-correction, while terminal-state error signals can miss early deviations that accumulate over long-horizon tasks.Prior work also uses preference and reinforcement learning with explicit error signals or reward functions.Source: §1 · p. 1
  • Timely calibration adjusts suboptimal actions as they occur; an early deviation can make subsequent actions drift from the optimal trajectory and increase task-failure risk.The introduction identifies dynamic, diverse environments and a lack of step-level calibration trajectory data as obstacles.Source: §1 · p. 2
  • STeCa significantly outperforms existing methods, with higher success rates across varied tasks and more robust handling of long-horizon tasks.The framework reports higher success rates across a variety of tasks.Source: §1 · p. 2
  • STeCa uses Monte Carlo sampling to estimate action-level rewards, compares adjacent actions to detect deviations, and uses LLM reflection to revise them and generate reflective thoughts.The revised action and thought, together with a subsequent expert trajectory, form calibrated training data.Source: §1 · p. 2
  • Calibrated trajectories are combined with successful exploration trajectories for reinforced training.The framework is designed to improve agent decision-making during task execution.Source: §1 · p. 2

2 Preliminaries

The paper models interactive agent tasks as POMDPs and defines task success through an outcome reward on the final interaction trajectory. It also introduces step-level reward estimation and normalized Dynamic Time Warping for trajectory comparison.

2 Preliminaries

  • Agent tasks are formalized as POMDPs with instruction, state, action, observation, transition, and reward elements; instruction, action, and observation spaces are subsets of natural language.The transition function maps state-action pairs to states, and the reward function maps them to values in [0, 1].Source: §2 · p. 2
  • An agent acts from its instruction and interaction history, receives observations, and stops when it completes the task or reaches the maximum step; an outcome reward scores the final trajectory.The final trajectory records the instruction and the sequence of actions and observations.Source: §2 · p. 2
  • Step-level reward measures an action’s contribution to future success by averaging outcome rewards from Monte Carlo-sampled continuations generated from the current interaction history.The method uses expert trajectories as demonstrations and starts exploration from their states.Source: §2 · pp. 2–3
  • Normalized Dynamic Time Warping uses dynamic programming to measure distance between multi-step trajectories, with normalization based on their lengths.The passage describes per-step action distances and defines the normalized distance over [0, 1].Source: §2 · p. 3

3 Method

STeCa warms an LLM agent with supervised fine-tuning, detects deviated actions during exploration, and constructs calibrated trajectories through reflection. It then trains on calibrated and successful trajectories using trajectory-level rewards.

3.1 Warm-up via Supervised Fine-tuning

  • Supervised fine-tuning on expert trajectories trains a base agent to generate ReAct-style rationales and actions from task interactions.The rationale and corresponding action are represented together as one action unit.Source: §3.1 · p. 4

3.2 Calibration Trajectory Construction

  • Step-level rewards approximate task-completion probabilities; STeCa flags an explored action when its reward falls below the preceding expert action’s reward by more than threshold δ.The comparison estimates how an action changes the chance of task completion, accounting for sequential dependencies.Source: §3.2 · p. 4
  • An off-the-shelf LLM uses the preceding expert sub-trajectory, deviated action, and ground-truth action to generate a reflective correction and calibrated trajectory.Calibration occurs at the first detected deviation, rather than after exploration ends, and the resulting trajectory is used in reinforced training.Source: §3.2 · pp. 4–5

3.3 Reinforced Training

  • Calibration-only training may hinder recognition of correct actions, so STeCa adds independently explored successful trajectories and expert continuations from failed trajectories.The successful explored trajectories can include trial-and-error actions; the expert sub-trajectories provide guidance on challenging cases.Source: §3.3 · p. 5
  • Trajectory deviation distance based on nDTW supplies a reward signal, increasing reward with deviation for calibration data but decreasing it for explored-successful trajectories.The rewards are integrated into reinforcement training with policy gradients.Source: §3.3 · p. 5

4 Experiments

The experiments evaluate STeCa on VirtualHome and ALFWorld, where it achieves the highest overall performance and exceeds the reported ablation variants.

4.1 Experimental Settings

  • Experiments use VirtualHome and ALFWorld, compare prompting- and tuning-based baselines, and measure task success with Average Final Reward.The reported implementation uses Llama-2-7B-Chat as its base model.Source: §4.1 · pp. 5–6

4.2 Main Results

  • 70.9 average final reward exceeds IPR’s 68.6 by 3.4%; STeCa also beats E2CL by 4.0% without additional iterative training.Table 1 covers two agent datasets, with seen tasks present during training and unseen task variations held out.Source: Table 1 · p. 6, §4.2 · p. 6
  • The SFT+DPO and w/o RT variants achieve average rewards of 70.0 and 69.6, respectively, and neither surpasses STeCa.The first variant trains on optimal and suboptimal trajectories; the second uses only optimal trajectories without reward tuning.Source: §4.2 · pp. 6–7
  • On ALFWorld, Table 2 compares SFT, IPR, and STeCa with different base models.Source: Table 2 · p. 7

5 Discussions and Analyses

The analyses report stronger calibration and robustness, test STeCa across base models and variants, and examine the relationship between step rewards and task completion.

5.1 Effectiveness with Different Base Models

  • Across Mistral-7B and Llama-3-8B-Instruct, STeCa consistently outperforms SFT and IPR on ALFWorld; on unseen Mistral-7B tasks, it improves 17.1% over SFT.Source: §5.1 · p. 7

5.2 Comparisons between Variants of STeCa

  • MC sampling for step rewards outperforms alternative acquisition variants, while direct GPT-4o reward annotation performs comparably to STeCa.The comparison suggests step rewards may also be obtained through more computationally efficient approaches.Source: Table 3 · p. 7, §5.2 · p. 7
  • Using the base agent to generate reflection thoughts significantly degrades performance, indicating that it lacks effective reflection capabilities.Source: Table 3 · p. 7, §5.2 · p. 7

5.3 Analyses of Deviated Action Detection

  • MC step rewards monotonically increase as expert trajectories approach task completion in both environments; deviated actions reduce completion probability.Source: Figure 3 · p. 7, §5.3 · p. 8

5.4 Analyses of Calibration

  • 14.8% relative improvement over IPR on unseen VirtualHome tasks; STeCa also varies minimally with deviated actions present versus absent, unlike other methods.Source: §5.4 · p. 8

6 Related Work

The related work describes long-horizon LLM agents and prior approaches to improving their decisions, then identifies step-level reflection data as an unresolved area.

  • LLM agents interact iteratively with environments, but long-horizon planning can make them prone to suboptimal actions and failure.Source: §6 · p. 8
  • Prior work improves optimal-action generation, uses preference learning to mitigate suboptimal actions, or explores self-correction after errors occur.Source: §6 · p. 8
  • Process-supervision research has not addressed constructing step-level reflection data to detect, explain, and calibrate suboptimal actions.Source: §6 · pp. 8–9

7 Conclusion

The conclusion presents STeCa as a long-horizon agent-learning framework that uses step-level reward comparisons and reflection to construct calibration trajectories for training.

  • STeCa is designed to enhance LLM-agent performance on long-horizon tasks.Source: §7 · p. 9
  • It identifies deviated actions through step-level reward comparisons and constructs calibration trajectories through reflection.Source: §7 · p. 9
  • The calibrated trajectories serve as training data, and experiments report that STeCa outperforms baselines with robust calibration capabilities.Source: §7 · p. 9

Limitations

The authors identify three limitations: Monte Carlo step-reward estimation is computationally costly, step rewards are not used broadly, and the framework does not explicitly handle multiple deviated actions.

  • Monte Carlo step-reward construction requires many sampling iterations, creating significant computational overhead.Source: Limitations · p. 9
  • STeCa uses step rewards to identify and evaluate deviations but does not fully exploit them for broader decision-making or optimization.Source: Limitations · p. 9
  • The framework focuses on immediate correction after a deviated action and does not explicitly address multi-step calibration for multiple deviations.Source: Limitations · p. 9

Ethics Statement

The experiments use simulated VirtualHome and ALFWorld environments. The authors report following academic-use licensing protocols for open-source models and acknowledge AI assistants used in coding and writing.

  • The work develops LLM agents in simulated environments and conducts experiments using VirtualHome v2.3.01 and ALFWorld.Source: Ethics Statement · p. 9
  • The authors state that fine-tuned models are open-source and that they followed their academic-use licenses, and they acknowledge GitHub Copilot and ChatGPT assistance.Source: Ethics Statement · p. 9

A Datasets and Preprocessing

The paper uses curated household-task datasets, compares against supervised, reinforcement, and preference-learning baselines, and specifies training and reward-acquisition procedures. It also tests GPT-4o annotation and a trained reward model as alternatives to Monte Carlo step-reward acquisition.

A Datasets and Preprocessing

  • ALFWorld provides seen and unseen household-task sets, while VirtualHome contributes filtered executable plans with lengths of 3–20 steps; the datasets are enriched with generated thoughts before actions.The datasets are organized in a thought-action format, and their statistics are summarized in Table 4.Source: A Datasets and Preprocessing · p. 13, Table 4 · p. 13

B Baseline Methods

C Additional Implementation Details

  • Base agents are trained for 3 epochs, reinforced training for 1 epoch, and inference uses ReAct-style rationales, greedy decoding, and vLLM acceleration.Fine-tuning uses 8 NVIDIA A6000 GPUs and includes Llama-2-7B-Chat, Mistral-7B, and Llama-3-8B-Instruct.Source: C Additional Implementation Details · pp. 13–14

D.1 Variants of Step-level Reward Acquisition

  • Reward-acquisition alternatives use GPT-4o annotations or a Llama-2-7B-Chat reward model trained for 3 epochs with LoRA; testing uses random seed 42.Source: §D.1 · p. 14

D.2 Detailed Settings for Calibration Analysis

The appendix details calibration evaluation and prompts, then reports case-study and additional benchmark analyses. These include higher affordance rates, contributions from all three training losses, and the best reported unseen-task results at δ = 0.

D.2 Detailed Settings for Calibration Analysis

  • Calibration evaluation samples 100 trajectories from seen and unseen test sets in both environments, then tests whether an agent can complete the task from the resulting state.A second setting traverses the history without the deviated action.Source: §D.2 · p. 14

E.1–E.3 Prompt Templates

  • Inference prompts combine instructions, a one-shot example, task instructions, and history; reflection prompts include a deviated-action history, while reward prompts request a 0–1 action score.Source: §E.1 · p. 14, Figure 6 · p. 15, §E.2 · p. 15

F Case study

  • In the ALFWorld case study, STeCa identifies deviated actions, reflects, and completes the task, while two other agents do not achieve the same performance.Source: F Case study · p. 15, Figure 9 · p. 16

G.1 Additional Evaluation on ScienceWorld

G.2 Affordance Analyses for LLM Agents

  • Across VirtualHome and ALFWorld, STeCa has higher affordance rates, indicating more generated actions are executable and satisfy environmental constraints.Source: Figure 10 · p. 17, §G.2 · p. 17

G.3 Ablation Studies

  • Removing any of the calibration, exploration, or success-guided losses reduces unseen-task performance, with the losses supporting complementary capabilities.Source: §G.3 · p. 17, Table 6 · p. 17

G.4 Hyperparameter Analyses

  • At δ = 0, unseen-task success reaches 76.1% on ALFWorld and 63.6% on VirtualHome; positive δ may over-filter calibration opportunities, while negative δ may tolerate too many suboptimal actions.Source: §G.4 · pp. 17–18, Table 7 · p. 18

G.5 Discussions on Long-horizon Tasks

The discussion examines long-horizon tasks in ALFWorld and VirtualHome and evaluates STeCa on unseen VirtualHome tasks of varying lengths. STeCa’s advantage over SFT and IPR is most evident on long-horizon tasks.

G.5 Discussions on Long-horizon Tasks

  • VirtualHome tasks often require intricate action sequences, such as writing emails using a laptop or performing household cleaning, within environments where long-horizon tasks involve many sequential interaction steps.Source: §G.5 · p. 18
  • ALFWorld and VirtualHome require 10.1 and 11.5 average interaction steps, respectively, making them suitable benchmarks for long-horizon evaluation.The paper describes their tasks as involving complex sequences of subtasks.Source: §G.5 · p. 18, Table 8 · p. 18
  • On unseen VirtualHome tasks, STeCa scores 48.9% on long-horizon tasks, versus 40.0% (SFT) and 42.2% (IPR), with a narrower advantage on medium-horizon tasks.For short-horizon tasks, STeCa’s 76.2% matches the best baseline, SFT.Source: Table 9 · p. 18, §G.5 · p. 18
  • The performance gap widens as task horizon increases, and the authors interpret this pattern as evidence of STeCa’s robustness in long-horizon scenarios.They emphasize calibration capability for maintaining trajectory adjustments in more complex, extended tasks.Source: §G.5 · p. 18
Loading 2502.14276v2…