Markov and Partially Observable Decision Processes › The Markov Decision Process

Michael BrenndoerferJune 7, 20269 min read
World Models HandbookAll chapters
Part 2 of 12Inference, Decisions, and Control
Chapter 7Markov and Partially Observable Decision Processes › The Markov Decision Process
Reading section 3 of 14 · The Markov Decision Process · 9 minSection 3 of 14 · 9 min

Book contents

Section 3 of 14 · 9 min read

Markov and Partially Observable Decision Processes › The Markov Decision ProcessOne section · Sections in this chapter3 / 14 ↓
Reading tools Definitions & inline links

Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.

Article links

Make inline references clickable

This section defines the MDP formally, states the Markov assumption, and explains discounting and horizons. Everything later in the book, from Kalman filters to large-scale world models, is best read as a variation on this template.

Definition: Markov Decision Process

A Markov Decision Process is a tuple M=(S,A,P,R,γ,ρ0)\mathcal{M} = (\mathcal{S}, \mathcal{A}, P, R, \gamma, \rho_0) where:

  • S\mathcal{S} is the set of states,
  • A\mathcal{A} is the set of actions,
  • P(s′∣s,a)P(s' \mid s, a) is the transition kernel, the probability of landing in state s′s' after taking action aa in state ss,
  • R(s,a,s′)R(s, a, s') is the reward function, the reward received when a transition from ss to s′s' occurs under action aa,
  • γ∈[0,1)\gamma \in [0, 1) is the discount factor,
  • ρ0\rho_0 is the distribution over initial states.

Each element answers a distinct question, and it helps to read the tuple that way. The state space S\mathcal{S} and initial distribution ρ0\rho_0 describe where the story can begin. The action set A\mathcal{A} describes what the agent can influence. The transition kernel PP describes how the world responds, capturing both physics and noise in a single conditional distribution. The reward function RR describes what matters, translating each transition into a score. Finally, the discount factor γ\gamma describes how patient the agent is, a quantity whose full meaning emerges below. If you can locate all six pieces for a concrete problem, you have turned an informal description into a solvable decision problem.

The transition kernel is the world model in miniature: it answers the predictive question "if we do aa here, where do we end up?" The reward function answers the evaluative question "how much did that outcome help?" Notice the deliberate division of labor between the two: prediction is descriptive, evaluation is normative, and neither substitutes for the other. A fully specified MDP is therefore a complete decision problem, and much of this book is about learning or approximating its pieces from data. Later chapters differ mainly in which piece they learn and how they plan against the learned version, while the skeleton of the problem stays exactly as written above.

The Markov Property and Why Everything Depends on It

The adjective Markov refers to one assumption that does an enormous amount of work.

Definition: Markov Property

A state sts_t is Markov with respect to a process if it summarizes all relevant history:

P(st+1∣st,at,ht)=P(st+1∣st,at),P(s_{t+1} \mid s_t, a_t, h_t) = P(s_{t+1} \mid s_t, a_t),

where ht=(o0,a0,o1,a1,…,ot)h_t = (o_0, a_0, o_1, a_1, \ldots, o_t) is everything the agent has seen so far. Given the present state and action, the past provides no additional predictive power.

Why does this matter so much? Because it collapses an ever-growing history into a fixed-size summary. Without it, every quantity of interest would be indexed by a history hth_t. At a fixed finite horizon, the history set is finite but grows exponentially whenever actions or observations branch. With an unbounded horizon, individual histories also grow without bound, so there is no fixed finite history table or fixed-size per-state recursion. Under the Markov property, by contrast, a policy only needs the current state, transition probabilities only need the current state and action, and the mathematics of planning becomes recursive rather than historical. Every efficient algorithm in this book, from value iteration to Kalman filtering to latent dynamics models, exploits some version of this compression.

It is worth being precise about what the Markov property does not claim. It does not claim the world is deterministic, nor that it is noiseless, nor even that the state is small. Stochasticity survives fully intact inside P(s′∣s,a)P(s' \mid s, a); the property constrains what the probabilities condition on, not how random they are. Nor does it claim the agent's chosen representation is automatically adequate. It claims only that the chosen state representation is predictively sufficient: no information relevant to the future is missing from it. Whether a given representation satisfies this is an empirical property of the environment paired with the representation, and Section "When the Markov Assumption Fails" examines what happens when it does not hold.

There is also a constructive reading worth internalizing: the Markov property is something you can often engineer. If position alone fails to predict next position, include velocity; if velocity fails, include acceleration; if battery charge matters, measure it. Each enrichment costs dimensionality, so practical modeling is a negotiation between sufficiency and tractability. That negotiation recurs throughout this book wherever learned latent representations stand in for engineered features.

Assumptions in Play

From here on we implicitly assume:

  • Markov dynamics: the state summarizes the past, as defined above.
  • Stationarity: PP and RR do not change over time.
  • Full observability: the agent perceives the true state, so ot=sto_t = s_t. We relax this later in the chapter.
  • Tabular scope: the theorem statements and algorithms in the MDP treatment use finite discrete state and action spaces with bounded rewards.
  • Known model versus sampled experience: the mathematics below assumes PP and RR are known. In practice we often only have samples, which is the subject of System Identification and model-based reinforcement learning.

Rewards, Returns, and Discounting

The agent does not care about individual rewards so much as about their accumulated total. The quantity of interest is the return GtG_t, the total discounted reward from time tt onward:

Gt=∑k=0∞γkrt+k.G_t = \sum_{k=0}^{\infty} \gamma^k r_{t+k}.

For episodic tasks that terminate, such as our delivery robot finishing its route, the sum simply stops at the terminal time step. For continuing tasks that never end, the discount factor γ\gamma serves two purposes at once, and understanding both prevents a lot of confusion.

First, γ\gamma is an economic preference for earlier reward. With γ=0.9\gamma = 0.9, a reward arriving ten steps from now counts about 0.910≈0.350.9^{10} \approx 0.35 as much as the same reward today. This mirrors interest rates and time preferences in economics, and in many applications it encodes the fact that sooner is better: energy spent today cannot be reclaimed by reward promised tomorrow. Second, and more technically, γ\gamma guarantees that the infinite sum stays finite and that the optimization problem is well posed. As long as rewards are bounded and γ<1\gamma < 1, the return is bounded by rmax⁡/(1−γ)r_{\max}/(1-\gamma). Without this guarantee, summing rewards forever could diverge, and two infinite quantities could not be compared; with it, every policy receives a finite score and there is always a well-defined best one to seek.

The quantity 1/(1−γ)1/(1-\gamma) is called the effective horizon: it measures how many future steps materially influence decisions. With γ=0.9\gamma = 0.9 the effective horizon is 10 steps; with γ=0.99\gamma = 0.99 it is 100. Choosing γ\gamma is therefore not a numerical detail but a modeling statement about how far ahead the agent should reason. Set it too low and a greedy agent will happily sprint toward a pit because tomorrow's catastrophe is discounted away; set it too high and planning becomes computationally expensive and statistically fragile, since values then depend on chains of many uncertain predictions. We will see in the value iteration experiments that γ\gamma bounds the worst-case contraction rate of Bellman backups, while the transition structure can make actual convergence substantially faster. It therefore sits at the junction of modeling intent and algorithmic cost.

The abstract discussion of discounting becomes much clearer when drawn. The next figure shows how much a unit of reward is worth as a function of how far in the future it arrives, for several values of γ\gamma.

In[3]:
Code
import matplotlib.pyplot as plt
import numpy as np

ks = np.arange(0, 51)
gammas = [0.5, 0.9, 0.99]
discount_curves = {g: g**ks for g in gammas}
effective_horizons = {g: 1.0 / (1.0 - g) for g in gammas}
Out[4]:
Visualization
Log-scale decay curves of discounted reward weight for three gamma values.
Discount weight of a unit reward arriving k steps in the future for gamma = 0.5, 0.9, and 0.99. Larger gamma flattens the curve, extending the effective horizon.

Each curve is a straight line on the logarithmic axis because γk\gamma^k decays geometrically, and its slope is set entirely by γ\gamma. The labeled effective horizons make the modeling statement explicit: moving from γ=0.9\gamma = 0.9 to γ=0.99\gamma = 0.99 stretches the decision-relevant future from ten steps to one hundred.

Two variations round out the picture. In finite-horizon problems, the agent optimizes reward over exactly HH remaining steps; the optimal policy then generally depends on the countdown, so it is nonstationary even in a stationary environment. Intuitively, with ten steps left it pays to take a shortcut you would refuse with three steps left, because there will be time to recover from it. In the average-reward formulation, the agent maximizes reward per step in the long run, which suits some scheduling and queueing problems where no natural notion of "early versus late" exists. Discounted infinite-horizon formulations dominate practice because their theory is especially clean, and we use one for the tabular MDP and value-iteration treatment below. The later T-maze is instead a finite, undiscounted episode.