SA-DQAS: Self-attention Enhanced
Differentiable Quantum Architecture Search

Yize Sun 1 2 3 Jiarui Liu 2 Zixin Wu 2 Zifeng Ding 2 3 Yunpu Ma 1 2 3 Thomas Seidl 2 Volker Tresp 1 2 3

Abstract

Various quantum architecture search (QAS) algorithms can
automatically search for the near-optimal quantum circuitarchitecture [7]–[15]. Differentiable quantum architecture
search (DQAS) [9] is a gradient-based QAS algorithm. It
designs circuits by replacing placeholders with operation
candidates. Instead of evaluating all possible architecture,
DQAS only samples a batch of candidates for updatingarchitecture parameter α and circuit parameters θ. The loss
L and the local loss L are given as:

We introduce SA-DQAS in this paper, a novel
framework that enhances the gradient-based Differentiable Quantum Architecture Search (DQAS)
with a self-attention mechanism, aimed at optimizing circuit design for Quantum Machine Learning(QML) challenges. Analogous to a sequence ofwords in a sentence, a quantum circuit can beviewed as a sequence of placeholders containing
quantum gates. Unlike DQAS, each placeholder
is independent, while the self-attention mechanism in SA-DQAS helps to capture relation anddependency information among each operation
candidate placed on placeholders in a circuit. To
evaluate and verify, we conduct experiments on
job-shop scheduling problems (JSSP), Max-cut
problems, quantum chemistry and quantum fidelity. Incorporating self-attention improves thestability and performance of the resulting quantum circuits and refines their structural design
with higher noise resilience and fidelity. Our research demonstrates the first successful integration of self-attention with DQAS.

L=Xk∈P (k,α)P

P (k, α)L(k)′k′ ∈P (k,α) P (k , α)

where
P (k, α) =p
Yp(ki , αi )

,

,

(1)

(2)

i=1

and k determines a circuit structure in a probabilistic model.
Since DQAS assumes that each placeholder is independentof other placeholders, each operation candidate has little
overall view of operations in other placeholders. In orderto tackle this issue, we choose the architecture parameter α
as a tokenized ”sentence” and extend the DQAS by adding
a transformer encoder [16], which compresses architecture
parameter and positional information into a low-dimension
vector to provide a global view of the operation candidates
in different placeholders. Unlike prior methods [9] that the
selection of operation for each placeholder has little information regarding operation candidates in other placeholders,
we present a DQAS method enhanced with the self-attention
mechanism SA-DQAS to let the operation candidates havea global view.

1. Introduction
In recent years, quantum computing (QC) has developed
rapidly and has achieved remarkable progress in different areas, such as image classification, circuit architecture search,quantum reinforcement learning, knowledge graph embedding, and approximate optimization problem [1]–[5]. However, the performance of the quantum algorithms is often
different from expected on noisy devices. Variational quantum algorithms (VQAs) are considered the leading strategy
in the NISQ era [6].

We summarise our contributions as follows:
1. We present a high-performing QAS algorithm SADQAS by extending the DQAS with an attention module. A transformer encoder can transform architecture
parameters by handling the fitness and positional information of operation candidates.

1
Munich Center for Machine Learning (MCML), Munich, Germany 2 Institute of Informatik, LMU, Munich, Germany 3 Siemens
AG, Munich, Germany. Correspondence to: Yunpu Ma <cognitive.yunpu@gmail.com>.

2. We conduct sufficient experiments for comparing our
new method with the original DQAS in different tasks.
The SA-DQAS provides outperforming results and canPublished at the 2 nd Differentiable Almost Everything Workshop
at the 41 st International Conference on Machine Learning, Vienna, Austria. July 2024. Copyright 2024 by the author(s).

1SA-DQAS: Self-attention Enhanced Differentiable Quantum Architecture Search

For F 2, we view the original architecture matrix α as an
input for the encoder. The output of this method is α2′ =α + βF2 (α). We expect that the self-attention mechanism
can give us additional features without strongly reducing theeffect of the original architecture parameters. As a result,
we select a sufficiently small β as a scaling coefficient.

