Papers
Topics
Authors
Recent
Search
2000 character limit reached

Worm Algorithm in Monte Carlo Methods

Updated 3 July 2026
  • Worm Algorithm is a Monte Carlo sampling technique that enlarges the state space by introducing a pair of defects to efficiently capture correlation functions and critical behaviors.
  • It employs reversible and nonreversible update schemes across models like the Ising, gauge, and fermionic systems to optimize performance and reduce backtracking.
  • The method provides rigorous mixing time bounds and adaptable estimators for nonlocal observables such as susceptibility, energy, and specific heat in diverse physical systems.

In the surveyed literature, the worm algorithm is presented as a versatile technique in the Markov chain Monte Carlo method for both classical and quantum systems, based on an enlarged state space with two defects, open boundaries, or open world-lines that are propagated locally and eventually removed or reclosed. Across Ising high-temperature expansions, dual flux or surface formulations, fermion-loop representations, and path-integral worldline methods, the defining operation is to move in an extended ensemble that relaxes a local closure constraint and then recover observables of the original closed sector from closed-worm visits or defect statistics (Suwa, 2017, Suwa, 2022, Collevecchio et al., 2014).

1. Extended-ensemble construction

For the ferromagnetic Ising model on a bipartite lattice,

H[σ]=−J∑⟨ij⟩σiσj,σi=±1,K≡βJ,H[\sigma] = -J\sum_{\langle ij\rangle}\sigma_i\sigma_j,\qquad \sigma_i=\pm1,\qquad K\equiv \beta J,

the high-temperature expansion yields

Z=2N[cosh⁡K]Nb∑{nb∈{0,1} forming only closed loops}(tanh⁡K)ℓ,Z = 2^N[\cosh K]^{N_b} \sum_{\{n_b\in\{0,1\}\ \text{forming only closed loops}\}} (\tanh K)^\ell,

with ℓ=∑bnb\ell=\sum_b n_b and the even-degree constraint at each site. The worm construction enlarges this loop ensemble by temporarily allowing exactly two odd-degree sites, interpreted as defects or kinks. In the site-based formulation, the tail is at xx, the head at yy, and a head move y→y′y\to y' flips one bond variable nb→1−nbn_b\to 1-n_b along b=⟨y,y′⟩b=\langle y,y'\rangle (Suwa, 2022).

On a general finite connected graph G=(V,E)G=(V,E), this structure is encoded by

CW:={A⊆E:∂A=W},W=C0∪C2,C_W := \{A\subseteq E:\partial A=W\},\qquad W=C_0\cup C_2,

where Z=2N[cosh⁡K]Nb∑{nb∈{0,1} forming only closed loops}(tanh⁡K)ℓ,Z = 2^N[\cosh K]^{N_b} \sum_{\{n_b\in\{0,1\}\ \text{forming only closed loops}\}} (\tanh K)^\ell,0 is the set of odd-degree vertices of Z=2N[cosh⁡K]Nb∑{nb∈{0,1} forming only closed loops}(tanh⁡K)ℓ,Z = 2^N[\cosh K]^{N_b} \sum_{\{n_b\in\{0,1\}\ \text{forming only closed loops}\}} (\tanh K)^\ell,1. The worm state space is therefore the union of Eulerian subgraphs and subgraphs with exactly two odd vertices. In the zero-field ferromagnetic Ising model, the corresponding high-temperature weight is Z=2N[cosh⁡K]Nb∑{nb∈{0,1} forming only closed loops}(tanh⁡K)ℓ,Z = 2^N[\cosh K]^{N_b} \sum_{\{n_b\in\{0,1\}\ \text{forming only closed loops}\}} (\tanh K)^\ell,2 with Z=2N[cosh⁡K]Nb∑{nb∈{0,1} forming only closed loops}(tanh⁡K)ℓ,Z = 2^N[\cosh K]^{N_b} \sum_{\{n_b\in\{0,1\}\ \text{forming only closed loops}\}} (\tanh K)^\ell,3, and the worm chain is defined precisely on Z=2N[cosh⁡K]Nb∑{nb∈{0,1} forming only closed loops}(tanh⁡K)ℓ,Z = 2^N[\cosh K]^{N_b} \sum_{\{n_b\in\{0,1\}\ \text{forming only closed loops}\}} (\tanh K)^\ell,4 (Collevecchio et al., 2014).

