Compiler Techniques to Fight Bias and Correlated Errors on NISQ Hardware Compiler Program Transformation Classical Program Transformation Program Transformation P P Caveat P P are semantically equivalent programs ID: 791074
Download The PPT/PDF document "Swamit Tannu APQC 2019 Estes Park, Colo..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Slide1
Swamit Tannu APQC 2019Estes Park, Colorado
Compiler Techniques to Fight Bias and Correlated Errors on NISQ Hardware
Slide2Compiler: Program Transformation
Slide3Classical Program Transformation
Program Transformation
P
P’
Caveat:
P , P’ are semantically equivalent programs
have access to identical instruction set
time to execute P > time to execute P’ (lower is better)
P is any classical program
Slide4Error Rates on Existing Quantum Computers
Can we
design program transformations
to improve resilience?
Caveat:
Semantically equivalent programs
have access to identical instruction set
Program Transformation
Q
Q’
Slide5“NISQ” Programming Model
5
Probability of Successful T
rial
(PST) is a key metric
Input Program
(Like Bernstein-
Vazirani
)
Compile
Execute
Repeat for N Trials
q-executable
Output String
Output String
Execute
Error free outcome
Erroneous outcome
Due to probabilistic measurements and qubit errors, program is executed multiple times.
For every execution trial the output is logged
N Trials
PST = 0.3
Slide6Inferring Correct Answer with NISQ Model
Quantum
Computer
Input Program
30%
20%
20%
10%
15%
5%
Output Strings
S1
S2
S3
S4
S5
S6
Inference: Pick output with highest frequency of occurrence
Frequency
Slide7OUTLINE
Background
Variability-Aware Qubit Allocation
[
ASPLOS-2019]
Ensemble of Diverse Mappings: Spreading Correlated Errors
[
MICRO-2019]
Flip and Measure: Diversifying Measurement Risk
[MICRO-2019]
Slide8Circuit Representation
of program
Qubit Allocation Problem
8
Compute Pairwise Distance Table assuming Uniform SWAP cost
Partition the program into layers
Find SWAPs to minimize the A-Star
cnot
A,B
cnot
C,D
cnot
A,C
cnot
A,D
A
B
C
D
cnot
B
D
C
A
Program Variable DAG
Map program on the physical qubits
Input Program
Program to Devices Map
(P2D ) Map
1
2
5
6
Physical Qubit Connectivity
3
4
Slide9The Problem of Limited Connectivity9
A
B
C
CNOT A,B
CNOT A,B
SWAP B,C
Compiler insert SWAPs
SWAPs are extra instructions which can also fail
Q1
Q2
Q5
Q6
Q3
Q4
Not Possible no link between
A and B
link between
A and B,
CNOT
can be performed
SWAP facilitate data movement
Slide10NISQ Compiler Policies10
A
1
2
5
6
3
4
B
SWAPs = 4
A
1
2
5
6
3
4
B
SWAPs = 2
[1]
Zulehner
+, (DATE’18)
[2]
Siraichi
+, (CGO’18)
[3] Li+, (ASPLOS’19)
Compiler responsible for qubit allocation and movement
Qubit movement policy minimizing SWAPs
Existing compiler policies solely focus on minimizing SWAPs
Slide11CNOT Errors on IBMQ-2011
Two
qubit error rate is high and show significant variability
90
th
Percentile: Link Error 10%
Average error rate 4%
Note: data collected in Feb-April 2018
from IBMQ20 (IBM Tokyo) reports
Slide12Not All Qubits Are Created Equal12
Q1
Q2
Q5
Q6
Q3
Q4
Q1
Q2
Q6
Q6
Q3
Q4
Variability:
Some qubits and links fail with higher probability than others
Avoiding certain links can improve reliability significantly
Worst SWAP 40% Chance of Failure
Best SWAP
6% probability of Failure
Goal: Exploit variation in error rates to improve reliability
(assign more operations on reliable qubits/links)
Tannu et. al, “Not All Qubits are Created Equal” (ASPLOS - 2019)
Slide13Variation in Two Qubit Gate Errors13
Some links are consistently more error prone than others
Average link error rate for 76 links in
IBM-Tokyo
machine
Link Error Rate > 7%
3% < Link Error Rate < 7%
Link Error Rate < 3%
Worst link:
15%
cnot
error
Best Link:
2%
cnot
error
Slide141
2
5
6
3
4
Variation-aware Qubit Movement (VQM)
14
A
B
0.9
0.95
0.95
0.9
0.95
0.8
0.95
cnot
A, B
Chose a sequence of swaps
that maximizes the reliability
Movement Path
Probability of Success
1-6-5
40%
1-2-3
50%
1-2-5
60%
Slide15Variation Aware Qubit Allocation (VQA)15
cnot
A,B
cnot
B,C
cnot
C,D
1
2
5
6
B
A
C
D
0.9
0.8
0.95
0.85
3
4
0.9
0.95
0.95
PST = 0.61
Choose qubits that maximizes the reliability
2
5
B
A
C
D
1
6
0.9
0.8
0.95
0.85
3
4
0.9
0.95
0.95
PST =
0.77
SWAPs = 0
SWAPs = 0
Slide16Variation-Aware Policy16
Input Program
Variation-aware
Compiler
Connectivity Map
Variation-aware Qubit Allocation (VQA)
Variation-aware Qubit Movement (VQM)
Noise Characteristics
We propose variation-aware policy , to generate initial assignment and operation schedule that maximize the reliability, not just SWAP count
Slide17Evaluations on ibmqx4 17
Relative PST
Variation unaware baseline
On IBM-Q5, VQA+VQM improves the reliability up
to 1.9x
90%
BV3 – Bernstein
Vazirani
with 3 bits
BV4 -- Bernstein
Vazirani
with 3 bits
Tri-SWAP – 3 SWAPs
Slide18Variability-aware Compilation for NISQNot All Qubits Are Created Equal by Tannu et. al (2018) [Georgia Tech] Noise-adaptive compiler mappings by Murli et. al (2019) [Princeton]
Extracting Success from IBM's 20-Qubit Machines by Nishio et. al (2019) [Keio]
Near-optimal routing of noisy quantum states by Sadlier et. al. (2019) [Oak Ridge]
Quantum Circuit Compilation by
Venturelli
et. al (2019) [NASA]
QURE: Qubit Re-allocation in NISQ by Ash- Saki et. al (2019) [Penn State]
And many more …….
IBM
QISkit
now offers Variability Aware Mapping
Slide19Variability-aware Compilation for NISQ
Input Program
Variation-aware
Compiler
Connectivity Map
One Best Mapping
Noise Characteristics
Should we use one best mapping for all
our trials
?
Slide20OUTLINE
Background
Variability-Aware Qubit Allocation
Ensemble of Diverse Mappings: Spreading Errors
Flip and Measure: Diversifying Measurements to Fight Bias
Slide21NISQ with Correlated Errors
21
High Probability of Successful T
rial
(PST) doesn’t guarantee correct inference
Error free outcome
Erroneous outcome
Input Program
Compile
Execute
Repeat for N Trials
q-executable
Output Log
10%
30%
30%
15%
15%
Expectation
Reality
Slide22Figure of Merit: Inference Strength (IST)
IST captures quality of inference. IST > 1 ensures correct answer is strongest
IST
=
A
B
C
D
35%
10%
5%
40%
IST
=
= 0.87
A
B
C
D
30%
25%
20%
25%
IST
=
= 1.25
Goal
Goal: Develop software transformation for NISQ
programs to reduce the impact of hardware errors
Software can significantly affect the ability to infer the right answer on NISQ
Slide24One Mapping For All Trials
Prior work searches for best qubit mapping and uses it for all N trials
Slide25Running Bernstein Vazirani (BV) on IBMQ-14
BV-6 Bernstein Vazirani Algorithm with 6-bit Key
Experiment with 8192 shots
Batch
Slide26Impact of Running Identical Program for All Trials
Running a program with identical mapping produces similar output distributions
KL-Divergence
Similarity between Probability Distributions
KL(Batch-1,
Batch-8
) = 0.035
Slide27Can We Suppress Incorrect Answers with Diversity?
Slide28Running Program with Diverse Mappings on IBMQ
Diversity in qubit mapping produces dissimilar output distributions
Slide29Ensemble of Diverse Mapping: Design
Sub-graph
Search
Q
Assembler
M 1
M 2
M 3
M 4
MAP
best
Variation Aware
Qubit Mapper
Execute on NISQ
E 1
E 2
E 3
E 4
O 1
O 2
O 3
O 4
Merge
PDFs
Qubit Mappings
Quantum Executables
Output PDF
Slide30Ensemble of Diverse Mappings
With diverse set of mappings we can orchestrate dissimilar mistakes
EDM creates four copies of the program using mappings A, B, C, and D
Slide31Evaluations on IBM-Q14 system
For current quantum kernels, EDM improves the IST by up to 1.5x
Slide32OUTLINE
Background
Variability-Aware Qubit Allocation
Ensemble of Diverse Mappings: Spreading Correlated Errors
Flip and Measure: Diversifying Measurement Risk
Slide33Data Dependent Bias in Measurement
Qubit Measurement
(N trials)
16%
84%
Probability
Correct Answer
Incorrect Answers
Qubit Measurement
(N trials)
38%
62%
Probability
Correct Answer
Incorrect Answers
On IBM-Q5, measurement errors have directional bias
Slide34Measurement Bias on IBMQ-14
Measurement Strength
Hamming weight of basis state
Measurement Strength is negatively corelated to Hamming weight of data
1.0
0.9
0.8
0.7
0.6
0.5
0.4
0
2
4
6
8
10
Slide35Measurement Bias for GHZ-5 State
GHZ-5 state
Slide36Insight – Leveraging Measurement Bias36
Not all states are created equal:
Some basis states are more vulnerable to measurement errors than others
Avoiding such weak states can improve reliability significantly
Goal: Exploit state-dependent bias in measurement error to improve reliability (transform weak states to strong states)
Slide37Invert and Measure on ibmqx4
38%
62%
Probability
Correct Answer
Incorrect Answers
Inverting a weak state (11..1) to produce strong state (00..0)
Qubit Measurement
(N trials)
22%
78%
Probability
Correct Answer
Incorrect Answers
Qubit Measurement
(N trials)
5
X gate
Slide38Invert and Measure: Design
Create two copies of program: one with inverted measurement and other with standard measurement
Slide39Invert and Measure on IBMQ
Invert and Measure
Baseline
Slide40Summary
Correlation in qubit errors and bias in measurements degrade the inference strength (ability to infer right answer) on NISQ machines
Executing Identical program that uses single best mapping for all trials produces correlated errors
Proposed Ensemble of Diverse Mapping (EDM) and Flip and Measure (FNM), creates multiple copies of the program to mitigate correlated errors and bias
Slide41Transformation: The Key to Computation41Problem
Algorithms
Language/Compilers
Architecture
Devices/Technology
Integrated Circuits
Electrons
Problem
(Conv. Hard, Quantum Easy)
Algorithms
Q-Software
Hardware Architecture
Qubit Devices
Characterization(QCVV)
Photons/Ions/Electrons
Slide42Thank you
Moin Qureshi
Professor,
moin@gatech.edu
Swamit Tannu
Ph.D. Candidate
swamit@gatech.edu
Slide43Backup Slides -- ASPLOS
Slide44Circuit Representation
of program
Implementation Example
44
Compute Pairwise Distance Table assuming Uniform SWAP cost
Partition the program into layers
Find SWAPs to minimize the A-Star
cnot
A,B
cnot
C,D
cnot
A,C
cnot
A,D
A
B
C
D
cnot
B
D
C
A
Logical Qubit DAG
1
2
3
4
Physical Qubit Connectivity
Map program on the physical qubits to maximize reliability
Input Program
L2P Map
Slide4545
A
B
C
D
A
B
C
D
L1
L2
L3
1
2
3
4
A
B
C
D
M1
1
2
3
4
A
B
C
D
M2
1
2
3
4
A
B
C
D
M3
Form Layers
L2P
Map for
Layer
Partition circuit in Layers (L
i
) & Find L2P Map (M
i
)
Variation-Aware Movement Design
1
2
3
4
0.95
0.9
0.8
0.9
Slide46Variation-Aware Movement Design
46
A
B
C
D
A
B
C
D
L1
L2
L3
1
2
3
4
A
B
C
D
M1
1
2
3
4
A
B
C
D
M2
1
2
3
4
A
B
C
D
M3
Form Layers
L2P
Map for
Layer
Search for set of optimal SWAPs (S
i, i+1
) to transform M
i
to M
i+1
?
S12
S12
?
S23
S23
Input Circuit
1
2
3
4
0.95
0.9
0.8
0.9
Slide4747
Find set of least number of SWAPs (S
i,i+1
) to transform M
i
into M
i+1
using A-star search
Variability-aware movement actively avoid unreliable links
A
B
C
D
L1
L2
L3
1
2
3
4
A
B
C
D
M1
1
2
3
4
A
B
C
D
M2
1
2
3
4
A
B
C
D
M3
?
S12
?
S23
D
A
B
C
D
A
B
C
1
2
3
4
A
B
C
D
Initial L2P Mapping
Final Schedule with SWAP (VQM)
SWAP = 1
0.95
0.9
0.8
0.9
PST: 0.65
PST: 0.55
Final Schedule with SWAP (baseline)
Variation-Aware Movement Design
Slide48VQA Design: Balancing Reliability and Connectivity
48
Find strongest subgraph (
SG
k
) by pruning the weak qubits
Strongest subgraph with
degree >
3
Map program qubits with high activity on strong qubits (nodes)
Slide49Backup Slides -- EDM
Slide50ESP vs PST50
Slide51ESP vs PST51
ge
gate error
m
e
Measurement error
Slide52Benchmarks52
Slide53Weighted EDM53
Slide54Backup Slides – Measurement Bias
Slide55Arbitrary Bias on ibmqx4
Slide56Adaptive Flip and Measure
Slide57Evaluations: Bernstein Vazirani on ibmqx4