Density-QUCB: Shift-Aware Q-Learning
- DQUCB is a shift-aware algorithm that integrates Q-learning and UCB by using a transition density estimator to modulate the exploration bonus based on in- and out-of-distribution transitions.
- It employs a sliding window with KDE to continuously estimate transition likelihoods, ensuring low exploration during stable phases and increased exploration right after shifts.
- Theoretical and empirical results show that DQUCB mitigates the exploitation of stale policies, achieving lower cumulative regret in both tabular and deep RL settings compared to shift-unaware methods.
Density-QUCB (DQUCB) is a shift-aware Q-learning–UCB algorithm for Non-Stationary Reinforcement Learning under distribution shifts in both finite-horizon episodic and infinite-horizon discounted Markov Decision Processes. It augments Q-learning Upper Confidence Bound (QUCB) with a transition density function used as a likelihood in the optimism bonus, so that exploration is suppressed when observed transitions are in-distribution and increased when post-shift transitions appear out-of-distribution. In the formulation studied in "Q-Learning with Shift-Aware Upper Confidence Bound in Non-Stationary Reinforcement Learning," DQUCB targets the failure mode in which a policy learned before a change-point continues to exploit sub-optimal rewards after the shift; its central mechanism is to divide the UCB bonus by an estimated transition likelihood , thereby making optimism explicitly shift-aware (Bui et al., 3 Oct 2025).
1. Problem setting and formal objectives
The paper studies two single-change-point non-stationary MDP models. In the finite-horizon episodic case, the MDP is
with finite state space , action space , horizon , step-dependent transition operator , and deterministic rewards . Episodes are indexed by , and at the start of each episode , an adversary picks the initial state . The non-stationarity is a single unknown abrupt change-point at episode 0, where transitions switch from 1 to 2. Before the change, 3; after the change, 4. Rewards are fixed across time in the analysis.
For a policy 5, the paper defines the pre-shift and post-shift value and action-value functions as
6
7
8
9
The optimal quantities are denoted 0, and episodic regret is
1
In the infinite-horizon discounted case, the MDP is
2
with discount factor 3, time-homogeneous transition 4 before shift, and a single change-point at time 5 after which transitions follow 6. Rewards are deterministic and satisfy 7. Policies map histories to actions. The discounted regret over the first 8 steps is
9
The discounted analysis also uses sub-optimality gaps
0
with 1 and 2 defined as the minimum strictly positive gaps.
The regularity conditions are deliberately close to standard QUCB analyses. Rewards are bounded in 3, concentration relies on Azuma–Hoeffding martingale inequalities and standard learning-rate properties, and no explicit mixing, ergodicity, or concentrability assumptions are required beyond those implicit in Q-learning UCB analyses. In the discounted setting, strictly positive sub-optimality gaps are used to obtain logarithmic-in-4 dependence. The main theory addresses one change-point, while noting that multiple shifts can be handled by extending the regret decomposition across stationary segments.
2. Transition density and implicit shift detection
DQUCB equips QUCB with a transition density estimator 5 and uses this likelihood directly inside the optimism bonus. The density is computed from a joint density model through Bayes’ rule,
6
The model is fit by maximum likelihood on a sliding window of the 7 most recent transition tuples 8. The paper instantiates 9 with a nonparametric estimator, specifically Kernel Density Estimation (KDE), for computational simplicity. In tabular episodic settings with step-dependent dynamics, a separate parameter 0 is maintained for each step 1; in the discounted setting, a single global parameter 2 is used.
The paper interprets this quantity as an approximate density ratio,
3
where 4 is the cumulative dataset used to fit 5 and 6 is the current sample. Before the shift, 7, so 8. At the change-point and shortly after, 9 while 0, so 1. After sufficient post-shift data are absorbed by the sliding window, the two distributions again match and 2.
A defining characteristic of DQUCB is that it does not perform explicit change-point testing. There is no GLR, no CUSUM, and no thresholded test statistic. Instead, shift handling is implicit: the algorithm continuously re-estimates 3 and scales the UCB bonus inversely by this likelihood. In-distribution samples therefore yield 4 close to 5, reducing exploration pressure, while out-of-distribution post-shift samples yield smaller 6 and inflate the bonus. False positives and false negatives are not explicitly controlled by a detector; robustness is attributed to the windowed density fit and to the smooth modulation of optimism rather than to hard reset logic.
This design also clarifies a common misconception. DQUCB is not a model-based RL method in the usual sense of explicitly estimating the full transition kernel. It uses density estimation only to modulate uncertainty in a model-free Q-learning–UCB update. A plausible implication is that the method occupies an intermediate position: it remains algorithmically model-free at the control level while importing a lightweight transition-likelihood signal for non-stationarity handling.
3. Q-learning updates and density-weighted optimism
The starting point is the standard tabular QUCB update. In the episodic setting, with visit counter 7 and learning rate
8
QUCB uses the value backup
9
and updates
0
with Hoeffding-style bonus
1
DQUCB changes only the bonus:
2
The episodic update becomes
3
When the environment is stable, 4, so the bonus is close to that of ordinary QUCB or smaller in effective impact. Immediately after a shift, the paper argues that 5 drops, approximately as 6, which inflates the bonus and pushes the algorithm away from stale pre-shift Q-values.
In the discounted setting, the effective horizon for analysis is
7
with learning rate
8
The QUCB bonus is
9
while the DQUCB bonus is
0
The discounted update uses auxiliary optimistic estimates,
1
and performs
2
The procedural structure mirrors these formulas. In episodic DQUCB, the inputs are 3, window size 4, and a density model class such as KDE; initialization sets 5, 6, and a density model for each step. For each episode and step, the algorithm selects 7, observes 8, increments the visit count, computes the likelihood 9, sets the density-aware bonus, updates 0, updates 1, and then refits 2 on the most recent 3 transition tuples. In discounted DQUCB, the structure is analogous but uses a single density model updated online at every step.
The computational overhead comes entirely from density fitting. With KDE over a window of size 4, the episodic version requires 5 time per fit and overall 6 time, with memory 7 for Q-values plus 8 for recent buffers. In the discounted case, density refitting costs 9 per update and 0 overall, with memory 1 for Q-values plus 2 for the buffer. Compared to QUCB, DQUCB therefore adds density buffers and model fits, but remains substantially lighter than explicit model-based transition estimation.
4. Regret guarantees and proof architecture
The main theoretical claim is that DQUCB achieves improved high-probability regret bounds over shift-unaware QUCB in both problem settings, with the gain arising from the elimination of the linear post-shift exploitation tail that can appear when stale pre-shift Q-values remain optimistic under the wrong transition law (Bui et al., 3 Oct 2025).
For the finite-horizon setting, Theorem 1 states that, for an absolute constant 3, with probability at least 4, choosing
5
yields
6
where 7 is the estimator error of 8. In the oracle limit 9,
00
By contrast, the paper remarks that non-shift-aware QUCB with
01
can incur
02
which is asymptotically worse as 03 grows because of the linear 04 term.
For the discounted setting, Theorem 2 states that, for an absolute constant 05, with probability at least 06, choosing
07
gives
08
In the oracle limit 09, the same expression holds without the multiplicative 10. The corresponding remark for ordinary QUCB is
11
again asymptotically worse because of the linear post-shift term.
The proof strategy decomposes regret before and after the change-point and treats optimism relative to 12 and 13 separately. Learning-rate lemmas for 14 control propagated error through visit mass, square-sum, and scale properties. Concentration is handled using Azuma–Hoeffding bounds on martingale difference sequences associated with empirical and true transitions. The density-aware bonus enters as
15
in the episodic case and
16
in the discounted case. The estimator error of 17 appears multiplicatively as the 18 factor.
A common misunderstanding would be to read these theorems as explicit guarantees for change-point detection accuracy. They are not. The guarantees are regret guarantees for a density-modulated optimistic learner under a single abrupt shift. The paper’s theoretical object is adaptation through bonus inflation, not certified detection delay or false-alarm control.
5. Empirical evaluation and observed behavior
The empirical study spans tabular benchmarks, a deep RL benchmark, and a real-world allocation problem, and reports that DQUCB consistently achieves lower cumulative regret than QUCB after shifts while preserving the computational efficiency of model-free RL (Bui et al., 3 Oct 2025).
In tabular experiments, the paper evaluates GridWorld and Frozen-Lake. The GridWorld environment is a 19 grid with a shift in transition noise 20 from 21 to 22 at episode 23, using 24 and 25. Frozen-Lake is a 26 environment with slippery-level shifts 27 at 28, using 29 and 30. The tabular baselines are QUCB, UCBMQ, and UCBVI. The reported pattern is that DQUCB consistently achieves lower cumulative regret than QUCB after shifts, confirming faster adaptation. Relative to UCBVI and UCBMQ, DQUCB trades slightly higher regret for significantly lower time and space complexity. For GridWorld, the complexity comparison states that model-based methods incur 31 time and 32 space, whereas DQUCB uses 33 time and 34 space.
In deep RL, the study uses CartPole-v0 with continuous state and two actions. The shift is the addition of Gaussian noise 35 to velocity features after episode 36, with 37. Density estimation still uses KDE with sliding window 38, while visit counts 39 are approximated with hashing in continuous state space. Baselines are random, DQN, and DQN-UCB. The reported result is that, despite instability of deep Q-learning, DQUCB shows the lowest cumulative regret, particularly post-shift. The accompanying calibration analysis reports that DQN-UCB becomes overconfident after shifts, whereas DQUCB remains better-calibrated because the bonus reacts to transition likelihood.
The real-world task is an infinite-horizon COVID-19 patient hospital allocation problem with 40 Texas hospitals and 41 days. The shift occurs at day 42 through a change in the environment parameter 43, affecting occupancy dynamics. The state is 44, the action is 45 subject to 46, and the reward penalizes overflow. Additional baselines are UCB_RA and CUCB_RA. The reported outcome is that DQUCB exhibits lower regret, equivalently higher reward, than DQN-UCB and the bandit baselines, especially post-shift. The normalized likelihood from the density model drops at the change-point, and this drop correlates with an increased UCB bonus and with explorative reallocation that reduces overflow.
The ablation results sharpen the empirical characterization. Under varying shift intensity in Frozen-Lake, DQUCB remains superior to QUCB and UCBMQ across intensities, although extreme noise degrades all methods, including UCBVI. Under a map-change shift in GridWorld from one-room to two-rooms, DQUCB adapts faster than QUCB. Under perturbed transition estimates in a comparison to UCBVI, model-based UCBVI degrades more as transition estimation error increases, while DQUCB remains more robust because it does not explicitly fit a full transition matrix.
6. Practical considerations, limitations, and relation to prior work
The implementation described in the paper uses the same learning-rate schedule as QUCB: 47 in the episodic setting and 48 in the discounted setting with effective horizon 49. The confidence terms are
50
and the bonus constants 51 and 52 are absolute constants, tuned in practice. The density model is KDE on approximately the last 53 samples, reflecting a trade-off between responsiveness and variance. In deep RL, hashing is used to approximate visit counts in continuous spaces (Bui et al., 3 Oct 2025).
The most direct limitation is density estimation accuracy. The regret bounds depend on the estimator error of 54, and the theory records this dependence through the multiplicative 55 factor. KDE may become costly or inaccurate in very high dimensions; the authors therefore suggest alternative density estimators with near-linear time and space. A second limitation is the shift model. DQUCB is tailored to abrupt, piecewise-stationary changes. Gradual drifts are still handled implicitly through the sliding window and the density-weighted bonus, but without explicit drift modeling. A third limitation concerns large state-action spaces: although DQUCB is more scalable than model-based RL, the per-step density models in the episodic setting and the global density fit in the discounted setting still add overhead relative to vanilla QUCB.
Its relation to prior work is sharply defined. Relative to QUCB and related UCB-based RL methods, DQUCB extends model-free Q-learning–UCB by making optimism shift-aware via a transition likelihood. Relative to model-based UCBVI or UCLR-style approaches, it avoids full transition estimation and the associated 56 costs. Relative to explicit change-point detection methods based on GLR or CUSUM, it replaces thresholding with continuous density-weighted optimism, which simplifies the mechanism but does not provide explicit false-alarm guarantees. Relative to momentum Q-learning methods such as UCBMQ, the paper positions DQUCB as simpler and more computationally efficient because UCBMQ requires bias-value function computation.
The paper also outlines several extensions. These include a model-based DQUCB that combines density-weighted bonuses with lightweight model learning such as linear mixture models; replacements for KDE in continuous state-action spaces, including normalizing flows or energy-based models and adaptation to actor-critic architectures; partial observability through densities over belief states or latent representations; and multiple change-points by decomposing the horizon into stationary segments and summing per-segment regret. These proposals are not developed into full algorithms in the paper, but they indicate the breadth of settings in which density-aware optimism could plausibly be transplanted.
At a conceptual level, DQUCB’s core contribution is narrow and specific: it modifies the UCB bonus in Q-learning by dividing by the estimated transition likelihood 57. This keeps exploration low when transitions match recent historical data and automatically increases exploration after an abrupt shift, mitigating exploitation of outdated policies. Within the scope studied, that modification is sufficient to produce improved oracle regret guarantees over shift-unaware QUCB and lower regret in tabular, deep RL, and real-world hospital-allocation experiments.