The same enlargement principle reappears outside spin models. In Abelian gauge theory, closed surfaces are supplemented by open-surface defects whose boundaries carry a Wilson-loop current (Korzec et al., 2010). In fermion-loop formulations of the Z=2N[cosh⁡K]Nb∑{nb∈{0,1} forming only closed loops}(tanh⁡K)ℓ,Z = 2^N[\cosh K]^{N_b} \sum_{\{n_b\in\{0,1\}\ \text{forming only closed loops}\}} (\tanh K)^\ell,5 Gross–Neveu model, one opens a fermionic string with two endpoints that sample a Majorana two-point function (Maillart et al., 2011). In canonical path-integral Monte Carlo for Bose systems, the diagonal sector of closed world-lines is enlarged by an off-diagonal sector in which one polymer is cut into a tail and a head (Spada et al., 2022). The underlying mechanism is unchanged: a local constraint is violated in a controlled way, the defect pair explores configuration space, and closure restores the original sector.

2. Reversible worm formulations and observables

In the standard Ising worm update, a configuration with two kinks carries weight Z=2N[cosh⁡K]Nb∑{nb∈{0,1} forming only closed loops}(tanh⁡K)ℓ,Z = 2^N[\cosh K]^{N_b} \sum_{\{n_b\in\{0,1\}\ \text{forming only closed loops}\}} (\tanh K)^\ell,6. A head move Z=2N[cosh⁡K]Nb∑{nb∈{0,1} forming only closed loops}(tanh⁡K)ℓ,Z = 2^N[\cosh K]^{N_b} \sum_{\{n_b\in\{0,1\}\ \text{forming only closed loops}\}} (\tanh K)^\ell,7 changes Z=2N[cosh⁡K]Nb∑{nb∈{0,1} forming only closed loops}(tanh⁡K)ℓ,Z = 2^N[\cosh K]^{N_b} \sum_{\{n_b\in\{0,1\}\ \text{forming only closed loops}\}} (\tanh K)^\ell,8, so the weight ratio is

Z=2N[cosh⁡K]Nb∑{nb∈{0,1} forming only closed loops}(tanh⁡K)ℓ,Z = 2^N[\cosh K]^{N_b} \sum_{\{n_b\in\{0,1\}\ \text{forming only closed loops}\}} (\tanh K)^\ell,9

With a symmetric proposal ℓ=∑bnb\ell=\sum_b n_b0 to one of the ℓ=∑bnb\ell=\sum_b n_b1 neighbors, the Metropolis acceptance

ℓ=∑bnb\ell=\sum_b n_b2

satisfies detailed balance. The basic life cycle is: insert two kinks at a random site, propagate the head by repeated flip-and-move steps, and remove the worm when the head returns to the tail (Suwa, 2022).

In the lazy Metropolis formulation on a general graph, the chain again preserves detailed balance on ℓ=∑bnb\ell=\sum_b n_b3. One chooses a vertex ℓ=∑bnb\ell=\sum_b n_b4 uniformly in ℓ=∑bnb\ell=\sum_b n_b5 if the state lies in ℓ=∑bnb\ell=\sum_b n_b6, or uniformly in ℓ=∑bnb\ell=\sum_b n_b7 if it lies in ℓ=∑bnb\ell=\sum_b n_b8, then chooses a neighboring vertex ℓ=∑bnb\ell=\sum_b n_b9, proposes xx0, and accepts with a Metropolis–Hastings rule that includes the degree ratio xx1 when both current and proposed states lie in xx2 (Collevecchio et al., 2014).

The reversible worm framework gives direct estimators for nonlocal observables. In the Ising chain on general graphs,

xx3

so susceptibility and two-point functions are encoded in the stationary weights of the closed and two-defect sectors (Collevecchio et al., 2014). In the two-dimensional Ising implementation used for graphene-impurity studies, the two-point correlator is obtained from the histogram of worm-end separations, while energy and specific heat are read from bond occupations (Szyniszewski, 2013). The surveyed literature therefore treats the worm algorithm not as a direct spin-flip method, but as a sampler of graphical expansions whose defect statistics already carry the desired correlation information (Szyniszewski, 2013, Suwa, 2017).

