Asymptotically Optimal Sequential Testing with Markovian Data

Alhad Sethi, Kavali Sofia Sagar, Shubhada Agrawal, Debabrota Basu, P. N. Karthik

Abstract / TL;DR This paper introduces a novel, asymptotically optimal framework for sequential hypothesis testing when data is generated by an ergodic, finite-state Markov chain rather than independent samples. By deriving a sharp, non-asymptotic lower bound on stopping times and designing a matching test, the authors provide a rigorous methodology to detect model misspecification in complex systems, such as Markov Chain Monte Carlo (MCMC) samplers and Reinforcement Learning (RL) environments.

Introduction

In classical statistics, hypothesis testing traditionally assumes that data points are independent and identically distributed (i.i.d.). However, many modern data streams—ranging from sensor networks to Reinforcement Learning (RL) agents—exhibit strong temporal dependence. The most common model for this dependence is a Markov chain, where the next state depends solely on the current state.

Sequential testing aims to optimize efficiency: the goal is to stop collecting data and make a decision as soon as sufficient evidence is gathered to meet a target error rate ($\alpha$). While robust tools exist for i.i.d. data, existing methods for Markovian data have historically been sub-optimal (requiring more samples than necessary) or limited to simple hypotheses (comparing one specific model against another). This paper tackles the more realistic and challenging composite case, where both the null and alternative hypotheses represent entire sets of possible transition matrices.

Theoretical Framework and Methodology

The authors provide a comprehensive theoretical and algorithmic foundation for Markovian sequential testing, structured around a tight lower bound and an optimal testing algorithm.

The Non-Asymptotic Lower Bound

The paper establishes a non-asymptotic "speed limit" for any valid sequential test. The authors demonstrate that the expected stopping time must scale with $\log(1/\alpha)$ divided by a specific information-theoretic quantity: the stationary-weighted Kullback-Leibler (KL) divergence between the true model and the closest model in the null set. Unlike i.i.d. testing where every sample is equally informative, the "hardness" of Markovian testing depends heavily on how often the chain visits states where the two hypotheses differ. The lower bound explicitly incorporates this stationary distribution.

The Poisson Equation and Martingale Decomposition

To handle the mathematical noise introduced by data dependence, the authors leverage the Poisson equation. This allows them to decompose the data stream into a manageable martingale term and a negligible remainder. A key theoretical breakthrough in the paper is controlling the "Poisson solution" uniformly across the entire alternative hypothesis set, a critical missing piece in prior literature.

An Optimal Sequential Test

Building on these insights, the authors propose a sequential test that estimates the transition matrix on the fly and calculates a martingale-based statistic. The test stops and rejects the null hypothesis the moment this statistic crosses a threshold that accounts for the number of visits to each state. Recognizing that calculating the exact test statistic for composite nulls can be computationally demanding, they also introduce a "Pinsker-type" inequality for Markov chains. This yields a surrogate statistic that is easier to compute while preserving strict error guarantees.

Empirical Validation

The framework was evaluated using simulated environments designed to mirror real-world research challenges:

  • MCMC Misspecification: Using a 5-state Markov chain, the test successfully detected whether a sampler was targeting the correct stationary distribution. In experiments, the test identified "bad" samplers with a false alarm probability near zero ($1.21 \times 10^{-30}$), demonstrating extreme reliability.
  • Reinforcement Learning (Mountain Car): The authors applied their test to a discretized version of the classic Mountain Car environment (64 states, 3 actions) to test the "Linear MDP" hypothesis. The algorithm correctly identified when low-dimensional linear features were insufficient to describe the environment's dynamics, with the test statistic growing linearly as evidence accumulated.
  • Synthetic Parametric Families: Using a one-parameter exponential family of transition matrices, the authors benchmarked their stopping times against theoretical limits, confirming that as the required error rate ($\alpha$) approaches zero, the test's stopping time perfectly matches the theoretical lower bound.

Limitations and Future Directions

While the paper provides a sharp and general characterization of optimal sequential testing under Markovian dependence, several avenues for future work remain:

  • State Space Extensions: The current theory is built for finite-state Markov chains. Extending these guarantees to continuous or infinite state spaces—common in robotics and continuous control—remains an open challenge.
  • Computational Complexity: Although the authors provide a tractable surrogate, solving the test statistic for highly complex, non-convex null hypotheses can still be computationally expensive.
  • Hidden Observations: The framework assumes direct observation of the Markov chain's states. Adapting these methods for Hidden Markov Models (HMMs), where only noisy observations of underlying states are available, is a natural and highly impactful next step.

Summary updated

BibTeX
@inproceedings{sethi2026asymptotically,
  author = {Alhad Sethi and Kavali Sofia Sagar and Shubhada Agrawal and Debabrota Basu and P. N. Karthik},
  title = {{Asymptotically Optimal Sequential Testing with Markovian Data}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=YEckWPoS09},
}
Figure