Episodes

One Complete Run of a Task

An episode is a complete sequence from the environment's initial state to a terminal state — game over, goal reached, task failed. The environment then resets and the agent tries again. Most RL training is measured in episodes rather than individual steps.

Episodic vs Continuing Tasks

Episodic

Natural termination: game over, goal reached, robot falls. Environment resets after each episode. Agent maximizes reward per episode. Examples: games, navigation, robotic manipulation.

Continuing

No termination — the interaction goes on indefinitely. Past consequences persist, no reset. Agent must balance short and long-term reward without a fresh start. Examples: trading, process control, resource management.

Returns and Learning

Return G_t = total discounted future reward

The return from time t is the sum of all future rewards, discounted by γ: Gt = Rt+1 + γRt+2 + γ²Rt+3 + ... Maximizing the return (not just the next reward) is the agent's true objective. After an episode ends, the agent knows all (state, action, reward) tuples and can compute returns for every step — the foundation of policy gradient learning.

Experience Replay

Reusing past episodes

Off-policy algorithms (DQN, SAC) store past (state, action, reward, next state) tuples in a replay buffer and sample random mini-batches for training. Breaks temporal correlations between consecutive samples (more stable) and allows the same experience to be learned from multiple times (more efficient).

Need Help?

Ask the AI assistant about RL episodes, the difference between episodic and continuing tasks, returns, or experience replay.