TiexinDing commited on
Commit
bef160c
·
verified ·
1 Parent(s): 30fd429

Initial release: DATABASE_v9_1 mirror from GitHub source-of-truth

Browse files
Files changed (6) hide show
  1. DATABASE_v9_1.csv +13 -0
  2. DATABASE_v9_1.md +70 -0
  3. DATABASE_v9_1_report.md +82 -0
  4. LICENSE +32 -0
  5. README.md +160 -0
  6. populate_database_v9_1.py +524 -0
DATABASE_v9_1.csv ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ entry_id,family,size,arch,n_q,n_kv,qk_norm,training_tokens,eta_peak,lambda_wd,T_steps,tau_iter,T_over_tau,Physical_State,hp_confidence,n_records,k_median_qkv,lambda_median_qkv,R2_median_qkv,R2_below_95_qkv,k_median_o,lambda_median_o,R2_median_o,R2_below_95_o,k_median_ffn_in,lambda_median_ffn_in,R2_median_ffn_in,R2_below_95_ffn_in,k_median_ffn_out,lambda_median_ffn_out,R2_median_ffn_out,R2_below_95_ffn_out,k_median_q,lambda_median_q,R2_median_q,R2_below_95_q,k_median_k,lambda_median_k,R2_median_k,R2_below_95_k,k_median_v,lambda_median_v,R2_median_v,R2_below_95_v,k_median_gate,lambda_median_gate,R2_median_gate,R2_below_95_gate,k_median_up,lambda_median_up,R2_median_up,R2_below_95_up,k_median_down,lambda_median_down,R2_median_down,R2_below_95_down
2
+ pythia-70m,Pythia,70m,MHA-merged,,,False,300B,0.001,0.01,143000,100000,1.43,Saturated,explicit,24,1.0488499908322977,0.027829200076895988,0.9980661795697541,1/6,1.1837935286072323,0.018602428920403802,0.9985356796636042,0/6,1.1902710504479086,0.026003913070232375,0.9983539238333419,0/6,1.1898015122737948,0.021012236928099785,0.9982397335063831,0/6,,,,,,,,,,,,,,,,,,,,,,,,
3
+ pythia-160m,Pythia,160m,MHA-merged,,,False,300B,0.0006,0.01,143000,166667,0.858,Near-saturated,explicit,48,1.0982363830376656,0.02515902104056176,0.9994532449901053,0/12,1.191740628409264,0.015679046523988435,0.9982396364419186,0/12,1.1926538220592602,0.024112364246690256,0.9982122944417534,0/12,1.1953319289698738,0.018883547673911608,0.9981279582557228,0/12,,,,,,,,,,,,,,,,,,,,,,,,
4
+ pythia-410m,Pythia,410m,MHA-merged,,,False,300B,0.0003,0.01,143000,333333,0.429,Approaching,explicit,96,1.146561528599217,0.02122171415636209,0.998936826903025,0/24,1.1988129781844883,0.017971449756907294,0.9980865208585606,0/24,1.1990799021662437,0.020800650303664674,0.9979860387362547,0/24,1.201096993470142,0.01715614873199387,0.9979236660582246,0/24,,,,,,,,,,,,,,,,,,,,,,,,
5
+ pythia-1b,Pythia,1B,MHA-merged,,,False,300B,0.0003,0.01,143000,333333,0.429,Approaching,explicit,64,1.1758165081776015,0.020136835465006095,0.9986403658408189,0/16,1.199000460660631,0.018768755040468516,0.9980321219869854,0/16,1.199710534194005,0.020151192747180725,0.9980168719428919,0/16,1.1992630782799794,0.01733192000700065,0.9980239716959693,0/16,,,,,,,,,,,,,,,,,,,,,,,,
6
+ pythia-6.9b,Pythia,6.9B,MHA-merged,,,False,300B,0.00012,0.01,143000,833333,0.172,Transition,explicit,128,1.1725961308622437,0.016787633359452464,0.9989545055530709,0/32,1.1986053979939104,0.013017965092167658,0.998024607412637,0/32,1.2026301500842531,0.016750572288110506,0.9978736032238523,0/32,1.200956915459356,0.014671536899830185,0.9979452059317363,0/32,,,,,,,,,,,,,,,,,,,,,,,,
7
+ olmo-1-7b,OLMo-1,7B,MHA-separate,32,32,False,2.5T,0.0003,0.1,477000,33333,14.31,Saturated,explicit,224,,,,,1.0408657276990618,0.002401554550633505,0.9971792835186756,2/32,,,,,,,,,0.8122912154036579,0.001728964705557532,0.9987052449748253,12/32,0.760128189603047,0.0017030071063091484,0.9985575728031171,13/32,1.0601198634820659,0.0025129714668301892,0.9971448334283877,0/32,1.2009840121871695,0.003363367499645852,0.997926463922367,0/32,1.203942863882499,0.0034419612928361385,0.9977918785255582,0/32,1.204103938938425,0.0034857079668821657,0.9977980830738356,0/32
8
+ olmo-2-7b,OLMo-2,7B,MHA-separate,32,32,True,5T,0.0003,0.1,600000,33333,18.0,Saturated,inferred,224,,,,,1.1957824956841125,0.01633689288553169,0.9980401478865495,0/32,,,,,,,,,0.989513585691632,0.014060155205477352,0.9908743229136651,2/32,0.9715995155742865,0.013240338570321912,0.9935710555725896,7/32,1.1930013229215812,0.016630755274009916,0.9980887579980875,0/32,1.1976133728932,0.017549626600536647,0.9980961344940342,0/32,1.2031829219410521,0.01675671031075271,0.9978851898208778,0/32,1.2030757372152108,0.01654031946425652,0.997865366465111,0/32
9
+ llama-3-8b,Llama-3,8B,GQA-4:1,32,8,False,15T,0.0003,0.1,1000000,33333,30.0,Saturated,inferred,224,,,,,1.184071385746421,0.008293435300471455,0.998465712933232,0/32,,,,,,,,,1.1352115988550961,0.013524263847823039,0.9995330340960915,0/32,1.1461534355136989,0.0210008606786853,0.9994212651102061,0/32,1.1710054472835778,0.0074532770403264465,0.9984796629483923,0/32,1.1890150725270956,0.011714635540860925,0.9984570553256354,0/32,1.1970808681863536,0.009321699181305845,0.9979506822747821,0/32,1.1931330108175051,0.009227488024057286,0.9980590165512454,0/32
10
+ mistral-7b,Mistral,7B,GQA-4:1,32,8,False,8T,0.0003,0.1,500000,33333,15.0,Saturated,estimated,224,,,,,1.190243912925892,0.002402403275884374,0.9983281530362517,0/32,,,,,,,,,1.1485392032119919,0.0029794427980022876,0.999306901399193,1/32,1.1290637579544684,0.0035066491246891554,0.9996222872848544,0/32,1.1701993384534188,0.0023825545163240107,0.9983546533501352,0/32,1.194720188713138,0.0028355399128622725,0.9981770951518927,0/32,1.1964326908213916,0.002581969834286769,0.9980098695080295,0/32,1.1925738330014424,0.002545509262438919,0.9981714252724023,0/32
11
+ qwen2.5-7b,Qwen2.5,7B,GQA-7:1,28,4,False,18T,0.0003,0.1,1100000,33333,33.0,Saturated,inferred,196,,,,,1.1664607878011877,0.013070396382489802,0.9989430337848695,0/28,,,,,,,,,1.1328116652061784,0.013520394365978409,0.9993364777176525,0/28,1.1033345281197386,0.014088124992005789,0.9998005555777307,0/28,1.1430042518328158,0.01389958738996697,0.9986895435422882,0/28,1.190394620384456,0.01430298685422907,0.9982928398948381,0/28,1.1888191751907358,0.014378046711090012,0.9982963964287199,0/28,1.1829726136894823,0.014066967405546603,0.9985022496848237,0/28
12
+ qwen2.5-14b,Qwen2.5,14B,GQA-5:1,40,8,False,18T,0.0003,0.1,1100000,33333,33.0,Saturated,estimated,189,,,,,1.1841492889945942,0.01635424142703244,0.9985449642031292,0/27,,,,,,,,,1.1598333532217517,0.017467613550818994,0.9988577504081926,0/27,1.134601112331773,0.019688051072659123,0.9993206828179739,0/27,1.1636461389324964,0.016113911185781107,0.9985097429190216,0/27,1.1908688512686276,0.01786358668592591,0.9982032807344513,3/27,1.1914319791119936,0.018228218923577316,0.9980806394042295,1/27,1.1884973746873577,0.018154542924089155,0.9982328415038318,1/27
13
+ qwen3-8b,Qwen3,8B,GQA-4:1,32,8,True,36T,0.0003,0.1,2200000,33333,66.0,Saturated,inferred,252,,,,,1.1801768316123442,0.022653566194551916,0.9985957983960119,0/36,,,,,,,,,1.162275174612215,0.02149767664699718,0.9991031504379486,0/36,1.1539186367719623,0.02110274935915082,0.9992249255351853,0/36,1.1580956333123513,0.024755221044291426,0.9986119730450285,0/36,1.1872130646195065,0.02374112314986921,0.998329750229662,0/36,1.1885651746494985,0.023673103492721705,0.9981567875217829,1/36,1.1846459565046368,0.023230312440040608,0.9984190108999799,0/36
DATABASE_v9_1.md ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DATABASE_v9_1 — Reference Table (12 family entries)
2
+
3
+ **Source**: cascade v3 (per-component Weibull fit, mid-80% trim)
4
+ **Generated**: by populate_database_v9_1.py
5
+
6
+ ## 12 entries (5 Pythia size + 7 cross-family) — k median per component
7
+
8
+ | Entry | Family | Size | Architecture | n_q/n_kv | QK-Norm | tokens | k_q | k_k | k_v | k_o | k_gate | k_up | k_down | low-R²(q) |
9
+ |---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
10
+ | pythia-70m | Pythia | 70m | MHA-merged | merged | no | 300B | 1.0488 | — | — | 1.1838 | 0.0000 | 0.0000 | 0.0000 | 1/6 |
11
+ | pythia-160m | Pythia | 160m | MHA-merged | merged | no | 300B | 1.0982 | — | — | 1.1917 | 0.0000 | 0.0000 | 0.0000 | 0/12 |
12
+ | pythia-410m | Pythia | 410m | MHA-merged | merged | no | 300B | 1.1466 | — | — | 1.1988 | 0.0000 | 0.0000 | 0.0000 | 0/24 |
13
+ | pythia-1b | Pythia | 1B | MHA-merged | merged | no | 300B | 1.1758 | — | — | 1.1990 | 0.0000 | 0.0000 | 0.0000 | 0/16 |
14
+ | pythia-6.9b | Pythia | 6.9B | MHA-merged | merged | no | 300B | 1.1726 | — | — | 1.1986 | 0.0000 | 0.0000 | 0.0000 | 0/32 |
15
+ | olmo-1-7b | OLMo-1 | 7B | MHA-separate | 32/32 | no | 2.5T | 0.8123 | 0.7601 | 1.0601 | 1.0409 | 1.2010 | 1.2039 | 1.2041 | 12/32 |
16
+ | olmo-2-7b | OLMo-2 | 7B | MHA-separate | 32/32 | yes | 5T | 0.9895 | 0.9716 | 1.1930 | 1.1958 | 1.1976 | 1.2032 | 1.2031 | 2/32 |
17
+ | llama-3-8b | Llama-3 | 8B | GQA-4:1 | 32/8 | no | 15T | 1.1352 | 1.1462 | 1.1710 | 1.1841 | 1.1890 | 1.1971 | 1.1931 | 0/32 |
18
+ | mistral-7b | Mistral | 7B | GQA-4:1 | 32/8 | no | 8T | 1.1485 | 1.1291 | 1.1702 | 1.1902 | 1.1947 | 1.1964 | 1.1926 | 1/32 |
19
+ | qwen2.5-7b | Qwen2.5 | 7B | GQA-7:1 | 28/4 | no | 18T | 1.1328 | 1.1033 | 1.1430 | 1.1665 | 1.1904 | 1.1888 | 1.1830 | 0/28 |
20
+ | qwen2.5-14b | Qwen2.5 | 14B | GQA-5:1 | 40/8 | no | 18T | 1.1598 | 1.1346 | 1.1636 | 1.1841 | 1.1909 | 1.1914 | 1.1885 | 0/27 |
21
+ | qwen3-8b | Qwen3 | 8B | GQA-4:1 | 32/8 | yes | 36T | 1.1623 | 1.1539 | 1.1581 | 1.1802 | 1.1872 | 1.1886 | 1.1846 | 0/36 |
22
+
23
+ ## Training hyperparameters + T/τ + Physical State (Wang-Aitchison 2024 cycle ratio)
24
+
25
+ τ_iter = 1/(η · λ_wd) — EMA iteration time-constant. T/τ_iter = T_steps / τ_iter — completed EMA cycles.
26
+
27
+ | Entry | η_peak | λ_wd | T_steps | τ_iter | **T/τ** | **Physical State** | hp source |
28
+ |---|---|---|---|---|---|---|---|
29
+ | pythia-70m | 1.0e-03 | 0.01 | 143000 | 100000 | **1.43** | **Saturated** | explicit |
30
+ | pythia-160m | 6.0e-04 | 0.01 | 143000 | 166667 | **0.86** | **Near-saturated** | explicit |
31
+ | pythia-410m | 3.0e-04 | 0.01 | 143000 | 333333 | **0.43** | **Approaching** | explicit |
32
+ | pythia-1b | 3.0e-04 | 0.01 | 143000 | 333333 | **0.43** | **Approaching** | explicit |
33
+ | pythia-6.9b | 1.2e-04 | 0.01 | 143000 | 833333 | **0.17** | **Transition** | explicit |
34
+ | olmo-1-7b | 3.0e-04 | 0.1 | 477000 | 33333 | **14.31** | **Saturated** | explicit |
35
+ | olmo-2-7b | 3.0e-04 | 0.1 | 600000 | 33333 | **18.00** | **Saturated** | inferred |
36
+ | llama-3-8b | 3.0e-04 | 0.1 | 1000000 | 33333 | **30.00** | **Saturated** | inferred |
37
+ | mistral-7b | 3.0e-04 | 0.1 | 500000 | 33333 | **15.00** | **Saturated** | estimated |
38
+ | qwen2.5-7b | 3.0e-04 | 0.1 | 1100000 | 33333 | **33.00** | **Saturated** | inferred |
39
+ | qwen2.5-14b | 3.0e-04 | 0.1 | 1100000 | 33333 | **33.00** | **Saturated** | estimated |
40
+ | qwen3-8b | 3.0e-04 | 0.1 | 2200000 | 33333 | **66.00** | **Saturated** | inferred |
41
+
42
+ **Physical State thresholds** (Wang-Aitchison 2024 cycle ratio):
43
+
44
+ - Saturated: T/τ ≥ 1.20
45
+ - Near-saturated: 0.80 ≤ T/τ < 1.20
46
+ - Approaching: 0.40 ≤ T/τ < 0.80
47
+ - Partial: 0.25 ≤ T/τ < 0.40
48
+ - Transition: T/τ < 0.25
49
+
50
+ **hp source confidence**:
51
+
52
+ - *explicit*: paper Table / official tech report directly states the value
53
+ - *inferred*: paper §3 states a quantity from which we derive it (e.g. tokens × batch / seq → steps)
54
+ - *estimated*: paper does not publish; same-family typical recipe used as fallback
55
+
56
+ ---
57
+
58
+ ## Verification
59
+
60
+ Per-entry per-component sanity check is recorded in
61
+ [`DATABASE_v9_1_report.md`](DATABASE_v9_1_report.md). All entries pass
62
+ R² ≥ 0.99 on the Transmission Class components.
63
+
64
+ **Transmission Class aggregated band** (median across components per
65
+ entry, then aggregated across the 12 entries): k ∈ [1.186, 1.204],
66
+ cross-family CV = 0.51%. See paper §3 for the strict-band definition
67
+ and protocol.
68
+
69
+ For per-block raw fits and the cascade pipeline that produces this
70
+ table, see the `npm-weibull-py` repository on GitHub.
DATABASE_v9_1_report.md ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DATABASE_v9_1 sanity verify report
2
+
3
+ ### pythia-70m (Pythia 70m, MHA-merged)
4
+ records: 24; tokens: 300B; QK-Norm: False
5
+ k_median(qkv) = 1.0488, R2(qkv) = 0.9981, low-R2: 1/6
6
+ k_median(gate)=n/a, k_median(up)=n/a, k_median(down)=n/a
7
+
8
+ ### pythia-160m (Pythia 160m, MHA-merged)
9
+ records: 48; tokens: 300B; QK-Norm: False
10
+ k_median(qkv) = 1.0982, R2(qkv) = 0.9995, low-R2: 0/12
11
+ k_median(gate)=n/a, k_median(up)=n/a, k_median(down)=n/a
12
+
13
+ ### pythia-410m (Pythia 410m, MHA-merged)
14
+ records: 96; tokens: 300B; QK-Norm: False
15
+ k_median(qkv) = 1.1466, R2(qkv) = 0.9989, low-R2: 0/24
16
+ k_median(gate)=n/a, k_median(up)=n/a, k_median(down)=n/a
17
+
18
+ ### pythia-1b (Pythia 1B, MHA-merged)
19
+ records: 64; tokens: 300B; QK-Norm: False
20
+ k_median(qkv) = 1.1758, R2(qkv) = 0.9986, low-R2: 0/16
21
+ k_median(gate)=n/a, k_median(up)=n/a, k_median(down)=n/a
22
+
23
+ ### pythia-6.9b (Pythia 6.9B, MHA-merged)
24
+ records: 128; tokens: 300B; QK-Norm: False
25
+ k_median(qkv) = 1.1726, R2(qkv) = 0.9990, low-R2: 0/32
26
+ k_median(gate)=n/a, k_median(up)=n/a, k_median(down)=n/a
27
+
28
+ ### olmo-1-7b (OLMo-1 7B, MHA-separate)
29
+ records: 224; tokens: 2.5T; QK-Norm: False
30
+ k_median(q) = 0.8123, R2(q) = 0.9987, low-R2: 12/32
31
+ k_median(k) = 0.7601, R2(k) = 0.9986, low-R2: 13/32
32
+ k_median(v) = 1.0601, R2(v) = 0.9971
33
+ k_median(o) = 1.0409, R2(o) = 0.9972
34
+ k_median(gate)=1.2010, k_median(up)=1.2039, k_median(down)=1.2041
35
+
36
+ ### olmo-2-7b (OLMo-2 7B, MHA-separate)
37
+ records: 224; tokens: 5T; QK-Norm: True
38
+ k_median(q) = 0.9895, R2(q) = 0.9909, low-R2: 2/32
39
+ k_median(k) = 0.9716, R2(k) = 0.9936, low-R2: 7/32
40
+ k_median(v) = 1.1930, R2(v) = 0.9981
41
+ k_median(o) = 1.1958, R2(o) = 0.9980
42
+ k_median(gate)=1.1976, k_median(up)=1.2032, k_median(down)=1.2031
43
+
44
+ ### llama-3-8b (Llama-3 8B, GQA-4:1)
45
+ records: 224; tokens: 15T; QK-Norm: False
46
+ k_median(q) = 1.1352, R2(q) = 0.9995, low-R2: 0/32
47
+ k_median(k) = 1.1462, R2(k) = 0.9994, low-R2: 0/32
48
+ k_median(v) = 1.1710, R2(v) = 0.9985
49
+ k_median(o) = 1.1841, R2(o) = 0.9985
50
+ k_median(gate)=1.1890, k_median(up)=1.1971, k_median(down)=1.1931
51
+
52
+ ### mistral-7b (Mistral 7B, GQA-4:1)
53
+ records: 224; tokens: 8T; QK-Norm: False
54
+ k_median(q) = 1.1485, R2(q) = 0.9993, low-R2: 1/32
55
+ k_median(k) = 1.1291, R2(k) = 0.9996, low-R2: 0/32
56
+ k_median(v) = 1.1702, R2(v) = 0.9984
57
+ k_median(o) = 1.1902, R2(o) = 0.9983
58
+ k_median(gate)=1.1947, k_median(up)=1.1964, k_median(down)=1.1926
59
+
60
+ ### qwen2.5-7b (Qwen2.5 7B, GQA-7:1)
61
+ records: 196; tokens: 18T; QK-Norm: False
62
+ k_median(q) = 1.1328, R2(q) = 0.9993, low-R2: 0/28
63
+ k_median(k) = 1.1033, R2(k) = 0.9998, low-R2: 0/28
64
+ k_median(v) = 1.1430, R2(v) = 0.9987
65
+ k_median(o) = 1.1665, R2(o) = 0.9989
66
+ k_median(gate)=1.1904, k_median(up)=1.1888, k_median(down)=1.1830
67
+
68
+ ### qwen2.5-14b (Qwen2.5 14B, GQA-5:1)
69
+ records: 189; tokens: 18T; QK-Norm: False
70
+ k_median(q) = 1.1598, R2(q) = 0.9989, low-R2: 0/27
71
+ k_median(k) = 1.1346, R2(k) = 0.9993, low-R2: 0/27
72
+ k_median(v) = 1.1636, R2(v) = 0.9985
73
+ k_median(o) = 1.1841, R2(o) = 0.9985
74
+ k_median(gate)=1.1909, k_median(up)=1.1914, k_median(down)=1.1885
75
+
76
+ ### qwen3-8b (Qwen3 8B, GQA-4:1)
77
+ records: 252; tokens: 36T; QK-Norm: True
78
+ k_median(q) = 1.1623, R2(q) = 0.9991, low-R2: 0/36
79
+ k_median(k) = 1.1539, R2(k) = 0.9992, low-R2: 0/36
80
+ k_median(v) = 1.1581, R2(v) = 0.9986
81
+ k_median(o) = 1.1802, R2(o) = 0.9986
82
+ k_median(gate)=1.1872, k_median(up)=1.1886, k_median(down)=1.1846
LICENSE ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Creative Commons Attribution 4.0 International (CC BY 4.0)
2
+
3
+ Copyright (c) 2026 Tiexin Ding
4
+
5
+ Full license text: https://creativecommons.org/licenses/by/4.0/legalcode
6
+
7
+ You are free to:
8
+
9
+ Share — copy and redistribute the material in any medium or format
10
+ Adapt — remix, transform, and build upon the material for any
11
+ purpose, even commercially.
12
+
13
+ Under the following terms:
14
+
15
+ Attribution — You must give appropriate credit, provide a link to
16
+ the license, and indicate if changes were made. You
17
+ may do so in any reasonable manner, but not in any
18
+ way that suggests the licensor endorses you or your
19
+ use.
20
+
21
+ No additional restrictions — You may not apply legal terms or
22
+ technological measures that legally restrict others
23
+ from doing anything the license permits.
24
+
25
+ The licensor cannot revoke these freedoms as long as you follow the
26
+ license terms.
27
+
28
+ When citing this dataset, please cite the associated paper:
29
+
30
+ Ding, Tiexin (2026). A Two-Parameter Weibull Framework for
31
+ Diagnosing Transformer Weight Distributions.
32
+ arXiv:2605.18898. https://doi.org/10.48550/arXiv.2605.18898
README.md ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-4.0
3
+ task_categories:
4
+ - other
5
+ language:
6
+ - en
7
+ size_categories:
8
+ - n<1K
9
+ tags:
10
+ - weibull
11
+ - transformer
12
+ - weight-statistics
13
+ - model-diagnostics
14
+ - npm-weibull
15
+ pretty_name: NPM-Weibull DATABASE v9_1
16
+ configs:
17
+ - config_name: default
18
+ data_files: DATABASE_v9_1.csv
19
+ ---
20
+
21
+ # NPM-Weibull DATABASE v9_1
22
+
23
+ Benchmark database of Weibull (k, λ) fits for **12 transformer model entries** spanning **7 architectural families** (Pythia, OLMo-1/2, LLaMA-3, Mistral, Qwen2.5, Qwen3) — 70M–14B parameters, GeLU and SwiGLU activations, Pre-LN and QK-Norm placements.
24
+
25
+ - 📄 **Paper**: [A Two-Parameter Weibull Framework for Diagnosing Transformer Weight Distributions](https://arxiv.org/abs/2605.18898) (arXiv:2605.18898)
26
+ - 📦 **Source repo (primary)**: [github.com/tiexinding/NPM-Weibull-public](https://github.com/tiexinding/NPM-Weibull-public) — directory `database_v9_1/`
27
+ - 🔧 **Python library**: `pip install npm-weibull-py` — [PyPI](https://pypi.org/project/npm-weibull-py/)
28
+
29
+ ---
30
+
31
+ ## 📌 Source of truth
32
+
33
+ The **primary, authoritative location** of this dataset is the GitHub repository above (directory `database_v9_1/`). This Hugging Face Dataset is a **mirror** synced from GitHub on each tagged release, provided for `load_dataset(...)` convenience and Dataset Viewer discoverability.
34
+
35
+ - Updates are **batched per release**, not per commit — for the latest state, watch the GitHub repo.
36
+ - Issues and pull requests: please file on [GitHub Issues](https://github.com/tiexinding/NPM-Weibull-public/issues) rather than HF discussions (faster response).
37
+ - License, citation, and documentation are kept consistent across both surfaces.
38
+
39
+ ---
40
+
41
+ ## Quick start
42
+
43
+ ### Option 1 — `load_dataset` (Hugging Face)
44
+
45
+ ```python
46
+ from datasets import load_dataset
47
+
48
+ ds = load_dataset("TiexinDing/NPM-Weibull-DATABASE-v9_1")
49
+ print(ds["train"][0]) # First entry: pythia-70m
50
+ ```
51
+
52
+ ### Option 2 — pandas
53
+
54
+ ```python
55
+ import pandas as pd
56
+
57
+ df = pd.read_csv("DATABASE_v9_1.csv")
58
+ print(df[["entry_id", "k_median_o", "lambda_median_o"]].head())
59
+ ```
60
+
61
+ ### Option 3 — `npm-weibull-py` library (recommended for analysis)
62
+
63
+ ```python
64
+ from npm_weibull import DATABASE_v9_1, compare_to_benchmark
65
+
66
+ print(DATABASE_v9_1) # 12 entries with per-component fits
67
+
68
+ cmp = compare_to_benchmark({
69
+ "median_k_per_kind": {"q": 1.14, "k": 1.13, "v": 1.19, "o": 1.19}
70
+ })
71
+ print(cmp["nearest_neighbor"]) # nearest of the 12 benchmark entries
72
+ ```
73
+
74
+ ---
75
+
76
+ ## Dataset structure
77
+
78
+ ### 12 entries
79
+
80
+ | `entry_id` | Family | Size | Architecture | QK-Norm | Tokens |
81
+ |---------------|----------|-------|---------------|---------|--------|
82
+ | pythia-70m | Pythia | 70m | MHA-merged | False | 300B |
83
+ | pythia-160m | Pythia | 160m | MHA-merged | False | 300B |
84
+ | pythia-410m | Pythia | 410m | MHA-merged | False | 300B |
85
+ | pythia-1b | Pythia | 1B | MHA-merged | False | 300B |
86
+ | pythia-6.9b | Pythia | 6.9B | MHA-merged | False | 300B |
87
+ | olmo-1-7b | OLMo-1 | 7B | MHA-separate | False | 2.5T |
88
+ | olmo-2-7b | OLMo-2 | 7B | MHA-separate | True | 5T |
89
+ | llama-3-8b | LLaMA-3 | 8B | GQA-4:1 | False | 15T |
90
+ | mistral-7b | Mistral | 7B | GQA-4:1 | False | 8T |
91
+ | qwen2.5-7b | Qwen2.5 | 7B | GQA-7:1 | False | 18T |
92
+ | qwen2.5-14b | Qwen2.5 | 14B | GQA-5:1 | False | 18T |
93
+ | qwen3-8b | Qwen3 | 8B | GQA-4:1 | True | 36T |
94
+
95
+ ### Columns (55 total)
96
+
97
+ **Identifiers**: `entry_id`, `family`, `size`, `arch`
98
+
99
+ **Architecture**: `n_q`, `n_kv` (head counts for GQA), `qk_norm`
100
+
101
+ **Training hyperparameters**: `training_tokens`, `eta_peak` (peak learning rate), `lambda_wd` (weight decay), `T_steps`, `tau_iter = 1/(η·λ_wd)`, `T_over_tau` (Wang-Aitchison 2024 cycle ratio), `Physical_State`, `hp_confidence` (explicit / inferred / estimated)
102
+
103
+ **Per-component Weibull fits** (median across blocks within each model):
104
+
105
+ - Pythia entries (GeLU 2-projection FFN with merged W_qkv): populate `qkv`, `o`, `ffn_in`, `ffn_out`
106
+ - Non-Pythia entries (SwiGLU 3-projection FFN with separate Q/K/V): populate `q`, `k`, `v`, `o`, `gate`, `up`, `down`
107
+
108
+ Each component has four columns: `k_median_*`, `lambda_median_*`, `R2_median_*`, `R2_below_95_*` (count of blocks with R² < 0.95).
109
+
110
+ `n_records` = total number of per-block Weibull fits aggregated.
111
+
112
+ ---
113
+
114
+ ## Key findings (paper §3)
115
+
116
+ 1. **Transmission Class** (FFN + W_o): the **median terminal k across components per entry**, then aggregated across the 12 entries, falls in **[1.186, 1.204]** with cross-family CV = **0.51%**. Shared across SwiGLU and GeLU activations, Pre-LN and QK-Norm placements, and model sizes 70M → 14B.
117
+
118
+ 2. **Selection Class** (W_q, W_k): k departs from initialization anchor (k_init ≈ 1.205), severity tracks attention storage architecture — **separately-stored MHA** (OLMo-1/2) deepest at k ∈ [0.76, 0.99], **GQA** (LLaMA-3, Mistral, Qwen2.5/3) milder at [1.10, 1.16], **Pythia merged W_qkv** transitional at [1.05, 1.18].
119
+
120
+ 3. **λ scaling**: terminal λ ∝ √(η/λ_wd) within Pythia, Pearson r = 0.94 across the three Transmission Class component kinds, directionally consistent with Fan et al. (2025) AdamW steady-state analysis.
121
+
122
+ ---
123
+
124
+ ## Files in this dataset
125
+
126
+ | File | Purpose |
127
+ |---|---|
128
+ | `DATABASE_v9_1.csv` | Machine-readable dataset (55 columns × 12 entries) |
129
+ | `DATABASE_v9_1.md` | Human-readable reference table |
130
+ | `DATABASE_v9_1_report.md` | Per-entry sanity verification |
131
+ | `populate_database_v9_1.py` | Internal regeneration script (dev-only; requires cascade v3 raw per-block fits not shipped here — see GitHub repo for the cascade pipeline) |
132
+ | `LICENSE` | CC BY 4.0 license text |
133
+ | `README.md` | This file |
134
+
135
+ ---
136
+
137
+ ## License
138
+
139
+ [CC BY 4.0](LICENSE) — free for academic and commercial use with attribution.
140
+
141
+ ---
142
+
143
+ ## Citation
144
+
145
+ ```bibtex
146
+ @article{ding2026twoparameterweibull,
147
+ title = {A Two-Parameter Weibull Framework for Diagnosing Transformer Weight Distributions},
148
+ author = {Ding, Tiexin},
149
+ journal = {arXiv preprint arXiv:2605.18898},
150
+ year = {2026},
151
+ doi = {10.48550/arXiv.2605.18898},
152
+ url = {https://arxiv.org/abs/2605.18898}
153
+ }
154
+ ```
155
+
156
+ ---
157
+
158
+ **Author**: Tiexin Ding · NeuralCAE
159
+
160
+ Issues / questions: [GitHub Issues](https://github.com/tiexinding/NPM-Weibull-public/issues)
populate_database_v9_1.py ADDED
@@ -0,0 +1,524 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """DATABASE_v9_1 populate — regenerate the 12-entry benchmark table.
2
+
3
+ INTERNAL DEVELOPMENT SCRIPT. End users do NOT need to run this — the
4
+ output files (DATABASE_v9_1.csv, .md, _report.md) are already committed
5
+ alongside it. Use those files directly, or load via `npm-weibull-py`:
6
+
7
+ pip install npm-weibull-py
8
+ from npm_weibull import DATABASE_v9_1
9
+
10
+ This script requires the cascade v3 raw per-block Weibull fit JSON
11
+ files, which are NOT shipped in this repository (they total several GB
12
+ of derived measurement data). It runs only on the author's development
13
+ machine where the cascade pipeline output lives at the ROOT path
14
+ hard-coded below.
15
+
16
+ Output (written next to this script):
17
+ - DATABASE_v9_1.csv (12 rows × 55 columns)
18
+ - DATABASE_v9_1.md (human-readable reference table)
19
+ - DATABASE_v9_1_report.md (per-entry sanity verification)
20
+
21
+ Source data:
22
+ - cascade_v3_pull/data/derived/{model}_main_fit_per_component_v3.json
23
+ - cascade_v3_pull/data/derived/pythia-{size}-step143000_step143000_fit_per_component_v3.json
24
+ - derived/{llama-3-8b, mistral-7b, qwen2.5-7b, olmo2-7b-final}_main_fit_per_component_v3.json
25
+
26
+ For the full cascade pipeline (raw checkpoints → per-block fits → this
27
+ benchmark), see the project root README on GitHub.
28
+ """
29
+
30
+ from __future__ import annotations
31
+
32
+ import csv
33
+ import json
34
+ import statistics
35
+ from pathlib import Path
36
+
37
+ ROOT = Path(
38
+ "/home/dingdang-ws/wsl-projects/claudecode/NPM_v13_commit_260324/NPM_v13_complete/30_NPM_weibull/cascade_v2_20260502"
39
+ )
40
+ CV3 = ROOT / "cascade_v3_pull" / "data" / "derived"
41
+ CV2_DERIVED = ROOT / "derived"
42
+ # Output goes next to this script (release dir under NPM-Weibull-public/database_v9_1/).
43
+ OUT = Path(__file__).resolve().parent
44
+ OUT.mkdir(parents=True, exist_ok=True)
45
+
46
+
47
+ # 12 family entry definitions + training hyperparameters for T/tau computation
48
+ # Hyperparameters from each model's paper / HF config.json:
49
+ # eta_peak : peak learning rate (after warmup)
50
+ # lambda_wd : weight decay coefficient
51
+ # T_steps : total training steps (terminal)
52
+ # src_conf : confidence (paper-explicit / inferred / estimated)
53
+ #
54
+ # Pythia: Biderman et al. 2023 (arXiv:2304.01373) Table 4
55
+ # OLMo-1: Groeneveld et al. 2024 (arXiv:2402.00838) §3
56
+ # OLMo-2: OLMo-2 paper (arXiv:2501.00656) §3
57
+ # LLaMA-3: Meta Llama 3 paper (arXiv:2407.21783) §3.4
58
+ # Mistral: tech report partial; estimates inferred from typical 7B recipe
59
+ # Qwen2.5: Qwen2.5 paper (arXiv:2412.15115)
60
+ # Qwen3: Qwen3 paper (arXiv:2505.xxxxx)
61
+ #
62
+ # (entry_id, json_path, family, size, arch, n_q, n_kv, qk_norm, training_tokens,
63
+ # eta_peak, lambda_wd, T_steps, hp_confidence)
64
+ ENTRIES = [
65
+ # ----- Pythia 5 size (terminal step143000) -- Biderman 2023 Table 4 -----
66
+ (
67
+ "pythia-70m",
68
+ CV3 / "pythia-70m-step143000_step143000_fit_per_component_v3.json",
69
+ "Pythia",
70
+ "70m",
71
+ "MHA-merged",
72
+ None,
73
+ None,
74
+ False,
75
+ "300B",
76
+ 1.0e-3,
77
+ 0.01,
78
+ 143000,
79
+ "explicit",
80
+ ),
81
+ (
82
+ "pythia-160m",
83
+ CV3 / "pythia-160m-step143000_step143000_fit_per_component_v3.json",
84
+ "Pythia",
85
+ "160m",
86
+ "MHA-merged",
87
+ None,
88
+ None,
89
+ False,
90
+ "300B",
91
+ 6.0e-4,
92
+ 0.01,
93
+ 143000,
94
+ "explicit",
95
+ ),
96
+ (
97
+ "pythia-410m",
98
+ CV3 / "pythia-410m-step143000_step143000_fit_per_component_v3.json",
99
+ "Pythia",
100
+ "410m",
101
+ "MHA-merged",
102
+ None,
103
+ None,
104
+ False,
105
+ "300B",
106
+ 3.0e-4,
107
+ 0.01,
108
+ 143000,
109
+ "explicit",
110
+ ),
111
+ (
112
+ "pythia-1b",
113
+ CV3 / "pythia-1b-step143000_step143000_fit_per_component_v3.json",
114
+ "Pythia",
115
+ "1B",
116
+ "MHA-merged",
117
+ None,
118
+ None,
119
+ False,
120
+ "300B",
121
+ 3.0e-4,
122
+ 0.01,
123
+ 143000,
124
+ "explicit",
125
+ ),
126
+ (
127
+ "pythia-6.9b",
128
+ CV3 / "pythia-6.9b-step143000_step143000_fit_per_component_v3.json",
129
+ "Pythia",
130
+ "6.9B",
131
+ "MHA-merged",
132
+ None,
133
+ None,
134
+ False,
135
+ "300B",
136
+ 1.2e-4,
137
+ 0.01,
138
+ 143000,
139
+ "explicit",
140
+ ),
141
+ # ----- 6 cross-family -----
142
+ # OLMo-1 7B: Groeneveld 2024 §3.2 — peak LR 3e-4, wd 0.1, ~477k steps × global_batch 2160 × seq 2048 = ~2.1T tokens (paper says 2T+ but OLMo-1B used 3T tokens; 7B run is ~2.5T)
143
+ (
144
+ "olmo-1-7b",
145
+ CV3 / "olmo-7b-hf_main_fit_per_component_v3.json",
146
+ "OLMo-1",
147
+ "7B",
148
+ "MHA-separate",
149
+ 32,
150
+ 32,
151
+ False,
152
+ "2.5T",
153
+ 3.0e-4,
154
+ 0.1,
155
+ 477000,
156
+ "explicit",
157
+ ),
158
+ # OLMo-2 7B: OLMo-2 paper — stage1 ~600k steps + stage2 annealing; here T_steps approx for stage1 saturation; LR 3e-4
159
+ (
160
+ "olmo-2-7b",
161
+ ROOT / "derived/olmo2-7b-final_main_fit_per_component_v3.json",
162
+ "OLMo-2",
163
+ "7B",
164
+ "MHA-separate",
165
+ 32,
166
+ 32,
167
+ True,
168
+ "5T",
169
+ 3.0e-4,
170
+ 0.1,
171
+ 600000,
172
+ "inferred",
173
+ ),
174
+ # Llama-3 8B: Meta Llama 3 paper — peak LR ~3e-4, wd 0.1, 15T tokens, batch ~16M tokens → ~1M steps
175
+ (
176
+ "llama-3-8b",
177
+ ROOT / "derived/llama-3-8b_main_fit_per_component_v3.json",
178
+ "Llama-3",
179
+ "8B",
180
+ "GQA-4:1",
181
+ 32,
182
+ 8,
183
+ False,
184
+ "15T",
185
+ 3.0e-4,
186
+ 0.1,
187
+ 1000000,
188
+ "inferred",
189
+ ),
190
+ # Mistral-7B: tech report partial — estimates inferred from typical Llama-style recipe
191
+ (
192
+ "mistral-7b",
193
+ ROOT / "derived/mistral-7b_main_fit_per_component_v3.json",
194
+ "Mistral",
195
+ "7B",
196
+ "GQA-4:1",
197
+ 32,
198
+ 8,
199
+ False,
200
+ "8T",
201
+ 3.0e-4,
202
+ 0.1,
203
+ 500000,
204
+ "estimated",
205
+ ),
206
+ # Qwen2.5-7B: paper says peak LR 3e-4, wd 0.1, 18T tokens
207
+ (
208
+ "qwen2.5-7b",
209
+ ROOT / "derived/qwen2.5-7b_main_fit_per_component_v3.json",
210
+ "Qwen2.5",
211
+ "7B",
212
+ "GQA-7:1",
213
+ 28,
214
+ 4,
215
+ False,
216
+ "18T",
217
+ 3.0e-4,
218
+ 0.1,
219
+ 1100000,
220
+ "inferred",
221
+ ),
222
+ # Qwen2.5-14B: GQA 40:8 = 5:1 (paper line 211 footnote: per-block extraction covers first 27 of 48 layers; aggregate-level entry); no QK-Norm (paper §QK-Norm figure caption)
223
+ (
224
+ "qwen2.5-14b",
225
+ CV3 / "qwen2.5-14b_main_fit_per_component_v3.json",
226
+ "Qwen2.5",
227
+ "14B",
228
+ "GQA-5:1",
229
+ 40,
230
+ 8,
231
+ False,
232
+ "18T",
233
+ 3.0e-4,
234
+ 0.1,
235
+ 1100000,
236
+ "estimated",
237
+ ),
238
+ # Qwen3-8B-base: 36T tokens, similar recipe to Qwen2.5
239
+ (
240
+ "qwen3-8b",
241
+ CV3 / "qwen3-8b-base_main_fit_per_component_v3.json",
242
+ "Qwen3",
243
+ "8B",
244
+ "GQA-4:1",
245
+ 32,
246
+ 8,
247
+ True,
248
+ "36T",
249
+ 3.0e-4,
250
+ 0.1,
251
+ 2200000,
252
+ "inferred",
253
+ ),
254
+ ]
255
+
256
+
257
+ def compute_t_tau(eta_peak, lambda_wd, T_steps):
258
+ """Wang-Aitchison 2024 cycle ratio: T/tau_iter where tau_iter = 1/(eta * lambda_wd)."""
259
+ tau_iter = 1.0 / (eta_peak * lambda_wd)
260
+ return T_steps / tau_iter
261
+
262
+
263
+ def classify_physical_state(t_over_tau):
264
+ """Physical state thresholds (Wang-Aitchison 2024 cycle ratio)."""
265
+ if t_over_tau >= 1.20:
266
+ return "Saturated"
267
+ if t_over_tau >= 0.80:
268
+ return "Near-saturated"
269
+ if t_over_tau >= 0.40:
270
+ return "Approaching"
271
+ if t_over_tau >= 0.25:
272
+ return "Partial"
273
+ return "Transition"
274
+
275
+
276
+ # kinds for separate-Q/K models (SwiGLU/GeGLU FFN: gate/up/down)
277
+ KINDS_SEPARATE = ["q", "k", "v", "o", "gate", "up", "down"]
278
+ # kinds for Pythia (merged W_qkv + GeLU FFN: ffn_in/ffn_out, no gate)
279
+ KINDS_MERGED = ["qkv", "o", "ffn_in", "ffn_out"]
280
+
281
+
282
+ def median_of_kind(records, kind, field):
283
+ vals = [r[field] for r in records if r.get("kind") == kind]
284
+ return statistics.median(vals) if vals else None
285
+
286
+
287
+ def count_low_R2(records, kind, threshold=0.95):
288
+ matching = [r for r in records if r.get("kind") == kind]
289
+ low = [r for r in matching if r.get("R2", 1.0) < threshold]
290
+ return len(low), len(matching)
291
+
292
+
293
+ def load_entry(json_path):
294
+ if not json_path.exists():
295
+ return None
296
+ with open(json_path) as f:
297
+ d = json.load(f)
298
+ return d.get("per_component", [])
299
+
300
+
301
+ def populate():
302
+ rows = []
303
+ sanity_lines = []
304
+
305
+ for (
306
+ eid,
307
+ jpath,
308
+ family,
309
+ size,
310
+ arch,
311
+ nq,
312
+ nkv,
313
+ qkn,
314
+ tok,
315
+ eta_peak,
316
+ lambda_wd,
317
+ T_steps,
318
+ hp_conf,
319
+ ) in ENTRIES:
320
+ records = load_entry(jpath)
321
+ if not records:
322
+ print(f"[WARN] missing data for {eid}: {jpath}")
323
+ continue
324
+
325
+ # T/tau and Physical State
326
+ t_over_tau = compute_t_tau(eta_peak, lambda_wd, T_steps)
327
+ phys_state = classify_physical_state(t_over_tau)
328
+
329
+ # Determine kinds based on architecture (Pythia merged W_qkv vs separate-Q/K)
330
+ is_merged = arch == "MHA-merged"
331
+ kinds = KINDS_MERGED if is_merged else KINDS_SEPARATE
332
+
333
+ row = {
334
+ "entry_id": eid,
335
+ "family": family,
336
+ "size": size,
337
+ "arch": arch,
338
+ "n_q": nq,
339
+ "n_kv": nkv,
340
+ "qk_norm": qkn,
341
+ "training_tokens": tok,
342
+ "eta_peak": eta_peak,
343
+ "lambda_wd": lambda_wd,
344
+ "T_steps": T_steps,
345
+ "tau_iter": round(1.0 / (eta_peak * lambda_wd)),
346
+ "T_over_tau": round(t_over_tau, 3),
347
+ "Physical_State": phys_state,
348
+ "hp_confidence": hp_conf,
349
+ "n_records": len(records),
350
+ }
351
+
352
+ for kind in kinds:
353
+ row[f"k_median_{kind}"] = median_of_kind(records, kind, "k")
354
+ row[f"lambda_median_{kind}"] = median_of_kind(records, kind, "lambda")
355
+ row[f"R2_median_{kind}"] = median_of_kind(records, kind, "R2")
356
+ low, tot = count_low_R2(records, kind)
357
+ row[f"R2_below_95_{kind}"] = f"{low}/{tot}" if tot else "n/a"
358
+
359
+ rows.append(row)
360
+
361
+ # Sanity logging
362
+ sanity_lines.append(f"### {eid} ({family} {size}, {arch})")
363
+ sanity_lines.append(f" records: {len(records)}; tokens: {tok}; QK-Norm: {qkn}")
364
+ if is_merged:
365
+ sanity_lines.append(
366
+ f" k_median(qkv) = {row['k_median_qkv']:.4f}, R2(qkv) = {row['R2_median_qkv']:.4f}, low-R2: {row['R2_below_95_qkv']}"
367
+ )
368
+ else:
369
+ sanity_lines.append(
370
+ f" k_median(q) = {row['k_median_q']:.4f}, R2(q) = {row['R2_median_q']:.4f}, low-R2: {row['R2_below_95_q']}"
371
+ )
372
+ sanity_lines.append(
373
+ f" k_median(k) = {row['k_median_k']:.4f}, R2(k) = {row['R2_median_k']:.4f}, low-R2: {row['R2_below_95_k']}"
374
+ )
375
+ sanity_lines.append(
376
+ f" k_median(v) = {row['k_median_v']:.4f}, R2(v) = {row['R2_median_v']:.4f}"
377
+ )
378
+ sanity_lines.append(
379
+ f" k_median(o) = {row['k_median_o']:.4f}, R2(o) = {row['R2_median_o']:.4f}"
380
+ )
381
+
382
+ def fnum(v):
383
+ return f"{v:.4f}" if isinstance(v, (int, float)) else "n/a"
384
+
385
+ sanity_lines.append(
386
+ f" k_median(gate)={fnum(row.get('k_median_gate'))}, k_median(up)={fnum(row.get('k_median_up'))}, k_median(down)={fnum(row.get('k_median_down'))}"
387
+ )
388
+ sanity_lines.append("")
389
+
390
+ # ===== Write CSV =====
391
+ csv_path = OUT / "DATABASE_v9_1.csv"
392
+ if rows:
393
+ # Union of all keys (separate + merged)
394
+ keys = list(rows[0].keys())
395
+ for r in rows[1:]:
396
+ for k in r:
397
+ if k not in keys:
398
+ keys.append(k)
399
+ with open(csv_path, "w", newline="") as f:
400
+ writer = csv.DictWriter(f, fieldnames=keys, extrasaction="ignore")
401
+ writer.writeheader()
402
+ for r in rows:
403
+ writer.writerow({k: r.get(k, "") for k in keys})
404
+ print(f"[saved CSV] {csv_path} ({len(rows)} rows)")
405
+
406
+ # ===== Write markdown reference table =====
407
+ md_path = OUT / "DATABASE_v9_1.md"
408
+ with open(md_path, "w") as f:
409
+ f.write("# DATABASE_v9_1 — Reference Table (12 family entries)\n\n")
410
+ f.write("**Source**: cascade v3 (per-component Weibull fit, mid-80% trim)\n")
411
+ f.write("**Generated**: by populate_database_v9_1.py\n\n")
412
+ f.write("## 12 entries (5 Pythia size + 7 cross-family) — k median per component\n\n")
413
+ f.write(
414
+ "| Entry | Family | Size | Architecture | n_q/n_kv | QK-Norm | tokens |"
415
+ " k_q | k_k | k_v | k_o | k_gate | k_up | k_down | low-R²(q) |\n"
416
+ )
417
+ f.write("|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|\n")
418
+ for r in rows:
419
+ qk = "yes" if r["qk_norm"] else "no"
420
+ nqkv = f"{r['n_q']}/{r['n_kv']}" if r["n_q"] else "merged"
421
+ kq = r.get("k_median_q") or r.get("k_median_qkv") or 0
422
+ kk = r.get("k_median_k") or "—"
423
+ kv = r.get("k_median_v") or "—"
424
+ ko = r.get("k_median_o") or "—"
425
+ kg = r.get("k_median_gate") or 0
426
+ ku = r.get("k_median_up") or 0
427
+ kd = r.get("k_median_down") or 0
428
+ lowq = r.get("R2_below_95_q", r.get("R2_below_95_qkv", "—"))
429
+
430
+ def fmt(v):
431
+ return f"{v:.4f}" if isinstance(v, (int, float)) else str(v)
432
+
433
+ f.write(
434
+ f"| {r['entry_id']} | {r['family']} | {r['size']} | {r['arch']} | {nqkv} | {qk} | {r['training_tokens']} | "
435
+ f"{fmt(kq)} | {fmt(kk)} | {fmt(kv)} | {fmt(ko)} | {fmt(kg)} | {fmt(ku)} | {fmt(kd)} | {lowq} |\n"
436
+ )
437
+ f.write("\n")
438
+
439
+ # ===== T/tau + Physical State table =====
440
+ f.write(
441
+ "## Training hyperparameters + T/τ + Physical State (Wang-Aitchison 2024 cycle ratio)\n\n"
442
+ )
443
+ f.write(
444
+ "τ_iter = 1/(η · λ_wd) — EMA iteration time-constant. T/τ_iter = T_steps / τ_iter — completed EMA cycles.\n\n"
445
+ )
446
+ f.write(
447
+ "| Entry | η_peak | λ_wd | T_steps | τ_iter | **T/τ** | **Physical State** | hp source |\n"
448
+ )
449
+ f.write("|---|---|---|---|---|---|---|---|\n")
450
+ for r in rows:
451
+ f.write(
452
+ f"| {r['entry_id']} | {r['eta_peak']:.1e} | {r['lambda_wd']} | {r['T_steps']} | "
453
+ f"{int(r['tau_iter'])} | **{r['T_over_tau']:.2f}** | **{r['Physical_State']}** | {r['hp_confidence']} |\n"
454
+ )
455
+ f.write("\n**Physical State thresholds** (Wang-Aitchison 2024 cycle ratio):\n\n")
456
+ f.write("- Saturated: T/τ ≥ 1.20\n")
457
+ f.write("- Near-saturated: 0.80 ≤ T/τ < 1.20\n")
458
+ f.write("- Approaching: 0.40 ≤ T/τ < 0.80\n")
459
+ f.write("- Partial: 0.25 ≤ T/τ < 0.40\n")
460
+ f.write("- Transition: T/τ < 0.25\n\n")
461
+ f.write("**hp source confidence**:\n\n")
462
+ f.write("- *explicit*: paper Table / official tech report directly states the value\n")
463
+ f.write("- *inferred*: paper §3 states a quantity from which we derive it (e.g. tokens × batch / seq → steps)\n")
464
+ f.write("- *estimated*: paper does not publish; same-family typical recipe used as fallback\n\n")
465
+
466
+ # ===== Public verification section =====
467
+ f.write("---\n\n## Verification\n\n")
468
+ f.write(
469
+ "Per-entry per-component sanity check is recorded in "
470
+ "[`DATABASE_v9_1_report.md`](DATABASE_v9_1_report.md). "
471
+ "All entries pass R² ≥ 0.99 on the Transmission Class components.\n\n"
472
+ )
473
+
474
+ # Compute aggregated Transmission band (median across components per
475
+ # entry, then aggregated across entries) — public-facing summary.
476
+ def fmt_or_dash(v):
477
+ return f"{v:.4f}" if isinstance(v, (int, float)) else "—"
478
+
479
+ per_entry_med = []
480
+ for r in rows:
481
+ # Transmission Class = FFN + W_o per paper §3
482
+ comps = []
483
+ if r.get("k_median_qkv"): # Pythia merged: ffn_in + ffn_out + o
484
+ for kind in ("ffn_in", "ffn_out", "o"):
485
+ v = r.get(f"k_median_{kind}")
486
+ if v is not None:
487
+ comps.append(v)
488
+ else: # SwiGLU: gate + up + down + o
489
+ for kind in ("gate", "up", "down", "o"):
490
+ v = r.get(f"k_median_{kind}")
491
+ if v is not None:
492
+ comps.append(v)
493
+ if comps:
494
+ per_entry_med.append(statistics.median(comps))
495
+
496
+ if per_entry_med:
497
+ mean_k = statistics.mean(per_entry_med)
498
+ cv_pct = statistics.stdev(per_entry_med) / mean_k * 100
499
+ f.write(
500
+ f"**Transmission Class aggregated band** (median across "
501
+ f"components per entry, then aggregated across the "
502
+ f"{len(per_entry_med)} entries): "
503
+ f"k ∈ [{min(per_entry_med):.4f}, {max(per_entry_med):.4f}], "
504
+ f"cross-family CV = {cv_pct:.2f}%.\n\n"
505
+ )
506
+ f.write(
507
+ "See paper §3 for the strict-band definition and trim "
508
+ "protocol. For per-block raw fits and the cascade "
509
+ "pipeline that produces this table, see the "
510
+ "`npm-weibull-py` repository on GitHub.\n"
511
+ )
512
+
513
+ print(f"[saved MD] {md_path}")
514
+
515
+ # ===== Sanity report =====
516
+ rpt = OUT / "DATABASE_v9_1_report.md"
517
+ with open(rpt, "w") as f:
518
+ f.write("# DATABASE_v9_1 sanity verify report\n\n")
519
+ f.write("\n".join(sanity_lines))
520
+ print(f"[saved report] {rpt}")
521
+
522
+
523
+ if __name__ == "__main__":
524
+ populate()