find high-performing circuit architectures efficiently
on a quantum simulator.
3. We test SA-DQAS in a noisy environment. By considering idle errors, we show that SA-DQAS can still findnoise-resilient circuit architecture by keeping entanglements.

Loss function The loss function for the whole process ofcircuit architecture search is described in Eq.1. In order to
get a gradually fixed architecture parameter, we select the
distance of the output of the encoder between the current
training step and one previous training step as our loss metric. For each training step t, the encoder parameters are
updated by

2. Methodology
Our work is based on DQAS, which uses a gradient-based
method to construct a quantum circuit by replacing theseplaceholders with one possible candidate operation fromthe operation pool. We denote the operation pool as O.
A circuit
Qp is a sequence of p placeholders described as
U = i=0 ui (θi ), where ui and oi ∈ O stand for unitary placeholder and operation candidate, and θi are theparameters of trainable gates. The architecture parameter
matrix is (αij ) ∈ Rp×l with l = |O|. The probability is
calculated by Eq 2 . This setting makes the search processcontinue and focuses on operations in one placeholder but
ignores the relationship among operation candidates placedon different placeholders.

wt = wt − η∆w Lencoder

(11)

trans
Lencoder = max max |Ft−m − Ft (αij)|,
1≤i≤p 1≤j≤l(12)where Ft is the output matrix of F in training step t. We set
m = 1 in our experiment and F (α0 ) is initialized by 0.

3. Experiments
3.1. Experiment settings

Encoder F 1&F 2 As shown in Figure 1, each architecture parameters vector αi is viewed as a word, and thearchitecture matrix α is viewed as a sentence. The outputof the encoder is the architecture parameters, including relationship features, and is added to the original architecture
parameter matrix α:α′ = α + βF (α),

Our experiments test our framework based on JSSP and
Max-cut problems. We define four different types of operation pools, O1 -O4 . Appendix A describes the operation
pool construction rules. The basic settings in the training
process and types of gates contained in O1 -O4 are given in
Appendix E.

(3)3.2. Experiments on JSSP

where F is the encoder and β is the scaling coefficient.

In this section, we conduct experiments with five qubits
using SA-DQAS for the simplest JSSP task defined in paper[4] with five qubits. Their manually designed circuit,represented in Figure 2b, is selected as our baseline. In
the experiments, all qubits are initialized with the state |0⟩and applied rx gates with a rotation angle of π to form
the encoding block. There is only one parameterized blockcontaining four placeholders. For each learning step, we
update all placeholders. The energies E are scaled to therange [0, 1]:

From different perspectives, by viewing a placeholder as
a token, we propose one encoder with two types of input:
F1 and F2 . Regarding the encoder F1 , we use sinusoidal
position embedding αipos for N layers-encoder. Each layer
consists of two sublayers:
αin1 = LayerNorm(αia ),αia = MultiHead(αipos , αipos , αipos ) + αipos .

(4)
(5)

The second sub-layer is a position-wise fully connected
feed-forward network:
αin2 = LayerNorm(αia2 ),(6)

αia2 = αin1 + g(αin1 ),g(αin1 ) = W2 max(0, W1 αin1 + b1 ) + b2 .

(7)
(8)

e=

α

trans

T

= α × α × α.

,

(13)

where Emin and Emax are the minimum and maximum
energy. When e ≈ 0, we reach the minimal energy and findthe optimal solution.
From Table 1, nearly all circuits designed by SA-DQAS
converge faster than those without self-attention. Whencircuits generated with SA-DQAS contain fewer parameterized gates than those with DQAS. There are still somesearches that do not find optimal circuits.

And α is updated by:
α1′ = α + βF1 (αtrans ),E − Emin∈ [0, 1]
Emax − Emin

(9)
(10)
2

SA-DQAS: Self-attention Enhanced Differentiable Quantum Architecture Search

