
A single Hadamard gate can turn your riskiest asset into — apparently — your safest one. And the worst part: the circuit never complains.
If you learned quantum computing from the usual examples — Grover, amplitude estimation, the quantum Fourier transform — you have one reflex burned in: step 1 is to apply a Hadamard to every qubit to build a uniform superposition. It’s almost muscle memory. And in many algorithms it’s exactly the right thing.
In a risk model built with amplitude encoding, that same reflex breaks everything. Silently: the circuit runs, returns probabilities, and the numbers look reasonable. It’s only when you check where the portfolio’s most dangerous asset ended up that you realize something broke.
Working on a portfolio-risk pipeline over 110 qubits, I ran into exactly this. Here’s the story, because the lesson goes beyond quantum.

The setup: one qubit per asset
The idea behind amplitude encoding is to write a classical number — here, each asset’s risk — into a qubit’s amplitude. With an RY(θ) rotation on a qubit that starts in |0⟩, choosing θ = 2·arcsin(√risk), you get something very clean: the probability of measuring |1⟩ is exactly the asset’s risk.
Risk 0 → you measure |1⟩ 0% of the time. Maximum risk → nearly 100%. The relationship is the identity line on the left of the chart: faithful, monotonic, no surprises. That’s the criterion. And it hinges on a detail that’s easy to overlook: the qubit has to start in |0⟩, because that initial state is the blank page the rotation writes the data onto.
Why the Hadamard breaks it
Now let’s add the textbook reflex: a Hadamard on each qubit before the rotation. The Hadamard takes |0⟩ to |+⟩, a superposition where the probability of |1⟩ is already 0.5. The risk rotation no longer writes on a blank page: it writes on top of something already halfway there.
The math gives a function that’s beautiful and disastrous at once:
It’s the upper half of a circle (the red curve in the chart). And it has two properties that are lethal for measuring risk:
- It’s not monotonic. It rises until risk 0.5 and then falls. The ordering is lost.
- It collapses the extremes. Risk 0 and maximum risk both land at P(|1⟩) = 0.5. The safest and the most dangerous asset in the portfolio become indistinguishable.
Side by side, the numbers make the failure concrete — our encoding tracks the true risk exactly, while the Hadamard version folds it back on itself:

|0⟩, no H) returns the risk verbatim; with the Hadamard, both risk 0 and maximum risk report 0.50, and everything in between is folded.The information wasn’t lost to noise or decoherence. It was lost to one extra gate, in the initial state, before the interesting part even began.
The cost: the ranking flips exactly where it matters
Here’s what makes this especially treacherous: if you measure the rank correlation across the whole portfolio, the aggregate number can still look high enough to pass a quick sanity check. In our universe almost every asset lives in the low-risk zone — where the curve is still rising — so very few names fall into the region where it folds back. The average hides it.
But the damage isn’t evenly spread: it concentrates in the tail, which is the entire reason risk management exists. In our run, SMCI — the riskiest of the 110 assets, ranked number 1 — dropped to rank 100. Practically the safest on the list. ENPH went from 2nd to 30th; MSTR, from 3rd to 26th. The five most dangerous, evaporated from the top.
A risk system that tells you your most volatile position is one of the calmest isn’t slightly off-key: it’s broken. And the aggregate metric was smiling at you the whole time.
The most uncomfortable part: it isn’t a “bug”
Here’s what made me think the most. Technically, this isn’t a code bug. The Hadamard did exactly what we asked — it executed perfectly: no typo, no off-by-one, no NaN. The circuit ran clean and returned well-formed probabilities.
What was wrong was the reasoning. We put a uniform superposition — a flawless recipe in Grover, in amplitude estimation, in interference-based ansätze like VQE or QAOA — into an encoding-and-measurement phase, where it doesn’t belong. It’s a design error, not a software one. And that makes it more dangerous: an error that never complains isn’t caught by any test. It only surfaces when someone looks at the final result and asks whether it makes sense.
Three things I’m taking away
- In amplitude encoding,
|0⟩isn’t “empty”: it’s the canvas. Superposition isn’t free; it overwrites. Before adding a gate to the initial state, ask what information already lives there. - Borrowed recipes carry someone else’s assumptions. “Hadamard on everything” is right when you want to explore an unknown space uniformly (search, estimation over states you don’t control). A model where you choose each qubit’s amplitude is the opposite case. Copying the pattern without copying the context is how these errors sneak in.
- Validate in the tail, not on the average. No exception fired and the aggregate metric looked healthy. What exposed the problem was a domain check: does the ranking make sense where it matters most? When the error hides in the few critical cases, averaging over all of them hands you a reassuring, false answer.
Quantum computing still carries a thick layer of mystique. But many of its practical stumbles are old acquaintances in new clothes: implicit assumptions, recipes copied out of context, and metrics that average away the exact error that matters most.
Sometimes it all comes down to one extra gate. What’s the most silent bug — the one that ran without complaining — you’ve had to hunt down?
Keep in touch
- Company: i-314 Security Research
- Web: https://i-314.com
- Email: [email protected]
- LinkedIn: linkedin.com/company/i314
First published on LinkedIn.
Related reading
- Zero Trust for AI Isn’t One Wall — It’s Two Planes and an Auditor
- Anatomy of an AI Research Agent That Doesn’t Hallucinate
- Capturing OWASP FinBot CTF: A Source-Aware Methodology for Agentic AI Red Teaming
AI red-teaming, agentic-AI security and post-quantum cryptography. LinkedIn