3. Directed and lifted nonreversible variants

A central limitation of conventional worms is backscattering: local rejections or immediate reversals suppress diffusivity of the head and waste Monte Carlo time. Directed variants address this by attaching an incoming direction to the worm head and optimizing local scattering probabilities so that forward scattering is favored and backscattering is averted (Suwa, 2017). In the directed-worm algorithm described by Suwa, the kinks are placed on bonds rather than sites, the local bond state takes values xx4, and the kink carries a travel direction through the local scattering event (Suwa, 2022).

The optimization is expressed as a geometric allocation problem. In the lifted setting one adds a discrete mode xx5 and defines stochastic flows

xx6

subject to global balance

xx7

The allocation is then chosen to minimize backscattering flow, satisfy global balance, and maximize net stochastic flow from low-weight to high-weight scattering states. In the closed-form solution reported for the lifted directed-worm algorithm, one checks that xx8 (Suwa, 2022). The same literature explicitly motivates lifting as a nonreversible perturbation that introduces net circulation in state space and cites mathematical proofs that any nonzero skew-detailed-balance perturbation shortens the relaxation time (Suwa, 2022).

The numerical consequences are substantial. For the simple-cubic Ising model at the critical temperature, the directed worm is approximately xx9 times as efficient as the conventional worm update and more efficient than the Wolff cluster algorithm; the estimated dynamic critical exponent is yy0 (Suwa, 2017). For the four-dimensional hypercubic lattice Ising model at yy1 and system sizes up to yy2, the lifted directed-worm algorithm yields

yy3

for the energy estimator, with corresponding factors yy4, yy5, and yy6 for yy7; the dynamic critical exponent for the energy is yy8 (Suwa, 2022). Earlier lifted Ising worms also showed marked improvements: on toroidal grids in dimensions yy9, the asymptotic improvement factor y→y′y\to y'0 grows from y→y′y\to y'1 in y→y′y\to y'2 to y→y′y\to y'3 in y→y′y\to y'4, while on the complete graph the lifted chain changes the scaling from y→y′y\to y'5 to y→y′y\to y'6 (Elçi et al., 2017).

4. Rigorous analysis and efficiency criteria

The reversible Prokof’ev–Svistunov worm algorithm for the zero-field ferromagnetic Ising model is not only practically effective but rigorously rapidly mixing on all finite connected graphs and at all temperatures. For y→y′y\to y'7 with y→y′y\to y'8, y→y′y\to y'9, maximum degree nb→1−nbn_b\to 1-n_b0, and nb→1−nbn_b\to 1-n_b1, the lazy worm chain satisfies

nb→1−nbn_b\to 1-n_b2

In particular, nb→1−nbn_b\to 1-n_b3 is polynomial in graph size and nb→1−nbn_b\to 1-n_b4. The same analysis yields fully polynomial randomized approximation schemes for the susceptibility and the two-point correlation function (Collevecchio et al., 2014).

Performance comparisons in the worm literature are typically organized around autocorrelation and variance, rather than around acceptance rate alone. The standard definitions used in the directed-worm work include the exponential autocorrelation time nb→1−nbn_b\to 1-n_b5, the integrated autocorrelation time

nb→1−nbn_b\to 1-n_b6

and the asymptotic variance

nb→1−nbn_b\to 1-n_b7

whose inverse is proportional to the sampling efficiency (Suwa, 2017). In the four-dimensional lifted directed-worm study, the normalized integrated autocorrelation time is measured in units of nb→1−nbn_b\to 1-n_b8 spin-updates, the estimator variance is written as nb→1−nbn_b\to 1-n_b9, and the asymptotic variance is reported as b=⟨y,y′⟩b=\langle y,y'\rangle0 (Suwa, 2022).

This metric choice matters because different observables can display different dynamic behavior. In the three-dimensional directed-worm study, the worm and Wolff algorithms produce different exponents for the integrated autocorrelation time of the magnetic susceptibility estimator but the same exponent for the asymptotic variance (Suwa, 2017). The literature therefore treats efficiency as an observable-dependent quantity that combines decorrelation and estimator variance.

