ABSTRACT (original article): Data poisoning attacks on machine learning models aim to manipulate the data used for model training such that the trained model behaves in the attacker’s favor. In classical models such as deep neural networks, large chains of dot products do indeed cause errors injected by an attacker to propagate or to accumulate. But what about quantum models? Our hypothesis is that, in quantum machine learning, error propagation is limited for two reasons. First of all, data, which in quantum computing is encoded in terms of qubits which are confined to the Bloch sphere. Second of all, quantum information processing happens via the application of unitary operators which are norm-preserving. Testing this hypothesis, we investigate how extensive error propagation and thus poisoning attacks affect quantum machine learning. CITATION (original article): Eldar Sultanow, Fation Selimllari, Siddhant Dutta, Barry D. Reese, Madjid Tehrani, William J Buchanan (2024), Quantum Error Propagation, arXiv:2410.05145. https://doi.org/10.48550/arXiv.2410.05145​
GitHub: https://github.com/Sultanow/quantum/tree/main/bloch_sphere
There are two possibilities to generate curves of the error propagation. They can first of all be obtained by applying the SU(2) rotation using equation
U(φ,θ,ψ)=
-i
φ
2
σ
3
e
-i
θ
2
σ
2
e
-i
ψ
2
σ
3
e
=
-i
φ+ψ
2
e
cos
θ
2
-
-i
φ-ψ
2
e
sin
θ
2
i
φ-ψ
2
e
sin
θ
2
i
φ+ψ
2
e
cos
θ
2
which yields the rotated vectors
ω
=U(φ,θ,ψ)·(
ν
·
σ
)·Uφ,θ,
†
ψ)
and
ω
err
=U(φ,θ,ψ)·
ν
err
·
σ
·Uφ,θ,
†
ψ)
. The second, more convenient way is to use the Euler matrix. In this case we refer to the equation​
′
q
=q·S(φ,θ,ψ)​​S(φ,θ,ψ)=
cosψcosθcosφ-sinψsinφ
cosψcosθsinφ+sinψcosφ
-cosψsinθ
-sinψcosθcosφ-cosψsinφ
-sinψcosθsinφ+cosψcosφ
sinψsinθ
sinθcosφ
sinθsinφ
cosθ
​​ =
cosψ
sinψ
0
-sinψ
cosψ
0
0
0
1
cosθ
0
-sinθ
0
1
0
sinθ
0
cosθ
cosφ
sinφ
0
-sinφ
cosφ
0
0
0
1
​​ =
S
3
(ψ)
S
2
(θ)
S
1
(φ)
​ and obtain the rotated vectors by the matrix products
ω
=
ν
·S(φ,θ,ψ)
and
ω
err
=
ν
err
·S(φ,θ,ψ)
.

SU(2)
based error propagation

In[]:=
ClearAll["Global`*"];
A qubit
M
q
that is given in matrix form can be converted to a Cartesian vector
q
(
q
1
,
q
2
,
q
3
)
as follows:​
q
·
σ