Figure 1: The illustration of the proposed framework SA-DQAS. On the left side is the common part of both algorithms (Step 1 and Step
2). On the right side, we show the differences between both algorithms. SA-DQAS uses the attention modules F1 or F2 to improve thearchitecture parameters α, such that each operation shares positional and fitness information among operation candidates in different
placeholders.
Table 1: Summary of circuits designed with and without selfattention from different operation pools for JSSP

Operation #Gates∗∗∗pool
Baseline
18
Y∗ N∗
op1-1
15 14
op1-2
13
9
op1-3
13 19
op1-4
14 20
op2-1
13
9
op2-2
15 16
op2-3
16 18
op2-4
15 18
op3-1
15 13
op3-2
15 13
op3-3
16 16
op3-4
13 20
op4-1
7
12
op4-2
12 15
op4-3
16 16
op4-4
16 17

#Param.
Gate∗∗∗
10
Y
N
15
14
9
9
9
14
5
15
9
9
7
12
8
18
10
5
7
9
11
13
4
12
5
20
7
12
12
15
16
16
16
17

Quantumcost∗∗∗
8
Y
N
0
0
4
0
4
0
4
0
4
0
8
4
8
0
0
8
8
4
4
0
12
4
8
0
0
4
8
8
8
8
16
12

ASP∗∗
29
Y
25
18
20
13
13
13
13
19
18
17
10
14
33
60
89
88

N
26
11
39
38
16
28
40
14
15
32
16
39
72
108
96
91

(a) Comparison(b) Baseline(c) Circuitauto

Figure 2: Evaluation of newly found architectures on the simulator
without noise. The results are averaged over 10 trials with thedifferent initial parameters.

(a) Op*-01(b) Op*-02(c) Op*-02(d) Op*-04*

Y indicates circuits searched by SA-DQAS and N indicates by DQAS**
Average solving point (ASP) refers to the number of
iterations required to find the minimum energy without
subsequent fluctuations.
***
Columns 1-3 indicate the number of total gates, trainable
gates and controlled gates in the parameterized blocks.

Figure 3: Comparison of circuits generated using operation pools
replacing ry with rx. We also generate operation pools by replacing
ry with rx gates.

Figure 2 shows the evaluation of newly found architectureson the simulator without noise. The best-performing circuits
converge faster than the baseline and have high reliability.
More controlled gates indicate a higher building cost of thequantum circuit, while controlled gates provide quantum
features. The discovered circuit contains fewer gates thanthe baseline. The impact of placeholders and parameterizedblocks are shown in Appendix B.

simulator. The designed circuits are noise-resilient andmore reliable in most cases, although the learned circuits,
including the baseline, do not find the accurate minimum
energy in some trials because of the influence of noise.

In Figure 5, we show the circuit evaluation on the noisy

From Figure 6, we know that random information to DQAS
3

SA-DQAS: Self-attention Enhanced Differentiable Quantum Architecture Search(a) op2-74(a) Performance JSSP-10qubits(b) op3-44(c) op3-64(b) Circuit JSSP-10-qubits
Figure 6: Evaluation of performances of circuits generated by SADQAS and DQAS with random information. Method 1 and 2 use
the encoder F1 and F2 , respectively. The line is the average resultsof 10 trials with different initial parameters. The suffix means four
placeholders are used.

Figure 4: Top performing circuit for 10 qubits JSSP problem.
The baseline (red) does not converge to the bottom, while theautomatically design circuit can within 300 training Epochs.

Table 3: Experiments on hydrogen. We solve the Hamiltonianof H2 and compare our method to other algorithms. The value
indicates the error level compared with ground state energy.

Algorithm
UCCSD
quantumDARTS
SA-DQAS
DQAS
QGAS
Randomness

Figure 5: Performance evaluation in noisy environments. We study
the resistance of auto-generated circuits to noise. We form noisemodels by adding 20% noise of different types on each end of thequbit in the generated circuit with the best performance.

3.3. Experiments on quantum chemistry

Table 2: Summary of circuit architectures designed with and without self-attention from different operation pools for solving different Max-cut problem.