5. Generalizations across models and representations

In Abelian gauge theory, the worm idea extends from closed loops to closed surfaces. For the lattice b=⟨y,y′⟩b=\langle y,y'\rangle1 gauge theory with Wilson plaquette action, one samples the all-order strong-coupling expansion in integer-valued plaquette occupation numbers and enlarges the ensemble to include open-surface defects whose boundaries are Wilson loops. In three dimensions at fixed physical volume, the worm-inspired algorithm exhibits b=⟨y,y′⟩b=\langle y,y'\rangle2 essentially independent of b=⟨y,y′⟩b=\langle y,y'\rangle3, whereas the Metropolis b=⟨y,y′⟩b=\langle y,y'\rangle4 grows roughly b=⟨y,y′⟩b=\langle y,y'\rangle5 with b=⟨y,y′⟩b=\langle y,y'\rangle6; the dimensionless cost indicator is reduced by a factor b=⟨y,y′⟩b=\langle y,y'\rangle7–b=⟨y,y′⟩b=\langle y,y'\rangle8 for the average plaquette and by an order of magnitude for the effective mass at b=⟨y,y′⟩b=\langle y,y'\rangle9 (Korzec et al., 2010). The surface worm algorithm for Abelian Gauge–Higgs systems generalizes the original loop worm to dual configurations of surfaces and loops, outperforms a local update for a wide range of parameters, and in the G=(V,E)G=(V,E)0 case at finite chemical potential avoids the complex-action problem because the dual weights remain positive (Delgado et al., 2012, Delgado et al., 2013).

For scalar and sigma-like systems, worm methods remain effective outside the strict Ising limit. In one-component lattice G=(V,E)G=(V,E)1 theory, the link-variable worm algorithm works from G=(V,E)G=(V,E)2 to G=(V,E)G=(V,E)3; at G=(V,E)G=(V,E)4 and fixed G=(V,E)G=(V,E)5 it shows moderate critical slowing down, with, for example, G=(V,E)G=(V,E)6 and G=(V,E)G=(V,E)7 in G=(V,E)G=(V,E)8, while at G=(V,E)G=(V,E)9 the growth is very mild and close to CW:={A⊆E:∂A=W},W=C0∪C2,C_W := \{A\subseteq E:\partial A=W\},\qquad W=C_0\cup C_2,0, and at CW:={A⊆E:∂A=W},W=C0∪C2,C_W := \{A\subseteq E:\partial A=W\},\qquad W=C_0\cup C_2,1 earlier studies show virtually no critical slowing down (Korzec et al., 2011). In the complex CW:={A⊆E:∂A=W},W=C0∪C2,C_W := \{A\subseteq E:\partial A=W\},\qquad W=C_0\cup C_2,2 model, the worm framework can sample not only the charged correlator CW:={A⊆E:∂A=W},W=C0∪C2,C_W := \{A\subseteq E:\partial A=W\},\qquad W=C_0\cup C_2,3, but also CW:={A⊆E:∂A=W},W=C0∪C2,C_W := \{A\subseteq E:\partial A=W\},\qquad W=C_0\cup C_2,4, CW:={A⊆E:∂A=W},W=C0∪C2,C_W := \{A\subseteq E:\partial A=W\},\qquad W=C_0\cup C_2,5, and condensates such as CW:={A⊆E:∂A=W},W=C0∪C2,C_W := \{A\subseteq E:\partial A=W\},\qquad W=C_0\cup C_2,6 at every step of the Monte Carlo evolution rather than only on closed-worm configurations (Rindlisbacher et al., 2016). For the two-dimensional CW:={A⊆E:∂A=W},W=C0∪C2,C_W := \{A\subseteq E:\partial A=W\},\qquad W=C_0\cup C_2,7 model, dual flux-variable worms and internal-space sub-worm moves permit simulations at finite density without sign problems; the internal-space moves restore ergodicity for CW:={A⊆E:∂A=W},W=C0∪C2,C_W := \{A\subseteq E:\partial A=W\},\qquad W=C_0\cup C_2,8, and the quartic and auxiliary-CW:={A⊆E:∂A=W},W=C0∪C2,C_W := \{A\subseteq E:\partial A=W\},\qquad W=C_0\cup C_2,9 lattice actions show marked differences in their approach to the continuum limit (Rindlisbacher et al., 2016, Rindlisbacher et al., 2017).

