Evaluation lab · San Francisco · London · Zürich
Reinforced Labs Request a briefing
Glossary

Monte Carlo methods (RL)

Also called: Monte Carlo RL, Monte Carlo prediction, Monte Carlo control, first-visit Monte Carlo, every-visit Monte Carlo

Monte Carlo methods in RL estimate values by averaging the actual returns observed after visiting a state, using complete episodes and no bootstrapping.

In reinforcement learning, Monte Carlo methods estimate the value of a state or action by running complete episodes and averaging the returns that actually followed it. They need no model of the environment and do not bootstrap from other estimates.

Monte Carlo prediction

To estimate , follow policy , record the return after each visit to , and average:

is the number of recorded visits and the return after the -th one. First-visit MC uses only the first visit to in each episode; every-visit MC uses all of them. Both converge to as visits grow. In incremental form, , with for an exact average or a constant for nonstationary problems.

Worked example

Three episodes pass through state , with returns 4, 10 and 1 afterwards. The estimate is . Incrementally: after the first episode ; after the second ; after the third . The spread of those returns, from 1 to 10, is the variance problem in miniature.

Monte Carlo control

MC control estimates action values from returns and improves the policy greedily, keeping exploration alive with epsilon-greedy choices or exploring starts. Off-policy MC uses importance sampling to evaluate one policy from another's episodes.

Strengths and weaknesses

  • Unbiased: targets are real returns, so errors in other estimates do not leak in, and the Markov property is not required.
  • High variance: a return sums many random rewards, so many episodes are needed.
  • Episodic only: learning waits until the episode ends. TD learning removes that wait at the cost of bias.

Why it matters

Monte Carlo estimation is the simplest correct way to evaluate a policy, and it is everywhere in practice. REINFORCE is a Monte Carlo policy gradient. Group-based baselines in language-model RL, which average the rewards of several sampled responses to the same prompt, are Monte Carlo value estimates. And most evaluation of agents, running episodes and averaging scores, is Monte Carlo estimation with confidence intervals.

Sources

  1. Richard S. Sutton, Andrew G. Barto. Reinforcement Learning: An Introduction (2nd edition), 2018. incompleteideas.net

Know the number before you ship.

A 45-minute working session with an evaluation engineer. Bring one use case; leave with a threat model, a draft eval plan with sample sizes, and an honest read on where you stand.