Skip to content

Noise Model Theory ​

Theoretical foundations of quantum noise modeling, including CPTP maps, Kraus representations, quantum error channels, and practical noise considerations for NISQ devices. This guide connects the mathematical formalism to pyqpanda3's noise simulation capabilities.


The Need for Noise Modeling ​

Real quantum computers operate in noisy environments. Unlike classical bits, qubits are fragile quantum systems that lose their quantum properties through interactions with the environment. Noise modeling is essential for:

  1. Accurate simulation: Predicting real hardware behavior before running experiments
  2. Error mitigation: Designing strategies to reduce the impact of noise
  3. Error correction: Understanding the noise to build appropriate quantum error-correcting codes
  4. Benchmarking: Comparing hardware performance against theoretical noise models

In pyqpanda3, the NoiseModel class and associated error channels provide a comprehensive framework for noisy simulation.


Quantum Operations as Maps ​

Density Matrix Formalism ​

Before discussing noise, we need the density matrix formalism for describing quantum states:

Pure state: A state that can be written as a ket |ψ⟩. Its density matrix is:

ρ=|ψ⟩⟨ψ|

Mixed state: A statistical mixture of pure states {pi,|ψi⟩}:

ρ=∑ipi|ψi⟩⟨ψi|

where pi≥0 and ∑ipi=1.

Properties of a valid density matrix:

  • Hermitian: ρ=ρ†
  • Positive semi-definite: ρ≥0 (all eigenvalues ≥0)
  • Unit trace: Tr(ρ)=1

Pure vs. Mixed States ​

A state is pure if and only if Tr(ρ2)=1, and mixed if Tr(ρ2)<1. The purity γ=Tr(ρ2) quantifies how "pure" a state is:

  • γ=1: pure state
  • 1/d<γ<1: mixed state (d is the Hilbert space dimension)
  • γ=1/d: maximally mixed state ρ=I/d

pyqpanda3's DensityMatrix class provides the purity() method for this calculation.


Completely Positive Trace-Preserving (CPTP) Maps ​

Definition ​

A quantum channel (noise model) is mathematically described by a Completely Positive Trace-Preserving (CPTP) map E that transforms input density matrices to output density matrices:

E:ρin↦ρout

The two requirements are:

Complete Positivity (CP): For any auxiliary system of any dimension dA, the extended map (E⊗IdA) maps positive operators to positive operators:

ρ≥0⟹(E⊗I)(ρ)≥0∀ extensions

Complete positivity is stronger than mere positivity — a map that is positive but not completely positive can produce unphysical results when applied to a subsystem of an entangled state.

Trace Preservation (TP): The trace of the density matrix is preserved:

Tr(E(ρ))=Tr(ρ)=1

This ensures total probability is conserved.

Why CPTP? ​

