Skip to main content
The engine needs to know how noisy the underlying hardware is. A logical noise model holds the simulated logical error rates of the fundamental operations (Clifford gates and T gate) as a function of code distance. If a ready-made model is enough, pick one from Publicly Available Noise Models — no simulation to run yourself. This page covers the other route: describing your own hardware as a PhysicalNoiseModel and simulating it.

Describe the physical noise

A PhysicalNoiseModel is a set of per-operation noise rules. Each field takes a list of rules that compose, except measure, which maps a measurement basis to a flip probability. Only reset gates (R, RX) and recognized 1- and 2-qubit Clifford gates may appear in gates; any other gate name is rejected. Supplying two rules of the same kind to one field is also rejected, so idle=[DepolarizeRule(p=1e-4), DepolarizeRule(p=2e-4)] is an error rather than a composition.

Noise rules

DepolarizeRule(p=...) applies a uniformly random Pauli error with total probability p; with probability 1 - p nothing happens. On a 1-qubit operation each of X, Y and Z is applied with probability p / 3; on a 2-qubit operation each of the 15 non-identity two-qubit Paulis is applied with probability p / 15. PauliRule(pauli=..., p=...) applies one specific Pauli error — "X", "Y" or "Z" — with probability p. This is the natural way to express a biased error, such as a reset to |0⟩ that occasionally leaves the qubit in |1⟩:

A complete model

Composing those rules into a single model, scaled by one parameter p. This is the model public/depolarize_1e-3 was generated from, with p = 1e-3:

Initialize the model

Call initialize_logical_noise to simulate the resulting logical error rates and store them under a name you choose.
initialize_logical_noise runs a logical-noise simulation on the backend and is a long-running operation. You only need to run it once per noise model — afterwards, retrieve the stored result with get_logical_noise.
Once retrieved, you can inspect and plot the fitted logical error rates — for example, the 1-qubit Clifford curves as a function of code distance:
Logical errors of a 1-qubit Clifford by code distance

Logical X and Z error of a 1-qubit Clifford, exponentially suppressed as the code distance grows.

Each curve is a log-linear fit 10 ** (a * cd + b); the legend reports the suppression factor Λ (the improvement per two units of code distance). LogicalNoise also provides plot_cnot() and plot_s(), and get_clifford_logical_error, get_cnot_logical_error and get_s_logical_error to read a single rate at a given code distance.

Remove a logical noise model

When you no longer need a model you created, delete it with remove_logical_noise. Public models (those whose name begins with public/) are shared and cannot be removed this way.
Next, route a program onto the lattice.