#Gates∗∗ #Param. G.
M∗1 M∗2 N∗ M1 M2 N∗∗∗
CircuitR−op4−74 23 22 29 23 22 29
CircuitL−op3−34 23 27 22 15 19 14
CircuitB−op3−64 29 30 23 21 22 23
Circuits

H2 (Energy Error)
10−11
10−6
10−4
10−4
10−2
10−2

In Table 3, we compared SA-DQAS with different algorithms in terms of hydrogen. The SA-DQAS can findoptimal circuit architecture that outperforms QGAS [7],RS but still has limited performance by comparing with
UCCSD [17] and quantumDARTS [2]. SA-DQAS here may
only find the local optimum due to a very shallow circuitwith only 4 placeholders. More molecules and a large circuit
should be considered by comparison in the next step.

#Con. G.
M 1 M2 N
8 16 8
8 8 8
8 8 0

*

M∗1 indicates circuits searched by Method 1, M∗2 by
Method 2 and N indicates by DQAS.
**
Columns 1-3 indicate the number of total gates, controlled gates, and trainable parameterized gates in theparameterized blocks.
***
The suffix indicates that the circuits are derived fromwhich operation pool and used to solve the Max-cut
problem in which graph. R denotes Random graph, Lmeans Ladder and B is Barbell. The suffix op4-4 means
the circuits are generated from operation op4-4.

4. Conclusion
Our method, SA-DQAS, improves DQAS by using the selfattention mechanism. We show the effectiveness of thismethod through various experiments for JSSP, quantum
chemistry, and max-cut problems. SA-DQAS still has limited performance in quantum chemistry. However, JSSP
experimental results show that SA-DQAS can find morestable circuit structures than DQAS in ideal and noisy environments.
However, the circuit depth and width are fixed, and being
especially small during a search may limit the search performance. Some search results still hardly depend on thesize and selected gate types of the operation pool, and alarger operation pool increases the search space exponentially, leading to tremendous training costs. Addressingthese issues could be the next step.

can lead to the instability of the final circuit performance.
However, self-attention can help build stable circuit architectures through additional information. There are morecomparison results in terms of randomness, Max-Cut anderror mitigation problem in Table 2 and Appendix C, andnoisy test in Appendix D.
4

SA-DQAS: Self-attention Enhanced Differentiable Quantum Architecture Search

Acknowledgements[13]

The project of this conference paper is based on was supported with funds from the German Federal Ministry of Education and Research in the funding program Quantum Reinforcement Learning for industrial Applications (QLindA)and the Federal Ministry for Economic Affairs and Climate Action in the funding program Quantum-Classical Hybrid Optimization Algorithms for Logistics and Production
Line Management (QCHALLenge) - under project number
13N15644 and 01MQ22008B. The sole responsibility forthe paper’s contents lies with the authors.

[14]

[15]

[16]

[17]

References
[1]

[2]

[3]

[4]

[5]

[6]

[7]

[8]

[9]

[10]

[11]

[12]

