Challenges
Datasets
Workspaces
Papers
Discussions
Leaderboard
Log inSign up
Challenges
Datasets
Workspaces
Papers
Discussions
Leaderboard
Blog
Job Board
Q3AS

© 2026 Aqora Quantum S.A.S.

TermsPrivacyLegal Notice

Continuous Relaxation Decoding for CSS Quantum LDPC Codes: Energy Landscape, Basin Geometry, Gradient Dynamics, and Hardware Implementation

Yannick Schmitt

Published Apr 10, 2026• 0 citations
Publisher

Abstract

This repository contains the full research for a novel approach to decoding Quantum Low-Density Parity-Check (QLDPC) codes via continuous optimization. Moving away from traditional message-passing or combinatorial algorithms, this work introduces a syndrome-agnostic energy landscape—a "squared-spring" potential where global minima correspond exactly to valid codewords. The decoder operates as a codeword projector, using gradient dynamics to navigate the continuous relaxation of the binary error space. Key Contributions The Energy Landscape: Formalization of the squared-spring Hamiltonian $H(v)$, proving that valid codewords are the only points with zero energy and zero gradient (Theorem 3.4). Basin Geometry & Convergence: Analytical derivation of the exact Hessian and gradient at valid codewords (Theorems 4.1, 4.3). The work defines three nested radii ($r_{loc}$, $r_{barrier}$, $r_{emp}$) that characterize the decoder’s convergence behavior. The Girth–Trap Hypothesis: An empirical finding that challenges existing intuition; data demonstrates that higher girth does not necessarily prevent decoder trapping, with girth-8 codes observed to trap at higher rates than girth-4 variants. Optimal λ Heuristic: Discovery of a universal scaling law $\lambda^* \approx (3/16)\bar{d}$ for the regularization parameter, verified across eight independent CSS code families. Hardware Acceleration: A high-throughput implementation leveraging PyTorch and CUDA, achieving >86,000 syndromes per second, representing a ~28,000× speedup over serial Python implementations. Contents Core Library: `continuous_relaxation_decoder.py` — A modular Python library for CSS code construction, GF(2) linear algebra, and energy-based decoding. Verification Suite: `verification_ContinuousRelaxationDecoder.py` — A self-contained script that numerically verifies every theorem and proposition in the paper to machine precision. Computational Experiments: Momentum and Langevin dynamics comparisons. Failure mode census and pseudo-codeword barrier height calculations. Causal Diamond (CD) geometry analysis and [[208, 16, 6]] distance certification. Manuscript: LaTeX source and compiled PDF of the paper. Testbed CodesThe results are benchmarked on several high-performance QLDPC codes, including: [[193, 25, 4]] D4 Causal Diamond Hypergraph Product (HGP) code. [[112, 4, (6,6)]] and [[176, 32, (3,6)]] augmented-seed codes. Various Generalised Bicycle and CSS-LDPC code families.

DOI
10.5281/zenodo.19484006

Related papers

Modular Assembly of High-Performance Logical Blocks from the Lorentzian Causal Diamond: Pareto-Optimal Finite-Block Codes, Asymmetric Distance Families, and an E₈ Structural Obstruction

Yannick Schmitt