1
2
((
q
1
+i
q
2
)(
σ
1
-i
σ
2
)+(
q
1
-i
q
2
)(
σ
1
+i
σ
2
)+
q
3
σ
3
)
​=
q
3
q
1
-i
q
2
q
1
+i
q
2
-
q
3
​We use this behavior for implementing the conversion function qubitmatrixToCartesian.
In[]:=
qubitmatrixToCartesian[Mq_]:=(​​q1=Re[(Mq[[1,2]]+Mq[[2,1]])/2];​​q2=Re[(Mq[[2,1]]-Mq[[1,2]])/(2*I)];​​q3=Re[Mq[[1,1]]];​​Return[{q1,q2,q3}];​​);
We rotate a qubit around Euler angles using the function rnSU2euler.
In[]:=
rnSU2euler[vec_,rx_,ry_,rz_]:=(​​sphericalVec=ToSphericalCoordinates[vec];​​θ=sphericalVec[[2]];​​ϕ=sphericalVec[[3]];​​sx=PauliMatrix[1];​​sy=PauliMatrix[2];​​sz=PauliMatrix[3];​​Mq=Sin[θ]*Cos[ϕ]*sx+Sin[θ]*Sin[ϕ]*sy+Cos[θ]*sz;​​Un={{Exp[-I*(rx+rz)/2]*Cos[ry/2],-Exp[-I*(rx-rz)/2]*Sin[ry/2]},{Exp[I*(rx-rz)/2]*Sin[ry/2],Exp[I*(rx+rz)/2]*Cos[ry/2]}};​​Return[Un.Mq.ConjugateTranspose[Un]];​​);​​​​rotateVector[vec_,rx_,ry_,rz_]:=(​​MqRotated=rnSU2euler[vec,rx,ry,rz];​​Return[qubitmatrixToCartesian[MqRotated]];​​);​​​​subtractAngles[a1_,a2_]:=(​​d=Abs[a1-a2];​​Return[Min[d,2*Pi-d]];​​);
Based on
SU(2)
we implement the error propagation due to
200
qubit rotations by
π
100
and visualize the curves of the error propagation (azimuth/blue and elevation/orange).
errorPropagation[n_,vec_,vecError_,rx_,ry_,rz_]:=(​​(*v=NestList[N[rotateVector[#,rx,ry,rz]]&,vec,n];​​vErr=NestList[N[rotateVector[#,rx,ry,rz]]&,vecError,n];*)​​v=NestList[rotateVector[#,rx,ry,rz]&,N@vec,n];​​vErr=NestList[rotateVector[#,rx,ry,rz]&,N@vecError,n];​​spherical=Map[ToSphericalCoordinates,v];​​sphericalErr=Map[ToSphericalCoordinates,vErr];​​{MapThread[subtractAngles,{sphericalErr[[All,3]],spherical[[All,3]]}],MapThread[subtractAngles,{sphericalErr[[All,2]],spherical[[All,2]]}]}​​);​​​​ListLinePlot[errorPropagation[200,{1,0,0},N[rotateVector[{1,0,0},0,0.2,0]],Pi/100,Pi/100,Pi/100]]
Out[]=
50
100
150
200
0.05
0.10
0.15
0.20

Euler matrix based error propagation

This section contains the Euler matrix based implementation of error propagation analysis using Mathematica.

Calculate and plot error propagation using Euler matrix

Calculating and visualizing the error propagation due to 200 qubit rotations by π/100
ClearAll["Global`*"];​​subtractAngles[a1_,a2_]:=(​​d=RealAbs[a1-a2];​​Return[Min[d,2*Pi-d]];​​);​​angularError[vec_,vecError_,rx_,ry_,rz_,t_,i_]:=(​​sphericalVec=ToSphericalCoordinates[vec.MatrixPower[N[EulerMatrix[{rx,ry,rz}]],t]];​​sphericalVecError=ToSphericalCoordinates[vecError.MatrixPower[N[EulerMatrix[{rx,ry,rz}]],t]];​​Return[subtractAngles[sphericalVec[[i]],sphericalVecError[[i]]]];​​);​​elevationErrorPlot=Plot[angularError[{1,0,0},N[{1,0,0}.EulerMatrix[{0,0.2,0}]],Pi/100,Pi/100,Pi/100,t,2],{t,0,200},PlotStyleOrange];​​azimuthalErrorPlot=Plot[angularError[{1,0,0},N[{1,0,0}.EulerMatrix[{0,0.2,0}]],Pi/100,Pi/100,Pi/100,t,3],{t,0,200}];​​Show[azimuthalErrorPlot,elevationErrorPlot,PlotRange->All]
Out[]=
50
100
150
200
0.05
0.10
0.15
0.20

Calculate and plot error propagation using the limit of Euler matrix power

In[]:=
SP[t_]:=Cos√5t,-2Sin√5t√5,Sin√5t√5,2Sin√5t√5,(1/5)1+4Cos√5t,-(2/5)-1+Cos√5t,-Sin√5t√5,-(2/5)-1+Cos√5t,(1/5)4+Cos√5t;​​angularErrorSimplified[vec_,vecError_,t_,i_]:=(​​sphericalVec=ToSphericalCoordinates[vec.SP[t]];​​sphericalVecError=ToSphericalCoordinates[vecError.SP[t]];​​Return[subtractAngles[sphericalVec[[i]],sphericalVecError[[i]]]];​​);​​elevationErrorPlotSimplified=Plot[angularErrorSimplified[{1,0,0},N[{1,0,0}.EulerMatrix[{0,0.2,0}]],t,2],{t,0,2Pi},PlotStyleOrange];​​azimuthalErrorPlotSimplified=Plot[angularErrorSimplified[{1,0,0},N[{1,0,0}.EulerMatrix[{0,0.2,0}]],t,3],{t,0,2Pi}];​​Show[azimuthalErrorPlotSimplified,elevationErrorPlotSimplified,PlotRange->All]

CITE THIS NOTEBOOK

Quantum error propagation​
by Eldar Sultanow, Fation Selimllari, Siddhant Dutta, Barry D. Reese, Madjid Tehrani, William J Buchanan
Wolfram Community, STAFF PICKS, November 26, 2024
​https://community.wolfram.com/groups/-/m/t/3329030