Loop, fermionic, and quantum worldline formulations admit equally direct worm constructions. A worm algorithm for the Z=2N[cosh⁡K]Nb∑{nb∈{0,1} forming only closed loops}(tanh⁡K)ℓ,Z = 2^N[\cosh K]^{N_b} \sum_{\{n_b\in\{0,1\}\ \text{forming only closed loops}\}} (\tanh K)^\ell,00 loop model on any finite connected bipartite cubic graph works for any real Z=2N[cosh⁡K]Nb∑{nb∈{0,1} forming only closed loops}(tanh⁡K)ℓ,Z = 2^N[\cosh K]^{N_b} \sum_{\{n_b\in\{0,1\}\ \text{forming only closed loops}\}} (\tanh K)^\ell,01 and any edge weight, including the fully-packed limit, and is rigorously ergodic with the correct stationary distribution; at Z=2N[cosh⁡K]Nb∑{nb∈{0,1} forming only closed loops}(tanh⁡K)ℓ,Z = 2^N[\cosh K]^{N_b} \sum_{\{n_b\in\{0,1\}\ \text{forming only closed loops}\}} (\tanh K)^\ell,02, it yields simulations of zero-temperature Potts antiferromagnets for which the Wang–Swendsen–Kotecký algorithm is non-ergodic (Liu et al., 2010). In the Z=2N[cosh⁡K]Nb∑{nb∈{0,1} forming only closed loops}(tanh⁡K)ℓ,Z = 2^N[\cosh K]^{N_b} \sum_{\{n_b\in\{0,1\}\ \text{forming only closed loops}\}} (\tanh K)^\ell,03 Gross–Neveu model with Wilson fermions, the open fermionic string samples two-point functions directly, extends to bound states involving an arbitrary number of Majorana fermions, and eliminates critical slowing down in practice (Maillart et al., 2011). In canonical path-integral Monte Carlo for Bose systems with periodic boundary conditions, the worm algorithm is formulated so that only the initial point of each path lies inside the simulation box while the remaining points span the whole space, allowing detailed balance without ambiguity in the periodic image selection; benchmarks against exact finite-Z=2N[cosh⁡K]Nb∑{nb∈{0,1} forming only closed loops}(tanh⁡K)ℓ,Z = 2^N[\cosh K]^{N_b} \sum_{\{n_b\in\{0,1\}\ \text{forming only closed loops}\}} (\tanh K)^\ell,04 results for the ideal Bose gas confirm the construction (Spada et al., 2022). In the quantum transverse-field Ising model, a continuous-time worm algorithm in the field-direction basis yields the two-dimensional critical point Z=2N[cosh⁡K]Nb∑{nb∈{0,1} forming only closed loops}(tanh⁡K)ℓ,Z = 2^N[\cosh K]^{N_b} \sum_{\{n_b\in\{0,1\}\ \text{forming only closed loops}\}} (\tanh K)^\ell,05 and loop fractal dimensions Z=2N[cosh⁡K]Nb∑{nb∈{0,1} forming only closed loops}(tanh⁡K)ℓ,Z = 2^N[\cosh K]^{N_b} \sum_{\{n_b\in\{0,1\}\ \text{forming only closed loops}\}} (\tanh K)^\ell,06 and Z=2N[cosh⁡K]Nb∑{nb∈{0,1} forming only closed loops}(tanh⁡K)ℓ,Z = 2^N[\cosh K]^{N_b} \sum_{\{n_b\in\{0,1\}\ \text{forming only closed loops}\}} (\tanh K)^\ell,07 (Huang et al., 2020).

6. Scope, misconceptions, and recent directions

The surveyed literature indicates that “worm algorithm” denotes a family of constructions rather than one unique transition rule. Reversible Metropolis worms, directed worms, lifted worms, surface worms, internal-space sub-worms, open-string fermion worms, and path-integral worms all share the defect-enlargement strategy, but they differ in local state spaces, balance conditions, and observables. Another recurrent misconception is that worms are intrinsically tied to detailed balance: the standard Prokof’ev–Svistunov form is reversible, whereas lifting and directed scattering deliberately break detailed balance to introduce net stochastic flow and suppress backtracking (Suwa, 2022, Elçi et al., 2017).

