Simple Algorithm
Reinforcement Learning · Bootstrapping · 24 min

Partial Observability & POMDPs

Acting on beliefs when you cannot see the state.

A doctor never sees the disease, only symptoms and test results; a robot never sees its position, only what its sensors report. When the state is hidden, an agent must act on what it believes, and the belief itself becomes the state: a partially observable MDP turns into an MDP whose states are probability distributions. This lesson builds that belief MDP, solves the tiger problem with it, and shows why an optimal agent sometimes pays for information instead of acting.

What you’ll learn

  • Define a POMDP and derive the belief update as a Bayes filter, with a predict step and a correct step.
  • Build the belief MDP, with its rewards, transitions and Bellman equation, and explain why the belief is a sufficient statistic.
  • Derive the tiger problem's one-step value function, and explain why optimal policies at longer horizons listen more before opening.
  • Compare a belief-based policy with a policy that reacts only to the latest observation, and with planning as if the state were visible.

States you cannot see

A partially observable MDP (POMDP) is an MDP whose state the agent never sees. It is a tuple (S,A,O,P,Z,r,γ,b0)(\mathcal S,\mathcal A,\mathcal O,P,Z,r,\gamma,b_0): an ordinary MDP, a finite set of observations O\mathcal O, an observation model Z(o∣s′,a)Z(o\mid s',a) giving the probability of seeing oo after an action aa that led to state s′s', and an initial distribution b0b_0 over the states. After each action the agent receives a reward and an observation Ot+1∼Z(⋅∣St+1,At)O_{t+1}\sim Z(\cdot\mid S_{t+1},A_t), but not St+1S_{t+1}. All it can use is its history of actions and observations.

Hidden state is the rule, not the exception. A mobile robot estimates its position from noisy sensors (Thrun, Burgard & Fox, 2005); a spoken dialogue system must guess what the user wants from error-prone speech recognition (Williams & Young, 2007); a physician chooses tests and treatments for a disease that is observed only indirectly (Hauskrecht & Fraser, 2000).

Check your understanding

A reactive policy chooses its action from the latest observation alone, ignoring everything before it. What is the best reactive policy in the tiger problem, with γ=0.95\gamma=0.95?

  1. Open the right door after every hear left and the left door after every hear right, which is right 85% of the time
  2. Listen forever, worth −1/(1−0.95)=−20-1/(1-0.95)=-20
  3. Open a door at random
  4. Listen after hear left, open the left door after hear right
Show the answer

B. Listen forever, worth −1/(1−0.95)=−20-1/(1-0.95)=-20

A single report is wrong 15% of the time, so opening on it is worth 0.85×10−0.15×100=−6.50.85\times10-0.15\times100=-6.5 before counting the listen, and after a door is opened the next report is pure noise, on which a reactive policy would act too. Every reactive policy that ever opens a door does worse than never opening: −20-20 in total. A policy that tracks its belief earns about +19.4+19.4 from the same start, as this lesson will show. (The Markov Property & Agent State shows a world in which the best reactive policy must randomize.)

The belief update is a Bayes filter

The agent's belief is the posterior over the hidden state given everything seen so far, bt(s)=Pr⁡(St=s∣Ht)b_t(s)=\Pr(S_t=s\mid H_t). After action aa and observation oo, Bayes' rule updates it in two moves: predict where the state went, then weigh each candidate by how well it explains the observation.

DerivationThe belief update
  1. bˉ(s′)=∑sP(s′∣s,a) b(s)\bar b(s')=\sum_sP(s'\mid s,a)\,b(s)

    Predict. Push the belief through the dynamics of the action taken:

  2. b′(s′)=Z(o∣s′,a) bˉ(s′)Pr⁡(o∣b,a),Pr⁡(o∣b,a)=∑s′Z(o∣s′,a) bˉ(s′)b'(s')=\frac{Z(o\mid s',a)\,\bar b(s')}{\Pr(o\mid b,a)},\qquad\Pr(o\mid b,a)=\sum_{s'}Z(o\mid s',a)\,\bar b(s')

    Correct. Multiply by the likelihood of the observation and normalize. The normalizer is the probability of seeing oo, which the planner will need as well:

  3. b=Pr⁡(TL)=0.85d0.85d+0.15d:d=1↦0.85,d=2↦0.970,d=3↦0.9945b=\Pr(\text{TL})=\frac{0.85^d}{0.85^d+0.15^d}:\qquad d=1\mapsto0.85,\quad d=2\mapsto0.970,\quad d=3\mapsto0.9945

    Write b′=τ(b,a,o)b'=\tau(b,a,o) for this belief update. In the tiger problem, listening does not move the tiger, so the predict step does nothing, and each hear left multiplies the odds of TL by 0.85/0.150.85/0.15 while each hear right divides them by it. From b=0.5b=0.5, after dd more hear left reports than hear right ones:

python
import numpy as np

def belief_update(b, a, o, P, Z):
    """b[s]: belief. P[a][s, s2] = P(s2 | s, a). Z[a][s2, o] = Z(o | s2, a).
    Returns the new belief and the probability of having seen o."""
    predicted = b @ P[a]                     # predict: sum_s b(s) P(s2 | s, a)
    unnormalized = predicted * Z[a][:, o]    # correct: weigh by the likelihood of o
    prob_o = unnormalized.sum()
    return unnormalized / prob_o, prob_o

One update costs O(S2)\order{S^2}. The belief is a sufficient statistic for control: it predicts future observations and rewards as well as the whole history does, and it updates recursively (Åström, 1965), so the agent can forget the history and keep only bb.

The belief MDP

Because the belief summarizes the history exactly, a POMDP is an MDP whose states are beliefs, the points of the probability simplex Δ(S)\Delta(\mathcal S). Its rewards and transitions follow from the model.

With two hidden states the belief is one number, b=Pr⁡(TL)b=\Pr(\text{TL}), and every value function is a curve over [0,1][0,1]. With one decision left, each action's value is linear in bb:

DerivationThe tiger problem with one decision left
  1. Q1(b,listen)=−1,Q1(b,open left)=10−110b,Q1(b,open right)=110b−100Q_1(b,\text{listen})=-1,\qquad Q_1(b,\text{open left})=10-110b,\qquad Q_1(b,\text{open right})=110b-100

    Listening is worth −1-1 whatever the belief. Opening the left door gains 10 if the tiger is on the right and loses 100 if it is on the left, and symmetrically for the right door:

  2. V1(b)=max⁡(10−110b, −1, 110b−100)V_1(b)=\max\big(10-110b,\ -1,\ 110b-100\big)

    Opening the left door beats listening when 10−110b>−110-110b>-1, that is b<0.1b<0.1, and opening the right door when b>0.9b>0.9. With one decision left, open only when at least 90% sure:

  3. V(λb1+(1−λ)b2)≤λV(b1)+(1−λ)V(b2)V\big(\lambda b_1+(1-\lambda)b_2\big)\le\lambda V(b_1)+(1-\lambda)V(b_2)

    V1V_1 is the upper envelope of three lines, so it is piecewise linear and convex. Convexity is the value of information in geometric form: learning which of two beliefs you are in is never worse than staying at their average. Every horizon has this shape (Belief MDPs & α-Vectors).

Predict before you look

With p=0.85p=0.85 and starting from b=0.5b=0.5, what is the smallest net lead dd (reports for one side minus reports for the other) that makes your belief in that side at least 0.99?

Show the answer

3

d=2d=2 gives 0.852/(0.852+0.152)≈0.9700.85^2/(0.85^2+0.15^2)\approx0.970, and d=3d=3 gives 0.99450.9945. In log-odds, each report adds or subtracts ln⁡(0.85/0.15)≈1.73\ln(0.85/0.15)\approx1.73, and 0.99 needs log-odds ln⁡99≈4.6\ln99\approx4.6: three net reports.

Planning over beliefs: why listen several times

Value iteration works on the belief MDP as on any MDP, Vh=T⋆Vh−1V_h=\mathcal T^\star V_{h-1} over beliefs, and for the tiger problem it can be computed exactly. The thresholds for opening move in a surprising way as the horizon grows:

Decisions left hhOpen left if b≤b\leOpen right if b≥b\geVh(0.5)V_h(0.5)
10.1000.900−1.00
20.02430.9757−1.95
30.01150.98852.31
40.06860.93141.80
200.03890.961111.88
∞\infty0.03970.960319.37
Exact values for p=0.85p=0.85 and γ=0.95\gamma=0.95. With two or three decisions left, opening needs far more certainty than with one, because opening now gives up the chance to listen once more and then open; after that the thresholds settle near 0.04 and 0.96. Two consistent reports give b=0.970b=0.970, past 0.960, while one gives only 0.85: in the long run the optimal policy listens until one side leads by two reports, then opens the other door.

Why stop at a lead of two? Each round of "listen until one side leads by dd, then open the other door" trades the cost of listening against the risk of the tiger:

Lead ddListens per roundRight doorReward per roundValue from b=0.5b=0.5 (γ=0.95\gamma=0.95)
1185.0%−7.5−73.6
22.797.0%+4.0+19.37
34.299.5%+5.2+16.26
45.799.9%+4.2+8.64
Per round, a lead of 3 pays most, but its rounds take longer. The lead-2 policy has the highest discounted value, and it is exactly optimal: V⋆(0.5)≈19.37V^\star(0.5)\approx19.37. Listening is not valuable in itself; it is valuable because it moves the belief at which you act.
Check your understanding

Per round, waiting for a lead of 3 earns more (+5.2) than a lead of 2 (+4.0). Why is the lead-2 policy the optimal one with γ=0.95\gamma=0.95?

  1. Its rounds are shorter, so it collects its rewards sooner and more often
  2. A lead of 3 is reached in fewer rounds
  3. The belief after a lead of 3 is less accurate
  4. It is not: the lead-3 policy is optimal
Show the answer

A. Its rounds are shorter, so it collects its rewards sooner and more often

A round with lead 3 takes about 4.2 listens plus the opening, against 2.7 plus the opening. Per step that is 5.2/5.2≈0.995.2/5.2\approx0.99 against 4.0/3.7≈1.084.0/3.7\approx1.08, and discounting rewards the faster rhythm as well: 19.37 against 16.26 from b=0.5b=0.5.

Shortcuts, and why exact planning is hard

Planning as if you could see. A popular shortcut, QMDP, solves the underlying MDP and scores each action by ∑sb(s)QMDP⋆(s,a)\sum_sb(s)Q^\star_{\text{MDP}}(s,a), as if the state were revealed after one step. On the tiger problem it listens until bb passes 0.9 and then opens, which is the lead-of-two policy, by luck: it listens because listening is cheap, not because it is informative, and it cannot tell listening apart from an action that costs the same and reveals nothing (Approximate POMDP Planning shows it then fails).

Why exact planning is hard. Beliefs form a continuum of dimension S−1S-1, the curse of dimensionality, and the beliefs reachable in hh steps can multiply like (AO)h(AO)^h, the curse of history. Finite-horizon POMDP planning is PSPACE-complete, against P-complete for MDPs (Papadimitriou & Tsitsiklis, 1987). Three families of methods respond: exact value iteration over α-vectors for small problems, point-based and online search methods for large ones, and, in deep RL, agents that learn a memory instead of a model.

Key takeaways

  • A POMDP adds observations Z(o∣s′,a)Z(o\mid s',a) to an MDP. The agent acts on its belief bt(s)=Pr⁡(St=s∣Ht)b_t(s)=\Pr(S_t=s\mid H_t), updated by a Bayes filter: predict through PP, correct with ZZ, normalize.
  • The belief is a sufficient statistic, so a POMDP is an MDP over the simplex, with reward ρ(b,a)=∑sb(s)r(s,a)\rho(b,a)=\sum_sb(s)r(s,a) and a move to τ(b,a,o)\tau(b,a,o) with probability Pr⁡(o∣b,a)\Pr(o\mid b,a).
  • Value functions over beliefs are piecewise linear and convex (for the tiger, an upper envelope of lines), and convexity says that information never hurts.
  • In the tiger problem the optimal policy listens until one side leads by two reports (b≈0.97b\approx0.97), worth 19.37 from b=0.5b=0.5; the best reactive policy never opens and earns −20-20.

Check yourself

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

Question 1

In the tiger problem (p=0.85p=0.85) you start at b=0.5b=0.5 and hear left, left, right, left. What is your belief that the tiger is on the left?

  1. 0.85
  2. 0.970
  3. 0.5
  4. 0.9945
Show the answer

B. 0.970

Only the net count matters: three left against one right is a lead of two, so b=0.852/(0.852+0.152)≈0.970b=0.85^2/(0.85^2+0.15^2)\approx0.970, the same as two left reports in a row.

Question 2

In the belief MDP, with what probability does belief bb move to τ(b,a,o)\tau(b,a,o) after action aa?

  1. Z(o∣s′,a)Z(o\mid s',a) for the true next state s′s'
  2. 1/∣O∣1/\abs{\mathcal O}
  3. 1, because the belief update is deterministic
  4. Pr⁡(o∣b,a)=∑s′Z(o∣s′,a)∑sP(s′∣s,a) b(s)\Pr(o\mid b,a)=\sum_{s'}Z(o\mid s',a)\sum_sP(s'\mid s,a)\,b(s)
Show the answer

D. Pr⁡(o∣b,a)=∑s′Z(o∣s′,a)∑sP(s′∣s,a) b(s)\Pr(o\mid b,a)=\sum_{s'}Z(o\mid s',a)\sum_sP(s'\mid s,a)\,b(s)

The next belief is a deterministic function of (b,a,o)(b,a,o), but the observation is random. Its probability, averaged over where the state might be and where it goes, is the normalizer of the Bayes update.

Question 3

With one decision left in the tiger problem, for which beliefs b=Pr⁡(TL)b=\Pr(\text{TL}) is opening the left door optimal?

  1. b<0.5b<0.5
  2. b<0.15b<0.15
  3. b<0.1b<0.1
  4. Never: with one decision left, listening is always best
Show the answer

C. b<0.1b<0.1

Opening the left door is worth 10−110b10-110b, which beats listening's −1-1 when b<0.1b<0.1; with no later step, listening cannot pay off. With two decisions left the threshold drops to about 0.024, because listening once and then deciding is better than gambling now.

Question 4

QMDP scores actions by ∑sb(s)QMDP⋆(s,a)\sum_sb(s)Q^\star_{\text{MDP}}(s,a). Why can it fail to gather information?

  1. It assumes the state will be known after one step, so information has no value in its scores
  2. It uses the wrong discount factor
  3. It ignores the rewards of the POMDP
  4. It needs the belief to be exact
Show the answer

A. It assumes the state will be known after one step, so information has no value in its scores

Under QMDP's assumption the uncertainty vanishes after one step whatever you do, so an informative action scores the same as an uninformative one with the same cost. On the tiger problem it happens to act optimally; offered an action that costs slightly less than listening and reveals nothing, it would take that one forever.

Go deeper

Further reading

  • 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).
  • K. J. Åström, "Optimal control of Markov processes with incomplete state information," Journal of Mathematical Analysis and Applications 10, 174–205 (1965).
  • R. D. Smallwood & E. J. Sondik, "The optimal control of partially observable Markov processes over a finite horizon," Operations Research 21(5), 1071–1088 (1973).
  • S. Thrun, W. Burgard & D. Fox, Probabilistic Robotics (MIT Press, 2005).