afoolishman commited on
Commit
827505a
·
verified ·
1 Parent(s): 6059a6e
Files changed (4) hide show
  1. sd-c/README.md +30 -0
  2. sd-c/config.json +161 -0
  3. sd-c/model.pt +3 -0
  4. sd-c/params.json +13 -0
sd-c/README.md ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SD-C (self-drafting, token router + SSM)
2
+
3
+ Part of the [Self-Drafting Latent Memory](../README.md) collection.
4
+
5
+ SD-B plus a 256-channel non-selective diagonal SSM over (detached) embeddings. Its state feeds both the router and the draft query (181 routes). This is the best drafter in the study.
6
+
7
+ - **Architecture:** 24-layer Llama-style decoder, d = 1024, 24 query / 4 KV heads, SwiGLU, RoPE, tied embeddings, vocabulary 32,768, context 2048. Training config: `w3_sdc_1b` in the repository.
8
+ - **Validation loss:** 2.7111 (1B tokens).
9
+ - **Zero-shot (lm-eval 0.4.13):**
10
+
11
+ | HellaSwag | MMLU-cloze | SciQ | WinoGrande | PIQA | ARC-Easy |
12
+ |---|---|---|---|---|---|
13
+ | 28.6 | 24.3 | 60.3 | 51.6 | 58.3 | 40.0 |
14
+ - Draft head: top-1 agreement 0.449 (held-out). Accepted tokens per step at gamma=4: 1.04 (head alone; beats a 300M-token n-gram drafter at 0.86), 2.52 (head + online counts, open text). Hybrid with prompt lookup: +0.13 over prompt lookup (open). Implied speedup with the PyTorch drafter: 2.86x (open, gamma=4).
15
+
16
+ ## Files
17
+
18
+ - `model.pt`: `{"model": state_dict, "config": ..., "step": ..., "params": ...}`, weights only (no optimizer state).
19
+ - `config.json`: the resolved training/model config.
20
+ - `params.json`: parameter counts by component.
21
+
22
+ ## Load
23
+
24
+ ```python
25
+ from ffnmem.infer import load_model # code from the accompanying repository
26
+ model, cfg = load_model("sd-c/model.pt", device="cuda")
27
+ draft_logits = model.draft_logits(idx, b_idx, t_idx) # token ids only; no backbone forward
28
+ ```
29
+
30
+ Research checkpoint: not instruction-tuned, not safety-tuned, not for deployment.
sd-c/config.json ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "model": {
3
+ "d_model": 1024,
4
+ "n_layers": 24,
5
+ "n_heads": 24,
6
+ "n_kv_heads": 4,
7
+ "head_dim": 64,
8
+ "vocab": 32768,
9
+ "seq_len": 2048,
10
+ "d_ff": [
11
+ 2816,
12
+ 2816,
13
+ 1536,
14
+ 1536,
15
+ 1536,
16
+ 1536,
17
+ 2816,
18
+ 2816,
19
+ 2816,
20
+ 2816,
21
+ 2816,
22
+ 2816,
23
+ 1536,
24
+ 1536,
25
+ 1536,
26
+ 1536,
27
+ 2816,
28
+ 2816,
29
+ 2816,
30
+ 2816,
31
+ 2816,
32
+ 2816,
33
+ 2816,
34
+ 2816
35
+ ],
36
+ "memory_layers": [
37
+ 1
38
+ ],
39
+ "memory": {
40
+ "routes": 181,
41
+ "mem_dim": 128,
42
+ "kv_heads": 4,
43
+ "q_heads": 16,
44
+ "head_dim": 64,
45
+ "execution_mode": "full",
46
+ "router_input": "embed2_ssm"
47
+ },
48
+ "norm_eps": 1e-05,
49
+ "rope_theta": 10000.0,
50
+ "init_std": 0.02,
51
+ "draft": {
52
+ "enabled": true,
53
+ "q_heads": 4,
54
+ "head_dim": 64,
55
+ "share_kv_proj": true,
56
+ "detach_embeddings": true,
57
+ "loss_weight": 0.1,
58
+ "loss_position_frac": 0.25,
59
+ "loss_chunk": 512
60
+ },
61
+ "ssm": {
62
+ "enabled": true,
63
+ "state_dim": 256,
64
+ "chunk": 128,
65
+ "feeds": [
66
+ "router",
67
+ "draft_query"
68
+ ]
69
+ },
70
+ "ffn_cut_layers": [
71
+ 2,
72
+ 3,
73
+ 4,
74
+ 5,
75
+ 12,
76
+ 13,
77
+ 14,
78
+ 15
79
+ ],
80
+ "ffn_cut_delta": 1280,
81
+ "layers": [
82
+ 0,
83
+ 1,
84
+ 2,
85
+ 3,
86
+ 4,
87
+ 5,
88
+ 6,
89
+ 7,
90
+ 8,
91
+ 9,
92
+ 10,
93
+ 11,
94
+ 12,
95
+ 13,
96
+ 14,
97
+ 15,
98
+ 16,
99
+ 17,
100
+ 18,
101
+ 19,
102
+ 20,
103
+ 21,
104
+ 22,
105
+ 23
106
+ ],
107
+ "memory_overrides": {}
108
+ },
109
+ "train": {
110
+ "seed": 1234,
111
+ "data_seed": 1234,
112
+ "val_tokens": 20000000,
113
+ "global_batch": 256,
114
+ "micro_batch": 2,
115
+ "tokens_total": 999817216,
116
+ "lr": 0.0006,
117
+ "min_lr_ratio": 0.1,
118
+ "warmup_frac": 0.02,
119
+ "warmup_min_steps": 100,
120
+ "betas": [
121
+ 0.9,
122
+ 0.95
123
+ ],
124
+ "eps": 1e-08,
125
+ "weight_decay": 0.1,
126
+ "grad_clip": 1.0,
127
+ "table_lr_mult": 4.0,
128
+ "precision": "fp16",
129
+ "act_ckpt": true,
130
+ "attn_backend": "sdpa",
131
+ "zero1": false,
132
+ "ckpt_every": 200,
133
+ "keep_last": 3,
134
+ "keep_every": 1000,
135
+ "eval_every": 200,
136
+ "eval_max_batches": null,
137
+ "diag_batches": 4,
138
+ "log_every": 10,
139
+ "scaler_min": 1.0,
140
+ "scaler_patience": 100,
141
+ "nan_patience": 20,
142
+ "save_steps": [
143
+ 500,
144
+ 1000,
145
+ 1907
146
+ ],
147
+ "strip_old_optimizer": true,
148
+ "seq_len": 2048
149
+ },
150
+ "name": "w3_sdc_1b",
151
+ "params": {
152
+ "reference": false,
153
+ "expected_non_embedding": null,
154
+ "match_config": "w3_sb_1b.yaml",
155
+ "match_tolerance": 0.001,
156
+ "match_target": 369777920
157
+ },
158
+ "wandb": {
159
+ "project": "morbius-wave3"
160
+ }
161
+ }
sd-c/model.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9f21fd33b12d84c2a9c074daba31a89420a0631db6804ca9658455793467b96b
3
+ size 1613808887
sd-c/params.json ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "embedding": 33554432,
3
+ "attention": 88080384,
4
+ "ffn": 176160768,
5
+ "norms": 50176,
6
+ "memory_tables": 100827136,
7
+ "memory_readout": 3905792,
8
+ "draft": 591872,
9
+ "ssm": 263424,
10
+ "total": 403433984,
11
+ "non_embedding": 369879552,
12
+ "active_non_embedding_per_token": 269098752
13
+ }