by Erik Källman (RISE Research Institutes of Sweden)

Quantum machine-learning models are usually trained to match a measured number. When a model's output becomes the input of another quantum model, that is not enough. Work at RISE, built on the open-source Shim library, shows what a reusable and composable quantum model must actually preserve, and tests whether an optimiser can learn it.

Quantum machine learning rarely runs one model in isolation. One model prepares a quantum state; a later model, or a later quantum channel, consumes part of that output. Making such composed and hybrid computations reliable and useful is one of RISE’s contribution to QSTAR, the Norwegian national Centre for Quantum Computing and Applications, which works on quantum algorithms and software [L2]. RISE participates as a Swedish project member, and this reduced-state work is one of our early contributions on the software side. It answers a question that sounds simple: when the output of one quantum model becomes the input of another, what must training preserve?

Many quantum models are trained against a single number, the expectation value of one measurement. That is enough when the number is the final output. It is not enough when a downstream quantum model receives the whole state. The smallest counterexample needs one qubit. Two states can give the same fifty-fifty result for one measurement and still be driven to opposite, certain outcomes by a single downstream gate. Agreement on the trained number then survives no further processing.

The right target is the state carried by the wires that cross the boundary between the two models — the exposed reduced state (see Figure 1). Two upstream models that expose the same state are interchangeable: any downstream channel receives the same input from either, so no later measurement can tell them apart. However, when the states are only close, trace distance, a measure of how distinguishable two quantum states are, sets the tolerance, and a basic law of quantum information [1] — that no physical processing can make two states more distinguishable — carries that tolerance through to every later measurement. For exact interchangeability, nothing less than equality will do: the next model might only measure the state it receives, and if the two states differ, some measurement can tell them apart.

 

Figure 1: The exposed state is the only part of the upstream output that crosses the boundary into the downstream channel; the rest is discarded. The downstream model sees only the exposed state. One upstream model can replace another when their exposed states match; if the states differ by at most epsilon in trace distance, no later measurement can differ by more than epsilon.
Figure 1: The exposed state is the only part of the upstream output that crosses the boundary into the downstream channel; the rest is discarded. The downstream model sees only the exposed state. One upstream model can replace another when their exposed states match; if the states differ by at most epsilon in trace distance, no later measurement can differ by more than epsilon.

 

Shim, an open-source Rust library developed at RISE [L1], lets us both state and test this in ways previously not possible. It holds circuits, states, density matrices and quantum channels together with category-theoretic interfaces around them [2]. You name which wires pass to the next model and discard the rest; the library forms the reduced state, applies the downstream channel, and reads out the result. Substitution then has a formal meaning, pulling a later measurement back through the downstream channel [3]. Shim turns this exposed-state criterion into something computable.
The value of the category theory approach is that it names the interface as an object: say which system crosses the boundary, and the upstream model is a map that ends there while the downstream model is a map that begins there. Replacement then follows from the fact that the same map on the same input gives the same output, instead of requiring a separate argument for each downstream circuit. The view also fixes what to compare and where: the state on that boundary, read after the discard. And because the guarantee sits at the interface, it composes: a bound proved at one boundary still holds when the model is dropped into a longer chain of models.

We then asked a separate, empirical question: can an optimiser actually learn the exposed state? A four-qubit model with three Ry-CNOT layers exposes two qubits and discards two. Five target states were fixed and then relearned from six random starts under two losses, one matching the full exposed state, the other matching only the single measured number. All sixty runs behaved as designed. Every scalar-trained run reached its target number, to within nine parts in a hundred thousand, yet its exposed states stayed far apart, up to a trace distance of 0.75. Training on the exposed state cut that spread to between 0.001 and 0.016, a median ninety-nine-fold improvement. A downstream check sent both trained states of every pair through the same fixed channel and a measurement, and no pair ever exceeded the predicted bound.

Four of five cases met the threshold of 0.01 that had been fixed in advance; one reached 0.016, and several runs used the full optimisation budget. That keeps two claims apart: it is proven that the exposed state defines what a reusable quantum model must preserve, while whether a given optimiser can preserve it in practice remains an open question, with a qualified answer. The distinction is the point. As quantum toolchains grow and hybrid pipelines start to interoperate, components will be swapped in and out, and what swapping means needs exactly this criterion, with a number attached to how close is close enough.

This is a deterministic, exact-simulator study of one small model family, meant as a baseline. Later experiments move to shot noise, real hardware, and larger exposed systems. With this result at hand, later studies can also investigate different model topologies and how trace distance affects their output, which is a fundamental aspect in quantum machine-learning model building.

Links:
[L1] https://github.com/erikkallman/shim 
[L2] https://www.mn.uio.no/math/english/research/groups/operator-algebras/events/conferences/qstar-kick-off/index.html 

References:
[1] M. A. Nielsen and I. L. Chuang, Quantum Computation and Quantum Information, Cambridge University Press, 2010.
[2] B. Coecke and A. Kissinger, Picturing Quantum Processes, Cambridge University Press, 2017.
[3] E. D'Hondt and P. Panangaden, "Quantum weakest preconditions", Math. Struct. Comput. Sci., vol. 16, no. 3, pp. 429-451, 2006.

Please contact:
Erik Källman
RISE Research Institutes of Sweden
This email address is being protected from spambots. You need JavaScript enabled to view it.