Executing Sycamore Circuits
Google’s research paper [1] [9], “Quantum supremacy using a programmable superconducting processor” claimes that Google’s Sycamore quantum computer with 53 qubits, took 200 seconds to sample one instance of the quantum circuit a million times, while the equivalent task for a state-of-the-art classical supercomputer would take approximately 10,000 years.
Sampling the quantum circuit’s output produces a set of bitstrings {\(x_i\)}, for example {\(0000101, 1011100, …\)}. Linear cross-entropy benchmarking fidelity, which is the mean of the simulated probabilities of the bitstrings is measured using the following formula:
where \(n\) is the number of qubits, \(P(x_i)\) is the probability of bitstring \(x_i\) computed for the ideal quantum circuit, and the average is over the observed bitstrings.
\(\mathscr{F}_{XEB}\) is correlated with how often high-probability bitstrings are sampled. When there are no errors in the quantum circuit, the distribution of probabilities is exponential, and sampling from this distribution will produce \(\mathscr{F}_{XEB} = 1\). On the other hand, sampling from the uniform distribution will give \(\left\langle P(x_i) \right\rangle_i = =1/2^n\) and produce \(\mathscr{F}_{XEB} = 0\). Values of \(\mathscr{F}_{XEB}\) between \(0\) and \(1\) correspond to the probability that no error has occurred while running the circuit. The probabilities \(P(x_i)\) must be obtained from classically simulating the quantum circuit, and thus computing \(\mathscr{F}_{XEB}\) is intractable in the regime of quantum supremacy.
The Google’s experiment uses a quantum computer with \(n\) superconducting qubits, that performs \(m\) rounds of computation using 1-qubit and 2-qubit gates. At the end of the computation the qubits are measured, leading to a string of zeroes and ones of length \(n\).
Executing Sycamore Circuits
The datasets [20] generated and analysed for the superemacy experiments are available at Google’s public Dryad repository [1]. From the repository, the Sycamore Random Quantum Circuits (RQCs) can be identified using the following parameters:
n: number of qubits (12, 14, … 38, 39, … 51, 53),
m: number of cycles (12, 14, 16, 18, 20),
s: PRNG seed number (0, 1, …, 23),
e: number of elided gates (0, 1, …, 35),
p: sequence of coupler activation patterns (EFGH, ABCDCDAB).
There are three variants of RQCs:
- ‘patch circuits’, remove a slice of two-qubit gates (a small fraction of the total number of two-qubit gates),
splitting the circuit into two spatially isolated, non-interacting patches of qubits. The total fidelity is the product of the patch fidelities, each of which can be easily calculated.
- ‘elided circuits’, remove only a fraction of the initial two-qubit gates along the slice, allowing for entanglement between patches,
which more closely mimics the full experiment while still maintaining simulation feasibility.
The full ‘verification circuits’, with the same gate counts as the supremacy circuits, but with a different pattern for the sequence of two-qubit gates, which is much easier to simulate classically.
Files corresponding to patch and elided circuits are differentiated by the presence or absence of the word “patch” in the file name. Circuits simulated by Forschungszentrum Jülich have s=20,21,22,23.
Sycamore circuits can be downloaded from the Dryard repository and executed using the following code fragments.
Note
Be sure to use your API token and your account name. Sycamore circuits are quite complex and may take an extended amount of time to execute. You can turn off the reporting from the job_monitor by setting quiet=True.
Step 1. Import the required modules and obtain the backend
import QuantumRingsLib
from QuantumRingsLib import QuantumRegister, AncillaRegister, ClassicalRegister, QuantumCircuit
from QuantumRingsLib import QuantumRingsProvider
from QuantumRingsLib import job_monitor
from QuantumRingsLib import JobStatus
from QuantumRingsLib import qasm2
from QuantumRingsLib import OptimizeQuantumCircuit
from matplotlib import pyplot as plt
import numpy as np
import math
provider = QuantumRingsProvider(token =<YOUR_TOKEN_HERE>, name=<YOUR_ACCOUNT_NAME_HERE>)
backend = provider.get_backend("scarlet_quantum_rings")
print(provider.active_account())
Step 2. Import the qasm2 file corresponding to the required Sycamore Circuit
qc = QuantumCircuit.from_qasm_file("C:\\Sycamore\\circuit_n12_m14_s0_e0_pEFGH.qasm")
qc.measure_all()
Step 3. Execute the circuit
OptimizeQuantumCircuit(qc)
job = backend.run(qc, shots=100, mode="async", quiet=True, defaults=False)
job_monitor(job, quiet=True)
result = job.result()
counts = result.get_counts()
print(counts)
A possible outcome when this circuit is executed is as follows:
{'101001101111': 1}
Note
The execution engine only stores the measurement data for the first 10,000 execution cycles in the results data structure. If the circuit needs to be executed for extended cycles, a file name can be provided for logging the measurement data. Also, the execution performance can be set to a specific mode that may be required. Amplitudes can be generated as part of the measurements and printed along with the measurements in the log file. For example,
number_of_executions = 10000
OptimizeQuantumCircuit(qc)
start_time = time.time_ns() / (10 ** 9)
job = backend.run(qc, shots=number_of_executions, mode="async", quiet=False, performance="highestefficiency", defaults=False, generate_amplitude = True, file="C:\\Sycamore\\meas.txt")
job_monitor(job, quiet=True)
end_time = time.time_ns() / (10 ** 9)
result = job.result()
counts = result.get_counts()
print(counts)
print("Start time:", start_time, "End time:", end_time)
print("Time taken", end_time-start_time)
Footnotes