Provably Efficient Q-Learning with Low Switching Cost

Yu Bai, Tengyang Xie, Nan Jiang, Yu-Xiang Wang

Abstract

In standard Reinforcement Learning (RL) theory, algorithms are typically fully adaptive, updating their policies after every episode of interaction. However, in many real-world applications—such as medical trials, hardware optimization, or large-scale recommendation systems—frequent policy deployment is prohibitively expensive or logistically impossible. This paper addresses the challenge of designing RL algorithms that achieve near-optimal regret while minimizing the number of policy updates, a metric known as switching cost. We introduce two Q-learning variants, UCB2-Hoeffding (UCB2H) and UCB2-Bernstein (UCB2B), which utilize a novel two-stage triggering mechanism to achieve logarithmic adaptivity. Our results demonstrate that updating a policy $O(\log K)$ times is sufficient to match the regret bounds of fully adaptive state-of-the-art model-free algorithms.

1. Introduction

Most theoretical frameworks for Reinforcement Learning assume that an agent can update its strategy instantaneously after every episode. While mathematically convenient, this "fully adaptive" requirement is a significant barrier to practical implementation. For instance, in clinical trials, treatment protocols cannot be altered for every individual patient feedback. Similarly, in systems like FPGAs or distributed web services, deploying a new policy involves significant downtime or computational overhead.

This paper formalizes these constraints by focusing on the switching cost: the number of times an algorithm changes its deployed policy. The goal is to bridge the gap between high-performance RL and the practical need for infrequent updates without sacrificing the agent's ability to minimize regret.

2. Problem Formulation and Switching Cost

We consider an episodic tabular Markov Decision Process (MDP) denoted by $M(S, A, H, P, r)$. The agent's performance is measured by regret, the cumulative difference between the rewards earned by an optimal policy and those earned by the agent over $K$ episodes.

To quantify the frequency of updates, the authors introduce the local switching cost. This metric counts the total number of times the action for any specific state-step pair $(h, x)$ is modified across all episodes. This is particularly relevant for modular or distributed systems where only specific components of a policy might be updated at any given time.

3. Methodology: UCB2-Style Q-Learning

The proposed algorithms, UCB2H and UCB2B, leverage a two-stage switching strategy inspired by the UCB2 bandit algorithm. The core innovation lies in how the algorithm decides when to sync its internal knowledge with the deployed policy.

3.1 Two-Stage Switching Strategy

The algorithm maintains two sets of Q-estimates: a "running" estimate that is updated with every interaction and a "delayed" estimate used for decision-making. The transition between these estimates follows two stages:

  1. Stage I (Eager Updates): For the initial visits to a state-action pair, the policy is updated immediately to allow for rapid early learning.
  2. Stage II (Delayed Updates): Once a pair has been visited a threshold number of times, the algorithm enters a "lazy" schedule. It only updates the deployed policy when the number of visits to that specific state-action pair increases by a factor of $(1+\eta)$.

3.2 Technical Innovation

The primary technical challenge is ensuring that using a "stale" (delayed) policy does not lead to diverging errors. The authors employ a novel perturbation analysis to prove that error propagation remains stable despite the infrequent synchronization between the running and delayed Q-estimates.

4. Theoretical Results

4.1 Regret and Switching Bounds

The algorithms achieve regret bounds that match the state-of-the-art for fully adaptive model-free RL:

  • UCB2H (Hoeffding): $\tilde{O}(\sqrt{H^4 SAT})$
  • UCB2B (Bernstein): $\tilde{O}(\sqrt{H^3 SAT})$

Crucially, these bounds are achieved with a local switching cost of only $O(H^3 SA \log K)$. This represents a massive reduction from the $O(HK)$ switches required by standard Q-learning algorithms.

4.2 Lower Bounds

The authors establish a fundamental lower bound of $\Omega(HSA)$ for the switching cost of any no-regret algorithm. This suggests that the $O(H^3 SA \log K)$ upper bound is reasonably tight, particularly regarding the dependence on the state and action spaces.

5. Discussion and Implications

5.1 Parallelization and Concurrent RL

A significant benefit of low switching cost is "natural parallelizability." Because the policy remains fixed for long intervals, multiple agents can execute the same policy across $M$ parallel machines without needing constant communication. The authors show that their approach achieves a nearly linear speedup in execution time, outperforming previous concurrent RL methods in terms of mistake bounds.

5.2 Limitations and Future Work

While the paper provides a strong theoretical foundation, several areas remain for exploration:

  • The Horizon Gap: There is a discrepancy between the $H^3$ upper bound and the $H^1$ lower bound regarding the horizon $H$.
  • Model-Based Approaches: While this work focuses on model-free Q-learning, model-based methods might offer even better trade-offs between regret and switching costs.
  • Function Approximation: Extending these guarantees from tabular MDPs to deep RL with function approximation is a critical next step for scaling these insights to high-dimensional environments.

6. Conclusion

This work proves that logarithmic adaptivity is sufficient for efficient reinforcement learning. By demonstrating that Q-learning can maintain near-optimal regret with a low switching cost, the authors provide a framework that is significantly more compatible with the constraints of real-world physical and clinical systems.

Summary updated

BibTeX
@inproceedings{bai2019provably,
  author = {Yu Bai and Tengyang Xie and Nan Jiang and Yu-Xiang Wang},
  title = {{Provably Efficient Q-Learning with Low Switching Cost}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2019},
  url = {https://openreview.net/forum?id=H-TswOa6_a},
}
Figure