NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Sample Complexity Characterization for Linear Contextual MDPs

Junze Deng, Yuan Cheng, Shaofeng Zou, Yingbin Liang · DOI

Abstract This paper investigates the theoretical foundations of Reinforcement Learning (RL) in Contextual Markov Decision Processes (CMDPs) using linear function approximation. We analyze two distinct modeling paradigms: Model I, where representations vary with context while weights remain shared, and Model II, where representations are fixed but weights are context-dependent. We establish the first comprehensive sample complexity bounds for these settings, demonstrating that Model I achieves near-optimal efficiency comparable to standard linear MDPs, while Model II exhibits higher complexity due to distribution shifts. Our results provide a rigorous framework for understanding generalization across contexts in high-dimensional state spaces.

1. Introduction

Standard Reinforcement Learning typically assumes a static environment where transition dynamics and reward functions remain constant. However, real-world applications—ranging from personalized recommendation systems to autonomous vehicles navigating varying traffic patterns—are inherently "contextual." In these scenarios, the rules of the environment change based on an external context variable.

While Contextual Markov Decision Processes (CMDPs) provide a powerful mathematical framework for these problems, their theoretical properties have remained largely unexplored for large or infinite state spaces. The primary challenge lies in generalization: how can an agent leverage data collected in one context to improve performance in another? Previous research has largely focused on "tabular" settings with finite states or made restrictive assumptions. This paper addresses this gap by providing a rigorous sample complexity characterization for CMDPs using linear function approximation.

2. Modeling Contextual Dynamics

The authors propose two distinct models to characterize how context influences the underlying MDP dynamics:

2.1 Model I: Varying Representation

In this model, the feature representations (the way the state-action space is perceived) change with the context, but the underlying "logic" or transition weights are shared across all contexts. This suggests a consistent physical or logical law governing the system, even if the features themselves are context-dependent.

2.2 Model II: Varying Linear Weights

Conversely, Model II assumes that the features are fixed across all contexts, but the "importance" or weight of those features changes depending on the context. This model is often more difficult to learn because it introduces a significant distribution shift; data gathered under one set of weights may not be directly applicable to a new context with different weights.

3. Methodology

To address these models, the authors introduce two model-based algorithms designed to estimate transition and reward functions by aggregating historical data across all observed contexts.

3.1 Algorithmic Framework

The proposed algorithms utilize Maximum Likelihood Estimation (MLE) for transition dynamics and Least Square Regression (LSR) for reward functions. By using model-based approaches rather than model-free value estimation, the agent can more effectively synthesize data from diverse environments.

3.2 Technical Innovations

A key innovation in this work is the design of a novel exploration bonus for Model II. While standard RL often employs a simple norm-based bonus, the authors developed a "squared norm" bonus term. This design is necessary to handle the unique uncertainty decomposition that occurs when weights are context-dependent, ensuring the agent explores the state-action space efficiently despite varying weights.

4. Theoretical Results

As a theoretical contribution, the paper evaluates performance based on "Sample Complexity"—the number of episodes ($N$) required to ensure the agent's policy is within $\epsilon$ of the optimal policy.

  • Model I Complexity: The authors prove a bound of approximately $\tilde{O}\left(\frac{H^4 d^3}{\epsilon^2}\right)$, where $H$ is the time horizon and $d$ is the feature dimension. This result is "near-optimal," as it matches the complexity of standard, non-contextual linear MDPs. This indicates that context-varying features do not inherently make the problem harder if the underlying dynamics are shared.
  • Model II Complexity: This model proves significantly more demanding, with a bound of $\tilde{O}\left(\frac{H^4 d^3 K}{\epsilon^2} \cdot \frac{p_{max}}{p_{min}}\right)$. The inclusion of $K$ (the number of actions) and the ratio of state densities ($p_{max}/p_{min}$) reflects the difficulty of learning under distribution shifts.

5. Key Insights

One of the most significant findings is the disparity between feature-varying and weight-varying efficiency. The "Shared Logic" advantage in Model I allows for high sample efficiency, effectively removing the "reachability assumption"—a common but often unrealistic technical requirement in tabular CMDP research that every state must be easily accessible.

Furthermore, the results highlight that having context-varying features (Model I) is fundamentally more efficient for learning than having common representations with varying weights (Model II). This insight provides a roadmap for practitioners on how to structure feature engineering in contextual RL tasks.

6. Limitations and Future Directions

While this work provides a foundational characterization, several areas remain for future exploration:

  • Density Requirements: The analysis for Model II relies on a minimum density assumption ($p_{min}$) for state transitions. While theoretically grounded, this remains a strong requirement for practical application.
  • Exploration Strategies: The current strategy for Model II uses uniform action selection for data collection. Future work could investigate more sophisticated "greedy" exploration strategies that are more common in real-world deployments.
  • Non-Linearity: Extending these bounds from linear models to non-linear function approximations, such as deep neural networks, is a critical next step for the field.

Summary updated

BibTeX
@inproceedings{deng2024sample,
  author = {Junze Deng and Yuan Cheng and Shaofeng Zou and Yingbin Liang},
  title = {{Sample Complexity Characterization for Linear Contextual MDPs}},
  booktitle = {International Conference on Artificial Intelligence and Statistics},
  year = {2024},
  url = {https://openreview.net/forum?id=Hvo8aJDNZ7},
}
Figure