A Paradox on Sampling Trajectories with Approximate Belief States
As mentioned on X, I got interested in a POMDP question more than 1 year ago, and discovered many interesting results against my initial intuition. After procrastinating forever, I eventually found time to write things down,1 and decided to share a piece of the counterintuitive results here as a teaser for the paper. The answer can be found in the paper, and I will post the link here after it appears on arXiv. (Update 11/26: paper link)
Background
Suppose we have a simulator modeled as a finite-horizon POMDP . When sampling a trajectory in the simulator, we sample latent states from the latent transition and generate observations from the emission process , and the record of an episode includes , i.e., the observations, the actions, and the latent states. The task is to use Monte-Carlo roll-outs to estimate the Q-value for any given pair and target policy , where is the prefix of an observable trajectory, or history. Note that the Q-function for a POMDP can be defined through the corresponding history-based MDP, i.e., the POMDP induces a conditional distribution of , which can be treated as the transition dynamics of an MDP with as the state.2
In an MDP, we can roll-out multiple trajectories from a given pair to estimate . Similarly, for the POMDP, we want to roll-out trajectories from to estimate . The problem is that the given does not include the value of , without which we cannot roll-out the simulation. The POMCP paper ran into this problem when they tried to apply MCTS to POMDPs, and suggested that the correct approach is to sample from the belief state, . That is, if we have access to , below is the correct way to sample an unbiased estimate of :
-
Sample .
-
Take given action , and sample , .
-
Repeat Step 2 by taking actions according to till the end of the trajectory. Take the sum of rewards (assume they are functions of the observations) as the Monte-Carlo return.
Roll-out using an Inaccurate Belief State
The problem is that is not directly available, and must be approximated via various techniques in Bayesian inference.3 So let’s consider the setting where we are given some candidates , and we want to select an appropriate so that we can produce the correct roll-out for estimating Q-values.
There are many ways to perform the selection (this is what the paper is about!), one of which is the following: note that
-
The value function for a POMDP is defined through the induced history-based MDP, which we denote as .
-
Every also induces a history-based MDP from which we can efficiently sample: given any , we can sample as . We denote this MDP as .
In general, if is incorrect we would have , so a natural selection criterion is to choose such that .4 This way, we can hope that the Q-functions defined in the two history-based MDPs are close to each other.
The Paradox
Suppose we successfully choose a such that and are exactly the same. Then their corresponding Q-functions should also be identical. This should imply that our earlier roll-out procedure using and should produce the right Monte-Carlo return, right?
The answer is no! And questions for you (answer can be found in the paper):
-
Which step of the above reasoning went wrong?
-
It is possible to fix this by changing the roll-out method. How? Note that we only have efficient sampling access to .
Footnote Remarks
-
The style of the paper does not quite fit the common standards of publications (I had an uphill battle before and do not want to try again), and the main purpose of writing is to offload the ideas from my mind so that they do not keep coming up and occupying my thought space forever… and for that I have to strike a trade-off between the rigor of the paper and the time spent on it. As a result, some proofs in the paper are not fully fleshed out, but I have expanded the key analyses to the extent that, I am reasonably confident I am not missing anything major. ↩
-
We only consider policies that operate on the observable history. If the policy can depend on the latent states, there will be confounding issues. ↩
-
What the POMCP paper did was the most basic ABC method, rejection sampling: to sample from , they (1) naturally simulate trajectories by replaying the actions in , and (2) reject the trajectory and start over again when any of the simulated observation disagrees with its counterpart in . Obviously, this procedure is extremely inefficient without a heavy dose of approximations and heuristics. On a tangentially related note, I recently ran into a structural estimation problem in econ where similar rejection sampling is also needed. (Update 11/29: I took another look at the POMCP paper and realize that they may be doing a sample-with-replacement variant of this by sampling all trajectories simultaneously. My current understanding is that it should compromise unbiasedness but might still be correct in the limit of infinite particles.) ↩
-
This is the principle of behavioral equivalence, which has a heavy influence in RL research, especially on topics related to POMDPs. See e.g., PSRs. ↩