Table of Contents
Fetching ...

PyMatching: A Python package for decoding quantum codes with minimum-weight perfect matching

Oscar Higgott

TL;DR

PyMatching delivers a fast, open-source MWPM-based decoder for quantum error correction, introducing a local matching variant that dramatically reduces computational complexity while preserving near-optimal decoding performance. Implemented in C++ with a Python interface, it supports weighted edges, boundaries, and measurement errors, and is applicable to any code compatible with MWPM decoding. Benchmark results show orders-of-magnitude speedups over standard MWPM implementations and competitive decoding thresholds, enabling efficient fault-tolerance simulations. The work provides a flexible, code-agnostic tool that should be valuable for researchers benchmarking decoders and simulating large-scale quantum error correction.

Abstract

This paper introduces PyMatching, a fast open-source Python package for decoding quantum error-correcting codes with the minimum-weight perfect matching (MWPM) algorithm. PyMatching includes the standard MWPM decoder as well as a variant, which we call local matching, that restricts each syndrome defect to be matched to another defect within a local neighbourhood. The decoding performance of local matching is almost identical to that of the standard MWPM decoder in practice, while reducing the computational complexity approximately quadratically. We benchmark the performance of PyMatching, showing that local matching is several orders of magnitude faster than implementations of the full MWPM algorithm using NetworkX or Blossom V for problem sizes typically considered in error correction simulations. PyMatching and its dependencies are open-source, and it can be used to decode any quantum code for which syndrome defects come in pairs using a simple Python interface. PyMatching supports the use of weighted edges, hook errors, boundaries and measurement errors, enabling fast decoding and simulation of fault-tolerant quantum computing.

PyMatching: A Python package for decoding quantum codes with minimum-weight perfect matching

TL;DR

PyMatching delivers a fast, open-source MWPM-based decoder for quantum error correction, introducing a local matching variant that dramatically reduces computational complexity while preserving near-optimal decoding performance. Implemented in C++ with a Python interface, it supports weighted edges, boundaries, and measurement errors, and is applicable to any code compatible with MWPM decoding. Benchmark results show orders-of-magnitude speedups over standard MWPM implementations and competitive decoding thresholds, enabling efficient fault-tolerance simulations. The work provides a flexible, code-agnostic tool that should be valuable for researchers benchmarking decoders and simulating large-scale quantum error correction.

Abstract

This paper introduces PyMatching, a fast open-source Python package for decoding quantum error-correcting codes with the minimum-weight perfect matching (MWPM) algorithm. PyMatching includes the standard MWPM decoder as well as a variant, which we call local matching, that restricts each syndrome defect to be matched to another defect within a local neighbourhood. The decoding performance of local matching is almost identical to that of the standard MWPM decoder in practice, while reducing the computational complexity approximately quadratically. We benchmark the performance of PyMatching, showing that local matching is several orders of magnitude faster than implementations of the full MWPM algorithm using NetworkX or Blossom V for problem sizes typically considered in error correction simulations. PyMatching and its dependencies are open-source, and it can be used to decode any quantum code for which syndrome defects come in pairs using a simple Python interface. PyMatching supports the use of weighted edges, hook errors, boundaries and measurement errors, enabling fast decoding and simulation of fault-tolerant quantum computing.

Paper Structure

This paper contains 10 sections, 2 equations, 7 figures, 1 algorithm.

Figures (7)

  • Figure 1: Stages of the minimum-weight perfect matching decoder for a distance 10 surface code.
  • Figure 2: The syndrome graph for the syndrome in \ref{['fig:mwpm_decoder']} using the local matching decoder with $m=5$.
  • Figure 3: Threshold of the local matching decoder as a function of $m$ for the 2D toric code, determined using lattice sizes $L=24,28,32,36$ and the critical exponent method of Ref. wang2003confinement. In (a) an independent noise model is used with perfect syndrome measurements, and the dashed lines show the $1\sigma$ lower and upper bounds on the threshold using full (exact) matching. In (b), a phenomenological noise model is used, for which both syndrome measurement and single qubit $Z$ errors occur with the same probability $p$. Syndrome measurements are repeated $L$ times, and decoding takes place over a 3D (2D + time) matching graph.
  • Figure 4: Logical error rate as a function of the number of neighbours $m$ used in the local matching decoder for the 2D toric code. (a) An $L=60$ toric code with $p=0.1$ and perfect syndrome measurements (2D matching graph). (b) An $L=20$ toric code with $p=0.029$ and noisy syndrome measurements (phenomenological noise model), with $L$ syndrome repeats (3D matching graph).
  • Figure 5: Approximation error of the local matching decoder as a function of the number of neighbours $m$ for a $L=20$ toric code. The approximation error is defined as the fraction of runs for which the weight of the local matching differs from exact matching. Plots labelled 2D assume perfect syndrome measurements, whereas those labelled 3D assume $L=20$ rounds of noisy syndrome measurements (phenomenological noise model).
  • ...and 2 more figures