Bisimulation Metrics and Trajectory Coupling
Today I want to share a rabbit hole I went down where I made an (in my view) interesting mistake when learning about bisimulation metrics. (*1)
Bisimulation Metrics
Bisimulation metrics can be viewed as a measure of behavioral equivalence/similarities between states in Markov chains. As a starter, consider a Markov chain over state space with a reward function Roughly speaking, if two states and admit similar rewards (*2)—the rewards are the “behavior” of the states that actually matter—we are willing to say the states are similar, even if and themselves “look” very different (e.g., and are real vectors that are far away from each other in Euclidean distance).
Of course things are not that easy: these states will transition to random next-states and , who will produce their own rewards and . So when we say and are behaviorally similar, we want to make sure not only they share similar immediate rewards , but they also transition to distributions of states that admit similar rewards, i.e., and are similar distributed, and and further transition to states whose reward similarities need to be accounted for… and so on and so forth. (*3)
The bisimulation metric captures the above intuition mathematically. In fact, it allows you to measure state similarity even between different chains. Consider two Markov chains defined over state spaces and , respectively, with transition kernels and . (If you want to measure state similarity in a single chain , just invoke the definition with and .) Let and be the reward functions. Then, the bisimulation metric measures the distance between a state and as:
where is a coupling between two distributions as often seen in the definition of Wasserstein’s distance, i.e., for and , is any joint distribution whose marginal matches and whose marginal matches .
Trajectory Coupling
A remarkable observation, made here and here, is that Eq.(1) is the Bellman optimality equation of an “augmented MDP” with state space . (*4) Viewed this way, is the in this augmented MDP, the LHS is simply at state , and on the RHS is the immediate reward. is minimizing over actions (so we are doing cost minimization instead of reward maximization), and the transition distribution over the next is given by the action itself.
And my down-the-rabbit-hole journey starts here: what does it look like to rollout Monte-Carlo trajectories in the MDP described by Eq.(1), under some policy for choosing ? Well, we start with some as initial state, i.e., . In each step , a policy chooses a to draw in a way that respects the transition laws of and , i.e., , and similarly for . So at the end of the day, this defines a joint distribution over
where the marginal of over is clearly identically distributed as a trajectory drawn from (let’s denote the distribution of trajectories starting from as ), and similarly for . Thus, we have
Moreover, the random return along this trajectory is
Seeing this, a guess immediately came to my mind: if a policy for choosing defines a coupling between and trajectories, perhaps the optimal policy in Eq.(1) simply induces the optimal coupling between and for minimizing Eq.(2)? If this is true, we will have a remarkable consequence that, is the Wasserstein distance between and , where the base metric is Eq.(2), i.e.,
Believing my intuition was correct, I started to sketch a proof based on the following claims (my mistake is hidden somewhere; see if you can spot it before I reveal the answer!):
Claim 1: A policy for choosing in the augmented MDP defines a coupling between and .
Justification: Evident from the description above.
Claim 2: Conversely, any coupling between and is a history-dependent policy in the augmented MDP.
Justification: The joint distribution between and specified by the coupling can always be written as the product of , which maps history of the augmented MDP to a distribution over next . Since the coupling respects the marginals of and , it also respects and , which is consistent with the “” specification in Eq.(1).
Claim 3: Among all history-dependent policies, the optimal one is Markov, i.e., the form of policy considered in Eq.(1).
Justification: Basic property of an infinite-horizon discounted MDP.
Combining the claims, it follows that the optimal policy implied in Eq.(1) minimizes Eq.(2) over all trajectory couplings.
Weird Implications
For a few weeks(!) I believed my reasoning was correct and was pretty excited about Eq.(3), as it implies an embarrassingly simple way (compared to what’s known in the literature) to estimate : roll out multiple trajectories from and , resp., and simply calculate the empirical Wasserstein according to Eq.(2) as the base metric! “There is an elegant paper to write,” I said to myself, “only if I could make sense of a few confusing implications…”
Implication 1: The rate of estimating Wasserstein’s suffers a curse of dimensionality, i.e., if the base metric is a standard distance (say or ) in , typically you’d expect a poor rate of . Now let’s look at Eq.(2): if we assume all trajectories end in steps (or perform the standard truncation), Eq.(2) is an distance in , resulting in rate.
Now what’s really peculiar is this: if the process only has terminal rewards, i.e., unless , then Eq.(2) is in , improving the estimation rate to ! This is super weird and strongly counterintuitive, as terminal rewards alone as an assumption almost never makes a problem fundamentally easier in RL.
Implication 2: In the hierarchy of state abstractions, model-irrelevance (which is closely related to bisimulation metrics (*3)) is at the finest level. Value-irrelevance (such as - or -irrelevance) is a significantly coarser notion, allowing the aggregation of states with similar expected values. Looking at Eq.(3), however, it is clearly closer to the value-irrelevance notion of abstraction than model-irrelevance. In fact, it is like a distributional variant of the former, and they coincide when the Markov chain is deterministic and there are only terminal rewards. This is also counterintuitive as we have not made any significant assumptions that should collapse the abstraction hierarchy.
Understanding the Mistake
The more I thought about the weirdness, the more I believed Eq.(3) is wrong. Eventually, I was able to come up with a simple counterexample:

