Manuscript Offprint

arXiv:2610.28060

TrajEvolve: Trajectory Evolution for Reinforcement Learning with Hindsight Credit Assignment

Yi Wen, Hao Chen, Wanyu Wang, Maolin Wang, Pengyue Jia, Derong Xu, Huize Tan, Yingyi Zhang, Wenlin Zhang, Weihong Luo, Xiku Du, Xiangyu Zhao

Abstract

The Reinforcement Learning (RL) paradigm has achieved remarkable success in enhancing the reasoning capabilities of Large Language Models (LLMs). However, when applied to long-horizon tasks, it faces severe challenges: i) Due to the high task complexity, the model struggles to sample enough successful trajectories, resulting in slow convergence. ii) Relying solely on sparse final rewards causes all steps to be updated indiscriminately, encouraging redundant step generation. When both the quantity and quality of successful trajectories become difficult to guarantee, the performance is severely constrained. This dilemma stems from the limitations: existing RL paradigms rely entirely on the reasoning capability of base models, lacking the ability to actively optimize trajectories. To address the above issues, we propose a novel trajectory evolution paradigm with hindsight credit assignment, termed TrajEvolve. TrajEvolve not only relies on the trajectory inferred by the model but also generates “evolutionary trajectories” by refining low-quality steps in historical trajectories, thereby exposing the policy to high-quality compositions that lie within the base model’s support but are rarely sampled within practical training budgets. Furthermore, TrajEvolve reformulates step-level continuous credit assignment as a binary classification task, whether each step is necessary for task completion. This simplification not only reduces the learning difficulty but also enables step labels to be obtained through counterfactual verification, achieving precise identification of redundant steps. Extensive experiments on two datasets demonstrate the superiority of the proposed method 2^{2}.

1 Introduction

Large Language Models (LLMs) [Achiam et al., 2023, Yang et al., 2025] have achieved remarkable breakthroughs in language understanding and generation. Among post-training techniques for LLMs, Reinforcement Learning (RL), which iteratively improves models through exploration and reward-driven optimization, has emerged as one of the most influential paradigms. Group Relative Policy Optimization [Shao et al., 2024] and its variants, which generate multiple rollout trajectories and leverage inter-group reward comparisons for policy optimization, have gained significant attention.

Despite great success achieved, RL paradigms face severe challenges when applied to long-horizon decision-making tasks [Feng et al., 2025, Shridhar et al., 2020]. Such tasks typically require the model to interact with external environments over dozens of steps, with reward signals provided only at the final outcome. The impact of any individual action may not manifest until many steps later, substantially increasing the difficulty of reinforcement learning. They face two typical dilemmas in this setting: i) Due to high task complexity and vast exploration space, the model struggles to

∗^{*}Both authors contributed equally to this work.

2^{2}https://github.com/wenyiwy99/TrajEvolve

Preprint.

sample sufficient successful trajectories, resulting in sparse learning signals and slow convergence. ii) Relying solely on sparse final rewards causes all steps to be updated indiscriminately, encouraging the generation of redundant steps in successful trajectories. When neither the quantity nor the quality of trajectories can be guaranteed, the performance of RL paradigms is severely constrained.

These issues fundamentally stem from a critical limitation of existing RL paradigms: their performance is bounded by the base model's reasoning capability, lacking the ability to actively optimize trajectories. Recent studies [Yue et al., 2025a] have pointed out that RL merely improves the sampling efficiency of correct reasoning paths already within the base model's repertoire, rather than eliciting fundamentally new reasoning patterns. This raises a natural question:

Can we proactively construct higher-quality trajectories during training to help models to overcome the sampling barrier that on-policy RL inherently faces in long-horizon tasks?

The key challenge in addressing this problem [Lu et al., 2025] lies in accurately identifying the valuable steps, which is essentially a step-level credit assignment problem. Existing credit assignment methods can be categorized into two types: i) Heuristic-based signals [Wang et al., 2025c], which rely on indicators such as LLM output confidence that have no direct correlation with task outcomes. Such signals may reinforce confident but incorrect outputs. ii) Outcome-based signals [Feng et al., 2025, Ji et al., 2025], which estimate credit through multiple rollouts on intermediate steps, evaluating credit with final rewards. These methods focus solely on which steps are likely to lead to success, but such biased estimations cannot identify steps that are redundant yet do not affect the final outcome. In summary, existing methods struggle to determine the true contribution of individual steps to the task, let alone identify redundant steps in the success trajectory. Moreover, accurate credit assignment remains extremely challenging given the vast solution space of long-horizon tasks.

To address these challenges, we propose TrajEvolve, a novel trajectory evolution for reinforcement learning with hindsight credit assignment. TrajEvolve not only relies on the trajectory inferred by the model but also generates “evolutionary trajectories” by refining low-quality steps in historical trajectories, thereby exposing the policy to high-quality compositions that lie within the base model’s support but are rarely sampled within practical training budgets. Notably, TrajEvolve reformulates continuous credit assignment as a binary classification of whether each step is necessary for task. This simplification compresses the infinite solution space into a finite subspace and can be verified through counterfactual experiments, thereby reducing learning difficulty and ensuring sufficient labeled data for Discriminator training. Specifically, TrajEvolve obtains step-level redundancy labels through hindsight verification and trains a discriminator model to evolve historical trajectories. The evolved trajectories serve as high-quality samples and are jointly utilized with policy-generated trajectories for reinforcement learning optimization. The main contributions of the paper are as follows:

• We propose a trajectory evolution paradigm that not only trains on the model-inferred trajectory but also generates “Evolutionary Trajectories” by refining low-quality steps in historical trajectories, thereby exposing the policy to high-quality compositions that are rarely sampled within training.

• We reformulate continuous credit assignment as a binary classification of whether each step is necessary for task completion. This simplification compresses the infinite solution space into a verifiable subspace, substantially reducing difficulty and achieving effective credit assignment.

• Experiments on ALFWorld and WebShop validate TrajEvolve’s effectiveness.

References (64)