M. Alam, S. Kundu, R. O. Topaloglu, and S. Ghosh,“Quantum-classical hybrid machine learning for image classification (iccad special session paper),” arXiv preprint
arXiv:2109.02862, 2021.
W. Wu, G. Yan, X. Lu, K. Pan, and J. Yan, “Quantumdarts:
Differentiable quantum architecture search for variational
quantum algorithms,” in Proceedings of the 40th International Conference on Machine Learning, ser. ICML’23,
Honolulu, Hawaii, USA: JMLR.org, 2023.
Y. Ma, V. Tresp, L. Zhao, and Y. Wang, “Variational quantum circuit model for knowledge graph embedding,” Advanced Quantum Technologies, vol. 2, no. 7-8, p. 1 800 078,
2019.
D. Amaro, M. Rosenkranz, N. Fitzpatrick, K. Hirano, and
M. Fiorentini, “A case study of variational quantum algorithms for a job shop scheduling problem,” EPJ Quantum
Technology, vol. 9, no. 1, p. 5, 2022.
Y. Sun, J. Liu, Y. Ma, and V. Tresp, “Differentiable quantum
architecture search for job shop scheduling problem,” arXiv
preprint arXiv:2401.01158, 2024.
M. Cerezo, A. Arrasmith, R. Babbush, et al., “Variational
quantum algorithms,” Nature Reviews Physics, vol. 3, no. 9,
pp. 625–644, 2021.
Y. Du, T. Huang, S. You, M.-H. Hsieh, and D. Tao, “Quantum circuit architecture search for variational quantum algorithms,” npj Quantum Information, vol. 8, no. 1, pp. 1–8,
2022.
F.-X. Meng, Z.-T. Li, X.-T. Yu, and Z.-C. Zhang, “Quantum
circuit architecture optimization for variational quantum
eigensolver via monto carlo tree search,” IEEE Transactions on Quantum Engineering, vol. 2, pp. 1–10, 2021.
S.-X. Zhang, C.-Y. Hsieh, S. Zhang, and H. Yao, “Differentiable quantum architecture search,” Quantum Scienceand Technology, vol. 7, no. 4, p. 045 023, 2022.
L. Ding and L. Spector, “Evolutionary quantum architecture search for parametrized quantum circuits,” in Proceedings of the Genetic and Evolutionary Computation
Conference Companion, 2022, pp. 2190–2195.
L. Ding and L. Spector, “Multi-objective evolutionary architecture search for parameterized quantum circuits,” Entropy, vol. 25, no. 1, p. 93, 2023.
T. Fösel, M. Y. Niu, F. Marquardt, and L. Li, “Quantum circuit optimization with deep reinforcement learning,” arXiv
preprint arXiv:2103.07585, 2021.

[18]

[19]

5

E.-J. Kuo, Y.-L. L. Fang, and S. Y.-C. Chen, “Quantum
architecture search via deep reinforcement learning,” arXiv
preprint arXiv:2104.07715, 2021.
E. Ye and S. Y.-C. Chen, “Quantum architecture search
via continual reinforcement learning,” arXiv preprint
arXiv:2112.05779, 2021.
M. Ostaszewski, L. M. Trenkwalder, W. Masarczyk, E.
Scerri, and V. Dunjko, “Reinforcement learning for optimization of variational quantum circuit architectures,” Advances in Neural Information Processing Systems, vol. 34,
pp. 18 182–18 194, 2021.
A. Vaswani, N. Shazeer, N. Parmar, et al., “Attention is
all you need,” Advances in neural information processing
systems, vol. 30, 2017.
J. Romero, R. Babbush, J. R. McClean, C. Hempel, P. J.
Love, and A. Aspuru-Guzik, “Strategies for quantum computing molecular energies using the unitary coupled cluster
ansatz,” Quantum Science and Technology, vol. 4, no. 1,
p. 014 008, 2018.
J. J. Wallman and J. Emerson, “Noise tailoring for scalable
quantum computation via randomized compiling,” PhysicalReview A, vol. 94, no. 5, p. 052 325, 2016.
A. Zlokapa and A. Gheorghiu, “A deep learning modelfor noise prediction on near-term quantum devices,” arXiv
preprint arXiv:2005.10811, 2020.

SA-DQAS: Self-attention Enhanced Differentiable Quantum Architecture Search

A. Operation PoolWe define four root operation pools O1 -O4 to create
concrete operation pools. Each root contains only thetype of quantum gates with a generic range. We define’RZ+RY+CZ+H’ (O1 ) and ’U3+CU3+H’ as two essential
roots since the circuits based on these two design spaces perform well in quantum optimization problems. Furthermore,
we define two additional roots by making a small change in’RZ+RY+CZ’. One is by extending it with CNOT (O3 ), andthe other is created by replacing CZ with CNOT (O2 ).

(a) Comparison of place- (b) Gates and ASP of autoholders
generated circuit

