BatchTNMC: Efficient sampling of two-dimensional spin glasses using tensor network Monte Carlo

Tao Chen, Jingtong Zhang, Jing Liu, Youjin Deng, Pan Zhang · 2025

Read BatchTNMC: Efficient sampling of two-dimensional spin glasses using tensor network Monte Carlo by Tao Chen, Jingtong Zhang, Jing Liu, Youjin Deng, Pan Zhang (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2509-19006.txt.

Introduction

Sampling the states of a two-dimensional spin glass is a notorious bottleneck in computational physics. Tao Chen and four co-authors speed up a newer sampling method called tensor network Monte Carlo. Spin glasses pair random, frustrated couplings with frozen disorder, so chain-based samplers slow down badly on large lattices. The tensor network method helps, but its first version ran one sample at a time.

Their version, BatchTNMC, rewrites the method to run in parallel on graphics processors. It draws samples for many disorder cases at once. On a single graphics card it produced a thousand clean samples for each of a thousand cases on very large lattices in a few hours. Speed gains reach up to five orders of magnitude over the original serial code, with a healthy share of samples accepted.

Catalog record

CREATORTao Chen, Jingtong Zhang, Jing Liu, Youjin Deng, Pan Zhang
YEAR2025
COLLECTIONPAPERS
FORMATTXT
FILE SIZE36 KB
VERSION1.0
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2509-19006

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

BatchTNMC: Efficient sampling of two-dimensional spin glasses using tensor network Monte Carlo Tao Chen, Jingtong Zhang, Jing Liu, Youjin Deng, Pan Zhang Abstract Efficient sampling of two-dimensional statistical physics systems remains a central challenge in computational statistical physics. Traditional Markov chain Monte Carlo (MCMC) methods, including cluster algorithms, provide only partial solutions, as their efficiency collapses for large systems in the presence of frustration and quenched disorder. The recently proposed Tensor Network Monte Carlo (TNMC) method offers a promising alternative, yet its original implementation suffers from inefficiencies due to the lack of scalable parallel sampling. In this work, we introduce BatchTNMC , a GPU-optimized and parallelized implementation of TNMC tailored for large-scale simulations of two-dimensional spin glasses. By leveraging batch processing and parallel sampling across multiple disorder realizations, our implementation achieves speedups of up to five orders of magnitude compared with the original serial scheme. Benchmarking on two-dimensional spin glasses demonstrates dramatic gains in efficiency: for instance, on a single GPU, BatchTNMC concurrently produces 𝟏𝟎𝟎𝟎 \bf{1000} uncorrelated and unbiased samples across 𝟏𝟎𝟎𝟎 \bf{1000} disorder realizations on 𝟏𝟎𝟐𝟒 × 𝟏𝟎𝟐𝟒 \bf{1024\times 1024} lattices in just 3.3 hours , with an acceptance probability of 37%. These results establish BatchTNMC as a scalable and powerful computational framework for the study of two-dimensional disordered spin glass systems. 1. Introduction A central challenge in statistical physics lies in the accurate estimation of the partition function, the computation of thermodynamic observables, and the unbiased sampling of equilibrium configurations from the Boltzmann distribution. The intrinsically high-dimensional nature of many-body systems makes these tasks computationally demanding, especially in frustrated and disordered systems such as spin glasses sfedwards1975theory ; binder1986spin , where the rugged and complex energy landscape severely hinders conventional numerical approaches. As spin glasses serve as paradigmatic models for understanding phase transitions and critical phenomena, the development of efficient and scalable computational approaches remains a pressing objective in the field of computational statistical physics. Markov chain Monte Carlo (MCMC) algorithms landau2014guide ; newman1999monte have long been indispensable tools for sampling from complex probability distributions, especially in the study of spin glasses. Traditional schemes such as the Metropolis algorithm metropolis1953equation , which rely on local spin updates, suffer from critical slowing down near phase transitions, thereby limiting their efficiency. More advanced methods, including parallel tempering swendsen1986replica ; e.marinari1992simulated ; hukushima1996exchange , alleviate these limitations to some extent but incur significant computational overhead, often restricting simulations to modest system sizes. Cluster algorithms such as Swendsen-Wang swendsen1987nonuniversal and Wolff algorithm wolff1989collective succeed in mitigating critical slowing down for unfrustrated systems by introducing non-local cluster updates. However, in frustrated systems their efficiency deteriorates sharply, as quenched randomness in the couplings suppresses the formation of meaningful clusters. This fundamental limitation exposes a substantial gap in existing numerical methodologies for disordered spin glass systems. Recent advances in machine learning, particularly in deep generative modeling, have introduced new computational paradigms into statistical physics tomczak2022deep ; wanglei2025computation . Variational autoregressive networks (VANs) have emerged as promising alternatives to conventional sampling techniques wu2019solving . VANs employ autoregressive neural networks germain2015made ; oord2016pixel ; oord2016conditional as expressive variational ansätze, enabling efficient ancestral sampling bishop2006pattern without the need for Markov chains. A salient advantage of VANs is their ability to generate statistically independent samples, which can be incorporated into importance sampling nicoli2020asymptotically or used as global spin updates and further refined by a Metropolis acceptance-rejection criterion, ensuing unbiased sampling from the Boltzmann distribution mcnaughton2020boosting . Despite their promise, however, applications of generative neural networks have thus far remained largely limited to small-scale demonstrations, constrained by the considerable computational costs associated with training liu2025efficient . Another recent line of progress involves hybrid approaches that incorporate tensor networks into Monte Carlo frameworks frias-perez2023collective ; chen2025tensor . Originally developed for quantum many-body simulations white1992density ; schollwock2011densitymatrix ; orus2014practical ; cirac2021matrix ; orus2019tensor , tensor networks have since found broad applications in statistical physics levin2007tensor ; liu2021tropical and machine learning cheng2019tree ; cheng2021supervised ; glasser2019expressive ; han2018unsupervised ; liu2023tensor ; stoudenmire2016supervised . In particular, the partition function of the Ising model can be reformulated as a tensor network contraction problem. Building on this observation, a pioneering study introduced a tensor-network-based sampling scheme in which ancestral sampling is performed through contractions encoding conditional probabilities frias-perez2023collective . Unlike VANs, this approach dispenses with costly neural-network training, since contractions are deterministic with controllable numerical errors governed by bond dimensions and truncation thresholds. The configurations generated from tensor network contractions can be utilized as global proposals within a Metropolis framework. This Tensor Network Monte Carlo (TNMC) method was first validated on small systems as a proof of concept, and more recently demonstrated remarkable scalability: Ref. chen2025tensor applied TNMC to the two-dimensional random-bond Ising model nishimori1981internal , a paradigmatic and notoriously challenging spin glass, enabling simulations on lattices up to 1024\times 1024 and yielding precise estimates of multicritical points as well as bulk and surface exponents along the Nishimori line. Despite these advances, the original TNMC implementation in Ref. chen2025tensor remains computationally suboptimal. In spin glass simulations, quenched disorder averaging requires generating multiple samples for each disorder realization in order to construct the Markov chain. The original scheme adopted a serial sampling strategy, producing one configuration at a time per realization. Although partial reuse of intermediate contractions was possible, this inherently sequential procedure led to inefficient utilization of modern computational resources. Motivated by batch-processing techniques common in neural-network training, we propose a GPU-accelerated, parallel sampling framework for TNMC. By introducing an additional computational dimension corresponding to disorder realizations, our method enables simultaneous sampling across many disorder instances, thus dramatically enhancing the overall efficiency. In this work, we extend the TNMC framework of Ref. chen2025tensor and present BatchTNMC batchtnmc , a GPU-optimized implementation designed for large-scale two-dimensional spin glasses simulations. Developed within the PyTorch ecosystem paszke2019pytorch , our implementation fully exploits the parallel processing capabilities of modern GPUs, achieving speedups of up to five orders of magnitude compared to the serial codes. The rest of this paper is organized as follows: Section 2 outlines the theoretical foundations of TNMC; Section 3 describes the parallelization strategies and implementation details of BatchTNMC ; Section 4 presents benchmarking results that highlight the substantial performance gains of our approach; and Section 5 summarizes our findings and discusses future research directions. 2. Principles of the Tensor Network Monte Carlo method 2.1. Ancestral sampling from the Boltzmann distribution To establish the theoretical foundation of the TNMC algorithm, we consider the Ising spin glass defined on an open square lattice of size N=L\times L . The energy of a configuration \bm{s}=\{s_{1},\cdots,s_{N}\} is given by the Hamiltonian: \displaystyle E(\bm{s})=-\sum_{\langle i,j\rangle}J_{ij}s_{i}s_{j}, (1) where s_{i}\in\{-1,+1\} denotes the spin at site i , J_{ij} represents nearest-neighbor coupling, and \langle i,j\rangle denotes the set of nearest-neighbor pairs. The corresponding Boltzmann distribution reads \displaystyle P(\bm{s})=\frac{1}{Z}e^{-\beta E(\bm{s})}, (2) where \beta is the inverse temperature and Z=\sum_{\bm{s}}e^{-\beta E(\bm{s})} is the partition function. By applying the chain rule of probability, the joint distribution can be decomposed into a product of conditional probabilities, \displaystyle P(\bm{s})=P(s_{1})\prod_{i=2}^{N}P(s_{i}|\bm{s}_{<i}), (3) where \bm{s}_{<i}=\{s_{1},\cdots,s_{i-1}\} and \bm{s}_{>i}=\{s_{i+1},\cdots,s_{N}\} . Throughout this work we adopt a raster-scan ordering on the two-dimensional lattice, see Fig. 1 (a). This factorization is exact, and the conditional probability of spin s_{i} is given by \displaystyle P_{i}(s_{i}|\bm{s}_{<i})=\frac{P(\bm{s}_{<i+1})}{P(\bm{s}_{<i})}=\frac{\sum_{\bm{s}_{>i}}e^{-\beta E(\bm{s})}}{\sum_{\bm{s}_{>i-1}}e^{-\beta E(\bm{s})}}=\frac{f(s_{i},\bm{s}_{<i})}{\sum_{s_{i}}f(s_{i},\bm{s}_{<i})},

Read the complete text