This is a finite-horizon example and I only consider across states at the same “level”, and it can be easily converted to the discounted setting. Basically we have two chains that both produce a Bernoulli-distributed terminal reward, but their bifurcations occur at different time steps. If we calculate according to Eq.(3), clearly we have . However, if we perform dynamic programming according to Eq.(1), we see that and , so it must follow that .
So what went wrong? (Last chance to make your own guess before the answer is revealed!)
Let’s examine the optimal trajectory coupling in Eq.(3), which is obviously
Now, the conditionals like are consistent with the transition rule of each chain. However, when you do the dynamic programming step in Eq.(1) by hand, you realize that what you need is not , but ! So among my claims, Claim 2 is incorrect: not any trajectory coupling can be realized by a valid policy in the augmented MDP. This is because an arbitrary trajectory coupling only satisfies:
but for the to be valid in the augmented MDP (i.e., it can be induced as the trajectory distribution of some policy), we must have:
In fact, the latter condition is discussed in Sec 2.1 of Calo et al., but without going through all of this I won’t be able to tell why conditioning on is necessary. If I have to find an excuse for myself, I’d say that in Eq.(1) is quite deceptive—it makes you feel that only needs to be respected, while the dependence on is secretly hidden on the LHS of the equation.
To conclude, the valid trajectory distributions in the augmented MDP is generally a small subset of all possible trajectory couplings . I want to develop more intuitions about this subset, and for now I only have some vague ideas like it looks “nested” as transition mass from cannot be coupled with that from a different pair of states (if this means anything). (*5) In any case, the weird implications that bothered me are all wrong, so I can finally make peace with myself. Phew.
Footnote Remarks
(*1) This was inspired by a conversation with Necmiye Ozay and her student Alperen Tercan at L4DC.
(*2) More generally, you don’t need to have a reward, but just some way to measure the “instantaneous” similarity between states.
(*3) This is also the intuition I use for bisimulation abstractions, a highly related topic that is very close to my heart and I teach in my RL courses (I might be one of the very few who does that). The difference and connection between bisimulation abstraction and metric is a topic for another day, but very briefly: for the former, you need to first specify an abstraction, then you can calculate the violation of the bisimulation criteria. Bisimulation metrics are more straightforward and generally tighter as a result: you directly compute from Eq.(1), and can decide how to aggregate states based off it.
(*4) One can extend bisimulation metrics to MDPs, where we need max over on the RHS of Eq.(1). The corresponding “augmented MDP” will actually become a two-player zero-sum game, where the two players take actions in turns (like Chess or Go): the max player chooses an action , and the min player chooses afterwards. The max player here plays a (what I call) “synchronized” policy , that is, choose an action for a pair that is supposedly “coupled” (in the sense they are drawn from a coupling created by the min player). In contrast, when we aggregate states according to bisimulation metrics (see (*3)), we may end up learning a policy that takes different actions for similar states; if you loosely think of these states as “coupled”, then the policy is not “synchronized” which can cause issues. In this sense, on-policy bisimulation metrics, which is basically bisimulation metrics for chains induced by an arbitrary fixed policy, is not necessarily “less pessimistic” than the version, as two states close in the latter can have large distance in the former if the policy takes different actions in them.
(*5) I guess what I am looking for is some way to encode the subset in a clean(?) way. For example, a general trajectory coupling in Eq.(3) only needs to satisfy and similarly for , which provides some “trajectory-level” understanding (that is, if it were right) compared to the very “local” form of the transition coupling in Eq.(1). Now, Calo et al. has something really close (their Eq.(6-8)), which is an exact characterization of the valid occupancies in the augmented MDP. (So this entire blogpost is really just me learning their paper in my own way!) Still, I’d be curious to know if there is a way to characterize the valid distributions at the trajectory level.