Table of Contents
Fetching ...

Explaining Quantum Circuits with Shapley Values: Towards Explainable Quantum Machine Learning

Raoul Heese, Thore Gerlach, Sascha Mücke, Sabine Müller, Matthias Jakobs, Nico Piatkowski

TL;DR

The paper addresses the need for explainability in quantum machine learning by adapting Shapley values to gate-level attributions in parameterized quantum circuits, forming the QSV framework. It introduces SVQXs, where gates (or groups) act as players and the value function is derived from circuit measurements, enabling attribution of each gate's contribution to selected objectives. The authors propose multiple value-function options (including expressibility, entangling capability, hardware fidelity, and transpilation efficiency) and handle uncertainty due to quantum hardware by using uncertain Shapley values with sampling-based estimators. Through experiments on simulators and two IBM QPUs, the work demonstrates gate-level insights across QSVM, QNN, QGAN, transpilation tasks, and QAOA/VQE, and provides a toolbox for public use. Overall, QSV offers a flexible, architecture-aware approach to XQML, with potential to inform circuit design and broader QML development, while acknowledging computational cost as a key challenge and suggesting future directions such as alternative attribution schemes and extensions to XQML.

Abstract

Methods of artificial intelligence (AI) and especially machine learning (ML) have been growing ever more complex, and at the same time have more and more impact on people's lives. This leads to explainable AI (XAI) manifesting itself as an important research field that helps humans to better comprehend ML systems. In parallel, quantum machine learning (QML) is emerging with the ongoing improvement of quantum computing hardware combined with its increasing availability via cloud services. QML enables quantum-enhanced ML in which quantum mechanics is exploited to facilitate ML tasks, typically in the form of quantum-classical hybrid algorithms that combine quantum and classical resources. Quantum gates constitute the building blocks of gate-based quantum hardware and form circuits that can be used for quantum computations. For QML applications, quantum circuits are typically parameterized and their parameters are optimized classically such that a suitably defined objective function is minimized. Inspired by XAI, we raise the question of the explainability of such circuits by quantifying the importance of (groups of) gates for specific goals. To this end, we apply the well-established concept of Shapley values. The resulting attributions can be interpreted as explanations for why a specific circuit works well for a given task, improving the understanding of how to construct parameterized (or variational) quantum circuits, and fostering their human interpretability in general. An experimental evaluation on simulators and two superconducting quantum hardware devices demonstrates the benefits of the proposed framework for classification, generative modeling, transpilation, and optimization. Furthermore, our results shed some light on the role of specific gates in popular QML approaches.

Explaining Quantum Circuits with Shapley Values: Towards Explainable Quantum Machine Learning

TL;DR

The paper addresses the need for explainability in quantum machine learning by adapting Shapley values to gate-level attributions in parameterized quantum circuits, forming the QSV framework. It introduces SVQXs, where gates (or groups) act as players and the value function is derived from circuit measurements, enabling attribution of each gate's contribution to selected objectives. The authors propose multiple value-function options (including expressibility, entangling capability, hardware fidelity, and transpilation efficiency) and handle uncertainty due to quantum hardware by using uncertain Shapley values with sampling-based estimators. Through experiments on simulators and two IBM QPUs, the work demonstrates gate-level insights across QSVM, QNN, QGAN, transpilation tasks, and QAOA/VQE, and provides a toolbox for public use. Overall, QSV offers a flexible, architecture-aware approach to XQML, with potential to inform circuit design and broader QML development, while acknowledging computational cost as a key challenge and suggesting future directions such as alternative attribution schemes and extensions to XQML.

Abstract

Methods of artificial intelligence (AI) and especially machine learning (ML) have been growing ever more complex, and at the same time have more and more impact on people's lives. This leads to explainable AI (XAI) manifesting itself as an important research field that helps humans to better comprehend ML systems. In parallel, quantum machine learning (QML) is emerging with the ongoing improvement of quantum computing hardware combined with its increasing availability via cloud services. QML enables quantum-enhanced ML in which quantum mechanics is exploited to facilitate ML tasks, typically in the form of quantum-classical hybrid algorithms that combine quantum and classical resources. Quantum gates constitute the building blocks of gate-based quantum hardware and form circuits that can be used for quantum computations. For QML applications, quantum circuits are typically parameterized and their parameters are optimized classically such that a suitably defined objective function is minimized. Inspired by XAI, we raise the question of the explainability of such circuits by quantifying the importance of (groups of) gates for specific goals. To this end, we apply the well-established concept of Shapley values. The resulting attributions can be interpreted as explanations for why a specific circuit works well for a given task, improving the understanding of how to construct parameterized (or variational) quantum circuits, and fostering their human interpretability in general. An experimental evaluation on simulators and two superconducting quantum hardware devices demonstrates the benefits of the proposed framework for classification, generative modeling, transpilation, and optimization. Furthermore, our results shed some light on the role of specific gates in popular QML approaches.
Paper Structure (26 sections, 69 equations, 27 figures, 3 tables)

