Batch Quantum Reinforcement Learning

Maniraman Periyasamy, Marc Hölle, Marco Wiedmann, Daniel D. Scherer, Axel Plinge, Christopher MutschlerarXiv 2023 · arXiv · OpenReview

Abstract: Training Deep Reinforcement Learning (DRL) agents is often a time-consuming process requiring extensive environment interactions. This challenge is amplified in Batch RL (Offline RL), where agents must learn solely from pre-collected datasets without further exploration. We propose BCQQ (Batch-Constraint Quantum Q-Learning), a hybrid quantum-classical algorithm that leverages Variational Quantum Circuits (VQCs) as function approximators. Central to our approach is a novel Cyclic Data Re-uploading scheme that enhances model expressivity. We demonstrate that BCQQ significantly outperforms classical neural network-based Batch-Constraint Q-Learning (BCQ) in low-data regimes within the OpenAI CartPole environment.

Introduction

Reinforcement Learning typically relies on millions of trial-and-error interactions, which is often impractical or hazardous in real-world applications like robotics or healthcare. Offline RL addresses this by learning from fixed datasets. However, it is prone to extrapolation error, where the agent inaccurately estimates rewards for state-action pairs not present in the training data. While classical algorithms like BCQ mitigate this by constraining the agent's policy to the data distribution, they still require substantial datasets to generalize effectively. This research investigates whether quantum models, theoretically more data-efficient, can overcome these limitations.

Methodology

The BCQQ Framework

BCQQ integrates two primary components:

  1. Discrete BCQ: A classical framework that uses a generative model to identify likely actions from the training data, preventing the Q-learning agent from selecting out-of-distribution actions.
  2. Variational Quantum Circuits (VQCs): These serve as the function approximators. Environment states are encoded into qubits, processed through trainable quantum gates, and measured to derive Q-values.

Cyclic Data Re-uploading

To increase the expressivity of VQCs, we introduce Cyclic Data Re-uploading. While standard re-uploading repeats input data across layers, our cyclic scheme shifts the order of input variables across qubits in a round-robin fashion (e.g., Layer 1 processes $[x_0, x_1, x_2, x_3]$, while Layer 2 processes $[x_1, x_2, x_3, x_0]$).

The Cyclic Data Re-uploading (DRU) scheme shifts input variables across qubits in successive layers to ensure every qubit eventually interacts with every feature of the input state.

This architecture ensures that every qubit eventually interacts with every feature of the input state, effectively increasing the model's capacity without increasing the parameter count.

Experimental Setup

We evaluated BCQQ on the OpenAI CartPole-v1 environment using two types of offline data:

  • Random Buffers: Trajectories generated by a random policy, representing a "worst-case" learning scenario, with sizes ranging from $10^2$ to $10^6$ samples.
  • Noisy-Expert Buffers: Small datasets (25, 50, or 100 samples) generated by a high-performing agent with added noise to test the agent's ability to learn stable policies from limited, imperfect demonstrations.

Results and Discussion

Quantum Data Efficiency

In the low-data regime (100 random samples), the BCQQ agent (42 parameters) achieved a perfect score of 500. In contrast, a classical neural network with 67 parameters failed to learn a viable policy, scoring only ~12.88. This suggests that quantum models can extract more meaningful patterns from sparse data than their classical counterparts.

Effective Dimension and Expressivity

Using the Fisher Information Matrix (FIM), we analyzed the "effective dimension" of the models. The cyclic data re-uploading scheme significantly increases the range of functions the quantum model can represent.

Normalized effective dimension comparison showing that quantum models maintain a high capacity across varying dataset sizes, significantly outperforming classical baselines (green line).

As shown in the analysis, quantum models maintain a high normalized effective dimension even as the number of data points increases, indicating a superior ability to utilize available information compared to classical models.

Hardware Validation

The trained BCQQ agent was validated on real quantum hardware (IBMQ). By employing Zero Noise Extrapolation (ZNE) to mitigate hardware errors, the agent achieved a near-perfect reward of 495, demonstrating the practical viability of the approach on Noisy Intermediate-Scale Quantum (NISQ) devices.

Conclusion

BCQQ demonstrates a clear advantage in sample efficiency for offline reinforcement learning tasks. By utilizing cyclic data re-uploading, the model achieves high expressivity and stability even when trained on extremely small datasets. Future work will focus on scaling these circuits to more complex environments and exploring alternative quantum architectures for the generative components of the BCQ framework.

Summary updated

Abstract

Training DRL agents is often a time-consuming process as a large number of samples and environment interactions is required. This effect is even amplified in the case of Batch RL, where the agent is trained without environment interactions solely based on a set of previously collected data. Novel approaches based on quantum computing suggest an advantage compared to classical approaches in terms of sample efficiency. To investigate this advantage, we propose a batch RL algorithm leveraging VQC as function approximators in the discrete BCQ algorithm. Additionally, we present a novel data re-uploading scheme based on cyclically shifting the input variables' order in the data encoding layers. We show the efficiency of our algorithm on the OpenAI CartPole environment and compare its performance to classical neural network-based discrete BCQ.
BibTeX
@misc{periyasamy2023batch,
  author = {Maniraman Periyasamy and Marc Hölle and Marco Wiedmann and Daniel D. Scherer and Axel Plinge and Christopher Mutschler},
  title = {{Batch Quantum Reinforcement Learning}},
  year = {2023},
  eprint = {2305.00905},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2305.00905},
}
Figure