A few months ago I would have told you quantum machine learning was mostly hype dressed up in cool-sounding words — "superposition," "entanglement," "quantum advantage" — thrown around papers that never quite show you the number that matters. Then I built one of these systems myself, for something that actually has stakes: classifying brain tumors from MRI scans. And I came out the other side with a more interesting opinion than "hype" or "revolution." It's somewhere in between, and the in-between is where the actual engineering lives.
The setup: a classifier that already worked fine
I didn't start from scratch. The backbone of the system is DenseNet121, a convolutional architecture that's been doing solid work on medical imaging for years. Trained on MRI slices, a plain DenseNet121 classifier already gets you a respectable accuracy on tumor classification. If your only goal is "ship something that works," you could stop there and nobody would blame you.
So why didn't I stop there?
Because "works" and "trustworthy enough to sit next to a radiologist" are different bars. Medical imaging is one of the few domains where a model being slightly better isn't really the point — the point is whether you can explain why it made a call, and whether that explanation would survive a doctor asking "wait, why?" That question is what pulled me toward two very different ideas at once: quantum circuits and explainability, bolted onto the same model.
Where the qubits come in
The quantum part isn't replacing the neural network — that's a common misconception about hybrid quantum-classical models, and it's worth being blunt about. DenseNet121 still does the heavy lifting: extracting features from the MRI images, learning what textures and shapes correlate with tumor types. What I added on top is a 4-qubit variational quantum circuit, built with PennyLane, sitting at the tail end of the pipeline where the classical network would normally just feed straight into a final classification layer.
A variational quantum circuit is, at a practical level, a small set of parameterized quantum gates whose parameters get trained the same way a classical layer's weights get trained — through gradient descent, just computed via a different mechanism (parameter-shift rules instead of standard backprop). The promise is that the quantum circuit can represent certain non-linear feature interactions more efficiently than a classical layer of comparable size, because superposition lets it explore a larger effective feature space with fewer parameters.
In this project, that promise showed up as a real, measurable gain over the classical-only baseline. Swapping the final classical layer for the 4-qubit circuit pushed accuracy up by around six percentage points. That's not a "we ran it once and got lucky" number — it held up across the held-out test set. But I want to be honest about what that gain actually represents, because "quantum gives you free accuracy" is the wrong takeaway.
The gain is real, but it's not magic
What the quantum layer is really doing here is acting as a different kind of non-linear transformation on the features DenseNet121 has already extracted — one that's harder to replicate exactly with a classical layer of the same parameter count. Whether that's because of genuine quantum effects or just a different inductive bias that happens to fit this dataset well is an open and genuinely debated question in the QML literature, and I don't think it's fully settled even by people far more qualified than me. What I can say with confidence is: on this dataset, with this architecture, the hybrid model classified more tumors correctly than the classical-only one did, consistently.
The honest framing I'd give anyone asking "should I add a quantum layer to my model" is: it's a tool worth testing when your classical model has plateaued and you have a small number of features feeding into a final decision layer — 4 to 8 qubits is the realistic, simulable range right now. It is not a tool for squeezing performance out of a model that's already well-fit, and it is absolutely not free — every quantum circuit you simulate classically costs you exponentially more compute as qubit count grows.
Trusting the model: Grad-CAM and SHAP, together
The accuracy gain was the smaller part of why I built this. The bigger part was explainability, because a 6% lift means nothing in a clinical context if you can't show why the model is making its decisions.
I used two explainability techniques side by side, deliberately, because they answer different questions:
Grad-CAM answers "where in the image was the model looking?" It produces a heatmap over the MRI slice, highlighting the regions that most influenced the classification. For a tumor classifier, this is the sanity check a radiologist would actually want — does the hot region in the heatmap correspond to the tumor, or is the model fixating on some artifact in the corner of the scan?
SHAP answers a different question: "of the features the model extracted, which ones mattered most for this specific prediction, and in which direction?" Where Grad-CAM is spatial, SHAP is attributional — it decomposes the prediction into per-feature contributions, which is useful for catching cases where the model's spatial attention looks fine but its actual decision logic is leaning on something subtle and wrong.
Running both gave me a much more complete picture than either alone would have. There were a handful of cases where Grad-CAM's heatmap looked perfectly reasonable — centered right on the tumor — but SHAP revealed the model was still weighting some unrelated texture feature more heavily than it should have. Without the second lens, I'd have shipped that case as "explained" when it wasn't really.
Noise, and why NISQ matters more than people think
The last piece — and the part that gets skipped in a lot of QML write-ups — is noise evaluation under NISQ (Noisy Intermediate-Scale Quantum) conditions. Right now, every real quantum computer is noisy. Gates have error rates, qubits decohere, and a circuit that works beautifully in a noiseless simulation can degrade meaningfully once you account for realistic hardware noise.
I didn't just train the model on a clean simulator and call it done — I evaluated how the 4-qubit circuit's performance held up under simulated NISQ noise conditions, because that's the actual environment any near-term quantum hardware will run in. This matters for one practical reason: if you're going to claim a quantum-enhanced model is viable, you have to show it's still better than the classical baseline after accounting for the noise you'd see on real hardware, not just in the idealized simulator where every gate is perfect.
Where I landed
If you're considering a hybrid quantum-classical approach for your own project, here's the honest summary: it's a legitimate technique, not a buzzword, but it's a narrow tool. It earns its place when you have a small, well-defined final decision layer, when you've already squeezed what you can out of the classical architecture, and when you're willing to do the unglamorous work of explainability and noise evaluation rather than just reporting one accuracy number and calling it a day.
The six points of accuracy were nice. The two explainability methods agreeing with each other — most of the time — was the part that actually made me trust the system.
Top comments (0)