The smallest and largest operation pool of O4 with five
qubits in JSSP for each type is shown as follows:
op4-1 = {U3 : [0, 1, 2, 3, 4],
U3 : [0, 1, 2, 3], U3 : [1, 2, 3, 4],
U3 : [0, 1, 2], U3 : [1, 2, 3], U3 : [2, 3, 4],(c) Comparison of parame- (d) Gates and ASP of autoterized blocks
generated circuit

U3 : [0, 1], U3 : [1, 2], U3 : [2, 3], U3 : [3, 4],
CU3 : [0, 1, 2, 3], E : [0, 1, 2, 3, 4]}

Figure 7: (a) and (b) illustrate the impact of placeholders whengenerating circuits with op1-3. (c) and (d) illustrate the impact ofparameterized blocks when generating circuits with op1-3.

op4-4 = {U3 : [0, 1, 2, 3, 4], H : [0, 1, 2, 3, 4],
CU3 : [0, 1, 2, 3], E : [0, 1, 2, 3, 4]}(14)
The last operation E means that add an identical gate to each
qubit. We change the size following this rule: every time we
reduce the size, we delete all single-gate operations with thecurrent smallest length of the working range. For example,
the largest operation pool of O4 contains U3 with a lengthof working range of 2. The smallest length of working range
in the smallest pool of single-qubit gates is 5. As a result,for each type, with N qubits, we will form N − 1 different
sizes of operation pools, and we number them in order fromlargest to smallest. In our experiments, our operation poolsof different qubits are formed to obey this rule. In someexperiments, we change the operation pool slightly, theworking range of entangle gates [0,1,2,3,4,5,6,7].

B. JSSP(a) SA-DQAS vs DQAS(b) Comparison in data(c) Circuit by SA-DQAS(d) Circuit by DQAS

Figure 8: Comparison of circuits generated using SA-DQAS and
DQAS. (a) performances for solving JSSP, (b) comparison in data,(c) one circuit generated with SA-DQAS, (d) one circuit generated
with DQAS.

The impact of placeholders and parameterized blocks during
generating circuits is studied. In Figure 7, the red line
indicates the number of gates of the baseline is 23 and the
ASP is 29. The evaluation results show that as the number ofplaceholders and parameterized blocks increase, the numberof gates in the generated circuits and the depth of the circuits
increase and converge more slowly when solving a simple
JSSP. The deeper the circuits are, the more parameterized
gates need to be trained, resulting in more complex quantum
calculations and slower convergence.

mances. We select some generated circuits to make a comparison. The results are shown in Figure 9. In Figure 9b,
circuits created with method 1 converge faster to the minimum energy than circuits searched by method 2. Figures
9c and 9e show that circuits searched by method 1 outperform those by method 2. Some circuits generated with these
two methods perform similarly for the Max-cut problem,
as shown in Figure 9d and 9f. Furthermore, in Figure 9a,although the circuit from method 2 converges fast, it has alarge deviation. The circuits generated by the two methods

C. Max-cut Problem
SA-DQAS adds self-attention in two methods for the Maxcut problem in the benchmark and compares their perfor6

SA-DQAS: Self-attention Enhanced Differentiable Quantum Architecture Search(a) W<WO op2-44(b) W>WO op4-74(c) W≈WO op4-54(d) W≈WO op3-34(e) W<WO op3-14(f) W>WO op3-64

Figure 9: A comparison of the performance of circuits generated with (methods 1 and 2) and without self-attention in solving different
Max-cut problems. (a),(b) are evaluation results for Random graph, (c), (d) are for Ladder graph and (e), (f) are for Barbell graph. W
means generating circuits with self-attention, and WO means without self-attention.

perform similarly in solving different Max-cut problems,and no circuit generated by one method will always perform better. However, the circuits generated in both ways
find the optimal solution faster than the baseline. Moreover,the circuit generated by method 1 has a more stable andreliable performance and is not sensitive to different initial
parameters.

(a) Ideal circuit(b) Circuit from SA-DQAS

Figure 10: Evaluation of newly found architectures on the simulator without noise. The results are averaged over 10 trials with thedifferent initial parameters.

