Simple Algorithm
Reinforcement Learning · Fixed Point · 26 min

The Markov Property & Agent State

Histories, sufficient statistics, and building a state from what the agent observes.

An Atari frame does not show which way the ball is moving, and a robot's camera does not show what is behind it. Real agents receive observations, not states. This lesson makes "state" precise: the history, information states and sufficient statistics, the agent state an RL system must build for itself, and what goes wrong when an agent learns on a state that is not Markov.

What you’ll learn

  • Define histories, information states and the Markov property as a conditional independence, and explain why an information state supports an exact Bellman equation.
  • Construct agent states by frame stacking, recurrent updates, belief states and predictive state representations, and compare what each guarantees.
  • Analyze perceptual aliasing: show that the best memoryless policy may need to randomize, and why TD learning on aliased observations converges to the wrong values.
  • Define bisimulation, and prove that bisimilar states have equal optimal values.

Histories, information states and the Markov property

Suppose the agent receives observations OtO_t rather than the environment's state. Everything it has seen is its history

Ht=(O0,A0,R1,O1,A1,R2,…,At−1,Rt,Ot),H_t = (O_0, A_0, R_1, O_1, A_1, R_2, \dots, A_{t-1}, R_t, O_t),

and anything it could ever use to act is a function of HtH_t. A candidate state Zt=σ(Ht)Z_t = \sigma(H_t) is Markov if, given ZtZ_t and the action, the rest of the history carries no further information about what comes next, that is, (Ot+1,Rt+1)⊥ ⁣ ⁣ ⁣⊥Ht∣(Zt,At)(O_{t+1}, R_{t+1}) \indep H_t \mid (Z_t, A_t):

Pr⁡(Ot+1,Rt+1 ∣ Ht,At)=Pr⁡(Ot+1,Rt+1 ∣ Zt,At)\Pr\big(O_{t+1}, R_{t+1} \,\big|\, H_t, A_t\big) = \Pr\big(O_{t+1}, R_{t+1} \,\big|\, Z_t, A_t\big)
The history itself satisfies this trivially, but it grows without bound. The question is how far it can be compressed.
Check your understanding

In a POMDP whose model the agent knows, which of these is an information state?

  1. The last observation
  2. The last four observations
  3. The belief bt(s)=Pr⁡(St=s∣Ht)b_t(s) = \Pr(S_t = s \mid H_t)
  4. The number of steps taken so far
Show the answer

C. The belief bt(s)=Pr⁡(St=s∣Ht)b_t(s) = \Pr(S_t = s \mid H_t)

The next observation and reward depend on the hidden state, so the posterior over it predicts them exactly as well as the full history, and Bayes' rule updates it recursively from (bt,At,Ot+1)(b_t, A_t, O_{t+1}). The belief state is the classic information state of POMDPs (Åström, 1965; Kaelbling, Littman & Cassandra, 1998). Finite windows of observations qualify only in special environments.

Building an agent state

An RL agent must construct its own agent state, usually without a model of the environment; Sutton and Barto (§17.3) write the update as St+1=u(St,At,Ot+1)S_{t+1} = u(S_t, A_t, O_{t+1}). The main options trade guarantees for practicality.

Agent stateUpdateMarkov whenUsed in
Last kk observations (frame stacking)Shift a windowThe environment is kk-th order Markov in its observationsDQN's four stacked Atari frames, which recover velocities
A recurrent network's stateZt=uθ(Zt−1,At−1,Ot)Z_t = u_\theta(Z_{t-1}, A_{t-1}, O_t), learnedNever guaranteed; trained to serve the agent's lossesRecurrent value-based and actor–critic agents
Belief stateBayes' rule with a known modelAlways, if the model is correctPOMDP planning, and the tiger problem below
Predictive stateUpdate predictions of future observationsAlways, for systems with a finite linear PSRPredictive state representations (Littman, Sutton & Singh, 2001)
A transformer's context windowAppend, keep the last kk tokensLike frame stacking, with a long windowLanguage-model agents and in-context RL

Predictive state representations show that a state need not be a guess about hidden variables at all. A test is a sequence of future actions and observations, and the state is the vector of probabilities that a few core tests would succeed if attempted. Littman, Sutton and Singh (2001) showed that every system that can be modeled as a POMDP with nn hidden states has a linear PSR with at most nn core tests: predictions about the future are always as compact as a hidden-state model, and they are grounded in quantities the agent can observe.

