A non-stationary bandit extends the classic multi-armed bandit framework to environments where the reward distributions are dynamic. Unlike stationary problems where the optimal arm remains constant, non-stationary settings—common in e-commerce and financial markets—require algorithms to detect concept drift and prioritize recent data. The core challenge is distinguishing genuine distribution shifts from random noise to avoid premature abandonment of a temporarily underperforming arm.
Glossary
Non-Stationary Bandit

What is Non-Stationary Bandit?
A non-stationary bandit is a reinforcement learning problem where the underlying reward probability distributions for each action change over time, requiring the algorithm to continuously adapt by discounting or forgetting obsolete historical observations.
Standard algorithms are adapted using discounting mechanisms such as sliding windows or exponential decay of past rewards. For example, a discounted UCB or sliding-window Thompson Sampling applies a decay factor to older observations, ensuring the model's model freshness remains high. This continuous adaptation is critical for dynamic pricing and real-time recommendation systems where consumer preferences and competitor actions are in constant flux.
Key Characteristics of Non-Stationary Bandits
Non-stationary bandits address the critical real-world scenario where user preferences and environmental factors shift over time, requiring algorithms to continuously adapt and discount obsolete historical data.
Temporal Reward Distribution Shift
The fundamental property distinguishing non-stationary bandits: the expected reward for a given action changes over time. Unlike stationary problems where the optimal arm is fixed, here the underlying probability distribution drifts. This requires the algorithm to treat recent observations as more informative than older ones, effectively implementing a forgetting mechanism to track the moving target.
Discounting and Windowing Strategies
To adapt to drift, algorithms employ explicit mechanisms to weight recent data more heavily:
- Sliding Windows: Only consider the last W observations, discarding older data entirely.
- Exponential Discounting: Apply a decay factor γ (gamma) where the weight of an observation halves after a fixed number of steps.
- Weighted Least Squares: In contextual settings like Discounted LinUCB, the linear model is fit by minimizing a weighted sum of squared errors, prioritizing recent context-reward pairs.
Abrupt vs. Gradual Change Detection
Non-stationarity manifests in two primary patterns:
- Gradual Drift: The reward distribution changes slowly and continuously, like evolving user tastes over weeks. Discounted methods excel here.
- Abrupt Switches: A sudden, discontinuous jump in rewards, such as a product going out of stock or a viral trend emerging. This often requires change-point detection algorithms that actively monitor for statistical breaks and reset the model's memory when a shift is detected, discarding all pre-change data.
Restless Bandit Formulation
A formal extension where the state of each arm evolves independently according to a Markov process, even when not selected. This models scenarios like user patience decaying over time or inventory depleting. The optimal policy must consider not just the immediate reward but how the underlying state of all arms is changing. Solving restless bandits is PSPACE-hard, making heuristic index policies like the Whittle index a common practical approximation.
Regret Against a Dynamic Oracle
Performance is measured by dynamic regret, which compares the algorithm's cumulative reward against a powerful oracle that can switch its chosen arm a limited number of times. This is a harder benchmark than static regret. Algorithms are often characterized by their regret bound as a function of T (time horizon) and S (number of environmental switches), with optimal algorithms achieving sublinear regret that scales with the total variation of the reward sequence.
Practical Deployment: Model Freshness
In production systems, non-stationarity is managed through online model retraining pipelines. A common pattern is the champion-challenger setup where a stable model serves traffic while a frequently retrained challenger is evaluated. Key metrics include model freshness—the time since the last update. For highly dynamic environments like flash sales or breaking news, freshness measured in minutes is critical to prevent serving stale, irrelevant recommendations.
Frequently Asked Questions
Clear, technical answers to the most common questions about non-stationary bandit problems, their mechanisms, and their application in dynamic retail environments.
A non-stationary bandit is a sequential decision-making problem where the underlying reward probability distributions for each action change over time, violating the static assumption of classical bandit models. Unlike stationary bandits where the optimal arm remains constant, a non-stationary bandit requires the algorithm to continuously adapt by discounting or forgetting old observations that no longer reflect the current environment. The core mechanism involves applying a discount factor (gamma) or a sliding window to historical rewards, giving exponentially or strictly less weight to older data points. This ensures the model's estimates track the shifting true means rather than converging to a stale global average. In practice, this is implemented by modifying the update rule of algorithms like Thompson Sampling or UCB to decay the influence of past trials, effectively creating a moving estimate of each arm's value that can respond to abrupt changes or gradual drift in user preferences, seasonality, or market conditions.
Stationary vs. Non-Stationary Bandit Algorithms
A technical comparison of stationary and non-stationary bandit algorithm variants, highlighting their mechanisms for handling changing reward distributions.
| Feature | Stationary Bandit | Non-Stationary Bandit | Contextual Non-Stationary Bandit |
|---|---|---|---|
Reward Distribution Assumption | Fixed over time | Changes over time | Changes based on context and time |
Primary Objective | Identify single best arm | Track best arm as it shifts | Map context to optimal action dynamically |
Discounting Mechanism | None or uniform weighting | Exponential decay or sliding window | Contextualized decay with feature weighting |
Exploration Strategy | Decreasing over time | Sustained or adaptive | Context-dependent adaptive |
Historical Data Weight | All data equally weighted | Recent data weighted higher | Contextually relevant data prioritized |
Regret Bound Type | Static regret | Dynamic regret | Contextual dynamic regret |
Typical Algorithm | UCB1, Thompson Sampling | Sliding-Window UCB, Discounted TS | LinUCB with forgetting, NeuralBandit |
Sensitivity to Concept Drift | High degradation | Adapts to drift | Adapts and attributes drift to context |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
Core concepts for building and evaluating bandit algorithms that thrive in dynamic, non-stationary environments where user preferences and reward structures shift over time.
Model Freshness
A critical metric quantifying how recently a deployed bandit model has been updated to reflect the latest user behavior. In non-stationary environments, stale models suffer from concept drift, where the learned policy no longer matches the current reward distribution. Maintaining freshness requires a continuous training pipeline that ingests streaming data and updates model parameters without full retraining. Techniques include online gradient descent and exponential decay weighting of historical observations.
Contextual Drift
The gradual or abrupt change in the statistical properties of input features over time, distinct from reward drift. For example, a user's contextual feature vector may shift due to seasonality, a new device, or changing economic conditions. A static model will misinterpret these shifted contexts, leading to poor action selection. Detection requires monitoring the population stability index (PSI) or using adaptive windowing (ADWIN) to trigger model retraining when drift exceeds a threshold.
Online Learning
A machine learning paradigm where the model updates incrementally as each new data point arrives, rather than training on a static batch. This is the natural fit for non-stationary bandits, as it allows the policy to track a moving target. Algorithms like Online Gradient Descent or Follow-the-Regularized-Leader (FTRL) update weights with each new reward signal, ensuring the model continuously adapts without the computational cost of periodic full retraining.
Regret Minimization
The optimization objective that measures the difference between the cumulative reward of a theoretical optimal policy and the reward accumulated by the learning algorithm. In a non-stationary setting, the definition shifts to dynamic regret, which compares against a sequence of changing optimal actions rather than a single fixed best arm. Minimizing dynamic regret requires algorithms that can forget stale information quickly, often using a sliding window or discount factor on historical rewards.
Exploration-Exploitation Trade-off
The fundamental dilemma amplified in non-stationary environments. An agent must continuously explore to detect shifts in reward distributions, even if it has already identified a seemingly optimal action. A purely exploitative policy will miss a new, better arm that emerges over time. Strategies like Thompson Sampling naturally maintain exploration through posterior uncertainty, while epsilon-greedy requires a persistent exploration rate to avoid stagnation in a changing world.
Champion-Challenger
A safe deployment pattern for non-stationary environments where a proven champion model serves the majority of live traffic while one or more challenger models receive a small fraction. This allows continuous, real-world evaluation of new algorithms against a shifting baseline. If a challenger demonstrates superior dynamic regret, it is promoted. This framework mitigates the risk of deploying an untested adaptive model that might react poorly to a sudden distribution shift.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us