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
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 θ 2 | - -i φ-ψ 2 e θ 2 |
i φ-ψ 2 e θ 2 | i φ+ψ 2 e θ 2 |
which yields the rotated vectors =U(φ,θ,ψ)·(·)·Uφ,θ, and =U(φ,θ,ψ)···Uφ,θ,. The second, more convenient way is to use the Euler matrix. In this case we refer to the equation=q·S(φ,θ,ψ)S(φ,θ,ψ)=
=
=(ψ)(θ)(φ) and obtain the rotated vectors by the matrix products =·S(φ,θ,ψ) and =·S(φ,θ,ψ).
ω
ν
σ
†
ψ)
ω
err
ν
err
σ
†
ψ)
′
q
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
ω
ν
ω
err
ν
err
SU(2) based error propagation
SU(2)
In[]:=
ClearAll["Global`*"];
A qubit that is given in matrix form can be converted to a Cartesian vector (,,) as follows:·((+i)(-i)+(-i)(+i)+)=
We use this behavior for implementing the conversion function qubitmatrixToCartesian.
M
q
q
q
1
q
2
q
3
q
σ
1
2
q
1
q
2
σ
1
σ
2
q
1
q
2
σ
1
σ
2
q
3
σ
3
q 3 | q 1 q 2 |
q 1 q 2 | - q 3 |
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 we implement the error propagation due to qubit rotations by and visualize the curves of the error propagation (azimuth/blue and elevation/orange).
SU(2)
200
π
100
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[]=
Euler matrix based error propagation
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
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},PlotStyleOrange];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[]=
Calculate and plot error propagation using the limit of Euler matrix power
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},PlotStyleOrange];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
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
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