Sampling two-dimensional spin systems with transformers

Piotr Białas, Piotr Korcyl, Tomasz Stebel, Adam Stefański, Dawid Zapolski
4/30/2026
cond-mat.dis-nncond-mat.stat-mechcs.LG
transformer-attention

No confident code implementation found for this paper.

Abstract

Autoregressive Neural Networks based on dense or convolutional layers have recently been shown to be a viable strategy for generating classical spin systems. Unlike these methods, sampling with transformers is commonly considered to be computationally inefficient.

Show full abstract

In this work, we propose a novel approach to transformer-based neural samplers in which we generate not a single spin per step but groups of spins. As an additional improvement, we construct a model of approximated probabilities, further improving the efficiency of the algorithm. Despite our approach being computationally heavier than dense networks or CNN-based approaches, we were able to sample larger systems of up to $180 \times 180$ spins in case of the Ising model. The Effective Sample Size of our sampler is $\sim 20$ times larger than that of the previous state-of-the-art neural sampler when trained for the $128 \times 128$ Ising model at critical temperature. Finally, we also test our algorithm on the 2D Edwards-Anderson model, where we train $64\times 64$ spin systems.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{biaas2026sampling,
  title  = {Sampling two-dimensional spin systems with transformers},
  author = {Piotr Białas and Piotr Korcyl and Tomasz Stebel and Adam Stefański and Dawid Zapolski},
  year   = {2026},
  eprint = {2604.27738},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2604.27738v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2604.27738.svg)](https://codeofpaper.com/paper/2604.27738)

Discussion