A further misconception is that worms are useful only for two-point functions. The corpus surveyed here uses worm statistics to estimate susceptibility, energy, specific heat, Wilson loops, plaquette correlators, effective masses, condensates, and more general composite correlators (Korzec et al., 2010, Rindlisbacher et al., 2016). This breadth follows directly from the enlarged ensemble: once the defect sector is built to represent an insertion of the relevant operator, the same Markov chain can update configurations and sample the correlator.

A recent cross-disciplinary development applies the same Z=2N[cosh⁡K]Nb∑{nb∈{0,1} forming only closed loops}(tanh⁡K)ℓ,Z = 2^N[\cosh K]^{N_b} \sum_{\{n_b\in\{0,1\}\ \text{forming only closed loops}\}} (\tanh K)^\ell,08 logic to decoding. For matchable qLDPC codes, the worm algorithm approximately computes probabilities of logical error classes given a syndrome, thereby implementing approximate optimal decoding. The underlying Markov chain has a rigorous relaxation-time bound in terms of the defect susceptibilities Z=2N[cosh⁡K]Nb∑{nb∈{0,1} forming only closed loops}(tanh⁡K)ℓ,Z = 2^N[\cosh K]^{N_b} \sum_{\{n_b\in\{0,1\}\ \text{forming only closed loops}\}} (\tanh K)^\ell,09 and Z=2N[cosh⁡K]Nb∑{nb∈{0,1} forming only closed loops}(tanh⁡K)ℓ,Z = 2^N[\cosh K]^{N_b} \sum_{\{n_b\in\{0,1\}\ \text{forming only closed loops}\}} (\tanh K)^\ell,10, and the method applies to the surface code, the honeycomb Floquet code, and hyperbolic surface codes with and without measurement errors. Numerically, the worm decoder gives Z=2N[cosh⁡K]Nb∑{nb∈{0,1} forming only closed loops}(tanh⁡K)ℓ,Z = 2^N[\cosh K]^{N_b} \sum_{\{n_b\in\{0,1\}\ \text{forming only closed loops}\}} (\tanh K)^\ell,11 for the rotated surface code with independent bit-flip and measurement error, Z=2N[cosh⁡K]Nb∑{nb∈{0,1} forming only closed loops}(tanh⁡K)ℓ,Z = 2^N[\cosh K]^{N_b} \sum_{\{n_b\in\{0,1\}\ \text{forming only closed loops}\}} (\tanh K)^\ell,12 for a family of hyperbolic Z=2N[cosh⁡K]Nb∑{nb∈{0,1} forming only closed loops}(tanh⁡K)ℓ,Z = 2^N[\cosh K]^{N_b} \sum_{\{n_b\in\{0,1\}\ \text{forming only closed loops}\}} (\tanh K)^\ell,13 codes, and a correlated-worm threshold of approximately Z=2N[cosh⁡K]Nb∑{nb∈{0,1} forming only closed loops}(tanh⁡K)ℓ,Z = 2^N[\cosh K]^{N_b} \sum_{\{n_b\in\{0,1\}\ \text{forming only closed loops}\}} (\tanh K)^\ell,14 for depolarizing noise on the rotated surface code, compared to approximately Z=2N[cosh⁡K]Nb∑{nb∈{0,1} forming only closed loops}(tanh⁡K)ℓ,Z = 2^N[\cosh K]^{N_b} \sum_{\{n_b\in\{0,1\}\ \text{forming only closed loops}\}} (\tanh K)^\ell,15 for plain minimum-weight perfect matching and approximately Z=2N[cosh⁡K]Nb∑{nb∈{0,1} forming only closed loops}(tanh⁡K)ℓ,Z = 2^N[\cosh K]^{N_b} \sum_{\{n_b\in\{0,1\}\ \text{forming only closed loops}\}} (\tanh K)^\ell,16 for correlated matching (Tobias et al., 5 Mar 2026). This suggests that the worm paradigm has evolved from a specialized update for lattice loop gases into a general framework for sampling constrained subgraph distributions.

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Worm Algorithm.