
In simulation, two qubits and a classical layer can reconstruct images from two numbers
Quantum computers are often imagined as machines that count possibilities in parallel. Their raw output, however, is a set of probabilities that add to one, which makes them awkward for tasks needing many ordinary numbers at once. Reconstructing an image from two inputs is exactly such a task. A hybrid design tries to fix this by letting a small quantum circuit feed a classical adjustment layer, so the system can emit full continuous vectors rather than separate single values.
Quick takeaways
The probability box that stops quantum outputs from becoming images
A standard variational quantum regressor encodes an input into qubits, applies trainable gates, and measures the result. The raw measurement is a list of probabilities for all possible basis states. Every entry in that list is nonnegative, and the entries add to one. This puts the output inside a probability simplex. A simplex is a flat geometric box where all coordinates are positive and total one. An image needs many pixel values that can be negative or larger than one. It also does not require the pixels to sum to a fixed number. So the quantum part alone cannot emit an ordinary real-valued image vector.
The hybrid design adds a classical affine step after measurement. That step takes the measured probabilities and applies a learned linear transformation plus an offset. The result is a final prediction vector in ordinary real space. This breaks the simplex constraint, because the transformed values are no longer forced to be nonnegative or to sum to one. During training, the quantum gate angles and the classical weights are adjusted as one system. The bias terms in the affine layer are also learned at the same time. End-to-end training lets the measurement probabilities and the final mapping move together.
In the image model, only 240 parameters live in the quantum gates. The classical affine layer holds 65,792 weights and biases. Altogether, the model has 66,032 trainable parameters, so the classical layer dominates the count. This matters because the quantum part supplies a probability vector, while the affine layer reshapes it into pixel values. Without that reshape, even a good measurement pattern would remain trapped in the simplex.
A small circuit with re-uploaded inputs and entangled qubits
The circuit starts with two qubits, which are quantum bits that can hold more than one state at once. Instead of running a separate machine for each predicted number, it sends one input through the same small quantum block. After measurement, a classical layer reshapes the probabilities into a vector of continuous outputs. This final step is learned together with the quantum gates, so the whole system can be tuned as one piece.
The input may enter through a simple padded vector, a repeated expansion, or a nonlinear feature map. Each layer re-uploads the input by applying rotations whose angles depend on that input. This repeated feeding lets a shallow circuit see the same data many times without adding more qubits. Between those input rotations, local trainable gates adjust each qubit on its own. CNOT gates then link pairs of qubits in a cascade, creating entanglement across the small register. A setting called range controls how far apart those linked qubits may sit.
Training uses two gradient routes, one for the classical layer and one for the quantum angles. The classical weights are updated by automatic differentiation, while the quantum rotations use a parameter-shift rule. That rule works because rotation angles can be probed at shifted values to get exact gradients. An Adam optimizer then combines these signals into updates for every trainable part.
The tested image model had only two qubits and nine layers, yet it made an image of 256 pixels. Its full parameter count reached 66,032 values, a number that sounds large for a small machine. Of that total, only 240 values controlled the quantum gates, while 65,792 classical weights and biases did most of the lifting. This split shows that the quantum part is a compact signal source rather than a huge standalone regressor.
Why tiny circuits can still build nonlinear functions
A quantum circuit that looks almost too small to be useful can still make curved functions. Each rotation turns an input into a periodic signal, and repeated rotations let those signals interfere in controlled ways. On a bounded interval such as from minus two to plus two, one qubit with repeated input dependent rotations can approximate x squared. The trick is to scale the input by a factor below one, so the required oscillations fit inside the range, then increase the re-uploading count until the curve becomes smooth. In ideal simulation without shot noise, that tiny model reached an R squared score of 1 on both training and test data. The split used 900 points, with 70 percent for training and 30 percent for testing.
That result does not mean a single qubit can solve every regression problem. It shows that the basic nonlinear ingredient, a square term, is already available inside a very small quantum device. A second building block appears when two qubits are linked by a CNOT gate. The circuit encodes both inputs into separate qubits, creates correlations between them, and then uses differences or combinations of measured probabilities to approximate their product. In ordinary regression, products matter because they let one variable change the effect of another. A model that can form x times y can bend its surface in ways a purely linear model cannot.
The theoretical argument goes further: with enough depth, single qubit gates plus CNOT gates can uniformly approximate target functions on compact input sets. That universal approximation result gives permission to build larger hybrid models from small pieces. If tiny circuits can produce squares and products, then deeper circuits can combine those pieces into more complex multivariate functions through repeated input use and entanglement.
What the simulated image tasks revealed about simple input padding
The image tests put a plain trick under pressure. Each example began with two numbers and had to become a 16 by 16 picture, so the model had to predict 256 values at once. The first set made smooth patterns on a grid that ran from minus 2 to 2 in both directions. Its inputs came from the range minus 1 to 1 and steered how those patterns formed. The second set used inputs from minus 2 to 2 and mixed three spatial patterns into one image. A hyperbolic tangent of each input set the pattern weight, so moving an input toward plus or minus one strengthened that picture.
The tested circuit had two qubits and nine layers. In total it had 66,032 trainable parameters, and only 240 of them were quantum gate angles. The remaining 65,792 belonged to a classical layer after measurement. Three input maps were compared on the image tasks, and each turned the two numbers into an eight dimensional vector. One expanded the inputs to third order with a tensor product. Another added chosen quadratic and cubic terms, including products of the two inputs and their squares.
The simplest kept only the original two numbers and filled the other six slots with zeros. That padded map won overall on the reported test scores. On the first image set it reached an R squared value of 0.990. On the second it reached 0.978, while the richer maps were weaker or inconsistent across datasets. The result is surprising because padding looks like throwing away structure. It suggests that a sparse start can still give the quantum part enough signal to work with.
A small quantum part, a large classical correction
The most useful lesson is that a quantum circuit does not need to be huge before it can help with structured prediction. The tested architecture used only two qubits for the image tasks, yet its measured probabilities were turned into full sixteen by sixteen pictures through a learned affine layer. That combination avoided running one separate regressor for every output value and kept the cost from growing in lockstep with the size of the target vector.
The result also shows why the classical part cannot be treated as an afterthought. Quantum measurement produces probabilities, which are nonnegative and add to one, so they naturally sit inside a probability box rather than in ordinary real-valued output space. The affine layer moves those probabilities into the space where images live. When either side is removed, performance collapses, which means the quantum circuit supplies structure while the classical projection makes that structure usable.
The broader opportunity lies in tasks with many continuous outputs at once: maps, fields, spectra, or other high-dimensional signals that are hard to predict one coordinate at a time. A compact hybrid model can be attractive when the output is structured and the input is small enough for careful encoding. The obstacle is that all reported numbers come from ideal simulation, where every statevector is exact and no hardware error appears. Real devices add shot noise, gate errors, and calibration drift, and none of those effects has been tested here.
There is also a design puzzle hidden in the best result. The simplest input map, which kept only the original two variables and padded the rest with zeros, beat more elaborate feature maps on the image tasks. That suggests that adding nonlinear terms can hurt as much as help, and that choosing an encoding may matter more than enlarging the quantum circuit. Future work will need real datasets, noisy hardware tests, and a clearer rule for deciding which inputs should be padded, expanded, or transformed before they reach the qubits.
If the quantum part is small enough to fit on near-term devices, what exactly does it contribute that a larger classical network cannot?
You may also like
Technology and computing
Cars can be tracked through surveillance cameras nobody gave access to
Health and medicine · Brain and mind
Can a routine prescription become a clue to possible Alzheimer's protection?
Technology and computing
Can a robot imagine what will happen before it moves? New models test futures in milliseconds
Health and medicine · Technology and computing



