File size: 3,870 Bytes
a52b0fb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
198e01f
 
1b44b21
530d381
a52b0fb
 
530d381
a52b0fb
 
 
 
 
 
198e01f
 
1b44b21
530d381
 
a52b0fb
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
---
tags:
- climate
- weather
- e3sm
- vision-transformer
- interpretability
library_name: pytorch
---

# vit-interp-e3sm: a close-to-vanilla ViT emulator of E3SMv3, built to be taken apart

A plain Vision Transformer that steps the E3SMv3 atmosphere (1°, AMIP) forward 6 hours. It was built for an
interpretability hackathon: attention heads, edge circuits (Vi-CD) and physical-law tests (LAWFUL) with
[exege](https://github.com/mahf708/exege).

**Results, the architecture explorer and executed notebooks:**
https://web.lcrc.anl.gov/public/e3sm/diagnostic_output/ac.ngmahfouz/vit-interp/

## Model

- 34 prognostic fields (PS, TS; T, U, V, total water on 8 levels) + 5 forcings in, 6-hour tendency out.
- 4°×4° patches → 4050 tokens, learned position embedding, 8 pre-LayerNorm blocks × 6 heads (dim 384), global
  attention, linear decoder; 16.2 M parameters. The state is carried forward and conservation corrections are
  applied outside the network.

| file | version | recipe | 5-day ACC (2010): PS / T_7 / U_3 / V_3 |
|---|---|---|---|
| `v1/v1.pt` | v1 | 2000–2009, MSE, one-step then 4- and 8-step rollouts | 0.87 / 0.84 / 0.83 / 0.78 |
| `v2/v2.pt` | v2 | 1980–2009, + 10 diagnostic outputs, ACE-style correctors in the loss, 3×3 output conv, EMA, input noise | 0.92 / 0.89 / 0.87 / 0.84 |
| `v3/v3.pt` | v3 | v2 made stochastic: noise-conditioned LayerNorms (32-dim per-token noise, zero-init), CRPS on 2-member ensembles, 4- then 8-step rollouts; best 10-day skill, spread/skill ≈ 0.95 | 0.92 / 0.89 / 0.86 / 0.83 |
| `v4/v4.pt` | v4 | v3 trained on random-length rollouts of 4–16 steps (1–4 days) with the gradient through the last step only; the year-long free run stays stable | 0.89 / 0.86 / 0.84 / 0.80 |
| `v7/v7.pt` | v7 | v4 continued with ACE's spectral energy score, 4–24-step rollouts, training with random sub-patch grid shifts, and STRATA's anti-aliased patch embedding (no new parameters). **For long runs, use patch jitter + the seam filter** (`pg.rollout` does past 10 days): a realistic climate for 6.6–10 years over 2000–2009 (3 noise seeds), with E3SM's day-to-day variability and SST response | 0.89 / 0.85 / 0.83 / 0.79 (with jitter + filter) |
| `v8/v8.pt` | v8 | **3D (ViViT-style)**: one token per level (8 atmospheric levels + a surface level, 9 × 4050 tokens), in every block 4 horizontal and 2 vertical attention heads, rotary horizontal positions, anti-aliased embedding; 14.4 M parameters, trained from scratch (20 one-step epochs, then 8 epochs of v7's rollout recipe). Best forecaster; with jitter + filter all 3 ten-year runs stay realistic | **0.93 / 0.90 / 0.88 / 0.85** (with jitter + filter) |

`v*/eval_2010.md` has each version's full evaluation (year-long free run on 2010 and 1–10-day skill).
v1 uses `data-v1/`; v2, v3, v4, v7 and v8 use `data-v2/`. `data-v1/`, `data-v2/` hold the normalization statistics and grid metadata (`stats.npz`, `meta.json`; v2 also has
the hybrid coefficients for the correctors). The training data are E3SMv3 output and are not included.

## Use

The code is in the vit-interp repository (`vit_interp.emulator.Emulator.load`, `vit_interp.playground`, and the
`vit-interp` adapter for exege). Free runs drift after several months (moist and cold for v2): few-day questions
give the cleanest answers. v3 and v4 are stochastic: `Emulator.step` draws fresh noise on each call
(pass `generator=` or `noise=` to fix it); `Emulator.ensemble(x, n, seed)` gives ensembles. Load any version by name with
`vit_interp.playground.load("v3")`. v7 needs the jitter and filter for free runs longer than a few weeks
(`vit_interp.filters.PatchJitter`, `SeamFilter`; `Emulator.rollout(..., jitter=, smooth=)`). v8 is a different
architecture (`vit_interp/model3d.py`); load it with `vit_interp.playground.load("v8")` from vit-interp `main`.

Research artifact, work in progress.