This repository contains the code for training ViT and ClimaX backbones, Sparse Autoencoders (SAEs), and SAE-Xplainers, as described in the paper SAE-Xplainers: Rule-Based Feature Interpretation for Extreme Earth Events.
- ππ The paper is available on ArXiv.
- π¨π¬ We provide a tool to investigate ClimaX features on SeasFire and ClimateNet available at this Demo Link.
Overview Framework
- Installation
- Repository Structure
- Data
- Models Finetuning
- Sparse Autoencoders Training
- SAE-Xplainers Training
- SAE-Xplainers Evaluation
- Citation
Install the required Python libraries:
pip install -r requirements/requirements.txt --extra-index-url https://download.pytorch.org/whl/cu121Requirements: Python 3.10+, CUDA 12.1 (for GPU training).
.env_template for the environment variables required to run this repository. Copy it to .env and fill in the values for your setup.
βββ ClimaX/ # ClimaX backbone (git submodule)
βββ televit/ # TeleViT backbone (git submodule)
βββ configs/ # Hydra configs
βββ data/ # Datasets (SeasFire, ClimateNet) β populated after download
βββ logs/ # Training logs, checkpoints, WandB runs β generated after running scripts
βββ models/ # Pretrained checkpoints (e.g. ClimaX pretrained weights)
βββ requirements/ # Python dependency files
βββ scripts/
β βββ downstream/ # ClimaX/ViT/ProtoSeg finetuning
β βββ sae/ # TopK + GeoTopK training
β βββ xplainer/ # SAE-Xplainers training
β βββ absorption/ # Absorption score evaluation
βββ src/ # Core source code
βββ stats/ # Precomputed statistics (e.g. normalization stats, dataset stats)
Note:
ClimaX/andtelevit/are git submodules. Clone withgit clone --recurse-submodules <repo-url>, or rungit submodule update --init --recursiveafter a regular clone.
SeasFire β Download version 0.3 from Zenodo and decompress it into your target data folder (default: ./data).
ClimateNet β First, move climatenet-splits/train.txt and climatenet-splits/test.txt extracted from the NERSC portal into your target ClimateNet data folder (default: ./data/climatenet). Then run:
python src/data/download_clim.pyto extract all tiles.
Download the pretrained checkpoint and place it in your target model folder (default: ./models).
SeasFire
bash scripts/downstream/climax_training.sh
bash scripts/downstream/vit_training.shClimateNet
bash scripts/downstream/climax_training_clim.sh
bash scripts/downstream/vit_training_clim.shWarm-up stage (SeasFire and ClimateNet)
bash scripts/downstream/proto/climax_experiments_proto.sh
bash scripts/downstream/proto/climax_experiments_clim_proto.shFinetuning stage (SeasFire and ClimateNet)
Before running: set
proto_path(checkpoint from the last epoch of the warm-up stage) in theYAMLconfig.
bash scripts/downstream/proto/climax_experiments_proto_finetune.sh
bash scripts/downstream/proto/climax_experiments_clim_proto_finetune.shPerformance of ClimaX, ViT, and ProtoSeg finetuned on SeasFire and ClimateNet. * denotes results reported from the original papers.
SeasFire
| Metric | ClimaX | ViT | ProtoSeg | U-Net++* |
|---|---|---|---|---|
| PRAUC β | 0.6205 | 0.6150 | 0.5161 | 0.6100 |
ClimateNet
| Metric | ClimaX | ViT | ProtoSeg | DeepLabV3+* |
|---|---|---|---|---|
| IoU β | 0.5385 | 0.4972 | 0.4254 | 0.5247 |
Scripts to reproduce Table 1 (ClimaX & ViT Γ SeasFire & ClimateNet Γ TopK & GeoTopK, 8 configurations total) are in ./scripts/sae. Run each individually, e.g.:
bash scripts/sae/sae_training.shBefore running: set
model_path(ViT and ClimaX checkpoint) in theYAMLconfig.
Comparison of TopK and GeoTopK on the last residual stream of ClimaX and ViT, finetuned on SeasFire and ClimateNet respectively. Bold indicates the best score; underline indicates a near-tie (difference β€ 0.005).
SeasFire
| Metric | ClimaX (TopK) | ClimaX (GeoTopK) | ViT (TopK) | ViT (GeoTopK) |
|---|---|---|---|---|
|
|
0.927 | 0.937 | 0.825 | 0.840 |
|
|
0.881 | 0.901 | 0.767 | 0.786 |
|
|
0.801 | 0.807 | 0.651 | 0.633 |
| MSE β | 1.84e-3 | 1.59e-3 | 1.77e-1 | 1.63e-1 |
| Dead Feat. β | 0.159 | 0.002 | 0.021 | 0.000 |
ClimateNet
| Metric | ClimaX (TopK) | ClimaX (GeoTopK) | ViT (TopK) | ViT (GeoTopK) |
|---|---|---|---|---|
|
|
0.943 | 0.953 | 0.987 | 0.993 |
|
|
0.910 | 0.924 | 0.983 | 0.988 |
|
|
0.880 | 0.893 | 0.974 | 0.980 |
| MSE β | 1.01e-3 | 0.84e-3 | 12.85e-3 | 7.12e-3 |
| Dead Feat. β | 0.513 | 0.391 | 0.811 | 0.442 |
To reproduce the scaling experiments, edit nb_k and nb_concepts in sae_training.sh and sae_training_scale.sh to one of the following pairs (nb_k, nb_concepts): (8, 8192) or (16, 16384).
Ablations for the two geographic modulation components: localization-aware adaptive normalization (LOAN) and per-latitude SAE band bias (LatBias), can be run via:
bash scripts/sae/ablation/loan_sae_training_scale.sh
bash scripts/sae/ablation/latbias_sae_training_scale.shFor the scalar-only, shift-only, and scale-only variants, modify the plSAE.forward function directly in src/model/sae_module.py.
The following scripts directly compute the SAE-Xplainers across the three Skope-Rules parametrizations and with or without spatial context.
Before running: set
sae_ckpt_path(SAE checkpoint), andoutput_act_dir(output model activations) in theYAMLconfig.
GeoTopK Interpretations
bash scripts/xplainer/white_box_training_multi_adapt_spa.sh
bash scripts/xplainer/white_box_training_multi_adapt_spa_clim.shClimaX Neurons Interpretations
bash scripts/xplainer/white_box_training_multi_adapt_spa_neurons.sh
bash scripts/xplainer/white_box_training_multi_adapt_spa_clim_neurons.shProtoSeg Prototypes Interpretations
bash scripts/xplainer/white_box_training_multi_adapt_spa_proto.sh
bash scripts/xplainer/white_box_training_multi_adapt_spa_clim_proto.shFirst, the SAE-Xplainers are aggregated via this python script that also outputs the aggregated evaluation accuracy:
python src/eval/merge_rules.pyBefore running: set
runs(Skope-Rules runs) in theYAMLconfig.
The absorption scores across both datasets are directly computed on the set of SAE-Xplainers trained on GeoTopK via the following scripts:
bash scripts/absorption/absorption.sh
bash scripts/absorption/absorption_clim.shBefore running: set
rules_csv(SAE-Xplainers CSV files) in thebashscript.
SAE-Xplainers Quantitative Analysis
The high fire risk True Conditions and Inverse Conditions scores for the paper Table 2, are computed via the python script:
python src/eval/fire_conds.pyBefore running: set
path_rules(target SeasFire SAE-Xplainers CSV file), andtest_data(SAE codes and SeasFire labels) in theYAMLconfig.
Ratio of rule sets containing true (Tr) and inverse (Inv) conditions for fire-specific dimensions.
| Metric | Neurons | Prototypes | GeoTopK |
|---|---|---|---|
|
|
0.33 | 0.50 | 0.46 |
|
|
0.16 | 0.20 | 0.02 |
The scores in Table 7 are computed via the following python script:
python src/eval/sampling_comp.pyBefore running: set
runs(multiple seed runs) in theYAMLconfig.
Comparison of sampling strategies for training SAE-Xplainers on ClimaX finetuned on SeasFire. Results are averaged across three runs, reported as mean Β± standard deviation.
| Sampling | Stability β |
|
|
|---|---|---|---|
| Random | 0.688 Β± 0.023 | 0.633 Β± 0.059 | 0.490 Β± 0.064 |
| Adversarial | 0.705 Β± 0.017 | 0.574 Β± 0.071 | 0.497 Β± 0.074 |
We also provide for this paper a global model interpretations framework available at this Demo Link, to investigate the SAE's features identify in the ClimaX models fine-tuned on SeasFire and CliamteNet.
The paper is currently under-review to cite please refer to our ArXiv version:
@misc{porta2026saexplainersrulebasedfeatureinterpretation,
title={SAE-Xplainers: Rule-Based Feature Interpretation for Extreme Earth Events},
author={Hugo Porta and Emanuele Dalsasso and Chang Xu and Theo Gnassounou and Devis Tuia},
year={2026},
eprint={2608.20117},
archivePrefix={arXiv},
primaryClass={cs.LG},
url={https://arxiv.org/abs/2608.20117},
}



