A topic in the Open Knowledge Graph — a free, open map of 15,290 topics and the order to learn them in.

Monte Carlo Methods in Reinforcement Learning

Research Depth 99 in the knowledge graph ☐ I know this ☆ Set as goal
20topics build on this
675prerequisites beneath it
See this on the map →
Introduction to Reinforcement LearningModel-Based Reinforcement Learning→→Q-Learning AlgorithmTemporal Difference Learning
reinforcement-learning value-estimation off-policy-learning importance-sampling

Core Idea

Monte Carlo methods estimate value functions by averaging complete episode returns, enabling learning from any state visited in episodes. Unlike temporal difference methods, they do not bootstrap and have high variance but unbiased estimates; importance sampling corrects for off-policy trajectories, extending applicability to learning from previously logged data.

Explainer

From your introduction to reinforcement learning, you know the core problem: an agent interacts with an environment, collecting rewards, and needs to learn which states are valuable and which actions lead to high long-term return. The fundamental challenge is estimating value functions — how good is it to be in a particular state, or to take a particular action in a particular state? Monte Carlo methods answer this question in the most straightforward way possible: let the agent play out complete episodes, observe what actually happened, and average the results.

Consider a concrete example. An agent plays 1,000 games of blackjack. In game 47, it visits state "holding 18, dealer shows 6" and ultimately wins, receiving a return of +1 from that state onward. In game 203, it visits the same state but loses, receiving −1. After all 1,000 games, the Monte Carlo estimate for that state's value is simply the average of all the returns observed when the agent was in that state. This is the first-visit Monte Carlo method — it uses only the first time a state appears in each episode. Every-visit Monte Carlo averages over all visits, including multiple visits within the same episode. Both converge to the true value as the number of episodes grows, because they are computing sample means of an unbiased estimator: the actual return.

The strength of Monte Carlo methods is also their limitation. Because they use the complete return from a state to the end of the episode, they make no assumptions about the environment's dynamics — they do not need a model of transition probabilities, and they do not bootstrap (estimate values based on other estimated values). This makes them unbiased: given enough episodes, the estimates converge to the true values. But waiting for the full episode introduces high variance, because a single episode's return depends on every random event from that state onward. A state might truly be valuable, but one unlucky episode can produce a very low return, and the estimate swings widely until enough data accumulates.

A powerful extension is off-policy Monte Carlo learning using importance sampling. Suppose you have logged data from a previous policy (the behavior policy) but want to evaluate or improve a different policy (the target policy). The returns observed under the behavior policy are "wrong" for the target policy — the agent took different actions than the target would have. Importance sampling corrects for this by weighting each return by the ratio of probabilities: how likely was this trajectory under the target policy divided by how likely it was under the behavior policy. Ordinary importance sampling is unbiased but can have extreme variance when the ratio is large; weighted importance sampling reduces variance at the cost of introducing a small bias. This off-policy capability makes Monte Carlo methods valuable in real-world settings where you cannot always re-collect data — you can learn from historical logs, past experiments, or demonstrations by another agent.

Practice Questions 5 questions

Prerequisite Chain

Understanding Zero → The Number Zero → Counting to Five → Counting to 10 → Counting to 20 → Counting a Set of Objects Up to 20 → Cardinality: The Last Number Counted → Matching Numerals to Quantities → Subitizing Small Quantities → Addition Within 10 → Number Bonds to 10 → Addition Within 20 → Doubles and Near Doubles → Doubles Facts Within 10 → Near Doubles Facts Within 20 → Mental Math Strategies for Addition → Mental Math: Adding and Subtracting Tens → Addition Within 100 → Repeated Addition as Multiplication → Multiplication as Equal Groups → Multiplication: Arrays → Basic Multiplication Facts (0s, 1s, 2s, 5s, 10s) → Multiplication Facts Within 100 → Division as Equal Sharing → Division as Grouping (Measurement Division) → Division: Grouping (Repeated Subtraction) Model → Division: Fair Sharing Model → Division as Equal Sharing → Division as Grouping → Basic Division Facts → Division Facts Within 100 → Multiplication and Division Fact Families → Relationship Between Multiplication and Division → Division Facts as Inverse of Multiplication → Remainders and Quotients in Division → Division Word Problems → Multi-Step Word Problems → Solving Multi-Step Word Problems → Multiplication Word Problems → Division Word Problems → Introduction to Long Division → Factors and Multiples → Prime and Composite Numbers → Equivalent Fractions → Relating Fractions and Decimals → Decimal Place Value → Integers and the Number Line → Comparing and Ordering Integers → Absolute Value → Adding Integers → Subtracting Integers → Multiplying Integers → Dividing Integers → Unit Rates → Proportions → Percent Concept → Converting Between Fractions, Decimals, and Percents → Operations with Rational Numbers → Two-Step Equations → Solving Multi-Step Equations → Equations with Variables on Both Sides → Angle Pairs: Complementary, Supplementary, and Vertical → Parallel Lines and Transversals → Corresponding Angles → Alternate Interior Angles → Triangle Angle Sum Theorem → Exterior Angle Theorem → Triangle Inequality Theorem → Similar Triangles: AA Similarity → Similar Triangles: SSS and SAS Similarity → Proportions in Similar Triangles → Right Triangle Trigonometry Introduction → Sine, Cosine, and Tangent Ratios → Trigonometric Ratios Review → Radian Measure → Converting Between Degrees and Radians → The Unit Circle → Graphing Sine and Cosine → Graphing Tangent and Reciprocal Trigonometric Functions → Derivatives of Trigonometric Functions → Antiderivatives → Indefinite Integrals → Basic Integration Rules → Riemann Sums → Definite Integral Definition → Probability Density Functions and Continuous Distributions → Cumulative Distribution Functions → Continuous Random Variables → Probability Density Functions → Expected Value → Weak Law of Large Numbers → Probability Axioms and Rules → Conditional Probability → Conditional Distributions → Conditional Expectation → Markov Chains → Markov Decision Processes → Introduction to Reinforcement Learning → Model-Based Reinforcement Learning → Monte Carlo Methods in Reinforcement Learning

Longest path: 100 steps · 675 total prerequisite topics

Prerequisites (2)

Leads To (2)