In this part, we compare the structural and performing differences between the circuits generated with SA-DQAS
and DQAS and the performances in solving different Maxcut problems in the benchmark. When we look into theresults shown in Figures 9a and 9e, we can know that circuits generated by SA-DQAS, no matter which method
is used, these circuits outperform those created without
self-attention. And circuits in Figures 9c, indicating thesecircuits don’t perform stably. Circuits created by DQAS,
shown in other figures, perform better than those designedwith SA-DQAS. However, if we look into their circuit architectures, the data are given in Table 2. CircuitR−op4−74
with method 2 contains the fewest gates, especially parameterized ones. Next, we look into the evaluation results of
the Ladder graph. Circuits derived from op3-3 by thesethree methods show similar performances, converging to theminimum energy almost simultaneously and containing asimilar number of each gate type. The circuit generated by
DQAS for the Barbell graph doesn’t contain any controlledgates. Controlled gates are essential in quantum circuits because they allow us to create interactions and entanglement
between quantum qubits, enabling various quantum computation and quantum information processing tasks. A circuit
without controlled gates is indistinguishable from a classicalcircuit. However, the hardware costs for entanglement incircuits designed by SA-DQAS are higher.

generated by the quantum gate itself to a certain extent.

D. Fidelity
In this section, we test our algorithm for error mitigationand study the fidelity between the pre-defined circuits andcircuits created by SA-DQAS. An experiment has been
done in [9] which proved that DQAS can be used for error
mitigation. We repeat this experiment but generate newcircuits with SA-DQAS. The pre-defined circuit is a threequbit QFT circuit. An x gate is added on each qubit at the
beginning for encoding. In the searching process, we set
up six placeholders in the circuit, half before the QFT partand half after it, just like the original experimental settingin [9]. The operation pool used in this experiment is Of 1
(shown in Appendix E), which only contains single-qubit
operations. A noise model assumes that there are 2% BitFlip
errors between two gates and 20% BitFlip errors when aqubit is idle. We design circuits by SA-DQAS in an ideal
environment and pick the one with the highest fidelity to theideal circuit in a noisy environment. The fidelity between
the auto-generated circuit by SA-DQAS (illustrated in 10a)and the ideal circuit is 0.66, which is a little higher than the
fidelity (0.6) between the ideal circuit and the circuit derived
from DQAS. It indicates that SA-DQAS outperforms DQAS
in error mitigation.

From these comparison results, we can know that by adding
self-attention to DQAS, a better circuit structure that keeps
the quantum features by containing entanglements can befound, and the circuit shows better stability and repeatability when solving problems and is insensitive to initial
parameters. Moreover, the number of gates in the generated
circuit is less, which saves the hardware resources needed tobuild the circuit and reduces the errors and hardware noise

We build three more noise models based on BitFlip. The first
type is designed by adding BitFlip errors with different occurrence probabilities on each qubit at the end. The second
type adds 2% BitFlip errors after each operation in the nonempty (the chosen operation is not ”E”) placeholders of thegenerated circuit and adds a 20% BitFlip to each qubit at the7

SA-DQAS: Self-attention Enhanced Differentiable Quantum Architecture Search
Table 4: A table that records the fidelity between the generated
circuit and the ideal circuit under different probabilities of BitFlip
noise when the placeholders are placed at different positions. The
circuits are automatically generated under an ideal environment(B0.0 ) and 20% BitFlip noise (B0.2 ).

