Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Neural Scaling Analysis (NSA)

Finite-size scaling (FSS) analysis is a fundamental technique in statistical physics and computational condensed matter physics for investigating critical phenomena and phase transitions from finite-size numerical simulation data.

Neural Scaling Analysis (NSA) is a machine learning framework that formulates finite-size scaling analysis as an end-to-end regression problem using neural networks. This package jaxfss provides a fast, JIT-compiled, flexible implementation of NSA built on top of JAX, Flax, and Optax.


1. Finite-Size Scaling Hypothesis

Near a continuous phase transition at a critical point TcT_{\mathrm{c}}, correlation lengths diverge and physical observables obey universal scaling relations. In a finite-size system with linear dimension LL at temperature TT, an observable A(T,L)A(T, L) follows the finite-size scaling law:

A(T,L)=L−c2F[(T−Tc)Lc1]A(T, L) = L^{-c_2} F\left[ (T - T_{\mathrm{c}}) L^{c_1} \right]

where:

The goal of scaling analysis is to estimate the critical parameters (Tc,c1,c2)(T_{\mathrm{c}}, c_1, c_2) such that data points (X,Y)=((T−Tc)Lc1,A(T,L)Lc2)(X, Y) = \left( (T - T_{\mathrm{c}}) L^{c_1}, A(T, L) L^{c_2} \right) from different system sizes LL collapse onto a single master curve F[X]F[X].


2. Motivation: Why Neural Networks?

Traditionally, two main methods have been used to perform finite-size scaling analysis:

  1. Polynomial regression:

    • Approximates the scaling function F[X]F[X] with a low-order Taylor polynomial.

    • Limitations: Only valid in a narrow region around the critical point (X≈0X \approx 0). Prone to overfitting or underfitting if the polynomial degree is mischosen.

  2. Gaussian Process (GP) regression (e.g., Harada’s Bayesian Scaling Analysis):

    • Provides non-parametric, flexible curve fitting with error estimation.

    • Limitations: Computational complexity scales as O(N3)\mathcal{O}(N^3) where NN is the number of data points, making it prohibitively heavy for large-scale or dense Monte Carlo datasets.

Neural Scaling Analysis (NSA) overcomes both limitations:


3. Method Architecture

In NSA, the scaling function FF is parameterized by a neural network NNθ\mathsf{NN}_{\theta}:

Y=NNθ(X)Y = \mathsf{NN}_{\theta}(X)

The network parameters θ\theta and the critical parameters ϕ=(c1,c2,Tc)\phi = (c_1, c_2, T_{\mathrm{c}}) are jointly optimized by minimizing a loss function:

min⁡θ,ϕL(θ,ϕ)\min_{\theta, \phi} \mathcal{L}(\theta, \phi)

Data Pre-Processing (CriticalData)

Neural networks train best when inputs and targets are standardized to order O(1)\mathcal{O}(1). CriticalData automatically applies affine transformations:

Parameter Constraints (Bijectors)

Physical exponents often have known constraints (e.g., c1>0c_1 > 0, or Tc∈[Tmin⁡,Tmax⁡]T_{\mathrm{c}} \in [T_{\min}, T_{\max}]). Using bijectors (such as softclip.SoftClip), unconstrained optimization variables pp are mapped to physical parameters:

Activation Functions (RationalMLP)

Standard ReLU or sigmoid networks can have derivative discontinuities or saturation issues. RationalMLP uses trainable rational functions P(x)/Q(x)P(x)/Q(x) as activations, offering superior smoothness and expressiveness for physical functions.


4. Loss Functions

Mean Squared Error (MSELoss)

When observational uncertainties are uniform or negligible:

LMSE=1N∑i=1N(Yi−NNθ(Xi))2\mathcal{L}_{\mathrm{MSE}} = \frac{1}{N} \sum_{i=1}^N \left( Y_i - \mathsf{NN}_{\theta}(X_i) \right)^2

Negative Log-Likelihood Loss (NLLLoss)

When Monte Carlo errors σi\sigma_i are provided for each data point:

LNLL=12N∑i=1N[(Yi−NNθ(Xi))2σY,i2+log⁡(2πσY,i2)]\mathcal{L}_{\mathrm{NLL}} = \frac{1}{2N} \sum_{i=1}^N \left[ \frac{(Y_i - \mathsf{NN}_{\theta}(X_i))^2}{\sigma_{Y, i}^2} + \log(2\pi \sigma_{Y, i}^2) \right]

where the scaled variance is σY,i2=σi2Li2c2\sigma_{Y, i}^2 = \sigma_i^2 L_i^{2 c_2}.


5. Dual Optimization Strategy

Because the neural network weights θ\theta and critical parameters ϕ\phi have different optimization landscapes, it is advantageous to use separate learning rates:

jaxfss.fit supports passing a dictionary of Optax optimizers:

optimizer = {
    "mlp": optax.adam(learning_rate=1e-3),
    "fss": optax.adam(learning_rate=1e-2),
}
params, losses, critical_vals = jaxfss.fit(loss_fn, optimizer, init_params, steps=10000)

Reference

If you use NSA or jaxfss in your research, please cite:

References
  1. Yoneda, R., & Harada, K. (2023). Neural network approach to scaling analysis of critical phenomena. Physical Review E, 107(4). 10.1103/physreve.107.044128