Markov Decision Process

Definition

A Markov Decision Process (MDP) is the formal object every RL algorithm optimizes: a model of sequential decision-making in which an agent in a state picks an action, receives a scalar reward, and transitions to a new state — with the defining property that the next state depends only on the current state and action, not the full history. It is the substrate on which value functions, the policy gradient, and all downstream methods are defined.

Key math

An MDP is a tuple with (optional) initial-state distribution :

  • — state / action spaces
  • — transition kernel, Markov by construction
  • — expected immediate reward
  • — discount factor

Markov property — the state is a sufficient statistic of history:

A policy induces a trajectory distribution that factorizes cleanly because of the Markov property:

The return (recursion ) defines the objective

Why it matters

LLM generation is an MDP: state is the prompt plus tokens so far, action is the next token, policy is the softmax over the vocabulary, and the transition is a deterministic append ( is a delta). Two consequences: the state is trivially Markov (it is the full prefix), and is exactly the sequence log-likelihood — fully differentiable, reusing the pretraining forward/backward pass. Reward is typically sparse and terminal (a single reward-model or verifier score at EOS), which makes credit assignment the central challenge that the advantage function exists to solve.

Taught in

  • 01-mdps-and-the-rl-objective — full development: Markov property, the MDP tuple, returns, the objective , Bellman equations, and the LLM-as-MDP mapping.

See also