This repository contains the complete research artifact and computational verification suite for scaling the discrete Lorentzian causal diamond into high-performance Quantum Low-Density Parity-Check (qLDPC) and finite-block codes. By systematically exploring algebraic amplification (Hypergraph Product), geometric tessellation (toric scaling), and lattice enrichment ($E_8$ Lorentzian substrates), this work identifies precise structural obstructions in existing approaches and introduces novel, Pareto-optimal CSS codes tailored for near-term hardware in the $N \sim 100\text{--}200$ physical qubit regime. Scientific Contributions The Augmented-Seed Code Family: The central discovery that a specific weight-3 row (one of 64 in two $B_4$ symmetry orbits) appended to the primal causal diamond seed raises the classical distance from 4 to 6. This breaks the intrinsic distance ceiling of the basic geometry, unlocking a family of finite-block codes that significantly outperform planar codes (e.g., surface/toric codes) at small block sizes. Methodological Warning on Sampling Blindness: Demonstration that Belief Propagation (BP)-style random sampling fails catastrophically in high-dimensional kernels. Earlier sampled bounds of $d \ge 67$ for the `[[193, 25]]` code are formally retracted; an exact Integer Linear Program (ILP) oracle is introduced, definitively proving $d = 4$. The $E_8$ Structural Obstruction (Theorem 4.5): Rigorous proof that the 28-qubit $E_8$ Lorentzian code cannot be punctured to yield a valid quantum code. Its 7-disconnected-4-cycle geometry guarantees $d_Z = 1$ after any single row drop, pointing toward the Euclidean $E_8$ root lattice as the necessary next step. Naïve CSS Lift Theorem (Theorem 5.3): Algebraic proof that setting $H_X = \ker(H_Z)$ definitionally forces $k=0$, regardless of chain or torus topology, resolving anomalies in earlier geometric scaling attempts. Highlighted Code FamiliesThe augmented geometric construction yields a frontier of codes optimized for neutral-atom and trapped-ion architectures, including: [[112, 4, (6, 6)]]: Achieves an exceptional figure of merit $kd^2/N \approx 1.29$, making it a highly efficient logical block for near-term implementation. [[176, 32, (3, 6)]: Features an asymmetric distance profile naturally aligned with the $Z$-biased noise characteristic of superconducting hardware. [[208, 16, 6]]: A self-hypergraph product code with $d=6$ proven algebraically via the Tillich–Zémor theorem. Artifact Contents Verification Suite (`verification_modular_assembly.py`): A unified, self-contained Python script using `scipy.optimize.milp` that computationally verifies every theorem, constructs all augmented seeds, performs exact distance certifications via ILP in under 100ms per operator, and reproduces the geometric obstructions. Manuscript: Complete LaTeX source files and compiled PDF of the paper.

•Apr 10, 2026•0 citations

Decoding Quasi-Cyclic Quantum LDPC Codes

Louis Golowich, Venkatesan Guruswami

Quantum low-density parity-check (qLDPC) codes are an important component in the quest for quantum fault tolerance. Dramatic recent progress on qLDPC codes has led to constructions which are asymptotically good, and which admit linear-time decoders to correct errors affecting a constant fraction of codeword qubits. These constructions, while theoretically explicit, rely on inner codes with strong properties only shown to exist by probabilistic arguments, resulting in lengths that are too large to be practically relevant. In practice, the surface/toric codes, which are the product of two repetition codes, are still often the qLDPC codes of choice. A previous construction of qLDPC codes based on the lifted product of an expander-based classical LDPC code with a repetition code (Panteleev and Kalachev, 2020) achieved a near-linear distance, and avoids the need for such intractable inner codes. Our main result is an efficient decoding algorithm for these codes that corrects a near-linear number of adversarial errors. En route, we give a similar algorithm for the hypergraph product version these codes, which are simpler but have distance growing only as the square root of the block length. Our decoding algorithms leverage the fact that the codes we consider are quasi-cyclic, meaning that they respect a cyclic group symmetry. Since the repetition code is not based on expanders, previous approaches to decoding expander-based qLDPC codes, which typically worked by greedily flipping code bits to reduce some potential function, do not apply in our setting. Instead, we reduce our decoding problem (in a black-box manner) to that of decoding classical expander-based LDPC codes under noisy parity-check syndromes. For completeness, we also include a treatment of such classical noisy-syndrome decoding that is sufficient for our application to the quantum setting.

arXiv:2411.04464•Annual Symposium on Foundations of Computer Science•Oct 27, 2024•1 citation

Quantum LDPC and High-Rate CSS Codes from Fair-Density Parity-Check Codes

Hessam Mahdavifar

We construct quantum LDPC (qLDPC) and high-rate CSS codes from our recently introduced classical fair-density parity-check (FDPC) codes. To this end, we introduce a structured sparsification of FDPC parity-check matrices, which reduces their check weights while preserving the underlying combinatorial structure and distance guarantees. Combined with the hypergraph-product construction, this yields finite-length qLDPC codes with analytically controlled blocklength, dimension, certified distance, and stabilizer weight. For quantum blocklengths $N<10^5$, the constructions introduced here span guaranteed rates from approximately $0.35\%$ to $25.8\%$ and certified quantum distances from $12$ to $69$, with stabilizer weights between $8$ and $16$. In the large-blocklength regime, allowing the FDPC order and sparsified check weight to scale moderately with blocklength yields a family of high-rate CSS codes, which we refer to as quantum FDPC (qFDPC) codes, with rate $R_Q$ and minimum distance $D$ satisfying \[ R_Q = 1-O\left(\frac{1}{\log\log N}\right), \ \ D=Ω(N^{1/4}), \] and stabilizer weight $O(\log N\log\log N)$. Finally, the analytically available FDPC weight distribution provides explicit information about the logical operators of the resulting hypergraph-product codes. Over the quantum erasure channel, this structure yields rigorous first-order maximum likelihood (ML) expressions and a higher-order weight-distribution approximation to the ML logical block error probability. This enables estimation of finite-length operating points and the onset of the error-floor regime. To the best of our knowledge, beyond surface-code-type constructions, this is the first finite-rate qLDPC framework to provide both finite-length certified minimum-distance information and an analytical characterization of low-weight logical multiplicities.

arXiv:2609.01181•Sep 1, 2026•0 citations

Soft syndrome iterative decoding of quantum LDPC codes and hardware architectures

Nithin Raveendran, Javier Valls, Asit Kumar Pradhan +3 more

Abstract In practical quantum error correction implementations, the measurement of syndrome information is an unreliable step—typically modeled as a binary measurement outcome flipped with some probability. However, the measured syndrome is in fact a discretized value of the continuous voltage or current values obtained in the physical implementation of the syndrome extraction. In this paper, we use this “soft” or analog information to benefit iterative decoders for decoding quantum low-density parity-check (QLDPC) codes. Syndrome-based iterative belief propagation decoders are modified to utilize the soft syndrome to correct both data and syndrome errors simultaneously. We demonstrate the advantages of the proposed scheme not only in terms of comparison of thresholds and logical error rates for quasi-cyclic lifted-product QLDPC code families but also with faster convergence of iterative decoders. Additionally, we derive hardware (FPGA) architectures of these soft syndrome decoders and obtain similar performance in terms of error correction to the ideal models even with reduced precision in the soft information. The total latency of the hardware architectures is about 600 ns (for the QLDPC codes considered) in a 20 nm CMOS process FPGA device, and the area overhead is almost constant—less than 50% compared to min-sum decoders with noisy syndromes.

EPJ Quantum Technology•Oct 19, 2023•7 citations

GPU-Accelerated Syndrome Decoding for Quantum LDPC Codes below the 63 μs Latency Threshold

Oscar Ferraz, Bruno Coelho Coutinho, Gabriel Falcão +3 more

This paper presents a GPU-accelerated decoder for quantum low-density parity-check (QLDPC) codes that achieves sub-63 μs latency, below the surface code decoder’s real-time threshold demonstrated on Google’s Willow quantum processor. While surface codes have demonstrated below-threshold performance, the encoding rates approach zero as code distances increase, posing challenges for scalability. Recently proposed QLDPC codes, such as those by Panteleev and Kalachev, offer constant-rate encoding and asymptotic goodness but introduce higher decoding complexity. To address such limitation, this work presents a parallelized belief propagation decoder leveraging syndrome information on commodity GPU hardware. Parallelism was exploited to maximize performance within the limits of target latency, allowing decoding latencies under 26 μs for [[784, 24, 24]] codes and as low as 16.9 μs for smaller codes, meeting the tight timing constraints of superconducting qubit cycles. These results show that real-time, scalable decoding of asymptotically good quantum codes is achievable using widely available commodity hardware, advancing the feasibility of fault-tolerant quantum computation beyond surface codes.

arXiv:2508.07879•Asilomar Conference on Signals, Systems and Computers (ACSSC)•Oct 26, 2025•1 citation

Certified decoding of quantum LDPC codes

Ragavi Krishnamoorthy, Florian Gerhardt, Johannes Knaute +8 more

Quantum low-density parity-check (qLDPC) codes reduce the qubit overhead of fault-tolerant quantum computation by an order of magnitude, but their decoding is harder than its classical counterpart: because many physical errors are equivalent up to stabilizers, the degenerate maximum-likelihood (ML) decoder must compare the probabilities of entire equivalence classes of errors, that is, partition functions, rather than single errors. The workhorse decoder BP+OSD sidesteps degeneracy heuristically and offers no guarantees. We treat degenerate decoding as probabilistic inference in an undirected graphical model: the probability of each logical class is the partition function of an unconstrained, strictly positive Markov random field over the code's check variables, a construction that generalizes the random-bond Ising mapping of the surface code to arbitrary CSS codes and to spacetime decoding with measurement errors and circuit-level noise. On this model we build two decoders. The first estimates all class partition functions by annealed importance sampling with common random numbers and attaches to every decision a certificate of optimality: a paired bootstrap test, or, composed with constant-factor estimators such as WISH, an exact optimality proof. The second is region-based: the Bethe free energy, whose bias cancels between classes, reproduces exact ML decoding on every tested surface-code instance at millisecond cost, and enlarging the regions to elimination clusters makes exact degenerate ML decoding of the [[72,12,6]] bivariate bicycle code feasible. Across surface codes and the bivariate bicycle codes [[72,12,6]] and [[144,12,12]], under code-capacity, phenomenological, and circuit-level noise, the sampling decoder matches or exceeds BP+OSD while certifying the bulk of its decisions, and the certificate flags exactly the syndromes on which any fast decoder should be distrusted.

quant-pharXiv:2608.25545•Aug 27, 2026•0 citations
This repository contains the full research for a novel approach to decoding Quantum Low-Density Parity-Check (QLDPC) codes via continuous optimization. Moving away from traditional message-passing or combinatorial algorithms, this work introduces a syndrome-agnostic energy landscape—a "squared-spring" potential where global minima correspond exactly to valid codewords. The decoder operates as a codeword projector, using gradient dynamics to navigate the continuous relaxation of the binary error space. Key Contributions The Energy Landscape: Formalization of the squared-spring Hamiltonian H(v)H(v)H(v), proving that valid codewords are the only points with zero energy and zero gradient (Theorem 3.4). Basin Geometry & Convergence: Analytical derivation of the exact Hessian and gradient at valid codewords (Theorems 4.1, 4.3). The work defines three nested radii (rlocr_{loc}rloc​, rbarrierr_{barrier}rbarrier​, rempr_{emp}remp​) that characterize the decoder’s convergence behavior. The Girth–Trap Hypothesis: An empirical finding that challenges existing intuition; data demonstrates that higher girth does not necessarily prevent decoder trapping, with girth-8 codes observed to trap at higher rates than girth-4 variants. Optimal λ Heuristic: Discovery of a universal scaling law λ∗≈(3/16)dˉ\lambda^* \approx (3/16)\bar{d}λ∗≈(3/16)dˉ for the regularization parameter, verified across eight independent CSS code families. Hardware Acceleration: A high-throughput implementation leveraging PyTorch and CUDA, achieving >86,000 syndromes per second, representing a ~28,000× speedup over serial Python implementations. Contents Core Library: continuous_relaxation_decoder.py — A modular Python library for CSS code construction, GF(2) linear algebra, and energy-based decoding. Verification Suite: verification_ContinuousRelaxationDecoder.py — A self-contained script that numerically verifies every theorem and proposition in the paper to machine precision. Computational Experiments: Momentum and Langevin dynamics comparisons. Failure mode census and pseudo-codeword barrier height calculations. Causal Diamond (CD) geometry analysis and [[208, 16, 6]] distance certification. Manuscript: LaTeX source and compiled PDF of the paper. Testbed CodesThe results are benchmarked on several high-performance QLDPC codes, including: [[193, 25, 4]] D4 Causal Diamond Hypergraph Product (HGP) code. [[112, 4, (6,6)]] and [[176, 32, (3,6)]] augmented-seed codes. Various Generalised Bicycle and CSS-LDPC code families.
This repository contains the complete research artifact and computational verification suite for scaling the discrete Lorentzian causal diamond into high-performance Quantum Low-Density Parity-Check (qLDPC) and finite-block codes. By systematically exploring algebraic amplification (Hypergraph Product), geometric tessellation (toric scaling), and lattice enrichment (E8E_8E8​ Lorentzian substrates), this work identifies precise structural obstructions in existing approaches and introduces novel, Pareto-optimal CSS codes tailored for near-term hardware in the N∼100–200N \sim 100\text{--}200N∼100–200 physical qubit regime. Scientific Contributions The Augmented-Seed Code Family: The central discovery that a specific weight-3 row (one of 64 in two B4B_4B4​ symmetry orbits) appended to the primal causal diamond seed raises the classical distance from 4 to 6. This breaks the intrinsic distance ceiling of the basic geometry, unlocking a family of finite-block codes that significantly outperform planar codes (e.g., surface/toric codes) at small block sizes. Methodological Warning on Sampling Blindness: Demonstration that Belief Propagation (BP)-style random sampling fails catastrophically in high-dimensional kernels. Earlier sampled bounds of d≥67d \ge 67d≥67 for the `[[193, 25]]` code are formally retracted; an exact Integer Linear Program (ILP) oracle is introduced, definitively proving d=4d = 4d=4. The E8E_8E8​ Structural Obstruction (Theorem 4.5): Rigorous proof that the 28-qubit E8E_8E8​ Lorentzian code cannot be punctured to yield a valid quantum code. Its 7-disconnected-4-cycle geometry guarantees dZ=1d_Z = 1dZ​=1 after any single row drop, pointing toward the Euclidean E8E_8E8​ root lattice as the necessary next step. Naïve CSS Lift Theorem (Theorem 5.3): Algebraic proof that setting HX=ker⁡(HZ)H_X = \ker(H_Z)HX​=ker(HZ​) definitionally forces k=0k=0k=0, regardless of chain or torus topology, resolving anomalies in earlier geometric scaling attempts. Highlighted Code FamiliesThe augmented geometric construction yields a frontier of codes optimized for neutral-atom and trapped-ion architectures, including: [[112, 4, (6, 6)]]: Achieves an exceptional figure of merit kd2/N≈1.29kd^2/N \approx 1.29kd2/N≈1.29, making it a highly efficient logical block for near-term implementation. [[176, 32, (3, 6)]: Features an asymmetric distance profile naturally aligned with the ZZZ-biased noise characteristic of superconducting hardware. [[208, 16, 6]]: A self-hypergraph product code with d=6d=6d=6 proven algebraically via the Tillich–Zémor theorem. Artifact Contents Verification Suite (`verification_modular_assembly.py`): A unified, self-contained Python script using `scipy.optimize.milp` that computationally verifies every theorem, constructs all augmented seeds, performs exact distance certifications via ILP in under 100ms per operator, and reproduces the geometric obstructions. Manuscript: Complete LaTeX source files and compiled PDF of the paper.
Quantum low-density parity-check (qLDPC) codes are an important component in the quest for quantum fault tolerance. Dramatic recent progress on qLDPC codes has led to constructions which are asymptotically good, and which admit linear-time decoders to correct errors affecting a constant fraction of codeword qubits. These constructions, while theoretically explicit, rely on inner codes with strong properties only shown to exist by probabilistic arguments, resulting in lengths that are too large to be practically relevant. In practice, the surface/toric codes, which are the product of two repetition codes, are still often the qLDPC codes of choice. A previous construction of qLDPC codes based on the lifted product of an expander-based classical LDPC code with a repetition code (Panteleev and Kalachev, 2020) achieved a near-linear distance, and avoids the need for such intractable inner codes. Our main result is an efficient decoding algorithm for these codes that corrects a near-linear number of adversarial errors. En route, we give a similar algorithm for the hypergraph product version these codes, which are simpler but have distance growing only as the square root of the block length. Our decoding algorithms leverage the fact that the codes we consider are quasi-cyclic, meaning that they respect a cyclic group symmetry. Since the repetition code is not based on expanders, previous approaches to decoding expander-based qLDPC codes, which typically worked by greedily flipping code bits to reduce some potential function, do not apply in our setting. Instead, we reduce our decoding problem (in a black-box manner) to that of decoding classical expander-based LDPC codes under noisy parity-check syndromes. For completeness, we also include a treatment of such classical noisy-syndrome decoding that is sufficient for our application to the quantum setting.
We construct quantum LDPC (qLDPC) and high-rate CSS codes from our recently introduced classical fair-density parity-check (FDPC) codes. To this end, we introduce a structured sparsification of FDPC parity-check matrices, which reduces their check weights while preserving the underlying combinatorial structure and distance guarantees. Combined with the hypergraph-product construction, this yields finite-length qLDPC codes with analytically controlled blocklength, dimension, certified distance, and stabilizer weight. For quantum blocklengths N<105N<10^5N<105, the constructions introduced here span guaranteed rates from approximately 0.35%0.35\%0.35% to 25.8%25.8\%25.8% and certified quantum distances from 121212 to 696969, with stabilizer weights between 888 and 161616. In the large-blocklength regime, allowing the FDPC order and sparsified check weight to scale moderately with blocklength yields a family of high-rate CSS codes, which we refer to as quantum FDPC (qFDPC) codes, with rate RQR_QRQ​ and minimum distance DDD satisfying RQ=1−O(1log⁡log⁡N),  D=Ω(N1/4), R_Q = 1-O\left(\frac{1}{\log\log N}\right), \ \ D=Ω(N^{1/4}), RQ​=1−O(loglogN1​),  D=Ω(N1/4), and stabilizer weight O(log⁡Nlog⁡log⁡N)O(\log N\log\log N)O(logNloglogN). Finally, the analytically available FDPC weight distribution provides explicit information about the logical operators of the resulting hypergraph-product codes. Over the quantum erasure channel, this structure yields rigorous first-order maximum likelihood (ML) expressions and a higher-order weight-distribution approximation to the ML logical block error probability. This enables estimation of finite-length operating points and the onset of the error-floor regime. To the best of our knowledge, beyond surface-code-type constructions, this is the first finite-rate qLDPC framework to provide both finite-length certified minimum-distance information and an analytical characterization of low-weight logical multiplicities.
Abstract In practical quantum error correction implementations, the measurement of syndrome information is an unreliable step—typically modeled as a binary measurement outcome flipped with some probability. However, the measured syndrome is in fact a discretized value of the continuous voltage or current values obtained in the physical implementation of the syndrome extraction. In this paper, we use this “soft” or analog information to benefit iterative decoders for decoding quantum low-density parity-check (QLDPC) codes. Syndrome-based iterative belief propagation decoders are modified to utilize the soft syndrome to correct both data and syndrome errors simultaneously. We demonstrate the advantages of the proposed scheme not only in terms of comparison of thresholds and logical error rates for quasi-cyclic lifted-product QLDPC code families but also with faster convergence of iterative decoders. Additionally, we derive hardware (FPGA) architectures of these soft syndrome decoders and obtain similar performance in terms of error correction to the ideal models even with reduced precision in the soft information. The total latency of the hardware architectures is about 600 ns (for the QLDPC codes considered) in a 20 nm CMOS process FPGA device, and the area overhead is almost constant—less than 50% compared to min-sum decoders with noisy syndromes.
This paper presents a GPU-accelerated decoder for quantum low-density parity-check (QLDPC) codes that achieves sub-63 μs latency, below the surface code decoder’s real-time threshold demonstrated on Google’s Willow quantum processor. While surface codes have demonstrated below-threshold performance, the encoding rates approach zero as code distances increase, posing challenges for scalability. Recently proposed QLDPC codes, such as those by Panteleev and Kalachev, offer constant-rate encoding and asymptotic goodness but introduce higher decoding complexity. To address such limitation, this work presents a parallelized belief propagation decoder leveraging syndrome information on commodity GPU hardware. Parallelism was exploited to maximize performance within the limits of target latency, allowing decoding latencies under 26 μs for [[784, 24, 24]] codes and as low as 16.9 μs for smaller codes, meeting the tight timing constraints of superconducting qubit cycles. These results show that real-time, scalable decoding of asymptotically good quantum codes is achievable using widely available commodity hardware, advancing the feasibility of fault-tolerant quantum computation beyond surface codes.
Quantum low-density parity-check (qLDPC) codes reduce the qubit overhead of fault-tolerant quantum computation by an order of magnitude, but their decoding is harder than its classical counterpart: because many physical errors are equivalent up to stabilizers, the degenerate maximum-likelihood (ML) decoder must compare the probabilities of entire equivalence classes of errors, that is, partition functions, rather than single errors. The workhorse decoder BP+OSD sidesteps degeneracy heuristically and offers no guarantees. We treat degenerate decoding as probabilistic inference in an undirected graphical model: the probability of each logical class is the partition function of an unconstrained, strictly positive Markov random field over the code's check variables, a construction that generalizes the random-bond Ising mapping of the surface code to arbitrary CSS codes and to spacetime decoding with measurement errors and circuit-level noise. On this model we build two decoders. The first estimates all class partition functions by annealed importance sampling with common random numbers and attaches to every decision a certificate of optimality: a paired bootstrap test, or, composed with constant-factor estimators such as WISH, an exact optimality proof. The second is region-based: the Bethe free energy, whose bias cancels between classes, reproduces exact ML decoding on every tested surface-code instance at millisecond cost, and enlarging the regions to elimination clusters makes exact degenerate ML decoding of the [[72,12,6]] bivariate bicycle code feasible. Across surface codes and the bivariate bicycle codes [[72,12,6]] and [[144,12,12]], under code-capacity, phenomenological, and circuit-level noise, the sampling decoder matches or exceeds BP+OSD while certifying the bulk of its decisions, and the certificate flags exactly the syndromes on which any fast decoder should be distrusted.