Inferensys

Glossary

Multi-Armed Bandit

A reinforcement learning approach for solving the exploration-exploitation dilemma in caching, where algorithms like Thompson Sampling learn optimal content to store.
Data engineer managing feature store on laptop, feature definitions visible, casual data engineering session.
REINFORCEMENT LEARNING

What is Multi-Armed Bandit?

A reinforcement learning framework for solving the exploration-exploitation dilemma in sequential decision-making, where an agent must balance trying new options against leveraging known ones to maximize cumulative reward.

A Multi-Armed Bandit (MAB) is a reinforcement learning framework that formalizes the exploration-exploitation dilemma in sequential decision-making under uncertainty. The name derives from the analogy of a gambler facing multiple slot machines ("one-armed bandits"), each with an unknown payout distribution, who must decide which arms to pull and how often to maximize total winnings over time.

In proactive caching, MAB algorithms like Thompson Sampling and Upper Confidence Bound (UCB) dynamically learn which content to cache at the network edge without requiring a pre-built popularity model. The agent treats each cacheable content item as an arm, observes user requests as rewards, and continuously refines its caching policy to optimize the cache hit ratio while adapting to shifting content popularity patterns.

EXPLORATION-EXPLOITATION FRAMEWORKS

Key MAB Algorithms for Caching

Multi-Armed Bandit algorithms provide a mathematically elegant framework for learning optimal caching policies under uncertainty. By treating each cacheable content item as an 'arm' with an unknown reward probability, these algorithms dynamically balance trying new content against storing known popular items.

01

Epsilon-Greedy Strategy

The simplest MAB algorithm for cache admission control. With probability ε, the cache explores by randomly selecting a new content item to store. With probability 1-ε, it exploits current knowledge by caching the item with the highest estimated cache hit ratio.

  • Implementation: A single tunable parameter (ε) controls the exploration rate
  • Typical values: ε starts at 0.1 and decays over time (ε-decay scheduling)
  • Limitation: Explores uniformly at random, potentially wasting cache space on clearly unpopular items
  • Use case: Baseline comparison for more sophisticated caching policies in MEC Caching environments
O(1)
Decision Complexity
02

Upper Confidence Bound (UCB)

A deterministic algorithm that selects content based on an optimistic estimate of potential reward. UCB computes an upper confidence bound for each item's expected hit rate, combining the observed average with an exploration bonus that shrinks as more data is collected.

  • Formula: Score = μ̂ + √(2 ln(t) / n), where μ̂ is the estimated reward, t is total rounds, and n is times the item was cached
  • Advantage: Eliminates the need for random exploration; systematically tests uncertain items
  • Variants: UCB1 for stationary popularity, Sliding-Window UCB for Content Freshness scenarios
  • Application: Effective when Zipf's Law popularity distributions shift gradually over time
O(log T)
Regret Bound
03

Thompson Sampling

A Bayesian approach that maintains a probability distribution over each content item's true popularity rather than a point estimate. At each decision point, the cache samples from these posterior distributions and selects the item with the highest sampled value.

  • Mechanism: Typically uses Beta-Bernoulli conjugacy—modeling cache hits as Bernoulli trials with Beta-distributed priors
  • Key property: Naturally balances exploration; items with high uncertainty have wider distributions and are more likely to produce high samples
  • Empirical performance: Often outperforms UCB in practice, especially with Temporal Locality patterns
  • Extension: Contextual Thompson Sampling incorporates Context-Aware Caching features like device type and time of day
Beta(α,β)
Posterior Distribution
04

Contextual Bandits for Caching

Extends standard MABs by incorporating side information (context) into the caching decision. Instead of learning a single best item, the algorithm learns a mapping from context vectors to optimal content selections.

  • Context features: User location, time of day, device type, recent browsing history, and Mobility-Aware Caching trajectory predictions
  • Linear UCB: Assumes expected reward is a linear function of context features with a learned parameter vector
  • Neural Bandits: Uses a deep neural network to model complex, non-linear relationships between context and content popularity
  • Integration: Pairs naturally with Sequence-Aware Recommendation systems to predict next-request probabilities conditioned on user context
d-dimensional
Context Vector
05

Combinatorial Bandits

Addresses the realistic constraint that a cache stores a set of items simultaneously, not just one. The action space is the power set of all content, and the reward is the aggregate Cache Hit Ratio across the entire stored collection.

  • Challenge: Naive enumeration is intractable; the number of possible cache configurations grows exponentially with cache capacity
  • Solution: Exploits submodularity of caching rewards—the marginal benefit of adding an item decreases as the cache fills
  • Algorithm: CUCB (Combinatorial UCB) approximates the oracle solution with polynomial complexity using greedy selection on UCB scores
  • Synergy: Models interactions between cached items, such as when Coded Caching creates multicast opportunities across stored content
NP-Hard
Optimal Selection
06

Adversarial Bandits (EXP3)

Designed for non-stationary environments where content popularity can change arbitrarily, even adversarially. Unlike stochastic bandits that assume fixed reward distributions, EXP3 (Exponential-weight algorithm for Exploration and Exploitation) guarantees performance against any sequence of rewards.

  • Mechanism: Maintains an exponential weight for each content item, updated based on observed rewards divided by selection probability (importance sampling)
  • Robustness: Provides worst-case regret bounds of O(√T), making it suitable for viral content spikes and flash crowds
  • Application: Ideal for Cache Warming scenarios where initial popularity estimates are unreliable or when facing Cache Eviction Policy attacks
  • Hybrid approach: Often combined with change-point detection to switch between stochastic and adversarial strategies based on detected distribution shifts
O(√T)
Worst-Case Regret
EXPLORATION-EXPLOITATION

Frequently Asked Questions

Addressing common questions about the application of the multi-armed bandit framework to optimize proactive caching and edge content placement.

A Multi-Armed Bandit (MAB) is a reinforcement learning framework used to solve the sequential decision-making problem of selecting which content to cache at the network edge to maximize cumulative reward, typically measured by cache hit ratio or reduced latency. In this model, each cacheable content item represents an 'arm' of the bandit. The caching algorithm must balance exploration—testing new or infrequently requested content to learn its true popularity—against exploitation—storing the currently known most popular content to guarantee immediate performance. Unlike static cache eviction policies like LRU, a MAB-based strategy continuously adapts to non-stationary content popularity prediction shifts without requiring an explicit pre-trained model of user demand.

Prasad Kumkar

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.