*/**
Back
Back and Front
Front

B0.0
B0.2
B0.0
B0.2
B0.0
B0.2

B0.0
0.94
0.97
0.97
0.94
0.99
0.99

B0.1
0.79
0.81
0.79
0.78
0.77
0.79

B0.2
0.68
0.69
0.68
0.67
0.65
0.66

Table 5: A table that records the fidelity between the generated
circuit from operation pools with and without controlled gates andthe ideal under different environments when the placeholders arein three positions of the QFT part.

B0.3
0.57
0.57
0.57
0.57
0.54
0.55

Back
Back and Front
Front

*

The column headings of the table indicate the environments when searching for a circuit with SADQAS. The row headers indicate the environment
the generated circuits are in when calculating the
fidelity between them and the ideal circuit.
**
We search five architectures in each environmentand calculate the average fidelity under different environments.

*

Ideal
BitFlip 2
Y∗ N∗ YN
B0.0 0.91 0.94 0.66 0.68
B0.2 0.94 0.97 0.67 0.69
B0.0 0.89 0.97 0.63 0.68
B0.2 0.89 0.94 0.64 0.67
B0.0 0.99 0.99 0.65 0.65
B0.2 0.99 0.99 0.64 0.66

BitFlip 3YN
0.56 0.65
0.63 0.65
0.53 0.66
0.51 0.65
0.50 0.64
0.47 0.64

Y indicates the operation pool contains controlled gates,
and N indicates only single-qubit gates are in the operation pool.

trolled gates connect multiple qubits, and when one of them,especially the control qubit, is perturbed by an error, it affects the state of the other qubits. So, the controlled gates
suffer from noise errors with a larger margin of error, resulting in lower fidelity of the final circuit. Furthermore, more
controlled gates in a circuit can cause qubits to last longer inidle states. When a qubit is idle, it has a higher probabilityof suffering from errors called idling errors.

end of the circuit. The third one uses the same noise model
given in [9]. Now we calculate the fidelity between the ideal
circuit and generated circuits in environments where BitFlip
errors occur with different probabilities.
From Table 4 we get the results. As the probability of the occurrence of BitFlip increases, the average fidelity decreases.
When placeholders are all behind or before the QFT part,the circuits generated in a noisy environment have higher
average fidelity than those created in an ideal environment.
While the QFT part is in the middle of the circuit, the situation is precisely the opposite. Circuits are more stable andreliable when created in a noisy environment. Their structures are better and suffer less from BitFlip noise, making
them more noise-resilient. Moreover, the noise resistance ofthe generated circuit is also related to the circuit structure.

E. Settings
Experiments settings:
Table 6: Basic settings in different experiments.

Experiments #Qubits #Placeholders #Param. blocks∗
Max-cut
8
4
1
JSSP
5
4
1
Fidelity3
61*

In [9] they only use single-qubit operations in the operation
pool. Such quantum error mitigation tricks can transfer
the coherent errors to the easily handled Pauli errors [9],[18], [19]. We add controlled gates into the operation pool
form a new operation pool Of 2 (given in Appendix E). In
this way, the automatically designed parameterized blocks
in the circuit architectures can consist of entangled gates.
Together with the operation pool containing single-qubit
gates, we generate circuits from both operation pools in an
ideal environment or add 20% BitFlip on each qubit at theend of the entire circuit. The average fidelity of the searchedcircuits is calculated in an ideal environment or with BitFlip
2 and 3 The comparisons are shown in Table 5.

#Param. blocks indicate the number of parameterizedblocks used in the training process.

Operation pools:
Table 7: The types of gates in operation pools O1 -O4

Operation pool
O1
O2
O3
O4

When circuits (except the QFT part) contain controlled gates,
whether in ideal or noisy environments, the average fidelity
is lower than those that only contain single-qubit gates. Con-

Gate type
RY, RZ, H, CZ
RY, RZ, H, CNOT
RY, RZ, H, CZ, CNOT
H, U3, CU3

Benchmark graphs of Max-cut problem:
Baseline in Max-cut problem:8

SA-DQAS: Self-attention Enhanced Differentiable Quantum Architecture Search

Figure 11: Benchmark graphs used for Max-cut problem.

Figure 12: Baseline used for Max-cut problem.

Operation pools used for study the fidelity:
Of 1 = {X : [0], X : [1], X : [2],T : [0], T : [1], T : [2], ,E : [0, 1, 2]
Of 2 = {X : [0], X : [1], X : [2],T : [0], T : [1], T : [2],CNOT : [0], CNOT : [1], CNOT : [2], CNOT : [0, 1, 2],
CZ : [0], CZ : [1], CZ : [2], CZ : [0, 1, 2],, E : [0, 1, 2, 3, 4]}(15)9