ManmohanSharma commited on
Commit
8234278
Β·
verified Β·
1 Parent(s): 50a78a6

Honest fix: README.md

Browse files
Files changed (1) hide show
  1. README.md +78 -43
README.md CHANGED
@@ -1,6 +1,8 @@
1
  # NativeSpecZ-FM-76M
2
 
3
- A 76M-parameter unimodal foundation model for DESI spectra. Trained from scratch on 97,332 DESI EDR spectra. No AION weights, no pretrained encoder β€” everything is ours.
 
 
4
 
5
  ## What it does
6
 
@@ -26,40 +28,66 @@ A 76M-parameter unimodal foundation model for DESI spectra. Trained from scratch
26
  - crop 35%, throughput 45%, noise 25%, resolution 20%, downsample 12%
27
  - bad_window 25%, line_dropout 15%, span_dropout 15%
28
  - **Loss**: rec_weight 0.5, z_weight 1.0, z_bin_weight 0.45, z_nll_weight 0.03
29
- - **Mask ratio**: 0.15 train, 0.25-0.30 eval
30
  - **High-z boost**: 1.5Γ— weight above z=1.0
31
 
32
- The augmentation simulates non-DESI instrument characteristics during training, which is the cleanest way to encourage cross-instrument generalization without using non-DESI data.
33
 
34
- ## Headline results
35
 
36
- ### DESI held-out (n=2500, deduped from training)
37
 
38
  | Metric | Value |
39
  |---|---:|
40
- | MAE(z) | **0.0516** |
41
- | Median AE | 0.00212 |
42
- | RMSE | 0.189 |
43
- | Pearson r | **0.936** |
44
  | NMAD | 0.0019 |
 
45
  | Cat \|dz\|/(1+z)>0.01 | 13.5% |
46
- | Cat \|dz\|/(1+z)>0.05 | 9.0% |
47
  | Cat \|dz\|/(1+z)>0.15 | 6.8% |
48
- | Acc \|dz\|<0.10 | 90.6% |
49
- | Acc \|dz\|<0.20 | 92.3% |
50
- | Acc \|dz\|<0.30 | 93.6% |
51
- | Masked recon MSE (mask=0.25) | 0.037 |
52
- | Masked recon MSE (mask=0.30) | 0.437 |
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
 
54
- ### Cross-instrument generalization
55
 
56
- | Dataset | n | MAE(z) | NMAD | AION-base MAE |
57
- |---|---:|---:|---:|---:|
58
- | **DESI held-out** | 2500 | **0.052** | 0.0019 | 0.074 (AION loses) |
59
- | **SDSS (real non-DESI)** | 2000 | 0.382 | 0.385 | 0.127 |
60
- | **VIPERS (real non-DESI)** | 2000 | **0.172** | 0.087 | 0.274 (AION loses) |
61
 
62
- We beat AION-base on **DESI** by 30% and on **VIPERS** by 37%.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
 
64
  ## Folder structure
65
 
@@ -68,22 +96,16 @@ NativeSpecZ-FM-76M_Submission/
68
  β”œβ”€β”€ NativeSpecZ-FM-76M.ipynb ← demo notebook (load model, run eval, plot results)
69
  β”œβ”€β”€ README.md ← this file
70
  β”œβ”€β”€ weights/
71
- β”‚ β”œβ”€β”€ best.pt ← 306 MB model checkpoint
72
- β”‚ β”œβ”€β”€ training_args.json ← all hyperparameters
73
- β”‚ └── best_metrics.json ← training-time eval metrics
74
  β”œβ”€β”€ code/
75
- β”‚ β”œβ”€β”€ hybrid_redshift.py ← model architecture + collator + training loop
76
  β”‚ β”œβ”€β”€ data.py, metrics.py, model.py, plots.py
77
  β”œβ”€β”€ eval_results/
78
  β”‚ └── desi_2500_metrics.json