CPTP maps are the correct mathematical framework for quantum noise because:

  1. Physicality: CPTP maps are exactly the set of transformations that can occur in nature (by Stinespring's dilation theorem, any CPTP map can be realized by unitary evolution on a larger system)
  2. Composability: The composition of two CPTP maps is also CPTP — noise models can be chained
  3. Convexity: A probabilistic mixture of CPTP maps is CPTP — different noise sources combine correctly

Stinespring Dilation ​

Every CPTP map E on a system HS can be realized as a unitary evolution on a larger system:

E(ρ)=TrE[USE(ρ⊗|e0⟩⟨e0|)USE†]

where USE is a unitary on the joint system-environment Hilbert space HS⊗HE, |e0⟩ is a fixed environment state, and TrE is the partial trace over the environment.

This means all physical noise can be understood as unitary evolution with an unobserved environment — the randomness comes from tracing out (ignoring) the environment degrees of freedom.

mermaid
graph LR
    subgraph "Stinespring Dilation"
        S["System ρ"] --> US["U_SE"]
        E["Environment |e₀⟩"] --> US
        US --> SE["System ⊗ Environment"]
        SE --> TrE["Tr_E (trace out)"]
        TrE --> Out["ρ_out = ℰ(ρ)"]
    end

    style S fill:#e3f2fd,stroke:#1565c0
    style E fill:#fff3e0,stroke:#e65100
    style Out fill:#c8e6c9,stroke:#2e7d32

Kraus Representation ​

Operator-Sum Representation ​

The most intuitive representation of a CPTP map is the Kraus (operator-sum) representation:

E(ρ)=∑iKiρKi†

where the Kraus operators {Ki} satisfy the completeness relation:

∑iKi†Ki=I

This condition ensures trace preservation:

Tr(E(ρ))=Tr(∑iKiρKi†)=Tr(ρ∑iKi†Ki)=Tr(ρ)=1

Properties of Kraus Representations ​

  1. Non-uniqueness: The same channel can have different Kraus representations related by unitary mixing: Ki′=∑juijKj where U=(uij) is unitary.

  2. Minimum number: The minimum number of Kraus operators needed is the Choi rank of the channel. For a qubit channel, this is between 1 (unitary) and 4 (completely depolarizing).

  3. Single Kraus operator: If there is only one Kraus operator, the channel is unitary: E(ρ)=UρU†.

Kraus Operators for Common Channels ​

ChannelNumber of Kraus OpsKraus Operators
Unitary (U)1K0=U
Bit Flip2K0=1−pI, K1=pX
Phase Flip2K0=1−pI, K1=pZ
Depolarizing4K0=1−3p/4I, K1,2,3=p/4{X,Y,Z}
Amplitude Damping2K0=(1001−γ), K1=(0γ00)
Phase Damping2K0=(1001−λ), K1=(000λ)

pyqpanda3's Kraus class in the quantum_info module represents channels in this form. Channels can also be represented as Chi, Choi, SuperOp, or PTM, all of which are interconvertible.


Quantum Error Channels ​

Depolarizing Channel ​

The depolarizing channel is the most commonly used noise model. With probability p, the state is replaced by the maximally mixed state I/2:

Edepol(ρ)=(1−p)ρ+pI2

An equivalent form expanded in the Pauli basis is:

Edepol(ρ)=(1−3p4)ρ+p4(XρX+YρY+ZρZ)

Kraus operators (4 operators):

K0=1−3p4I,K1=p4X,K2=p4Y,K3=p4Z

Properties:

  • Symmetric: treats all three axes equally
  • Shrinks the Bloch vector uniformly: r→→(1−p)r→
  • Often used as a worst-case noise model
  • p=1 gives the completely random state I/2

Amplitude Damping Channel ​

The amplitude damping channel models energy dissipation — the decay of an excited state |1⟩ to the ground state |0⟩:

EAD(ρ)=K0ρK0†+K1ρK1†

Kraus operators:

K0=(1001−γ),K1=(0γ00)

where γ∈[0,1] is the damping probability (related to T1 relaxation time).

Action on basis states:

|0⟩⟨0|→|0⟩⟨0|(ground state unchanged)|1⟩⟨1|→(1−γ)|1⟩⟨1|+γ|0⟩⟨0|(decay to ground)

Properties:

  • Non-unital: E(I)≠I (the channel doesn't preserve the identity)
  • Drives states toward |0⟩
  • Models spontaneous emission, T1 decay
  • γ=0: identity (no damping); γ=1: complete relaxation to |0⟩

Connection to T1 time: For a gate of duration tg:

γ=1−e−tg/T1

Phase Damping (Dephasing) Channel ​

The phase damping channel models loss of phase coherence without energy loss:

EPD(ρ)=K0ρK0†+K1ρK1†

Kraus operators:

K0=(1001−λ),K1=(000λ)

where λ∈[0,1] is the dephasing probability.

Equivalent form using Pauli Z:

EPD(ρ)=(1−p2)ρ+p2ZρZ

where p=1−e−tg/Tϕ.

Properties:

  • Unital: E(I)=I
  • Preserves computational basis: diagonal elements unchanged
  • Suppresses off-diagonal elements (coherences): ρ01→1−λρ01
  • Models T2 decoherence
  • λ=0: identity; λ=1: complete dephasing (classical mixture)

Connection to T2 time:

1T2=12T1+1Tϕ

where Tϕ is the pure dephasing time.

Bit Flip Channel ​

The bit flip channel randomly applies an X gate:

EBF(ρ)=(1−p)ρ+pXρX

Kraus operators: K0=1−pI, K1=pX

Bloch sphere action: Flips the z-component with probability p: rz→(1−2p)rz, ry→(1−2p)ry, rx unchanged.

Connection: Equivalent to phase flip in the Hadamard basis: H⋅EBF⋅H=EPF.

Phase Flip Channel ​

The phase flip channel randomly applies a Z gate:

EPF(ρ)=(1−p)ρ+pZρZ

Kraus operators: K0=1−pI, K1=pZ

Bloch sphere action: rz unchanged, rx→(1−2p)rx, ry→(1−2p)ry.

Bit-Phase Flip Channel ​

The bit-phase flip channel randomly applies a Y gate (simultaneous bit and phase flip):

EBPF(ρ)=(1−p)ρ+pYρY

Kraus operators: K0=1−pI, K1=pY

Note: Y=iXZ, so this is a combined bit flip and phase flip (with an additional global phase).

Pauli Noise Channel ​

The general Pauli noise channel applies random Pauli operators with individual probabilities:

EPauli(ρ)=pIρ+pXXρX+pYYρY+pZZρZ

where pI+pX+pY+pZ=1.

This is the most general single-qubit Pauli channel and includes bit flip, phase flip, and depolarizing as special cases.

Thermal Relaxation Channel ​

The thermal relaxation channel models the combined effect of T1 (amplitude damping) and T2 (dephasing) processes over a gate duration t:

Ethermal(ρ)=E0ρE0†+E1ρE1†+E2ρE2†

where the Kraus operators depend on the relaxation times T1, T2, and the gate time t:

preset=1−e−t/T1pdephasing=1−e−t/T2

This channel is essential for realistic simulations of superconducting qubit hardware.

Summary: Error Channel Comparison ​

ChannelParameterUnital?Physical Origin
Depolarizingp∈[0,1]YesGeneric noise
Amplitude Dampingγ∈[0,1]NoT1 relaxation
Phase Dampingλ∈[0,1]YesT2 dephasing
Bit Flipp∈[0,0.5]YesX errors
Phase Flipp∈[0,0.5]YesZ errors
Bit-Phase Flipp∈[0,0.5]YesY errors
Pauli NoisepI,pX,pY,pZYesGeneral Pauli errors
Thermal RelaxationT1,T2,tNoCombined relaxation
mermaid
graph TD
    All["All Error Channels"] --> Unital["Unital Channels"]
    All --> NonUnital["Non-Unital Channels"]

    Unital --> PauliCh["Pauli Channels"]
    PauliCh --> BF["Bit Flip"]
    PauliCh --> PF["Phase Flip"]
    PauliCh --> BPF["Bit-Phase Flip"]
    PauliCh --> Depol["Depolarizing"]
    PauliCh --> General["General Pauli"]

    Unital --> PD["Phase Damping"]

    NonUnital --> AD["Amplitude Damping"]
    NonUnital --> TR["Thermal Relaxation"]
    AD --> TR

    style Unital fill:#e3f2fd,stroke:#1565c0
    style NonUnital fill:#fff3e0,stroke:#e65100

Quantum Channel Representations ​

A single quantum channel can be represented in multiple mathematically equivalent ways. pyqpanda3 supports five representations, all interconvertible:

Kraus Representation ​

E(ρ)=∑iKiρKi†

Most intuitive; directly shows the physical operations.

Superoperator (Liouville) Representation ​

The channel is represented as a d2×d2 matrix S acting on vectorized density matrices:

vec(E(ρ))=S⋅vec(ρ)

where vec(⋅) stacks matrix columns. In pyqpanda3, this is the SuperOp class.

Chi Matrix Representation ​

The channel is expanded in the Pauli basis:

E(Pj)=∑iχijPi

The χ matrix (not to be confused with the Choi matrix) is the Pauli-basis representation. In pyqpanda3, this is the Chi class.

Choi Matrix Representation ​

The Choi matrix is defined as:

J(E)=(E⊗I)(|Ω⟩⟨Ω|)

where |Ω⟩=∑i|i⟩⊗|i⟩ is the maximally entangled state. The channel is CPTP if and only if J(E)≥0 (positive semidefinite) and Tr1(J)=I (partial trace condition). In pyqpanda3, this is the Choi class.

Pauli Transfer Matrix (PTM) ​

The PTM represents the channel's action on the generalized Pauli basis:

Rij=1dTr(PiE(Pj))

where {Pi} are normalized Pauli operators. The PTM is a real matrix for Hermiticity-preserving channels. In pyqpanda3, this is the PTM class.

Conversion Between Representations ​

All five representations are interconvertible in pyqpanda3 by constructing one from another:

mermaid
graph TD
    Kraus["Kraus"]
    SuperOp["SuperOp"]
    Chi["Chi"]
    Choi["Choi"]
    PTM["PTM"]

    Kraus -->|constructor| SuperOp
    Kraus -->|constructor| Chi
    Kraus -->|constructor| Choi
    Kraus -->|constructor| PTM

    SuperOp -->|constructor| Kraus
    SuperOp -->|constructor| Chi
    SuperOp -->|constructor| Choi
    SuperOp -->|constructor| PTM

    Chi -->|constructor| Kraus
    Chi -->|constructor| SuperOp
    Chi -->|constructor| Choi
    Chi -->|constructor| PTM

    Choi -->|constructor| Kraus
    Choi -->|constructor| SuperOp
    Choi -->|constructor| Chi
    Choi -->|constructor| PTM

    PTM -->|constructor| Kraus
    PTM -->|constructor| SuperOp
    PTM -->|constructor| Chi
    PTM -->|constructor| Choi

    style Kraus fill:#e3f2fd,stroke:#1565c0
    style SuperOp fill:#c8e6c9,stroke:#2e7d32
    style Chi fill:#fff3e0,stroke:#e65100
    style Choi fill:#f3e5f5,stroke:#9c27b0
    style PTM fill:#ffebee,stroke:#c62828

Noise in NISQ Devices ​

Characteristics of NISQ Noise ​

Current Noisy Intermediate-Scale Quantum (NISQ) devices exhibit several types of noise:

1. Gate Errors: Imperfect gate implementation causes unitary errors and over/under-rotation:

  • Single-qubit gate error rate: ∼10−4 to 10−3
  • Two-qubit gate error rate: ∼10−3 to 10−2
  • Typically modeled as depolarizing or coherent rotation errors

2. Measurement Errors: Readout (SPAM — State Preparation And Measurement) errors:

  • Assignment error rate: ∼1% to 5%
  • P(read 0|state 1) and P(read 1|state 0) can be asymmetric
  • Modeled as a classical confusion matrix

3. Decoherence: Qubits lose quantum information over time:

  • T1 (relaxation time): Energy decay, typically 20μs to 200μs
  • T2 (dephasing time): Phase coherence loss, typically 10μs to 150μs
  • Gate times: ∼20ns to 200ns

4. Cross-Talk: Unwanted coupling between qubits during operations:

  • Spectral cross-talk: Simultaneous gate operations interfere
  • Always-on coupling: Residual interaction between neighboring qubits

5. Leakage: Qubit state escapes the computational subspace:

  • Population in |2⟩ or higher energy levels
  • Particularly problematic for superconducting transmon qubits

Modeling Noise with pyqpanda3 ​

pyqpanda3's NoiseModel class supports configuring noise for realistic simulations:

python
from pyqpanda3.core import CPUQVM, NoiseModel, QProg, QGate
from pyqpanda3.core import H, CNOT, measure, depolarizing_error, GateType

# Create a noise model
noise = NoiseModel()

# Add depolarizing noise to all single-qubit gates
error_1q = depolarizing_error(0.001)
noise.add_all_qubit_quantum_error(error_1q, GateType.H)

# Add depolarizing noise to all two-qubit gates
error_2q = depolarizing_error(0.01)
noise.add_all_qubit_quantum_error(error_2q, GateType.CNOT)

# Run noisy simulation
qvm = CPUQVM()
prog = QProg()
prog << H(0) << CNOT(0, 1) << measure([0, 1], [0, 1])
qvm.run(prog, shots=1000, model=noise)
result = qvm.result()

Noise-Aware Circuit Design ​

Principles for designing circuits that are robust to noise:

  1. Minimize two-qubit gates: They have the highest error rates
  2. Minimize circuit depth: Errors accumulate with each time step
  3. Use noise-aware transpilation: Map circuits to qubits with best connectivity and coherence
  4. Exploit symmetries: Design circuits where noise cancels (e.g., dynamical decoupling)

Error Mitigation Techniques ​

Error mitigation reduces the impact of noise without full error correction:

Zero-Noise Extrapolation (ZNE):

  • Run the circuit at multiple noise levels (by folding gates to amplify noise)
  • Extrapolate results to the zero-noise limit
  • Typically uses linear or exponential fitting

Probabilistic Error Cancellation (PEC):

  • Characterize the noise channel E
  • Apply the inverse channel E−1 probabilistically
  • Produces unbiased estimates at the cost of increased sampling

Measurement Error Mitigation:

  • Characterize the readout error matrix M
  • Apply M−1 to the observed probability distribution
  • Requires calibration runs for each measurement basis

Twirled Readout Error Extinction (TREX):

  • Randomly flip qubits before measurement (twirling)
  • Converts correlated readout errors into simpler diagonal form
  • Easier to invert

Mathematical Summary ​

Key Relationships ​

CPTP Map⟷Kraus Ops⟷Choi Matrix⟷SuperOp⟷PTM

Bloch Sphere Picture ​

For single-qubit channels, the CPTP map acts on the Bloch vector r→ as an affine transformation:

r→′=Mr→+t→

where M is a 3×3 real matrix and t→ is a translation vector.

Channel TypeMt→
Depolarizing (p)(1−p)I0→
Bit Flip (p)diag(1,1−2p,1−2p)0→
Amplitude Damping (γ)(1−γ0001−γ0001−γ)(0,0,γ)
Phase Damping (λ)diag(1−λ,1−λ,1)0→

Unital channels (t→=0→) preserve the maximally mixed state and only shrink/rotate the Bloch sphere. Non-unital channels (t→≠0→) also translate the Bloch sphere, driving it toward a preferred state.


See Also ​

Released under the MIT License.