DerivationThe tiger problem: a whole history in one integer
  1. ℓ′=ℓ+ln⁡p1−p=ℓ+ln⁡0.850.15≈ℓ+1.73\ell' = \ell + \ln\frac{p}{1-p} = \ell + \ln\frac{0.85}{0.15} \approx \ell + 1.73

    A tiger hides behind the left or the right door, and listening reports the correct side with probability p=0.85p = 0.85. Write the belief b=Pr⁡(tiger left)b = \Pr(\text{tiger left}) as log-odds ℓ=ln⁡b1−b\ell = \ln\frac{b}{1-b}. Hearing left multiplies the odds by the likelihood ratio:

  2. b=11+(0.150.85)nL−nRb = \frac{1}{1 + \big(\tfrac{0.15}{0.85}\big)^{n_L - n_R}}

    Hearing right subtracts the same amount, and the tiger stays put until a door is opened. Starting from b=0.5b = 0.5, that is ℓ=0\ell = 0, the belief depends on the whole history of reports only through the difference nL−nRn_L - n_R:

  3. Two agreeing reports give b=0.852/(0.852+0.152)≈0.97b = 0.85^2/(0.85^2 + 0.15^2) \approx 0.97. A history of any length compresses to one integer, which is a sufficient statistic and an information state for this problem. Optimal play can be stated on it directly: with γ=0.95\gamma = 0.95 the long-run optimal policy listens until one side leads by two reports, then opens the other door.

Aliasing: learning on a state that is not Markov

Predict before you look

In the two-rooms world, what is the average reward per step of the memoryless policy that takes AA with probability 0.75?

Show the answer

-0.25

−(2⋅0.75−1)2=−0.25-(2 \cdot 0.75 - 1)^2 = -0.25. The chain is in xx a quarter of the time, earning 0.75−0.25=0.50.75 - 0.25 = 0.5 per step there, and in yy three quarters of the time, earning 0.25−0.75=−0.50.25 - 0.75 = -0.5: in total 0.25⋅0.5+0.75⋅(−0.5)=−0.250.25 \cdot 0.5 + 0.75 \cdot (-0.5) = -0.25.

Singh, Jaakkola and Jordan (1994) studied exactly this setting, learning without state estimation. They showed that the best stationary stochastic memoryless policy can be arbitrarily better than the best deterministic one (scale the rewards above), that TD learning on observations converges under the usual conditions but in general not to the values one wants, and that the values of memoryless policies do not satisfy a Bellman equation of the usual form. They also conjectured that Q-learning on observations does not in general find even the best deterministic memoryless policy.

The reason is visible in the example. V(o)V(o) must be one number for two situations with different futures, and which of them dominates the estimate depends on how often the behavior policy visits each, so the estimate shifts whenever the policy does. Policy-gradient methods can find the stochastic optimum because they search over stochastic policies directly. The short corridor of The Policy Gradient Theorem & REINFORCE is the classic instance: every state looks the same, the actions are reversed in one of them, and the best memoryless policy goes right with probability 2−2≈0.592-\sqrt2 \approx 0.59.

What should count as the same state? Bisimulation

Aliasing merges states that should be kept apart. The opposite question matters just as much when building compact states: when can two states be merged without loss? Equal observations are neither necessary nor sufficient.