79
- └── plots/
80
- β”œβ”€β”€ scatter_redshift.png ← Predicted vs True scatter, Pearson r=0.9358
81
- β”œβ”€β”€ spectrum_reconstruction.png ← 4-panel masked-region reconstruction overlay
82
- β”œβ”€β”€ comparison_vs_aion.png ← MAE bar chart vs AION-base
83
- β”œβ”€β”€ foundation_evidence.png ← cross-instrument robustness
84
- β”œβ”€β”€ dashboard.png ← 6-panel model summary
85
- β”œβ”€β”€ multi_mask_reconstruction.png ← rec quality vs mask ratio
86
- └── stress_curve.png ← instrument-shift robustness
87
  ```
88
 
89
  ## How to reload the model
@@ -112,15 +134,28 @@ See `NativeSpecZ-FM-76M.ipynb` for the full inference + evaluation pipeline.
112
 
113
  ## Hugging Face
114
 
115
- Model also available at `ManmohanSharma/NativeSpecZ-FM-76M` on Hugging Face.
116
 
117
- ## Submission checklist
118
 
119
- - [x] Approach A (joint z-head training, encoder shaped by z)
120
- - [x] Approach B (always-masked z token)
121
- - [x] Redshift prediction working (MAE 0.052 on held-out DESI)
122
- - [x] Masked spectrum reconstruction working (rec MSE 0.037 at 25% mask)
123
- - [x] Cross-instrument testing on real non-DESI data (SDSS + VIPERS)
124
  - [x] Unimodal β€” DESI spectra + z only, no imaging
125
- - [x] No AION pretrained weights used
126
- - [x] Single-model submission with notebook + weights + report
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  # NativeSpecZ-FM-76M
2
 
3
+ A 76M-parameter unimodal foundation model for DESI spectra. Trained from scratch on 97,332 DESI EDR spectra. **The headline checkpoint (`weights/best.pt`) uses no AION pretrained weights** β€” every parameter in `best.pt` was learned from DESI data only.
4
+
5
+ (A secondary inference-time ensemble β€” the "strict OOD router" β€” does combine this checkpoint with AION-tokenized variants and is documented as a footnote at the bottom of this README. The router is not the headline submission.)
6
 
7
  ## What it does
8
 
 
28
  - crop 35%, throughput 45%, noise 25%, resolution 20%, downsample 12%
29
  - bad_window 25%, line_dropout 15%, span_dropout 15%
30
  - **Loss**: rec_weight 0.5, z_weight 1.0, z_bin_weight 0.45, z_nll_weight 0.03
31
+ - **Mask ratio**: 0.15 train, 0.25–0.30 eval
32
  - **High-z boost**: 1.5Γ— weight above z=1.0
33
 
34
+ ## Headline results on DESI held-out (n=2500, deduped from training)
35
 
36
+ Numbers depend on eval mask ratio β€” quoted honestly below.
37
 
38
+ ### At mask=0.25 (pixel-mode, the lightest eval)
39
 
40
  | Metric | Value |
41
  |---|---:|
42
+ | MAE(z) | 0.0516 |
 
 
 
43
  | NMAD | 0.0019 |
44
+ | Pearson r | 0.936 |
45
  | Cat \|dz\|/(1+z)>0.01 | 13.5% |
 
46
  | Cat \|dz\|/(1+z)>0.15 | 6.8% |
47
+ | Accuracy \|dz\|<0.10 | 90.6% |
48
+
49
+ ### At mask=0.30 (mixed_span, AION-comparable)
50
+
51
+ | Metric | Value |
52
+ |---|---:|
53
+ | MAE(z) | **0.0690** |
54
+ | Median AE | 0.0029 |
55
+ | RMSE | 0.207 |
56
+ | Pearson r | 0.922 |
57
+ | Cat \|dz\|/(1+z)>0.15 | 8.9% |
58
+ | Accuracy \|dz\|<0.10 | 86.8% |
59
+ | Accuracy \|dz\|<0.30 | 90.8% |
60
+ | Masked reconstruction MSE | 0.437 |
61
+
62
+ ### Clean-only subset (ZWARN==0, n=238)
63
+
64
+ | Metric | Value |
65
+ |---|---:|
66
+ | MAE(z) | **0.489** |
67
+ | NMAD | 0.305 |
68
 
69
+ **Honest disclosure**: clean-label spectra (`ZWARN==0`) are heavily biased toward higher z (median ~0.87) because that's where the DESI pipeline has highest confidence. Our model is strong at the bulk distribution but weak on this high-z clean subset. If the instructor's held-out benchmark filters to clean labels only, the model's redshift accuracy will be much worse than the bulk number above.
70
 
71
+ ## Comparison to AION-base
 
 
 
 
72
 
73
+ On the same 2500 DESI held-out subset (apples-to-apples eval setup):
74
+
75
+ | Metric | NativeSpecZ-FM-76M | AION-base | Margin |
76
+ |---|---:|---:|---|
77
+ | MAE(z) at mask=0.30 | **0.069** | 0.074 | we're ~7% better |
78
+ | MAE(z) at mask=0.25 | **0.052** | (AION not re-evaluated at this mask) | gentler eval |
79
+
80
+ So the honest headline: at the eval config most comparable to AION, we are roughly tied with AION-base on DESI in-distribution (small ~7% margin). The 30% margin we previously quoted was at a lighter mask ratio than the AION comparison.
81
+
82
+ ## Cross-instrument generalization (real non-DESI data)
83
+
84
+ | Dataset | n | NativeSpecZ-FM-76M MAE | AION-base MAE | Verdict |
85
+ |---|---:|---:|---:|---|
86
+ | **DESI held-out** | 2500 | **0.069** (mask=0.30) | 0.074 | we win ~7% |
87
+ | **SDSS** (MultimodalUniverse/sdss) | 2000 | 0.382 | **0.127** | **AION wins, we lose** by 3Γ— |
88
+ | **VIPERS** (MultimodalUniverse/vipers) | 2000 | **0.172** | 0.274 | we win by 37% |
89
+
90
+ **Honest read**: we beat AION-base on DESI (small margin) and VIPERS (large margin); we lose to AION-base on SDSS by a wide margin. SDSS is the visible weakness of this from-scratch model. The plot `foundation_evidence.png` shows the SDSS-to-DESI degradation ratio honestly β€” our ratio is much higher than AION's, reflecting the SDSS loss.
91
 
92
  ## Folder structure
93
 
 
96
  β”œβ”€β”€ NativeSpecZ-FM-76M.ipynb ← demo notebook (load model, run eval, plot results)
97
  β”œβ”€β”€ README.md ← this file
98
  β”œβ”€β”€ weights/
99
+ β”‚ β”œβ”€β”€ best.pt ← 306 MB model checkpoint (the headline)
100
+ β”‚ β”œβ”€β”€ training_args.json
101
+ β”‚ └── best_metrics.json
102
  β”œβ”€β”€ code/
103
+ β”‚ β”œβ”€β”€ hybrid_redshift.py
104
  β”‚ β”œβ”€β”€ data.py, metrics.py, model.py, plots.py
105
  β”œβ”€β”€ eval_results/
106
  β”‚ └── desi_2500_metrics.json
107
+ β”œβ”€β”€ plots/ ← 7 figures (see below)
108
+ └── router_strict_ood_verified_*/ ← optional secondary system, see footnote
 
 
 
 
 
 
109
  ```
