---
title: "Towards Explainable Quantum AI: Informing the Encoder Selection of Quantum Neural Networks via Visualization"
authors:
  - Shaolun Ruan
  - Feng Liang
  - Rohan Ramakrishna
  - Chao Ren
  - Rudai Yan
  - Qiang Guan
  - Jiannan Li
  - Yong Wang
abstract: "Quantum Neural Networks (QNNs) represent a promising fusion of quantum computing and neural network architectures, offering speed-ups and efficient processing of high-dimensional, entangled data. A crucial component of QNNs is the encoder, which maps classical input data into quantum states. However, choosing suitable encoders remains a significant challenge, largely due to the lack of systematic guidance and the trial-and-error nature of current approaches. This process is further impeded by two key challenges: (1) the difficulty in evaluating encoded quantum states prior to training, and (2) the lack of intuitive methods for analyzing an encoder’s ability to effectively distinguish data features. To address these issues, we introduce a novel visualization tool, XQAI-Eyes, which enables QNN developers to compare classical data features with their corresponding encoded quantum states and to examine the mixed quantum states across different classes. By bridging classical and quantum perspectives, XQAI-Eyes facilitates a deeper understanding of how encoders influence QNN performance. Evaluations across diverse datasets and encoder designs demonstrate XQAI-Eyes’s potential to support the exploration of the relationship between encoder design and QNN effectiveness, offering a holistic and transparent approach to optimizing quantum encoders. Moreover, domain experts used XQAI-Eyes to derive two key practices for quantum encoder selection, grounded in the principles of pattern preservation and feature mapping."
summaryType: survey
sourceStatus: null
sources:
  - https://doi.org/10.1109/TVCG.2026.3694424
---

