Getting into Quantum Computing with Rust and Python: QuantumNN and qec-playground
One night in early 2026, around 02:00, I read a paper on arXiv: Li & Martonosi's SWIPER-SIM behavioral model, an analysis of speculative window decoders for quantum error correction codes. It took me 4 hours to understand the paper. 2 weeks to implement it.
The result: qec-playground, the world's first open-source SWIPER-SIM simulator. And as a side product, QuantumNN, a playground for quantum neural networks.
This post is the story of those 2 weeks and what came after.
Why quantum?
Let me be honest: because it's cool.
Serious answer: because there are problems classical computers can't solve. Integer factorization (Shor), unstructured search (Grover), quantum simulation (Feynman's original motivation). And once quantum computers become widespread, these problems will suddenly become solvable.
But the real reason is this: quantum computing is the last frontier of computer science. AI exploded, distributed systems matured, WebAssembly got standardized. But quantum? We're still at the very beginning. Learning quantum programming in 2026 is like learning web development in 1995. Whoever gets in early wins.
I wanted to be one of the early ones.
qec-playground: implementing SWIPER-SIM
Li & Martonosi's paper (arXiv:2606.24048) says this: the biggest problem with quantum error correction (QEC) codes is decoding latency. While a quantum processor is running, decoding the error correction code takes time. And you have a limited time window before the quantum bits (qubits) decohere.
SWIPER (Sliding Window Interleaved Parallel Error Resolution) is a technique that parallelizes this decoding speculatively. The idea: instead of waiting for the whole error correction code, decode it piece by piece with a sliding window, and speculatively predict the next window.
The paper was theoretical. It described a simulation framework, but there was no implementation. I said, "someone should write this." That someone was me.
Technical details
qec-playground does the following:
- Quantum circuit simulation: Simulates qubits, gates and measurements on a classical computer. (Not a real quantum computer, a simulation. But it's enough for developing algorithms.)
- Error modeling: Injects quantum error models like bit-flip, phase-flip and the depolarizing channel.
- SWIPER decoder implementation: I implemented the paper's sliding window algorithm one-to-one. Window size, overlap amount, speculative prediction parameters: all configurable.
- Streamlit interface: Web-based and interactive. You can change the parameters with sliders and see the result instantly.
- Metric analysis: Decoding latency, logical error rate, pseudo-threshold. It computes every metric from the paper.
On the code side it's Python + Streamlit. A pretty simple stack. Because the hard part here isn't the code, it's the physics. Understanding quantum mechanics, figuring out the stabilizer formalism, grasping how surface codes work: that was the real work.
What I learned
Quantum error correction is completely different from classical error correction. In the classical world you fix bit flips. In the quantum world you have both bit flips and phase flips, measuring destroys the state, and you can't copy anything because of the no-cloning theorem. A completely different world.
The stabilizer formalism is beautiful. Thanks to the Gottesman-Knill theorem, you can simulate stabilizer circuits efficiently on a classical computer. Turning the paper's mathematical formalism into code looked impossible at first. But once I sat down and worked through it line by line, I saw that it's actually a very elegant system.
Streamlit is great for scientific simulations. It gives a better UX than a Jupyter notebook. Change a parameter, see it instantly. Ideal for showing to paper authors.
Open source spreads fast in academia. Within 3 days of putting the project on GitHub, a quantum computing researcher opened an issue: "Can we adapt this for surface code rotation too?" Answer: yes, I'm working on it.
QuantumNN: Quantum neural networks
While writing qec-playground, a side effect happened: the quantum circuit simulation infrastructure was already there. I asked myself, "can I use this for neural networks too?" The answer was yes. And out came QuantumNN.
QuantumNN is a framework that replaces classical neural network layers with quantum circuits. The idea:
- Use a variational quantum circuit (VQC) instead of a classical neural network layer
- Optimize the circuit's parameters with gradient descent
- End up with a hybrid classical-quantum model
What's it good for?
In theory, quantum neural networks have these advantages:
- Higher expressiveness with fewer parameters. A quantum circuit can represent exponentially more states than a classical neural network layer (thanks to the dimension of the Hilbert space).
- Native quantum data processing. Data from quantum sensors can be fed straight into a quantum model without classical preprocessing.
- Potential for quantum advantage. Not demonstrated in practice yet (we're in the NISQ era), but in theory it could beat classical models on some problems.
In practice? I'm not sure yet. QuantumNN is a playground. Where a classical CNN gets 99% accuracy on MNIST, the quantum NN gets 92%. But with 10x fewer parameters. That's interesting.
Technical structure
QuantumNN is made up of these components:
from quantumnn import QuantumLayer, HybridModel
# Quantum layer: 4 qubits, 3-layer variational circuit
qlayer = QuantumLayer(n_qubits=4, n_layers=3, encoding="angle")
# Hybrid model: classical dense + quantum + classical dense
model = HybridModel([
torch.nn.Linear(784, 16),
qlayer,
torch.nn.Linear(4, 10)
])
encoding="angle" encodes classical data into qubit rotation angles. There are other encoding strategies too: amplitude encoding (more efficient but more complex), basis encoding (simple but carries little information).
Optimization: gradients are computed with the parameter shift rule. Backpropagation doesn't work on quantum circuits: for each parameter you have to run the circuit twice and take the difference. That's slow even in classical simulation. On real quantum hardware it'll be even slower.
But that's research: slow and hard. What matters is getting started.
The NISQ era and reality
Right now we're in the NISQ (Noisy Intermediate-Scale Quantum) era. Here's what that means:
- Noisy: Qubits are noisy. Error rates are high. In a 100-qubit circuit, even with 0.1% error per gate, the chance of the circuit running correctly is very low.
- Intermediate-Scale: There are devices with 50-1000 qubits (IBM, Google, Rigetti). But no error correction. Each "logical qubit" needs thousands of physical qubits.
- Quantum advantage: Google claimed "quantum supremacy" in 2019. IBM pushed back. They tried again in 2024. The debate is still going.
That's exactly why I got into this field: it's early. Nobody is a "quantum developer" yet. Everyone is learning. And I'm one of the people learning.
What's next?
qec-playground:
- Surface code rotation simulation
- Color code support
- Testing against a real IBM Quantum backend (IBM Q Experience API)
- More decoder algorithms: MWPM, Union-Find, belief propagation
QuantumNN:
- Bigger models (8-12 qubits)
- Testing on real quantum hardware (IBM, Rigetti)
- Quantum transfer learning experiments
- Taking part in QML benchmarks
Try it
# qec-playground
git clone https://github.com/Tuntii/qec-playground
cd qec-playground
pip install -r requirements.txt
streamlit run app.py
# QuantumNN
git clone https://github.com/Tuntii/QuantumNN
cd QuantumNN
pip install -r requirements.txt
python examples/mnist_hybrid.py
Both are public repos. Both are experimental. Neither is "production-ready," and they don't need to be. Research code doesn't have to be pretty, it just has to work.
Quantum computing has been the hardest learning experience of my career. But also the most rewarding. If you're curious too, grab a paper and implement it. That's the best way to learn.
In the next post I'll talk about Hyperembed: a pure-Rust BERT embedding inference engine, SIMD optimizations and local-first AI.