Table of Contents
Fetching ...

A differentiable programming framework for spin models

Tiago de Souza Farias, Vitor Vaz Schultz, José Carlos Merino Mombach, Jonas Maziero

TL;DR

We present a differentiable programming framework for simulating and optimizing three spin-model families—Ising, Potts, and Cellular Potts—by reformulating Metropolis-Hastings updates as differentiable operations on batched tensors and computing energies via convolution. The approach enables gradient-based optimization of both exchange parameters $J_{ij}$ and spin values, and is implemented in PyTorch to leverage GPUs and TPUs. Key contributions include a unified differentiable Monte Carlo methodology, demonstration of energy-minimizing optimization tasks, and substantial hardware-accelerated speedups across Ising, Potts, and CPM simulations. This framework broadens the use of differentiable programming in statistical physics and related fields, with potential impact on materials science, biology, and combinatorial optimization.

Abstract

We introduce a novel framework for simulating spin models using differentiable programming, an approach that leverages the advancements in machine learning and computational efficiency. We focus on three distinct spin systems: the Ising model, the Potts model, and the Cellular Potts model, demonstrating the practicality and scalability of our framework in modeling these complex systems. Additionally, this framework allows for the optimization of spin models, which can adjust the parameters of a system by a defined objective function. In order to simulate these models, we adapt the Metropolis-Hastings algorithm to a differentiable programming paradigm, employing batched tensors for simulating spin lattices. This adaptation not only facilitates the integration with existing deep learning tools but also significantly enhances computational speed through parallel processing capabilities, as it can be implemented on different hardware architectures, including GPUs and TPUs.

A differentiable programming framework for spin models

TL;DR

We present a differentiable programming framework for simulating and optimizing three spin-model families—Ising, Potts, and Cellular Potts—by reformulating Metropolis-Hastings updates as differentiable operations on batched tensors and computing energies via convolution. The approach enables gradient-based optimization of both exchange parameters and spin values, and is implemented in PyTorch to leverage GPUs and TPUs. Key contributions include a unified differentiable Monte Carlo methodology, demonstration of energy-minimizing optimization tasks, and substantial hardware-accelerated speedups across Ising, Potts, and CPM simulations. This framework broadens the use of differentiable programming in statistical physics and related fields, with potential impact on materials science, biology, and combinatorial optimization.

Abstract

We introduce a novel framework for simulating spin models using differentiable programming, an approach that leverages the advancements in machine learning and computational efficiency. We focus on three distinct spin systems: the Ising model, the Potts model, and the Cellular Potts model, demonstrating the practicality and scalability of our framework in modeling these complex systems. Additionally, this framework allows for the optimization of spin models, which can adjust the parameters of a system by a defined objective function. In order to simulate these models, we adapt the Metropolis-Hastings algorithm to a differentiable programming paradigm, employing batched tensors for simulating spin lattices. This adaptation not only facilitates the integration with existing deep learning tools but also significantly enhances computational speed through parallel processing capabilities, as it can be implemented on different hardware architectures, including GPUs and TPUs.
Paper Structure (14 sections, 8 equations, 9 figures, 2 tables, 2 algorithms)

This paper contains 14 sections, 8 equations, 9 figures, 2 tables, 2 algorithms.

Figures (9)

  • Figure 1: The checkerboard method marks each spin of a lattice (a) with a color from a checkerboard pattern (b). All spins marked with the same color are updated in parallel.
  • Figure 2: Lattice configurations for two different temperatures of the Ising model. (a) $T < Tc$ and (b) $T > Tc$. (c) Magnetization with respect of the temperature for different lattice sizes. The temperature is measured in units of the Boltzmann constant $k_B$.
  • Figure 3: Flips per nanosecond for different lattice and batch sizes. (a) Simulation on CPU, (b) GPU and (c) TPU.
  • Figure 4: Lattice configurations for three different temperature of the Potts model with $q=3$. Each color represents a spin state. (a) $T < Tc$, (b) $T \approx Tc$, (c) $T > Tc$.
  • Figure 5: Cellular Potts Model simulation. Each figure is a snapshot from different steps of the simulation. The cells spontaneously reorder themselves into clusters of same type as the the number of Monte Carlo steps increases.
  • ...and 4 more figures