NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

AirFormer: Predicting Nationwide Air Quality in China with Transformers

Yuxuan Liang, Yutong Xia, Songyu Ke, Yiwei Wang, Qingsong Wen, Junbo Zhang, Yu Zheng, Roger Zimmermann · DOI

Introduction

Predicting air quality is a critical task for public health and environmental policy. However, scaling these predictions from individual cities to a nationwide level presents significant challenges. Traditional models, particularly standard Transformers using Multi-head Self-Attention (MSA), suffer from quadratic computational complexity $O(N^2)$ relative to the number of monitoring stations ($N$). While manageable for a few dozen stations, this complexity becomes prohibitive when dealing with over 1,000 stations across a country like China. Furthermore, air quality data is often "noisy" due to sensor failures and unpredictable external factors, making deterministic modeling difficult.

Nationwide PM2.5 concentration and station-level forecasting in China.

Methodology

AirFormer addresses these challenges through a decoupled architecture consisting of a bottom-up deterministic stage and a top-down stochastic stage.

1. Deterministic Representation Learning

To achieve computational efficiency, AirFormer introduces two novel attention modules:

  • Dartboard Spatial MSA (DS-MSA): This module mimics human geographic perception by partitioning the area around a station into a "dartboard" pattern. It attends to nearby stations with high granularity and distant stations with coarse granularity. This approach reduces spatial complexity to $O(N)$, enabling nationwide modeling on standard hardware.
  • Causal Temporal MSA (CT-MSA): This module processes time-series data using expanding local windows, similar to dilated convolutions, while strictly enforcing causality to prevent the model from accessing future information during training.
The Dartboard Spatial Attention mechanism: (a) spatial partition, (b) spatial projection, and (c) spatial attention.

2. Stochastic Latent Variable Stage

To handle data uncertainty and sensor noise, AirFormer incorporates a Variational Autoencoder (VAE) framework. By introducing hierarchical latent random variables ($Z$), the model learns the underlying probability distribution of air quality rather than just a single deterministic value. This allows the system to better account for sudden environmental shifts and measurement errors.

Experimental Setup

The model was evaluated using a massive dataset covering mainland China from 2015 to 2018. This dataset includes hourly readings of six major pollutants (PM2.5, PM10, NO2, CO, O3, and SO2) from 1,085 stations, supplemented by meteorological data from 2,575 weather stations. This scale is significantly larger than previous benchmarks, which typically focused on fewer than 200 stations.

Key Results

AirFormer was tested against 12 baseline models for 72-hour future predictions, yielding several key insights:

  • Superior Accuracy: AirFormer reduced Mean Absolute Error (MAE) by 5% to 8% compared to previous state-of-the-art models like GMAN and DeepAir.
  • Robustness to Spikes: In scenarios involving rapid pollution shifts (±20 µg/m³), AirFormer outperformed the best baseline by 7.3% in MAE and 13.1% in RMSE, demonstrating the value of its stochastic stage.
  • Efficiency: The DS-MSA module ran 39% faster than standard vanilla attention, proving that $O(N)$ complexity is the key to enabling nationwide forecasting.
  • Interpretability: Visualization of attention weights revealed that the model naturally learns to prioritize upwind stations, aligning with physical wind patterns.

Conclusion

AirFormer represents a significant step forward in environmental forecasting. By combining an efficient "dartboard" spatial attention mechanism with a stochastic VAE framework, it overcomes the scalability and uncertainty hurdles that previously limited nationwide air quality prediction. Future work will focus on addressing memory constraints for deeper architectures and adapting the model for dynamic sensor networks where stations are frequently added or relocated.

Summary updated

BibTeX
@inproceedings{liang2023airformer,
  author = {Yuxuan Liang and Yutong Xia and Songyu Ke and Yiwei Wang and Qingsong Wen and Junbo Zhang and Yu Zheng and Roger Zimmermann},
  title = {{AirFormer: Predicting Nationwide Air Quality in China with Transformers}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2023},
  doi = {10.1609/aaai.v37i12.26676},
}
Figure