Honest fix: README.md
Browse files
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.
|
|
|
|
|
|
|
| 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
|
| 30 |
- **High-z boost**: 1.5Γ weight above z=1.0
|
| 31 |
|
| 32 |
-
|
| 33 |
|
| 34 |
-
|
| 35 |
|
| 36 |
-
###
|
| 37 |
|
| 38 |
| Metric | Value |
|
| 39 |
|---|---:|
|
| 40 |
-
| MAE(z) |
|
| 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 |
-
|
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
|
| 54 |
-
|
| 55 |
|
| 56 |
-
|
| 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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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
|
| 73 |
-
β βββ best_metrics.json
|
| 74 |
βββ code/
|
| 75 |
-
β βββ hybrid_redshift.py
|
| 76 |
β βββ data.py, metrics.py, model.py, plots.py
|
| 77 |
βββ eval_results/
|
| 78 |
β βββ desi_2500_metrics.json
|
| 79 |
-
|
| 80 |
-
|
| 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 |
-
|
| 116 |
|
| 117 |
-
## Submission checklist
|
| 118 |
|
| 119 |
-
- [x] Approach A
|
| 120 |
-
- [x] Approach B
|
| 121 |
-
- [x] Redshift prediction
|
| 122 |
-
- [x] Masked
|
| 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
|
| 126 |
-
- [x]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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.
|