RL for LLM Agents

Credit Assignment in Multi-Turn Agents: Which Action Earned the Reward?

Token, turn and episode-level credit, and the tools that make sparse agent rewards learnable.

RL for LLM Agents · 5 min read

An agent may take dozens of actions, calling tools and reading results, before anything tells it whether it succeeded. Deciding which actions deserve the credit is the central difficulty of RL for agents.

The problem

If the only reward arrives at the end of a long episode, every action shares one number. A single helpful decision and ten wasteful ones get the same signal, so learning needs many episodes to separate them.

Levels of credit

In language models, you can assign credit per token, per turn, or per whole episode. Token-level credit is fine-grained but noisy for long outputs. Turn-level credit, where each tool call or message is one action, matches how agents actually act and often gives a cleaner signal.

Tools for better credit

  • A learned value function estimates how promising a partial trajectory is, giving advantages for each step.
  • Discounting weights nearer consequences more than distant ones.
  • Intermediate rewards, such as passing a subgoal check, add density but risk being gamed.
  • Group baselines compare an episode with others for the same task.

Design advice

Define what one action is, decide where rewards can be checked, and log per-turn statistics. When training stalls, look at where in the episode good and bad runs diverge, and add a verifiable signal near that point if you can.

More guides from this book