110
 
111
  ## How to reload the model
 
134
 
135
  ## Hugging Face
136
 
137
+ `ManmohanSharma/NativeSpecZ-FM-76M` on Hugging Face.
138
 
139
+ ## Submission checklist (honest version)
140
 
141
+ - [x] Approach A β€” z head trained jointly, encoder shaped by z
142
+ - [x] Approach B β€” `[Z_MASK]` token always masked
143
+ - [x] (a) Redshift prediction β€” works at MAE 0.069 (mask=0.30) on held-out DESI
144
+ - [x] (b) Masked reconstruction β€” works at MSE 0.437 (mask=0.30); line-region pixels are ~2Γ— harder than continuum (evidence of learned spectral structure)
 
145
  - [x] Unimodal β€” DESI spectra + z only, no imaging
146
+ - [x] No AION pretrained weights in the headline checkpoint
147
+ - [x] Cross-instrument testing on real non-DESI: **beats AION on VIPERS, loses to AION on SDSS** β€” both reported honestly
148
+ - [⚠] Clean-subset (ZWARN==0) performance is weak (MAE 0.49) β€” bulk performance is strong but clean-label benchmarks will show this gap
149
+ - [⚠] 300M-parameter spec target β€” we ship 76M, below target
150
+
151
+ ## Footnote β€” the optional strict-OOD router system
152
+
153
+ The folder `router_strict_ood_verified_20260519_163714/` contains an inference-time ensemble that combines three checkpoints (this 76M native + AION-token + AION-continuous v3) and uses AION-cont's reconstruction MSE as an OOD gate. Its numbers are:
154
+
155
+ | Dataset | Router MAE | This 76M alone | AION-base |
156
+ |---|---:|---:|---:|
157
+ | DESI | 0.054 | 0.069 (mask=0.30) | 0.074 |
158
+ | SDSS | **0.135** | 0.382 | 0.127 |
159
+ | VIPERS | 0.184 | 0.172 | 0.274 |
160
+
161
+ The router has the best aggregate numbers but **uses AION encoder weights** (via the AION-cont component) and **has a hand-tuned OOD threshold**. It's documented for completeness, not as the headline submission.