DerivationProof sketch
  1. (T⋆Qk)(s,a)=r(s,a)+γ∑CP(C∣s,a) mk(C)=r(s~,a)+γ∑CP(C∣s~,a) mk(C)=(T⋆Qk)(s~,a)(\mathcal T^\star Q_k)(s,a) = r(s,a) + \gamma\sum_{C} P(C \mid s,a)\,m_k(C) = r(\tilde s,a) + \gamma\sum_{C} P(C \mid \tilde s,a)\,m_k(C) = (\mathcal T^\star Q_k)(\tilde s,a)

    Run value iteration with the Bellman optimality operator T⋆\mathcal T^\star from Q0=0Q_0 = 0. Suppose QkQ_k is constant on equivalence classes, so that max⁡a′Qk(s′,a′)\max_{a'}Q_k(s',a') takes a single value mk(C)m_k(C) for all s′∈Cs' \in C. Then for sEs~s \mathrel{E} \tilde s the backup only sees class probabilities:

  2. So every iterate is constant on classes, and so is the limit Q⋆Q^\star. The class-level iterates are exactly value iteration on the quotient MDP, which therefore has the same optimal values; a policy that is greedy for them is greedy for Q⋆Q^\star. ■\blacksquare

Exact bisimulation is brittle: rewards that differ by 10−910^{-9} break it. Ferns, Panangaden and Precup (2004) defined bisimulation metrics, the fixed point of a recursion that combines reward differences with a Wasserstein distance between next-state distributions, and showed that they bound differences in optimal values. Coarser state abstractions preserve less: Li, Walsh and Littman (2006) order abstractions from bisimulation, which preserves the whole model, down to ones that keep only Q⋆Q^\star, only the optimal action or only an optimal policy, and show that the coarser ones can make some learning algorithms fail. Deep RL uses bisimulation-style objectives to learn representations that ignore task-irrelevant detail (Representation Learning for RL).

Key takeaways

  • The history is always Markov but grows without bound; an information state compresses it without losing anything needed to predict rewards and its own future, and optimal policies can act on it alone.
  • Agent states trade guarantees for practicality: frame stacks are Markov only for kk-th order environments, recurrent states never by construction, belief states only with a correct model, and predictive states are grounded in observable predictions.
  • Under aliasing the best memoryless policy may need to randomize (it can be arbitrarily better than any deterministic one), and TD learning on aliased observations converges to values that depend on the behavior policy.
  • Bisimilar states have identical rewards and transition probabilities into equivalence classes, hence identical optimal values; bisimulation metrics relax this to an approximate notion of "the same state".

Check yourself

In the interactive lesson these are scored with your confidence, and what you miss comes back for review.

Question 1

Which statement expresses the Markov property of an agent state Zt=σ(Ht)Z_t = \sigma(H_t)?

  1. ZtZ_t is independent of Zt−1Z_{t-1}
  2. ZtZ_t determines the next observation exactly
  3. Given ZtZ_t and AtA_t, the next observation and reward are independent of the rest of the history
  4. The agent's policy depends only on ZtZ_t
Show the answer

C. Given ZtZ_t and AtA_t, the next observation and reward are independent of the rest of the history

The Markov property is a conditional independence: once ZtZ_t and the action are known, nothing else in the past helps to predict what comes next. The future may still be random.

Question 2

When does stacking the last kk observations give a Markov state?

  1. When the next observation and reward depend on the past only through the last kk observations and actions
  2. Always, once k≥4k \ge 4
  3. Only in deterministic environments
  4. Never: only recurrent states can be Markov
Show the answer

A. When the next observation and reward depend on the past only through the last kk observations and actions

A window of length kk is Markov exactly for environments that are kk-th order Markov in their observations. Two frames recover a velocity, but no fixed window recovers a key picked up a hundred steps ago.

Question 3

In the two-rooms world, where the best memoryless policy takes each action with probability ½, why can ε-greedy Q-learning on the shared observation not find it?

  1. Its step size is too small
  2. It needs positive rewards
  3. It finds it after enough episodes
  4. Its greedy choice is one fixed action per observation, and ε adds a fixed amount of randomness, not the amount the task requires
Show the answer

D. Its greedy choice is one fixed action per observation, and ε adds a fixed amount of randomness, not the amount the task requires

With ε=0.1\varepsilon = 0.1 and two actions, ε-greedy takes its greedy action with probability 0.95, for an average reward of −(2⋅0.95−1)2=−0.81-(2 \cdot 0.95 - 1)^2 = -0.81, far from the optimum 0. Methods that learn action probabilities directly, such as policy gradients, can find the 50/50 policy.

Question 4

Two states have equal expected rewards for every action and, for every action, equal probabilities of moving into each class of a bisimulation that relates them. What follows?

  1. They must produce the same observation
  2. Nothing, unless the transitions are deterministic
  3. They have the same optimal Q-values, so they can be merged without loss
  4. They have the same value under every policy, including policies that act differently in the two states
Show the answer

C. They have the same optimal Q-values, so they can be merged without loss

Value iteration keeps every iterate constant on bisimulation classes, so Q⋆(s,⋅)=Q⋆(s′,⋅)Q^\star(s,\cdot) = Q^\star(s',\cdot), and the quotient MDP has the same optimal values and, lifted back, the same optimal policies.

Further reading

  • M. L. Littman, R. S. Sutton & S. Singh, "Predictive representations of state," Advances in Neural Information Processing Systems 14 (2001).
  • S. P. Singh, T. Jaakkola & M. I. Jordan, "Learning without state-estimation in partially observable Markovian decision processes," ICML, 284–292 (1994).
  • R. Givan, T. Dean & M. Greig, "Equivalence notions and model minimization in Markov decision processes," Artificial Intelligence 147(1–2), 163–223 (2003).
  • L. P. Kaelbling, M. L. Littman & A. R. Cassandra, "Planning and acting in partially observable stochastic domains," Artificial Intelligence 101(1–2), 99–134 (1998).
  • R. S. Sutton & A. G. Barto, Reinforcement Learning: An Introduction, §17.3 (MIT Press, 2nd ed., 2018).