Professional Documents
Culture Documents
Algorithms
Ji Guan Wang Fang
State Key Laboratory of Computer Science, Institute of State Key Laboratory of Computer Science, Institute of
Software, Chinese Academy of Sciences Software, Chinese Academy of Sciences
Beijing, China Beijing, China
guanj@ios.ac.cn University of Chinese Academy of Sciences
Beijing, China
fangw@ios.ac.cn
arXiv:2309.04819v1 [quant-ph] 9 Sep 2023
𝜌 {𝑝𝑖 }𝑖 ∈ O
E {𝑀𝑖 }𝑖 ∈ O A (𝜌)
Input Quantum States (Noisy) Quantum Circuits Measurement Output
Figure 1: The Computational Model of Quantum Algorithms.
(I) 1-qubit (parameterized) logic gates (2 × 2 unitary matrices): (3) Controlled parameterized gates: For example, the controlled
Pauli X rotation gate with rotation angle 𝜃 is:
0 1 0 −𝑖 1 0
𝑋 =
1 0
𝑌 =
𝑖 0
𝑍=
0 −1 1 0 0 0
©0 1 0 0 ª®
1 1 1 1 0 1 0 =
𝐻= √ 𝑆= 𝑇 = . 𝑅𝑥 (𝜃 ) 0 0 cos 𝜃2 −𝑖 sin 𝜃2 ®
®
2 1 −1 0 𝑖 0 𝑒 𝑖𝜋 /4
«0 0 −𝑖 sin 𝜃2 cos 2 ¬
𝜃
𝑅𝑥 (𝜃 1 )
2 2 −𝑖 sin 𝜃2 cos 𝜃2
cos 𝜃2 − sin 𝜃2
𝜃 𝜃 𝑅 𝑦 (𝜃 2 ) 𝑅𝑥 (0.1)
𝑅 𝑦 (𝜃 ) = 𝑒 −𝑖𝜃𝑌 /2 = cos 𝐼 − 𝑖 sin 𝑌 = 𝑆𝑋
2 2 sin 𝜃2 cos 𝜃2
0 𝑅𝑥 (𝜃 4 )
−𝑖𝜃 /2
𝐻
𝜃 𝜃 𝑒
𝑅𝑧 (𝜃 ) = 𝑒 −𝑖𝜃𝑍 /2 = cos 𝐼 − 𝑖 sin 𝑍 = .
2 2 0 𝑒 𝑖𝜃 /2
𝑅𝑧 (𝜃 3 )
Rotation gates 𝑅𝑥 (𝜃 ), 𝑅 𝑦 (𝜃 ), 𝑅𝑧 (𝜃 ) are widely used to encode
classical data into quantum states and also construct quantum (a) A simple quantum neural network to perform MNIST im-
machine learning models (parameterized quantum circuits). age classification task in TorchQuantum’s tutorial.
These will be detailed in the later discussion.
(III) 2-qubit Controlled-U gates (4 × 4 unitary matrices): For any
1-qubit logic gate 𝑈 , we can get a 2-qubit logic gate — controlled- 𝐻 𝑇 𝑇
𝑈 (CU) gate, applying 𝑈 on the second qubit (the target qubit) 𝐻 𝑇 𝑇
if and only if the first qubit (the control qubit) is |1⟩. See the
following instances: 𝐻 𝑇 𝑆𝑋
(1) CNOT: CX gate is also known as controlled NOT (CNOT)
gate and has a special circuit representation: 𝐻 𝑇 𝑇
cation of 2𝑛 × 2𝑛 matrices needs 𝑂 (23𝑛 ) operations, and the number locality and regularity of quantum circuits. This allows us to speed
|J | of the Kraus operators {𝐸 𝑗 } 𝑗 ∈ J of E can be at most 22𝑛 [39, up the calculations involved in verification. As a result, we are able
Chapter 2.2]; In Line 6, calculating 𝑘 ∈ S 𝑊𝑘 and its maximum to verify quantum algorithms with up to 21 qubits, as shown in the
Í
and minimum eigenvalues (and the corresponding eigenvectors later experimental section.
for S = S ∗ in Line 14) for each 𝐴 ⊆ O costs 𝑂 (2 | O | |O|22𝑛 ) since Further improving the scalability of verified qubits is possible by
the number of subsets of O is 2 | O | , |S| ≤ |O| for any S ⊆ O and adapting classical approximation methods to the quantum domain,
computing maximum and minimum eigenvalues with correspond- as they have successfully analyzed large-scale classical machine
ing eigenvectors of 2𝑛 × 2𝑛 matrix by basic power method [40] learning algorithms [41]. Two promising techniques are:
costs 𝑂 (22𝑛 ). Therefore, the total complexity of Algorithm 1 is • Abstraction-based approximation using abstract interpretation
𝑂 (25𝑛 + 2 | O | |O|22𝑛 ). provides over-approximations of concrete program semantics.
If a property holds for the abstracted version, it also holds for solving classical tasks with angle encoding introduced in Section 2.
the original. This technique has boosted verification scalability All of them have been implemented on current NISQ computers.
for classical neural network robustness [42] and correctness of
quantum circuits up to 300 qubits [43]. 5.1 Quantum Approximate Optimization
• Bound-based approximation derives efficiently computable bounds Algorithms
on algorithm properties. If the algorithm satisfies the bound, it The Quantum Approximate Optimization Algorithm (QAOA) is a
satisfies the property, but the converse is unknown. This has quantum algorithm for producing approximate solutions for combi-
enabled robustness verification for large-scale classical neural natorial optimization problems [14]. Fig. 5. shows a 2-qubit example
networks [44] and quantum classifiers [35]. of QAOA circuit. In our experiment, we use the circuit for hardware
grid problems in [18] generated from code in Recirq [47]. Circuit
These approximation methods trade off formal guarantees for scal-
name qaoa_𝐷 represents such a QAOA circuit with 𝐷 connected
ability in verifying algorithm properties. Since quantum algorithms
qubits on Google’s Sycarmore quantum processor.
rely on quantum circuits, we can follow similar approaches [35, 43]
to improve the scalability of verifying quantum differential privacy.
RY ( −𝜋
2 ) RZ ( 𝜋2 ) RX (𝜋)
5 EVALUATION
RY ( −𝜋
2 ) RZ ( 𝜋2 ) RX (𝜋)
In this section, we evaluate the effectiveness and efficiency of our
Algorithms on noisy quantum algorithms.
Figure 5: A 2-qubit QAOA circuit.
Implementation: We implemented our Algorithms on the top
of Google’s Python software libraries: Cirq for writing and manip-
ulating quantum circuits, TensorNetwork for converting quantum 5.2 Variational Quantum Eigensolver
circuits to tensor networks. Our implementation supports circuit
models not only written in Cirq but also imported from IBM’s
Algorithms
Qiskit, and accepts quantum machine learning models from both The circuit of Variational Quantum Eigensolver (VQE) Algorithms
TensorFlow Quantum and TorchQuantum. comes from the experiments in [17], which uses Google’s Sycarmore
quantum processor to calculate the binding energy of hydrogen
Optimization Techniques: We convert quantum circuits into
chains. Fig. 6. shows an 8-qubit basis rotation circuit for 𝐻 8 used
tensor networks, which is a data structure exploiting the regularity
in the VQE algorithm. In our experiment, VQE circuit is obtained
and locality contained in quantum circuits, while matrix represen-
from Recirq and named hf_𝐸 with 𝐸 being the number of qubits.
tation cannot. The multiplication of matrices in our algorithm is
transformed into the contraction of tensor networks. For the ten-
sor network of a quantum circuit, its complexity of contraction 𝑋
𝜃7
is 𝑇 𝑂 (1) exp[𝑂 (𝑞𝑑)] [45], where 𝑇 is the number of gates (ten- 𝑋
𝜃4 𝜃 11
sors), 𝑑 is the depth in the circuit (tensor network) and 𝑞 is the 𝑋
number of allowed interacting qubits, i.e., the maximal number of 𝑋
𝜃2 𝜃8 𝜃 14
levels.
10
𝑝 = 10 −2 Depolarizing noise
5
The optimal bound 𝜀 ∗
𝑝 = 10 −3
𝑝 = 10 −4
𝑝 = 10 −5 10
0 𝑝 = 10 −6
𝑝 = 10 −2
0 0.5 1 5 𝑝 = 10 −3
𝜂 𝑝 = 10 −4
𝑝 = 10 −5
(a) The optimal bound function 𝜀 ∗ (𝜂 ) for hf_12.
0 𝑝 = 10 −6
Bit flip noise 0 0.5 1
The optimal bound 𝜀 ∗
𝜂
10
(a) The optimal bound function 𝜀 ∗ (𝜂 ) for inst_4x5_10.
𝑝 = 10 −2 Bit flip noise
5
The optimal bound 𝜀 ∗
𝑝 = 10 −3
𝑝 = 10 −4
𝑝 = 10 −5 10
0 𝑝 = 10 −6
𝑝 = 10 −2
0 0.5 1 5 𝑝 = 10 −3
𝜂 𝑝 = 10 −4
𝑝 = 10 −5
function 𝜀 ∗ (𝜂 )
(b) The optimal bound for hf_12.
0 𝑝 = 10 −6
0 0.5 1
Figure 7: Comparison of 𝜀-differential privacy on Variational 𝜂
Quantum Eigensolver Algorithms with different noise levels.
(b) The optimal bound function 𝜀 ∗ (𝜂 ) for inst_4x5_10.
explore the tendency of the optimal bound function 𝜀 ∗ (𝜂). All ex- Figure 9: Comparison of 𝜀-differential privacy on Quantum
perimental results confirm that the quantum noises on input states Supremacy Algorithms with different noise levels.
can logarithmically enhance the differential privacy as we claimed
before. Furthermore, as quantum differential privacy protects the
privacy of encoded classical data, as shown in Example 3.4, intro- of the encoded data, much like how adding classical noise improves
ducing quantum noise can further enhance the differential privacy the privacy of original classical data [21].
Depolarizing noise Depolarizing noise Depolarizing noise
The optimal bound 𝜀 ∗
5 𝑝 = 10 −2 𝑝 = 10 −2 𝑝 = 10 −2
𝑝 = 10 −3 5 𝑝 = 10 −3
5 𝑝 = 10 −3
𝑝 = 10 −4 𝑝 = 10 −4 𝑝 = 10 −4
𝑝 = 10 −5 𝑝 = 10 −5 𝑝 = 10 −5
0 𝑝 = 10 −6 0 𝑝 = 10 −6 0 𝑝 = 10 −6
(a) The optimal bound function 𝜀 ∗ (𝜂 ) for (b) The optimal bound function 𝜀 ∗ (𝜂 ) for (c) The optimal bound function 𝜀 ∗ (𝜂 ) for
MNIST_10. GC_9. EC_9.
Bit flip noise Bit flip noise Bit flip noise
The optimal bound 𝜀 ∗
5 𝑝 = 10 −2 𝑝 = 10 −2 𝑝 = 10 −2
𝑝 = 10 −3 5 𝑝 = 10 −3
5 𝑝 = 10 −3
𝑝 = 10 −4 𝑝 = 10 −4 𝑝 = 10 −4
𝑝 = 10 −5 𝑝 = 10 −5 𝑝 = 10 −5
0 𝑝 = 10 −6 0 𝑝 = 10 −6 0 𝑝 = 10 −6
(d) The optimal bound function 𝜀 ∗ (𝜂 ) for (e) The optimal bound function 𝜀 ∗ (𝜂 ) for (f) The optimal bound function 𝜀 ∗ (𝜂 ) for
MNIST_10. GC_9. EC_9.
Figure 10: Comparison of 𝜀-differential privacy on various Quantum Machine Learning Models with different noise levels.
𝑘∈S 𝑘∈S
tr(E (𝑀𝑘 )(𝜌 − 𝑒 𝜎))
†
∑︁
𝜀
⇔𝛿 ≥
𝑘∈S
⇔ 𝛿 ≥ tr(𝑀 S (𝜌 − 𝑒 𝜀 𝜎)).
By the arbitrariness of S, the above inequality holds if and only if for any S ⊆ O, we have 𝛿 ≥ 𝛿 S , where
𝛿S = sup tr(𝑀 S (𝜌 − 𝑒 𝜀 𝜎)).
𝜌,𝜎 with 𝐷 (𝜌,𝜎 ) ≤𝜂
(7)
Because of S ⊆ D (H ), we obtain that 𝜆min (𝑀) ≤ 𝜆min (E † (𝑀)) and 𝜆max (E † (𝑀)) ≤ 𝜆max (𝑀), completing the proof. □
Now we can prove Theorem 3.5.
Proof. It follows from Theorem 4.1 and Lemma B.1 by noting that 𝜆max (U † (𝑀)) = 𝜆max (𝑀) and 𝜆min (U † (𝑀)) = 𝜆min (𝑀) for any
positive semi-definite matrix 𝑀. □