Skip to main content
QUICK REVIEW

[Paper Review] PyMatching: A Python package for decoding quantum codes with minimum-weight perfect matching

Oscar Higgott|arXiv (Cornell University)|May 27, 2021
Quantum Computing Algorithms and ArchitectureComputer Science12 citations
TL;DR

PyMatching is a fast, open-source Python package for decoding quantum error-correcting codes using minimum-weight perfect matching (MWPM), featuring a novel local matching variant that reduces computational complexity by approximately quadratically while maintaining near-identical decoding performance to exact MWPM. It enables efficient simulation of fault-tolerant quantum computing with support for weighted edges, hook errors, measurement noise, and boundaries via a simple Python interface.

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.

Motivation & Objective

  • To develop a high-performance, general-purpose decoder for quantum error-correcting codes using minimum-weight perfect matching (MWPM).
  • To reduce the computational complexity of MWPM decoding without sacrificing decoding performance.
  • To provide a flexible, open-source Python package that supports diverse noise models and code structures beyond specific codes like toric or surface codes.
  • To enable efficient simulation of circuit-level noise and fault-tolerant quantum computing workflows.
  • To offer a user-friendly interface that supports weighted edges, hook errors, boundaries, and repeated syndrome measurements.

Proposed method

  • Implement the standard MWPM decoder using the Blossom V algorithm via C++-based optimizations, exposed through a Python interface.
  • Introduce 'local matching', a variant that restricts each syndrome defect to be matched only to its nearest neighbors within a local neighborhood.
  • Use Dijkstra’s algorithm for shortest path computation in the matching graph, with configurable neighborhood size via the `num_neighbours` parameter.
  • Support weighted edges by assigning log-likelihood weights to edges based on error probabilities, enabling stochastic noise modeling.
  • Allow construction of the matching graph directly from NetworkX graphs to model complex error structures like hook errors and boundary nodes.
  • Enable simulation of repeated syndrome measurements and boundary nodes by allowing odd-parity syndromes to be corrected via boundary edge matching with zero weight.

Experimental results

Research questions

  • RQ1Can a local matching variant of MWPM achieve near-identical decoding performance to exact MWPM while significantly reducing computational cost?
  • RQ2How does the performance of PyMatching compare to existing MWPM implementations such as those using NetworkX or Blossom V in terms of speed and memory usage?
  • RQ3To what extent can PyMatching handle complex noise models, including weighted edges, hook errors, and measurement errors, in a unified and efficient framework?
  • RQ4Can PyMatching be used as a general-purpose tool for decoding any quantum code amenable to MWPM, regardless of code structure or noise model?
  • RQ5What is the impact of varying the neighborhood size in local matching on decoding performance and computational complexity?

Key findings

  • Local matching in PyMatching reduces computational complexity by approximately quadratically compared to exact MWPM, while maintaining decoding performance nearly identical to the full MWPM algorithm.
  • PyMatching's local matching implementation is several orders of magnitude faster than implementations using NetworkX or Blossom V for large-scale matching graphs commonly used in error correction simulations.
  • The package supports weighted edges, hook errors (where a single edge corresponds to multiple qubit errors), and boundary nodes, enabling accurate modeling of circuit-level noise and measurement errors.
  • PyMatching can simulate stochastic noise models by assigning error probabilities to edges and using the `add_noise()` method to generate syndrome outcomes.
  • The use of boundary nodes allows correction of syndromes with odd parity by flipping one boundary node, ensuring a perfect matching always exists.
  • PyMatching is distributed under the Apache 2.0 license, with open-source code and comprehensive documentation available on GitHub and Read the Docs.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.