The discount factor, written , is a number between 0 and 1 that multiplies each future reward by when it arrives steps later. A small makes the agent short-sighted; a close to 1 makes it weigh distant consequences almost as much as immediate ones.
Definition
In a Markov decision process, the discounted return from time is
where is the reward received steps after time . Because shrinks geometrically, the sum is finite whenever rewards are bounded: if every reward is at most , then . The same appears in the Bellman equation, where it scales the value of the next state.
Effective horizon
A useful rule of thumb is that corresponds to an effective planning horizon of roughly steps. With the horizon is about 10 steps; with it is about 100. A reward 100 steps away is worth of its face value at , but only at .
Worked example
An agent can take a reward of 1 now, or walk five steps to a reward of 10. With the distant option is worth , so the agent walks. With it is worth , which is less than 1, so the agent grabs the immediate reward. Nothing about the environment changed; only the agent's patience did.
Three ways to read gamma
- Preference: the designer genuinely prefers sooner reward, as in finance.
- Termination probability: discounting by is equivalent to an undiscounted problem in which the episode ends with probability at every step.
- Variance control: in practice is often a hyperparameter that trades bias for variance. Lower values give lower-variance return estimates and faster learning, at the cost of optimising a slightly different objective. GAE adds a second parameter, , for the same purpose.
Why it matters
The discount factor is part of the objective, not just a training knob, so changing it changes which policy is optimal. Too low and the agent ignores delayed consequences, which matters for safety when harms show up late; too high and learning becomes slow and noisy under sparse rewards. In RL for language models, a whole response is often treated as one episode with , because the reward arrives only at the end and the horizon is short and fixed.
Related terms
Sources
- Richard S. Sutton, Andrew G. Barto. Reinforcement Learning: An Introduction (2nd edition), 2018. incompleteideas.net