Home▸Quantum Physics▸Parameter-Shift Rule: Training a Quantum Neural Network

Parameter-Shift Rule (2D): Training a Quantum Neural Network

A 2D heatmap of a quantum neural network's cost landscape: watch the exact parameter-shift rule evaluate the circuit at +/-90 degree shifts to compute real quantum gradients, plotted live alongside the resulting training loss curve.

Quantum Physics2DAdvanced60 FPS📱 Mobile-adapted⇄ 3D version
2d-qe-topic-96 ↗ Open standalone

A quantum neural network is a parameterized quantum circuit whose rotation angles play the role of weights, trained by gradient descent just like a classical network — except a quantum computer cannot backpropagate. This 2D simulator renders the cost landscape of a single-qubit QNN, R_z(θ₂)R_y(θ₁)|0⟩ measured in X, as a live heatmap over the two rotation angles, and trains it using the exact parameter-shift rule: at every step the circuit is re-evaluated at each parameter shifted by ±π/2, and the difference of those two runs gives the true gradient. Watch the marker slide downhill toward whatever target expectation value you set, with the four shift-rule evaluation points highlighted at each step, a live loss curve tracking the cost across training iterations, and readouts of the cost, output, both angles and the gradient magnitude.

⚙ Under the hood

A 2D heatmap simulator of a single-qubit quantum neural network, where the exact parameter-shift rule computes real quantum gradients at each training step and a live loss curve tracks the cost as gradient descent drives the circuit toward a target expectation value.

quantum-machine-learningparameter-shift-rulevariational-quantum-circuitgradient-descentquantum-neural-network2d

2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)