To leverage the full potential of quantum error-correcting stabilizer codes
it is crucial to have an efficient and accurate decoder. Accurate, maximum
likelihood, decoders are computationally very expensive whereas decoders based
on more efficient algorithms give sub-optimal performance. In addition, the
accuracy will depend on the quality of models and estimates of error rates for
idling qubits, gates, measurements, and resets, and will typically assume
symmetric error channels. In this work, instead, we explore a model-free,
data-driven, approach to decoding, using a graph neural network (GNN). The
decoding problem is formulated as a graph classification task in which a set of
stabilizer measurements is mapped to an annotated detector graph for which the
neural network predicts the most likely logical error class. We show that the
GNN-based decoder can outperform a matching decoder for circuit level noise on
the surface code given only simulated experimental data, even if the matching
decoder is given full information of the underlying error model. Although
training is computationally demanding, inference is fast and scales
approximately linearly with the space-time volume of the code. We also find
that we can use large, but more limited, datasets of real experimental data
[Google Quantum AI, Nature {\bf 614}, 676 (2023)] for the repetition code,
giving decoding accuracies that are on par with minimum weight perfect
matching. The results show that a purely data-driven approach to decoding may
be a viable future option for practical quantum error correction, which is
competitive in terms of speed, accuracy, and versatility.Comment: 15 pages, 12 figure