This Reinforcement Learning concept is the current idea: keep the same invariant visible across Intuition, Math, Code, Interactive Demo.
Reinforcement Learning
Monte Carlo Reinforcement Learning
Monte Carlo RL evaluates a fixed policy by averaging return-to-go values from complete sampled episodes, so no transition model is needed and small visit counts can be noisy.
Concept Structure
Monte Carlo Reinforcement Learning
Start with the picture, metaphor, or geometric mechanism.
Make the objects explicit and connect them with notation.
Mirror the equations with runnable implementation details.
Manipulate the mechanism and watch the idea respond.
Learner Contract
What this page should let you do.
2 prerequisites listed; refresh them before leaning on the math or code.
Explain the mechanism, trace the main notation, and test one prediction in the live demo.
Read the intuition before the notation; the math should name a mechanism you already felt.
Follow this edge after making one prediction here; the next page should reuse the result, not restart the route.
Claim/source review status
Substantive review recorded
1/1 claims have bounded review metadata; still check caveats and source scope.Metadata-derived; review may be AI-assisted. Not a human certification.01
Intuition
Build the mental picture first so the rest of the page has something to attach to.
Dynamic programming asked for a model. It updated values by looking through transition probabilities.
Monte Carlo reinforcement learning makes a different bargain:
Do not ask for the model. Run episodes, wait until they end, then average what actually happened.
For policy evaluation, the policy is fixed. Every time an episode visits a state , we can look forward along that sampled episode and compute the return from that visit. If the agent visits the same state many times across many episodes, the average of those returns becomes an estimate of .
That makes Monte Carlo conceptually simple. It is also why it can feel jumpy. A single unusually good or bad episode can move a value estimate, especially when a state has only a few visits. Monte Carlo learns from complete returns, not from one-step bootstrapped targets.
The useful contrast is:
- dynamic programming backs up through a known model;
- Monte Carlo RL averages sampled complete-episode returns;
- temporal-difference learning will update from one sampled step plus a bootstrapped value estimate.
02
Math
Translate the story into symbols, assumptions, and a derivation you can inspect.
Let an episode under policy be
where is terminal. The return from time is the discounted sum of rewards after that time:
The state-value function under policy is
Monte Carlo policy evaluation estimates that expectation with sample averages. In first-visit Monte Carlo, each state contributes at most one return per episode: the return after its first visit in that episode.
If are the observed first-visit returns for state , then
Every-visit Monte Carlo uses every occurrence of in the episode instead of only the first. Both variants are built from sampled returns. Neither uses , reward tables, or a Bellman backup through another value estimate.
The incremental average form is useful for code and memory:
This is a sample-average update. The target is the complete return , not . That distinction is exactly what temporal-difference learning will change.
03
Code
Keep the implementation aligned with the notation so the algorithm is legible.
gamma = 0.90
episodes = [
[("Start", 1.0), ("Practice", 0.5), ("Practice", 1.2)],
[("Start", -0.5), ("Confused", -0.8), ("Confused", 0.7), ("Practice", 2.0)],
[("Start", 3.0)],
]
returns = {}
for episode in episodes:
G = 0.0
tape = []
for state, reward in reversed(episode):
G = reward + gamma * G
tape.append((state, G))
seen = set()
for state, G in reversed(tape):
if state in seen:
continue
returns.setdefault(state, []).append(G)
seen.add(state)
for state, values in returns.items():
estimate = sum(values) / len(values)
print(state, [round(v, 3) for v in values], round(estimate, 3))
The code computes return-to-go backward through each completed episode, then averages first-visit returns by state. There is no transition matrix in the program.
04
Interactive Demo
Use direct manipulation to connect the explanation to a moving system.
Use the Monte Carlo RL Return Lab to predict how one more completed episode changes value estimates.
Choose first-visit or every-visit counting, inspect the returns already observed, then predict which state estimate will jump most after the next episode is added. After reveal, compare the return-to-go tape, the before/after sample average, and the variance note.
Before reveal, the next episode and updated estimates stay locked. That keeps the learning move honest: Monte Carlo value estimates are empirical averages over complete returns, so a rare episode can move a small-sample estimate sharply.
Live Concept Demo
Explore Monte Carlo Reinforcement Learning
The stage is code-native and interactive. Use it to test the explanation against the mechanism.
Manipulate one control and predict the visible change.
Commit to what Monte Carlo Reinforcement Learning should make visible before reading the result.
After The First Pass
Turn the concept into an inspected object.
Once the invariant is visible in the intuition, math, code, and demo, use these panels to inspect the mechanism visually, check source support, practice the idea, and attach a grounded research question.
Mechanism Storyboard
See the idea move before the page explains it
Monte Carlo RL evaluates a fixed policy by averaging return-to-go values from complete sampled episodes, so no transition model is needed and small visit counts can be noisy.
Start with the picture, metaphor, or geometric mechanism.
Before reading further, choose the kind of change Monte Carlo Reinforcement Learning should make visible.
Visual Inquiry
Make the image answer a mathematical question
Monte Carlo RL evaluates a fixed policy by averaging return-to-go values from complete sampled episodes, so no transition model is needed and small visit counts can be noisy.
Which visible object should carry the first intuition?
Pick the cue that should make Monte Carlo Reinforcement Learning easier to reason about before the page gives the answer.
Source Grounding
Canonical references for the mechanism on this page.
Canonical source for Monte Carlo prediction, first-visit/every-visit averaging, no-model learning from episodes, and the no-bootstrapping contrast with dynamic programming and TD.
Open sourceGraduate RL source for return-to-go, incremental Monte Carlo policy evaluation, first-visit/every-visit properties, high variance, and episodic limitations.
Open sourceLocal prerequisite page for sample-average estimation, estimator variance, and the probability background behind Monte Carlo RL.
Open sourceClaim Review
Monte Carlo RL evaluates a fixed policy by averaging return-to-go values from complete sampled episodes, so no transition model is needed and small visit counts can be noisy.
Claims without a substantive review badge still need exact source-support review.
sutton-barto-2018-rl, stanford-cs234-mc-policy-evaluation, cf-monte-carlo-importance-sampling
Use equations, runnable code, and demos to check whether the source support is operational.
The sources support finite episodic on-policy Monte Carlo policy evaluation as empirical averaging of discounted returns from sampled episodes under a fixed policy, with first-visit/every-visit variants, model-free/no-bootstrapping contrast, high variance, and the need to observe episode returns before updating.
Sources: Reinforcement Learning: An Introduction, Second Edition, Stanford CS234: Lecture 3, Model-Free Policy Evaluation, Continuous Function: Monte Carlo Estimation and Importance SamplingFinite episodic teaching MDP only; excludes Monte Carlo control, off-policy importance-sampling corrections, continuing tasks, function approximation, eligibility traces, and TD bootstrapping beyond a contrast note.A bounded review summary is present; still check caveats and exact reference scope.Checked Sutton/Barto Chapter 5 for Monte Carlo prediction as averaging returns after state visits, model-free sample-episode learning, and no bootstrapping; checked Stanford CS234 Lecture 3 for return-to-go definitions, incremental updates, first-visit/every-visit properties, high-variance limitations, and episodic update timing. GPT Pro publication critique remains pending because 127.0.0.1:51672 is unavailable.
Reviewer: codex-local-source-review; reviewed 2026-07-03Source support candidates
book 2018Reinforcement Learning: An Introduction, Second EditionCanonical source for Monte Carlo prediction, first-visit/every-visit averaging, no-model learning from episodes, and the no-bootstrapping contrast with dynamic programming and TD.
course-notes 2026Stanford CS234: Lecture 3, Model-Free Policy EvaluationGraduate RL source for return-to-go, incremental Monte Carlo policy evaluation, first-visit/every-visit properties, high variance, and episodic limitations.
reference 2026Continuous Function: Monte Carlo Estimation and Importance SamplingLocal prerequisite page for sample-average estimation, estimator variance, and the probability background behind Monte Carlo RL.
Practice Loop
Try the idea before it explains itself
Monte Carlo RL evaluates a fixed policy by averaging return-to-go values from complete sampled episodes, so no transition model is needed and small visit counts can be noisy.
Before touching the demo, predict one visible change that should happen in Monte Carlo Reinforcement Learning.
Reveal when your model needs a nudge.
Reveal when your model needs a nudge.
Reveal when your model needs a nudge.
A concrete answer is on the canvas.
The answer names why the claim should hold.
It touches the page context or a neighboring idea.
Research Room
Attach the question to a claim, equation, code, or demo
Pick the concept, equation, source, runnable code, claim, misconception, or demo state before asking for help. The handoff keeps that page item in context.Open the draft below to save one note and next action in this browser.
Monte Carlo Reinforcement Learning
What is the smallest example that makes Monte Carlo Reinforcement Learning click without losing the math?
Local action draftNo local draft saved yetExpand only when ready to capture one local next action
This draft stays in this browser, attached to the selected learning item.
- References to inspect: attached references on this page.
- Definition, prerequisite, and contrast concept links
- The equation or runnable code that makes the concept operational
- One demo state that shows the invariant instead of a slogan
- The learner can state the mechanism in their own words
- The learner can name the prerequisite that would repair confusion
- The learner can predict how the mechanism changes under one perturbation
I am working in Continuous Function's research reading room. Object: concept - Monte Carlo Reinforcement Learning Selected item key: recorded for copy. Context: Reinforcement Learning Page anchor: recorded for copy. Open question: What is the smallest example that makes Monte Carlo Reinforcement Learning click without losing the math? Evidence to inspect: - References to inspect: attached references on this page. - Definition, prerequisite, and contrast concept links - The equation or runnable code that makes the concept operational - One demo state that shows the invariant instead of a slogan What would resolve this: - The learner can state the mechanism in their own words - The learner can name the prerequisite that would repair confusion - The learner can predict how the mechanism changes under one perturbation Answer as a careful research tutor: stay source-grounded, separate verified evidence from assumptions, name the relevant math objects, and end with one next action.
concept/concept-notebook/reinforcement-learning/monte-carlo-rl
concept:reinforcement-learning/monte-carlo-rl