[Original paper (PDF)](https://doi.org/10.1109/TVCG.2026.3694424)

## Background and research problem

XQAI-Eyes addresses the selection of quantum data encoders for quantum neural networks (QNNs).
In the architecture studied here, an encoder maps classical features into a quantum state, a parameterized ansatz transforms that state during optimization, and measurement produces a classical prediction.
Different encoders can produce different representations of the same dataset, so a circuit with substantial expressibility or entangling capability need not be well suited to a particular classification task.
The paper investigates how visualization can help developers reason about that relationship instead of relying only on repeated training runs and final accuracy.

Encoder selection is an existing problem, and prior work has compared encoding strategies empirically or evaluated circuit properties such as expressibility and entanglement capacity.
These approaches can establish performance differences without explaining how an encoder transforms the features that distinguish the classes.
The paper also draws on quantum circuit and state visualizations, including QuantumEyes, VENUS, and VIOLET, and on feature-oriented and training-oriented visual analytics for classical neural networks.
Its stated gap is the connection between the original dataset, the intermediate encoded representation, and subsequent learning behavior.
VIOLET is especially relevant because it visualizes QNN state evolution, while XQAI-Eyes concentrates on comparing encoder suitability across datasets.

Two difficulties motivate the system.
First, an encoded quantum state does not have the same directly readable feature representation as the original classical data.
Second, developers need to understand whether samples from different classes remain distinguishable after encoding.
The authors respond with complementary views: a scalar expectation map that retains the original input coordinates and a projection of the encoded states that reveals the arrangement of labeled samples.
This is a visual explanation and exploration contribution; the paper does not demonstrate a quantum computational speed-up or an automatic procedure for finding a globally optimal encoder.

## Formative study and implemented scope

The design process involved nine experts with an average of 6.8 years of quantum computing experience: three professors, three doctoral students, and three postdoctoral researchers.
Two were project collaborators.
Over five months, the authors conducted semi-structured interviews, examined workflows, built prototypes, and refined them through think-aloud reviews and deployment feedback.
The resulting requirements were to compare original and encoded feature maps, examine the intermingling of classes in quantum-state representations, explain intermediate encoding steps, support experiments with different datasets and encoders, and connect these observations to familiar training controls and performance plots.

The implemented examples comprise six two-dimensional datasets and ten predefined two-qubit encoder circuits, giving 60 selectable combinations.
The datasets place samples on a regular grid with both features in $[0,1]$ and assign two class labels represented numerically by $-1$ and $+1$.
The encoders combine Pauli rotation gates and controlled gates.
The ansatz is held fixed across the examples to make encoder comparisons easier to interpret.
The quantum computations and intermediate-state inspection use PennyLane simulation.
These choices give the study a concrete, understandable setting, but the examples do not constitute validation on large, high-dimensional, or hardware-executed QNNs.

## Encoder Expectation Measurement

The first method, called Encoder Expectation Measurement, extracts the simulated state immediately after the encoder and computes a scalar consistent with the model's eventual measurement of the first qubit, $q_0$.
For the two-qubit setting, the paper computes

$$
E_{\mathrm{encoder}} = P(q_0=0)-P(q_0=1)
= \sum_{i\in\{0,1\}} P(|0i\rangle)-\sum_{j\in\{0,1\}} P(|1j\rangle).
$$

This value lies in $[-1,1]$ and is the Pauli-$Z$ expectation of the first qubit.
The simulation exposes the state or density matrix from which those probabilities can be calculated, so the tool obtains an observable summary without inserting a physical measurement gate between the encoder and ansatz.
Figure 2 is a schematic of this inspection point in the circuit.
The method should therefore be understood as a simulator-based extraction and visualization workflow, rather than a demonstrated nondestructive measurement protocol on quantum hardware.

The expectation value gives every input sample a comparable scalar, but it is not a complete representation of that sample's quantum state.
The formative study explicitly recognizes that distinct states can share a measured value.
The system consequently pairs the expectation map with a second view that uses density-matrix information, allowing users to compare the two explanations rather than treating a single scalar as sufficient evidence of encoder quality.

## Visual encodings and interaction

The interface screenshot in Figure 1 and view explanations in Figure 4 show how the system connects the data, encoder, and training results.
The Original Data View places square cells at the two input-feature coordinates and uses yellow and teal to distinguish the classes.
The Encoder Map retains exactly those positions but colors each cell along a continuous yellow-to-teal scale according to its expectation value.
This shared spatial arrangement lets users compare the shape of the label regions with patterns induced by the encoder.
The interface also offers an original-boundary overlay to support this comparison.

The Encoded Data Evolution View places intermediate expectation maps along a horizontal sequence of encoding steps, beneath the corresponding circuit diagram.
Below each intermediate map, two further maps show the probabilities of $q_0$ being $|0\rangle$ and $|1\rangle$.
Their visual subtraction explains where the expectation map comes from and helps users associate pattern changes with gates in the encoder.
The authors chose tiled square cells instead of circles to reduce gaps that interrupted pattern perception, and removed a white midpoint from the color scale because it made intermediate values too faint.

The second central view is called the State Comparison Map in the method description and Quantum Distribution Map in the interface.
For each sample, the system converts the encoded state into a density matrix, flattens that representation, and applies principal component analysis (PCA) to obtain two display coordinates.
The scatterplot uses these coordinates for position and the original class label for point color.
The authors choose PCA for its deterministic linear projection and emphasis on global variance, so users can inspect whether the two colors form separate regions or overlap.
Here, visual class mixing means intermingling of labeled samples in the projection; the plot is not presented as a numerical quantum-state purity measure.
Figure 5 illustrates the intended interpretation through two different label patterns with the same displayed Encoder Map: one associated distribution separates the colors more clearly and is reported at 95% accuracy, whereas the other is more intermingled and is reported at 55%.

The Trained Map uses the original grid again, with cell color representing the learned prediction after training.
The Performance Analysis View pairs this with blue loss and orange accuracy curves over epochs.
Users can select a dataset, open a side panel of encoder templates, change the epoch count and learning rate through numeric inputs or sliders, and pause or resume training to inspect intermediate results.
The implementation combines a React frontend with a Flask backend and streams incremental training updates through server-sent events; it also supports stopping a training session.
Figure 3 diagrams the storage, processing, and view modules, while Figure 7 shows the complete page and its explanatory tutorial.
These figures represent system architecture and implemented interface output, rather than additional controlled evaluations.

## Evaluation and findings

The evaluation consists of two think-aloud case studies followed by qualitative interviews with three experts who were distinct from the formative-study participants.
The authors recorded screen activity and spoken reasoning, then asked about effectiveness, usability, workflow, and visual design.
This evaluation provides evidence about how experts used the displays and interpreted particular examples, without a controlled comparison against another tool or a quantitative study of task completion and explanation accuracy.

In the first case, a postdoctoral researcher with eight years of relevant experience examined a circular class region and selected an RX-RY-RY-CNOT encoder that he expected to be sufficiently expressive.
The Encoder Map instead displayed stripe-like patterns that did not match the circle, the Trained Map showed an incorrect learned pattern, and the reported accuracy was 55%.
The Quantum Distribution Map showed intermingled classes, while the evolution view helped the participant investigate the effect of the encoding steps.
He attributed the mismatch to the angle preparation rather than assuming that the availability of expressive gates guaranteed useful features.
The case demonstrates an expert's diagnostic reasoning through the interface, rather than an independent causal test of every part of that explanation.

In the second case, a professor and a postdoctoral researcher compared several combinations shown in Figure 6.
In scenario A, an Encoder Map resembling the dataset and clearer class separation accompanied 96% accuracy, rapid convergence, and little fluctuation.
Other scenarios showed progressively less favorable correspondence or more overlap in the projected states, which the experts related to slower or less stable training.
For scenario D, changing the encoder while retaining the dataset produced pronounced accuracy fluctuations and approximately 65% accuracy after 100 epochs.
The examples support the experts' proposed heuristics, but they do not establish that visual overlap uniquely determines achievable accuracy or that every more separated projection yields a better model.

The experts derived two practices: seek encoded feature patterns that align with the dataset to reduce the subsequent optimization burden, and seek representations that distinguish the classes to support smoother convergence.
They also emphasized that performance depends jointly on the encoder and ansatz.
Post-study feedback praised the familiar heatmaps, complementary state projection, gate-level evolution, and ability to pause training.
Suggestions included expanding the encoder collection, using the distribution view to pre-test candidate encoders, and adding brushing so users could trace poorly predicted samples backward through the views.

## Contributions, limitations, and future work

The paper contributes requirements for encoder-focused visual analysis, a simulator-based expectation extraction workflow, complementary spatial and projected-state views, and an integrated interface through which experts connect encoding patterns to training outcomes.
Its main result is an account of how these representations can support reasoning and generate practical encoder-selection hypotheses.
The case-study observations and positive expert feedback should be distinguished from proof that the two heuristics generalize to arbitrary datasets, ansatzes, or training procedures.

The demonstrated scope is limited to static two-dimensional, two-class data, two-qubit circuits, a fixed ansatz, and predefined encoder templates.
Higher-dimensional inputs would require new or adapted representations, and an $N$-qubit density matrix has $2^N\times2^N$ entries.
The paper proposes dimensionality reduction as a route to broader use, but it does not report large-scale performance measurements or empirical validation of that extension.
Likewise, PCA displays only two components, so separation or overlap in the plot is a visual diagnostic rather than a complete account of distinguishability in the full state space.
The reported implementation and experiments are simulation-based; hardware measurement costs and noise robustness are not evaluated.

The authors propose adaptive learning for changing datasets or circuit configurations, support for additional quantum machine-learning tasks such as regression and clustering, and extensions to quantum federated learning.
They also discuss applying similar explanations to ansatz optimization, barren plateaus, and vanishing gradients, but these remain future directions.
The suggested brushing and sample tracing would deepen the current workflow by connecting a training error to the same sample's earlier encoded representations.
