All models

AirFormer

A two-stage Transformer that forecasts air quality for monitoring stations across China.

Time series · 498 operations Checked

100%

Showing the top corner; full diagram not loaded yetShowing a small copy; full diagram not loaded yetLarge diagram, not loaded yet

Open SVG

Loading diagram (96 KB)

Open in a new tab

Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.

At a glance

Parameters
232K
Operations
498
Framework
PyTorch
Recurrent
No
Published
AAAI 2023
Cited by
183 (as of 27 October 2026)
Authors
Yuxuan Liang, Yutong Xia, Songyu Ke and others
Checked
Passed: the trace was replayed operation by operation and matched the model's own output for this input.

Files

The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.

Details
Stable ID
m14662
Graph hash
1fc158fdc63f188cbb3f6ac60c2b6b6da53d7c116cb767615e78096e5c83c995
Skeleton hash
221b91fa4a846f7429225632c7d88ed352e2d39f1473efcec9618a933dbd5d51
Architecture hash
7a10e20e311561c5b3cc0036a24b875b2a3f735341f4e70207103f41d9a691f5
Diagram SHA-256
a858f64a58987a220ab0e3b4ef2b3e6cfa51535874b869030efc3fafa284606b
TorchLens version
2.36.0
Renderer
graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
Check
Forward pass replayed in PyTorch

What it is

AirFormer is a Transformer architecture that predicts air quality across China for thousands of locations together. The paper evaluates it with 4-year data from 1,085 stations in the Chinese Mainland.

The model splits learning into two stages. The first is a bottom-up deterministic stage with two new types of self-attention that learn spatio-temporal representations efficiently. The second is a top-down stochastic stage that uses latent variables to capture the intrinsic uncertainty of air quality data. In the authors' code the stochastic stage is optional: a flag turns it on or off, and one of the examples trains AirFormer without latent variables.

The paper reports that AirFormer reduces prediction errors by 5% to 8% on 72-hour future predictions compared with the leading model at the time. The air quality and meteorology dataset used in the paper is larger than 500GB, so the repository provides a tiny version with 20 training, 20 validation and 20 test instances.

Key idea. AirFormer predicts nationwide air quality with a two-stage Transformer: a deterministic stage with two new self-attention mechanisms and a stochastic stage with latent variables.

  • airformer
  • air quality prediction
  • air quality forecasting
  • nationwide air quality
  • air pollution forecasting
  • spatio-temporal forecasting
  • transformer forecasting
  • ds-msa
  • ct-msa

AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.

Cite the paper

@misc{liang2022airformerpredictingnationwideair,
      title={AirFormer: Predicting Nationwide Air Quality in China with Transformers}, 
      author={Yuxuan Liang and Yutong Xia and Songyu Ke and Yiwei Wang and Qingsong Wen and Junbo Zhang and Yu Zheng and Roger Zimmermann},
      year={2022},
      eprint={2211.15979},
      archivePrefix={arXiv},
      primaryClass={eess.SP},
      url={https://arxiv.org/abs/2211.15979}, 
}