Abstract
We prove that two popular linear contextual bandit algorithms, OFUL and Thompson Sampling, can be made efficient using Frequent Directions, a deterministic online sketching technique. More precisely, we show that the per-round computational complexity can be reduced from $O(d^2)$ to $O(md)$, where $d$ is the feature dimension and $m$ is the sketch size. We provide theoretical regret bounds that match state-of-the-art algorithms when the underlying data has a low-rank structure and demonstrate the empirical effectiveness of our approach on several real-world datasets.
Introduction
Contextual bandits are a core component of modern personalized recommendation systems and online advertising. In the linear contextual bandit setting, an agent selects actions based on feature vectors, assuming rewards are a linear function of these features. Standard algorithms like OFUL (Optimism in the Face of Uncertainty Linear bandit) and Thompson Sampling (TS) maintain a correlation matrix of past actions. Decision-making requires inverting this matrix or computing its square root, operations that scale quadratically ($\Omega(d^2)$) with the feature dimension $d$. In high-dimensional spaces, this quadratic bottleneck often makes real-time updates computationally prohibitive.
Methodology
To address this challenge, we employ Matrix Sketching, specifically a technique called Frequent Directions (FD). Unlike random projections, FD is a deterministic, online sketching method that maintains a small $m \times d$ matrix (where $m \ll d$) capturing the most important directions (eigenvectors) of the context vectors seen so far. It essentially functions as an online version of Principal Component Analysis (PCA).
We introduce two novel algorithms:
- SOFUL (Sketched OFUL): We modify the standard OFUL algorithm to use the sketched matrix instead of the full correlation matrix, reducing the per-round update time from $O(d^2)$ to $O(md)$.
- Sketched Linear Thompson Sampling: We apply a similar logic to Linear Thompson Sampling, using the sketch to approximate the posterior distribution from which parameters are sampled.
The core theoretical contribution is proving that the "spectral error" ($\epsilon_m$)—the information lost by ignoring the tail end of the data's eigenvalues—can be rigorously bounded within the regret analysis.
Experimental Setup
We evaluated our algorithms on six real-world multiclass classification datasets from the OpenML repository, converted into contextual bandit problems: Bank, SatImage, Spam, Pendigits, MFeat, and CMC. We transformed these into bandit tasks by treating class labels as the "optimal" action, assigning a reward of 1 for correct classification and 0 otherwise.
Results and Discussion
Our empirical results demonstrate that sketching significantly reduces computational overhead with minimal impact on performance.
As shown in the figure above, using a sketch size of only 60% to 80% of the original dimension $d$ resulted in virtually no loss in cumulative reward across multiple datasets. This supports our "Low-Rank Advantage" insight: if the context vectors lie in a lower-dimensional subspace, the sketched algorithms perform as well as their computationally expensive counterparts.
Furthermore, the sketched version often performs as well as a model trained on the "perfect" PCA-reduced subspace known only in hindsight. This highlights the effectiveness of the deterministic FD sketch in capturing relevant data structure online compared to traditional offline methods.
Conclusion
This work demonstrates that matrix sketching via Frequent Directions provides a robust framework for making linear contextual bandits efficient. By reducing the computational complexity from quadratic to linear in the feature dimension, SOFUL and Sketched TS enable the application of sophisticated bandit strategies to high-dimensional real-world problems. While performance may degrade on heavy-tailed data, the theoretical and empirical results suggest that sketching is a powerful tool for scalable online learning.
Summary updated