This paper contains 26 sections, 69 equations, 27 figures, 3 tables.

Figures (27)

  • Figure 1: Simplified sketch of a hybrid quantum-classical ML pipeline (or hybrid ML pipeline for short) in form of a variational quantum algorithm. Preprocessed features $\vec{x}$ and parameters $\vec{\theta}$ from a classical host (represented here by a CPU) control a variational circuit that is executed on a QPU. The measurement results $\vec{B}$ are returned to the classical host (in form of bit strings) and enable a quantum classical optimization loop for the parameters. In the end, a suitable model for the proposed ML problem can be realized. Prospectively, such a pipeline involves multiple CPU and QPU as well as GPU gambetta2022.
  • Figure 2: Two possible approaches for SV in QML involving variational quantum circuits: (a) SV from classical ML for which features represent players. (b) Newly proposed QSV for which quantum gates represent players. In both cases, the value function, \ref{['eqn:vQ']}, is determined by the measurement results. Shown is an exemplary four-qubit variational circuit consisting of a data encoding unitary for a $k$-dimensional feature vector $\vec{x} := \{x_1,\dots,x_k\}$ and a set of five parameterized gates as outlined in \ref{['fig:qml-pipeline']}, where each parameterized gate depends on a single variational parameter $\vec{\theta}^{i+1} := \{\theta_i\} \subset \vec{\theta} \,\forall\, i \in \{1,\dots,5\}$ with $\vec{\theta} := \{\theta_1, \dots, \theta_5\}$. In terms of \ref{['eqn:U']}, $G=6$, $U_1(\vec{x}^1, \vec{\theta}^1):=U_1(\vec{x})$, and $U_{1+i}(\vec{x}^{1+i}, \vec{\theta}^{1+i}):=U_{1+i}(\theta_i) \,\forall\, i \in \{1,\dots,5\}$. For both of the SV approaches presented here, the gate parameters $\vec{\theta}$ are assumed to be arbitrary but fixed.
  • Figure 3: Schematic representation of the set of circuits that are involved in a coalition game for QSV. Exemplarily, we consider the circuit from \ref{['fig:shapleys']} as the circuit of interest with an active gate set $A=\{A_1=2,A_2=3,A_3=4,A_4=5,A_5=6\}$, \ref{['eqn:A']}, and a set of remaining gates $R=\{1\}$, \ref{['eqn:R']}. The original circuit of interest is shown on top, it contains the six gates $U_1,\dots,U_6$, where we omit all arguments. The index of each gate indicates the corresponding gate index $g \in \{1,\dots,G\}$ with $G=6$ in \ref{['eqn:U']}. Each coalition $S$ can be associated with a circuit that contains the gates whose indices are included in the set $\{ A_a \,|\, a \in S\} \cup R$ as defined in \ref{['eqn:USR']}. Four exemplary coalitions and their corresponding circuits are shown at the bottom. The leftmost and rightmost circuits are associated with the empty and grand coalition, respectively.
  • Figure 4: Feature map circuit for the QSVM: two-qubit second-order Pauli-Z evolution circuit with $r$ repetitions parameterized by feature vectors $\vec{x} \in \mathbb{R}^2$. We use the circuit symbols from \ref{['sec:app:circuit symbols']} and the abbreviations from \ref{['eqn:phixi', 'eqn:phix']}. The number near each gate represents its gate index $g$, \ref{['eqn:U']}. Here and in the following, we omit initialization and measurements in circuit sketches to simplify our presentation. These operations are by default always realized as shown in \ref{['fig:qshap-circuits']}.
  • Figure 5: Artificial test and training data sets for the supervised classification problem with two-dimensional features $\vec{x} \in (0,2\pi]^2$ and binary labels $y \in \{0,1\}$. We use a QSVM to solve this problem.
  • ...and 22 more figures