PyTorchFire: A GPU-accelerated wildfire simulator with Differentiable Cellular Automata

Zeyu Xia, Sibo ChengEnviron. Model. Softw 2025

Introduction

Predicting wildfire spread is a critical, time-sensitive challenge. Traditional wildfire models typically fall into two categories: slow, CPU-bound physical/semi-empirical models that struggle with real-time high-resolution prediction, and fast machine learning surrogates that often fail to generalize across diverse topographies and fuel types. Furthermore, calibrating these models to match real-time satellite observations usually requires computationally expensive brute-force searches.

PyTorchFire addresses these limitations by introducing an open-source, GPU-accelerated simulator that redesigns traditional Cellular Automata (CA) to be fully differentiable. By leveraging PyTorch’s automatic differentiation, the system can calibrate simulation parameters in real-time using gradient descent, achieving millisecond-level efficiency and high spatial accuracy.

Differentiable Cellular Automata (DCA)

The core innovation of PyTorchFire is the transition from discrete, non-differentiable CA states to a differentiable framework. In standard CA, state transitions are binary. PyTorchFire, however, treats the ignition process as a continuous probability-like function, allowing for the calculation of gradients with respect to environmental parameters.

The simulation architecture showing the flow from environmental data and parameters to the differentiable update loop.

Technical Innovations

  • GPU Acceleration: Built entirely on PyTorch, the simulator achieves massive parallelization across grid cells. This ensures high portability across NVIDIA, AMD, and CPU hardware without requiring custom CUDA kernels.
  • Differentiable Normalization: To ensure the ignition process can be tracked via gradients, the authors employ a normalization function $f_p$ (based on tanh). This "smooths" the transition, allowing for backpropagation through the simulation steps.
The normalization function $f_p(x)$ used to ensure differentiability in the ignition process.
  • Update by Step Rings: To manage the memory overhead of backpropagating through hundreds of steps, the system uses a "step rings" technique. It only attaches specific rings of newly ignited cells to the computation graph, balancing memory efficiency with sufficient gradient signal.
  • Hybrid Loss Function: Parameter optimization is driven by a combination of Binary Cross Entropy (BCE) for shape matching and Mean Squared Error (MSE) with 2D average pooling to match the fire's overall scale.

Datasets and Validation

The model was validated using high-resolution environmental data and historical California fire events:

  • Environmental Data: LANDFIRE (30m resolution topography and vegetation) and ECMWF/ERA5 (daily wind data).
  • Ground Truth: MODIS satellite thermal observations.
  • Case Studies: The Bear (2020), Brattain (2020), and Pier (2017) fires served as primary test cases for real-world calibration.

Key Results and Insights

PyTorchFire transforms wildfire simulation into an optimization problem. By treating parameters like fuel susceptibility and wind scaling as "weights" in a neural network, the simulator can "learn" local conditions in real-time.

  • Computational Efficiency: On an NVIDIA RTX 4090, a 300-step simulation on a 1,200 x 1,200 grid completes in less than one second. On an A800, it scales to 14,000 x 14,000 grids in under a minute.
  • Calibration Accuracy: In the Bear Fire case study, gradient-based calibration improved the Jaccard Index (spatial overlap) from 0.17 (uncalibrated) to approximately 0.80, demonstrating a high degree of fidelity to actual fire perimeters.

Limitations and Future Work

While PyTorchFire represents a significant step forward, several areas for improvement remain. The current model assumes a relatively uniform spread speed and does not yet fully integrate complex "spotting" effects (embers jumping barriers) into the differentiable map. Future iterations aim to incorporate more granular variables like fine fuel moisture content and support for multiple simultaneous ignition points.

Summary updated

BibTeX
@inproceedings{xia2025pytorchfire,
  author = {Zeyu Xia and Sibo Cheng},
  title = {{PyTorchFire: A GPU-accelerated wildfire simulator with Differentiable Cellular Automata}},
  booktitle = {Environ. Model. Softw},
  year = {2025},
}
Figure