Notes

Monte Carlo Control

Imagine learning to play blackjack by finishing many hands, noting the final payoff from each one, and gradually favouring the decisions that led to better outcomes. Monte Carlo control does exactly this: it learns a policy directly from complete experience, without needing to know the environment’s rules or predict its next state.

Learning from finished episodes

For each state–action pair encountered in an episode, Monte Carlo control records the return: the total discounted reward received from that point until the episode ends. It averages observed returns to estimate Q(s, a), the long-term value of taking action a in state s. The policy is then improved by choosing actions with the largest estimated Q-value. This alternating cycle—evaluate the current policy from sampled returns, then improve it—is called generalized policy iteration.

Exploration is not optional

A policy cannot discover that an action is good if it never tries it. Monte Carlo control therefore needs a mechanism ensuring relevant state–action pairs are sampled:

  • Exploring starts begins episodes from varied state–action pairs; it is clean in theory but rarely controllable in real systems.
  • An ε-soft policy chooses a random action with small probability ε, while otherwise selecting the current best action. This supports practical on-policy Monte Carlo control.

Without exploration, an agent that gets an early lucky reward can lock into a mediocre behaviour forever. With too much exploration, it keeps sacrificing reward to random choices.

Where it fits—and its limits

Monte Carlo control is especially natural for episodic tasks such as card games, where a clear ending reveals the full outcome. The blackjack example in Sutton and Barto’s text estimates action values this way. Unlike DQN, it does not bootstrap from its own next-state estimate: its targets are actual completed returns, avoiding that particular source of drift. The trade-off is that it must wait until an episode ends, and long or unsafe real-world episodes make learning slow. It is also impractical for continuing tasks with no natural terminal point, where temporal-difference methods can update after every step.

Monte Carlo control is a model-free reinforcement-learning method that learns an action-value function and improves its policy from returns observed over complete episodes. It estimates each state–action pair’s value by averaging sampled cumulative rewards, then selects actions greedily or near-greedily with respect to those estimates while maintaining exploration. It matters because it can learn an effective policy directly from experience without knowing environment dynamics, though updates require episodes to end.

Imagine learning which route through a maze is best by walking all the way to the exit many times. After each complete trip, you look back: “Did the choices I made lead to a good outcome or a bad one?” Over time, you favour choices that tended to produce better trips.

Monte Carlo Control is this idea applied to an AI learning to make decisions. It learns from whole attempts, such as an entire game or delivery route, rather than needing someone to label each move as right or wrong. By trying different choices and comparing the final rewards, it gradually discovers a strategy that works well.