hf3-request-level-v1: metadata, configs, code, and registry

#1
by ryan-0608 - opened
README.md ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ inference: false
4
+ tags:
5
+ - routing
6
+ - request-level-routing
7
+ - speculative-decoding
8
+ - dflash
9
+ - mixture-of-speculators
10
+ - qwen3
11
+ ---
12
+
13
+ # MoS DFlash Routers
14
+
15
+ This repository contains three experimental **request-level** router snapshots
16
+ used by the MoS/DFlash studies. A router classifies one prompt and selects one
17
+ of five draft experts:
18
+
19
+ ```text
20
+ 0 code
21
+ 1 math
22
+ 2 factual_qa
23
+ 3 creative_writing
24
+ 4 general
25
+ ```
26
+
27
+ These artifacts are not token-level routers, standalone language models, or
28
+ complete serving systems. They require hidden states from the exact target
29
+ model and feature contract recorded beside each weight file.
30
+
31
+ ## Release layout
32
+
33
+ ```text
34
+ request-level/
35
+ offline-v2/qwen3-8b/
36
+ intraining-sidecar/qwen3-8b/
37
+ c3/qwen3-4b/
38
+ registry/
39
+ schema/
40
+ verification/
41
+ manifests/
42
+ ```
43
+
44
+ | Release | Feature contract | Head |
45
+ |---|---|---|
46
+ | `offline-v2/qwen3-8b` | layers 1/9/17/25/33; mean, max, and last pooling; stored z-score statistics | LayerNorm(61440) → Linear(512) → GELU → Linear(5) |
47
+ | `intraining-sidecar/qwen3-8b` | layers 1/9/17/25/33; mean pooling | LayerNorm(20480) → Linear(512) → GELU → Linear(5) |
48
+ | `c3/qwen3-4b` | layers 1/9/17/25/33; mean pooling | LayerNorm(12800) → Linear(512) → GELU → Linear(5) |
49
+
50
+ The offline-v2 source was a PyTorch checkpoint. This release converts only its
51
+ tensor state into safetensors and does not publish the pickle container.
52
+
53
+ ## Loading
54
+
55
+ Install the two runtime dependencies:
56
+
57
+ ```bash
58
+ pip install -r requirements.txt
59
+ ```
60
+
61
+ Then load a release with the included helper:
62
+
63
+ ```python
64
+ from pathlib import Path
65
+ from router_loader import load_offline_v2, load_sidecar
66
+
67
+ root = Path("request-level/offline-v2/qwen3-8b")
68
+ head, feature_mean, feature_std, config = load_offline_v2(
69
+ root / "router_head.safetensors",
70
+ root / "router_config.json",
71
+ )
72
+ head.eval()
73
+ ```
74
+
75
+ `load_sidecar` handles either in-training sidecar release. Feature extraction
76
+ is intentionally not hidden inside the loader: callers must implement the
77
+ recorded tokenizer, prompt template, target-layer, and pooling contract
78
+ exactly.
79
+
80
+ The offline-v2 deployment contract additionally zeros z-scored dimensions
81
+ whose stored standard deviation is at most `2e-6`, then clamps the remaining
82
+ values to `[-10, 10]`. Use `prepare_offline_features` from
83
+ `router_loader.py`.
84
+
85
+ ## Verification boundary
86
+
87
+ The release manifest binds every public file to SHA-256 and byte size. The
88
+ included validation report covers:
89
+
90
+ - exact tensor equality for the offline-v2 weights-only conversion;
91
+ - safetensors header, key, shape, dtype, and finite-forward checks;
92
+ - removal of machine-local paths and private per-sample material.
93
+
94
+ It does **not** claim task-level accuracy reproduction on a new inference
95
+ backend. Exact tokenizer, target revision, prompt formatting, hidden-state
96
+ indexing, and numeric dtype still need end-to-end parity testing.
97
+
98
+ Raw prompts, hidden-state feature tensors, per-sample routing records, training
99
+ logs, and raw pickle checkpoints are not included.
100
+
THIRD_PARTY_NOTICES.md ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Third-party notices
2
+
3
+ ## Qwen3 runtime dependency
4
+
5
+ The routers require, but do not redistribute:
6
+
7
+ - `Qwen/Qwen3-8B@b968826d9c46dd6066d109eabc6255188de91218`
8
+ - `Qwen/Qwen3-4B@1cfa9a7208912126459214e8b04321603b3df60c`
9
+
10
+ Qwen3 is licensed under Apache-2.0. Target tokenizer, embedding, LM head, and
11
+ full language-model weights are not included.
12
+
13
+ ## MoS / SpecForge modifications
14
+
15
+ The MoS implementation, router heads, and release tooling are distributed
16
+ under the project MIT License.
17
+
18
+ ## Data boundary
19
+
20
+ Training and evaluation data are not redistributed. Raw prompts, hidden-state
21
+ feature tensors, per-sample predictions, and grouped evaluation samples are
22
+ excluded from this repository.
23
+
manifests/hf3-request-level-v1.json ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "batch_id": "hf3-request-level-v1",
3
+ "created_utc": "2026-07-23T20:19:44.853445+00:00",
4
+ "files": [
5
+ {
6
+ "path": "README.md",
7
+ "sha256": "70166ed56d3fda4959388cdf11ee75a43551c6acd86e740b9b91946b3ca6cbdb",
8
+ "size_bytes": 2983
9
+ },
10
+ {
11
+ "path": "THIRD_PARTY_NOTICES.md",
12
+ "sha256": "225322aa72ce0f62a01deb7397594f5bda82d70001df806f3577834dbe0574ad",
13
+ "size_bytes": 687
14
+ },
15
+ {
16
+ "path": "registry/router_registry.json",
17
+ "sha256": "1c60521f97239aca909c2fc2df9b480c445d685f50cb95595f2ec57dba3437d9",
18
+ "size_bytes": 1700
19
+ },
20
+ {
21
+ "path": "request-level/c3/qwen3-4b/router_config.json",
22
+ "sha256": "802b443727d1960188fb471101ef21f87b75aefbc427f374f030725e0e81365a",
23
+ "size_bytes": 4311
24
+ },
25
+ {
26
+ "path": "request-level/c3/qwen3-4b/router_head.safetensors",
27
+ "sha256": "f1a353e667df2320202daa8bd33101623335dba7f8c3b3e17d5c1f30d694f2f6",
28
+ "size_bytes": 13165082
29
+ },
30
+ {
31
+ "path": "request-level/intraining-sidecar/qwen3-8b/router_config.json",
32
+ "sha256": "9ff4ac13212023dc8c9a26e53391e73a6a668adc39172fb66cc6a516754b7350",
33
+ "size_bytes": 3964
34
+ },
35
+ {
36
+ "path": "request-level/intraining-sidecar/qwen3-8b/router_head.safetensors",
37
+ "sha256": "d0332bd1c37ef498de4b3157f7403d96709b4f641c5a765134fa45ae71d45d98",
38
+ "size_bytes": 21060122
39
+ },
40
+ {
41
+ "path": "request-level/offline-v2/qwen3-8b/router_config.json",
42
+ "sha256": "fbb7cdc501276efd741337d8ad830a2800cd22a2037699f04c4ff5c6fdad5235",
43
+ "size_bytes": 4625
44
+ },
45
+ {
46
+ "path": "request-level/offline-v2/qwen3-8b/router_head.safetensors",
47
+ "sha256": "007a5298d372db09fcb577b9e437227c8773430b2702e7e55f57f15efeafda2b",
48
+ "size_bytes": 126825196
49
+ },
50
+ {
51
+ "path": "request-level/offline-v2/qwen3-8b/selection_sweep.json",
52
+ "sha256": "16ce6fec4aa81471ca9541ece787803dd31f5341fca559cb83d66bc03099f8cd",
53
+ "size_bytes": 4068
54
+ },
55
+ {
56
+ "path": "requirements.txt",
57
+ "sha256": "64e946b5b5eccfcdb377491fd352a24b8add573799549f7885f052e64914620d",
58
+ "size_bytes": 29
59
+ },
60
+ {
61
+ "path": "router_loader.py",
62
+ "sha256": "8473d8d7e37b159837d1cbbb6baabc7c344b2567a6b8972a7f8425e9c1045a1c",
63
+ "size_bytes": 4012
64
+ },
65
+ {
66
+ "path": "schema/router_config.schema.json",
67
+ "sha256": "42bcf639ed14d5c3e57b52b717bc33a14ed3aec3885a0baf1b067039707c2b5e",
68
+ "size_bytes": 2231
69
+ },
70
+ {
71
+ "path": "verification/structural_validation.json",
72
+ "sha256": "51b818b32fff87e036eb4574ea017aa72f421b34a8c59020d4c769d5ec30c995",
73
+ "size_bytes": 675
74
+ }
75
+ ],
76
+ "merged": false,
77
+ "repo_id": "ryan-0608/MoS-DFlash-Routers",
78
+ "schema_version": "1.0",
79
+ "source_artifacts_deleted": false,
80
+ "tagged": false
81
+ }
registry/router_registry.json ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "routers": [
3
+ {
4
+ "artifact_id": "offline-v2-qwen3-8b",
5
+ "config": "request-level/offline-v2/qwen3-8b/router_config.json",
6
+ "feature_dim": 61440,
7
+ "router_kind": "request-level",
8
+ "sha256": "007a5298d372db09fcb577b9e437227c8773430b2702e7e55f57f15efeafda2b",
9
+ "size_bytes": 126825196,
10
+ "status": "experimental",
11
+ "target_model": {
12
+ "repo_id": "Qwen/Qwen3-8B",
13
+ "revision": "b968826d9c46dd6066d109eabc6255188de91218"
14
+ },
15
+ "weights": "request-level/offline-v2/qwen3-8b/router_head.safetensors"
16
+ },
17
+ {
18
+ "artifact_id": "intraining-sidecar-qwen3-8b",
19
+ "config": "request-level/intraining-sidecar/qwen3-8b/router_config.json",
20
+ "feature_dim": 20480,
21
+ "router_kind": "request-level",
22
+ "sha256": "d0332bd1c37ef498de4b3157f7403d96709b4f641c5a765134fa45ae71d45d98",
23
+ "size_bytes": 21060122,
24
+ "status": "experimental",
25
+ "target_model": {
26
+ "repo_id": "Qwen/Qwen3-8B",
27
+ "revision": "b968826d9c46dd6066d109eabc6255188de91218"
28
+ },
29
+ "weights": "request-level/intraining-sidecar/qwen3-8b/router_head.safetensors"
30
+ },
31
+ {
32
+ "artifact_id": "c3-qwen3-4b",
33
+ "config": "request-level/c3/qwen3-4b/router_config.json",
34
+ "feature_dim": 12800,
35
+ "router_kind": "request-level",
36
+ "sha256": "f1a353e667df2320202daa8bd33101623335dba7f8c3b3e17d5c1f30d694f2f6",
37
+ "size_bytes": 13165082,
38
+ "status": "experimental",
39
+ "target_model": {
40
+ "repo_id": "Qwen/Qwen3-4B",
41
+ "revision": "1cfa9a7208912126459214e8b04321603b3df60c"
42
+ },
43
+ "weights": "request-level/c3/qwen3-4b/router_head.safetensors"
44
+ }
45
+ ],
46
+ "schema_version": "1.0"
47
+ }
request-level/c3/qwen3-4b/router_config.json ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "artifact_id": "intraining-mean-qwen3-4b-r4-epoch-002-step-074910",
3
+ "created_utc": "2026-07-20T04:35:36.278433+00:00",
4
+ "domain_outputs": [
5
+ {
6
+ "domain_id": 0,
7
+ "expert_id": "code",
8
+ "label": "code"
9
+ },
10
+ {
11
+ "domain_id": 1,
12
+ "expert_id": "math",
13
+ "label": "math"
14
+ },
15
+ {
16
+ "domain_id": 2,
17
+ "expert_id": "factual_qa",
18
+ "label": "factual_qa"
19
+ },
20
+ {
21
+ "domain_id": 3,
22
+ "expert_id": "creative_writing",
23
+ "label": "creative_writing"
24
+ },
25
+ {
26
+ "domain_id": 4,
27
+ "expert_id": "general",
28
+ "label": "general"
29
+ }
30
+ ],
31
+ "feature_contract": {
32
+ "dropout_at_evaluation": false,
33
+ "feature_dim": 12800,
34
+ "hidden_size": 2560,
35
+ "inference_compute_dtype": "bfloat16 (matches training forward)",
36
+ "max_length": 3072,
37
+ "pooling": "mean_over_all_attended_prompt_tokens",
38
+ "prompt_template": "<|im_start|>system\\nYou are a helpful assistant.<|im_end|>\\n<|im_start|>user\\n{content}<|im_end|>\\n<|im_start|>assistant\\n",
39
+ "target_backend": "sglang (same capture path as Arm-B training)",
40
+ "target_layer_ids": [
41
+ 1,
42
+ 9,
43
+ 17,
44
+ 25,
45
+ 33
46
+ ]
47
+ },
48
+ "head": {
49
+ "architecture": "LayerNorm(12800)->Linear(12800,512)->GELU->Dropout(0.2)->Linear(512,5)",
50
+ "dropout": 0.2,
51
+ "dropout_at_evaluation": false,
52
+ "hidden_dim": 512,
53
+ "input_dim": 12800,
54
+ "output_dim": 5
55
+ },
56
+ "paper_alias": "C3",
57
+ "provenance": {
58
+ "pre_export_source_tensor_sha256": {
59
+ "router_head.0.bias": "8f226e631487e84cd3f7f6bcc8c3bb84622cd6b678d290458531d4e543db1fd9",
60
+ "router_head.0.weight": "dc5eb0e053dbc5f84988445bcad64a5bd478a1911d8f962cb650960b971d1980",
61
+ "router_head.1.bias": "806fe5f22d8e175bdb1753b50e8968c2711dd82b9a035135a011d796de9e9838",
62
+ "router_head.1.weight": "7999df7bfb58ea932f0f75a4823df7e69000fd2cd1e58ae659fc6362278cfa52",
63
+ "router_head.4.bias": "c49ea773ce1a43279f8905ed2243269ff1265d3c684442055ef7c38021672374",
64
+ "router_head.4.weight": "bbd3a2753c5191607ac09a2c8a3790e065f0772051711d85d4538fe07c0c3743"
65
+ },
66
+ "source_checkpoint_config_sha256": "df69894933c784aaa6a7eb41717dc03df2845d856c4cf08fefa91ce1b4d53f62",
67
+ "source_checkpoint_model_sha256": "cda9721a37fc0766ea462608f8af7c3a4f9f0391e1bdf863f847d0dceff15f66",
68
+ "source_metadata_sha256": "17b1b5373e8e0ec34be35d0ab7c97d7a3ed9536847b1293b00f373d15b129dd4",
69
+ "target_backend_implementation_sha256": "654b43cb3a646bda857a5cc3091027f1ef382bcf333f80137b3e597d2572d888",
70
+ "target_config_sha256": "8ba006f74fecfaaeb392872a60f4a480e7ec9860153d2e1b769ec81f9a147f8a"
71
+ },
72
+ "router_kind": "request-level",
73
+ "schema_version": "1.0",
74
+ "source_snapshot_id": "epoch-002-step-074910",
75
+ "status": "experimental",
76
+ "target_model": {
77
+ "repo_id": "Qwen/Qwen3-4B",
78
+ "revision": "1cfa9a7208912126459214e8b04321603b3df60c"
79
+ },
80
+ "weights": {
81
+ "filename": "router_head.safetensors",
82
+ "format": "safetensors",
83
+ "sha256": "f1a353e667df2320202daa8bd33101623335dba7f8c3b3e17d5c1f30d694f2f6",
84
+ "size_bytes": 13165082,
85
+ "tensor_info": {
86
+ "router_head.0.bias": {
87
+ "dtype": "bfloat16",
88
+ "sha256": "c5543a99083d6270f50eadd20f86aa1fef14ab3b7f582603721b831db6ae9d19",
89
+ "shape": [
90
+ 12800
91
+ ]
92
+ },
93
+ "router_head.0.weight": {
94
+ "dtype": "bfloat16",
95
+ "sha256": "a9f7df25661cae17ec5ce8afae0862845f247aed85e719b21387c0574a2c2702",
96
+ "shape": [
97
+ 12800
98
+ ]
99
+ },
100
+ "router_head.1.bias": {
101
+ "dtype": "bfloat16",
102
+ "sha256": "7d078914ce63c4d485e8682b9c4f718fbd5a76cdecb1df472ed48c1998511a46",
103
+ "shape": [
104
+ 512
105
+ ]
106
+ },
107
+ "router_head.1.weight": {
108
+ "dtype": "bfloat16",
109
+ "sha256": "ec58c348a3d18276a7e52304227a57a63776677012e90ab1f81137bf0953b4a9",
110
+ "shape": [
111
+ 512,
112
+ 12800
113
+ ]
114
+ },
115
+ "router_head.4.bias": {
116
+ "dtype": "bfloat16",
117
+ "sha256": "f8c6fa4694e452b7675f540e9fb92260f82f585009e7cb01316eec66344d6b26",
118
+ "shape": [
119
+ 5
120
+ ]
121
+ },
122
+ "router_head.4.weight": {
123
+ "dtype": "bfloat16",
124
+ "sha256": "3541b9619042d7f179271249e55ef0f27705ab4edb369bbd61caa5c19b64a0b3",
125
+ "shape": [
126
+ 5,
127
+ 512
128
+ ]
129
+ }
130
+ }
131
+ }
132
+ }
request-level/c3/qwen3-4b/router_head.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f1a353e667df2320202daa8bd33101623335dba7f8c3b3e17d5c1f30d694f2f6
3
+ size 13165082
request-level/intraining-sidecar/qwen3-8b/router_config.json ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "artifact_id": "intraining-sidecar-qwen3-8b-epoch-000-step-002341",
3
+ "created_utc": "2026-07-19T04:26:37.133107+00:00",
4
+ "domain_outputs": [
5
+ {
6
+ "domain_id": 0,
7
+ "expert_id": "code",
8
+ "label": "code"
9
+ },
10
+ {
11
+ "domain_id": 1,
12
+ "expert_id": "math",
13
+ "label": "math"
14
+ },
15
+ {
16
+ "domain_id": 2,
17
+ "expert_id": "factual_qa",
18
+ "label": "factualqa"
19
+ },
20
+ {
21
+ "domain_id": 3,
22
+ "expert_id": "creative_writing",
23
+ "label": "creativewriting"
24
+ },
25
+ {
26
+ "domain_id": 4,
27
+ "expert_id": "general",
28
+ "label": "general"
29
+ }
30
+ ],
31
+ "feature_contract": {
32
+ "dropout_at_serving": false,
33
+ "feature_dim": 20480,
34
+ "feature_standardization": null,
35
+ "hidden_state_offset": 1,
36
+ "max_length": 3072,
37
+ "pooling": "mean_over_prompt_tokens",
38
+ "prompt_template": "<|im_start|>system\\nYou are a helpful assistant.<|im_end|>\\n<|im_start|>user\\n{content}<|im_end|>\\n<|im_start|>assistant\\n",
39
+ "target_layer_ids": [
40
+ 1,
41
+ 9,
42
+ 17,
43
+ 25,
44
+ 33
45
+ ]
46
+ },
47
+ "head": {
48
+ "architecture": "LayerNorm(20480)->Linear(20480,512)->GELU->Dropout(0.2)->Linear(512,5)",
49
+ "dropout": 0.2,
50
+ "dropout_at_evaluation": false,
51
+ "hidden_dim": 512,
52
+ "input_dim": 20480,
53
+ "output_dim": 5
54
+ },
55
+ "provenance": {
56
+ "pre_export_source_tensor_sha256": {
57
+ "router_head.0.bias": "12258f6171230eca45b8e32a6c71de18d8da183159b26e6d46431dafdedd4e46",
58
+ "router_head.0.weight": "9da7066800a1d526656318e182f3f8675ba439b216be323e6b99bb5ab854419d",
59
+ "router_head.1.bias": "1dca0bef5b54b6cd21aa52e8b42fb13cf7b2110e5eb28302e5eabcb8c59c4c1e",
60
+ "router_head.1.weight": "2c5adde4909f8b3c92a7669790a7ca3de122bc4d4f1d086e9a4398878e59572f",
61
+ "router_head.4.bias": "c4cc7c266d132dfea19baa792e5a9a347d48272504ebf6a9f1c97892df955d3e",
62
+ "router_head.4.weight": "b7f92fe5bda71e837ae4979606c3ec07afbe991a2338422a110d63251e83c425"
63
+ },
64
+ "source_checkpoint_config_sha256": "52f8597dcb666d4e7e9136ef00af5a502ccc20be48dfefe35eabc389d553011f",
65
+ "source_checkpoint_index_sha256": "fad5709071910e254838e40c51a601541dbaab181ac508afa3f52002f11fbe28",
66
+ "source_metadata_sha256": "b15ff65196f41c0c99a9e6fc87ad3f4251698ac083c618859a83b523a745e67b"
67
+ },
68
+ "router_kind": "request-level",
69
+ "schema_version": "1.0",
70
+ "source_snapshot_id": "epoch-000-step-002341",
71
+ "status": "experimental",
72
+ "target_model": {
73
+ "repo_id": "Qwen/Qwen3-8B",
74
+ "revision": "b968826d9c46dd6066d109eabc6255188de91218"
75
+ },
76
+ "weights": {
77
+ "filename": "router_head.safetensors",
78
+ "format": "safetensors",
79
+ "sha256": "d0332bd1c37ef498de4b3157f7403d96709b4f641c5a765134fa45ae71d45d98",
80
+ "size_bytes": 21060122,
81
+ "tensor_info": {
82
+ "router_head.0.bias": {
83
+ "dtype": "bfloat16",
84
+ "sha256": "2d28be30d37b490e9a195a0ebde656f27eff287576846370e1e1339927c0533b",
85
+ "shape": [
86
+ 20480
87
+ ]
88
+ },
89
+ "router_head.0.weight": {
90
+ "dtype": "bfloat16",
91
+ "sha256": "d1d5fe35f4860164fa1d792785f985681770bba65410f30d064e8678b9b34773",
92
+ "shape": [
93
+ 20480
94
+ ]
95
+ },
96
+ "router_head.1.bias": {
97
+ "dtype": "bfloat16",
98
+ "sha256": "ff2ca250d24324f3ce6cbe5e0c8360d29662f6a13d4426bd6a9fcec3b475ab71",
99
+ "shape": [
100
+ 512
101
+ ]
102
+ },
103
+ "router_head.1.weight": {
104
+ "dtype": "bfloat16",
105
+ "sha256": "4490d2940bcd0dcf7ea880429e8b2cca6526228a2adbfa2322b7100f665d0901",
106
+ "shape": [
107
+ 512,
108
+ 20480
109
+ ]
110
+ },
111
+ "router_head.4.bias": {
112
+ "dtype": "bfloat16",
113
+ "sha256": "4142aa8de41a17fc6cdfa37efc665d0caa7535d3174aabf0c5cb87a5f5bac5f4",
114
+ "shape": [
115
+ 5
116
+ ]
117
+ },
118
+ "router_head.4.weight": {
119
+ "dtype": "bfloat16",
120
+ "sha256": "dab62389367b90bafda0af396886021b3712bb4201f1e313042973a03508ebb5",
121
+ "shape": [
122
+ 5,
123
+ 512
124
+ ]
125
+ }
126
+ }
127
+ }
128
+ }
request-level/intraining-sidecar/qwen3-8b/router_head.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d0332bd1c37ef498de4b3157f7403d96709b4f641c5a765134fa45ae71d45d98
3
+ size 21060122
request-level/offline-v2/qwen3-8b/router_config.json ADDED
@@ -0,0 +1,211 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "artifact_id": "offline-v2-qwen3-8b",
3
+ "domain_outputs": [
4
+ {
5
+ "domain_id": 0,
6
+ "expert_id": "code",
7
+ "label": "code"
8
+ },
9
+ {
10
+ "domain_id": 1,
11
+ "expert_id": "math",
12
+ "label": "math"
13
+ },
14
+ {
15
+ "domain_id": 2,
16
+ "expert_id": "factual_qa",
17
+ "label": "factualqa"
18
+ },
19
+ {
20
+ "domain_id": 3,
21
+ "expert_id": "creative_writing",
22
+ "label": "creativewriting"
23
+ },
24
+ {
25
+ "domain_id": 4,
26
+ "expert_id": "general",
27
+ "label": "general"
28
+ }
29
+ ],
30
+ "feature_contract": {
31
+ "concatenation_order": "pool-major-over-concatenated-layers",
32
+ "feature_dim": 61440,
33
+ "hidden_size_per_layer": 4096,
34
+ "hidden_state_offset": 1,
35
+ "max_length": 3072,
36
+ "pooling": [
37
+ "mean",
38
+ "max",
39
+ "last"
40
+ ],
41
+ "pooling_scope": "all-attended-prompt-tokens",
42
+ "prompt_template": "<|im_start|>system\\nYou are a helpful assistant.<|im_end|>\\n<|im_start|>user\\n{content}<|im_end|>\\n<|im_start|>assistant\\n",
43
+ "standardization": {
44
+ "clamp": [
45
+ -10.0,
46
+ 10.0
47
+ ],
48
+ "dead_dimension_value": 0.0,
49
+ "dead_std_threshold": 2e-06,
50
+ "mean_tensor": "feature_mean",
51
+ "std_floor": 1e-06,
52
+ "std_tensor": "feature_std"
53
+ },
54
+ "target_layer_ids": [
55
+ 1,
56
+ 9,
57
+ 17,
58
+ 25,
59
+ 33
60
+ ]
61
+ },
62
+ "head": {
63
+ "architecture": "zscore->LayerNorm->Linear(d,h)->GELU->Dropout->Linear(h,5)",
64
+ "dropout": 0.3,
65
+ "dropout_at_evaluation": false,
66
+ "hidden_dim": 512,
67
+ "input_dim": 61440,
68
+ "output_dim": 5
69
+ },
70
+ "router_kind": "request-level",
71
+ "schema_version": "1.0",
72
+ "selection_metrics": {
73
+ "confusion": [
74
+ [
75
+ 84,
76
+ 0,
77
+ 2,
78
+ 1,
79
+ 2
80
+ ],
81
+ [
82
+ 0,
83
+ 34,
84
+ 0,
85
+ 0,
86
+ 1
87
+ ],
88
+ [
89
+ 1,
90
+ 0,
91
+ 42,
92
+ 1,
93
+ 3
94
+ ],
95
+ [
96
+ 0,
97
+ 0,
98
+ 0,
99
+ 26,
100
+ 4
101
+ ],
102
+ [
103
+ 2,
104
+ 4,
105
+ 7,
106
+ 6,
107
+ 36
108
+ ]
109
+ ],
110
+ "overall": 0.8671875,
111
+ "per_class_recall": [
112
+ 0.9438202247191011,
113
+ 0.9714285714285714,
114
+ 0.8936170212765957,
115
+ 0.8666666666666667,
116
+ 0.6545454545454545
117
+ ]
118
+ },
119
+ "status": "experimental",
120
+ "target_model": {
121
+ "repo_id": "Qwen/Qwen3-8B",
122
+ "revision": "b968826d9c46dd6066d109eabc6255188de91218"
123
+ },
124
+ "training_hyperparameters": {
125
+ "bs": 256,
126
+ "ep": 100,
127
+ "focal": true,
128
+ "gamma": 2,
129
+ "genw": 1.6,
130
+ "lr": 0.001,
131
+ "ls": 0.0,
132
+ "use_pools": [
133
+ "mean",
134
+ "max",
135
+ "last"
136
+ ],
137
+ "wd": 0.01
138
+ },
139
+ "weights": {
140
+ "conversion": {
141
+ "loader_policy": "torch.load(weights_only=True)",
142
+ "source_container_published": false,
143
+ "source_container_sha256": "0621f22b66a778e1e3a7a4d8d35411d7293b699a233f1e1e983fdb5afb4359d0",
144
+ "tensor_equality_verified": true
145
+ },
146
+ "filename": "router_head.safetensors",
147
+ "format": "safetensors",
148
+ "sha256": "007a5298d372db09fcb577b9e437227c8773430b2702e7e55f57f15efeafda2b",
149
+ "size_bytes": 126825196,
150
+ "tensor_info": {
151
+ "f1.bias": {
152
+ "dtype": "float32",
153
+ "sha256": "36f71391a40475a8034100b352c84a80f61c7cceb63bec4c6050f660d9d6d3e9",
154
+ "shape": [
155
+ 512
156
+ ]
157
+ },
158
+ "f1.weight": {
159
+ "dtype": "float32",
160
+ "sha256": "4cc3edfd26e621c8fb5b36aa0b952a54e1fca56c40e20e402be4342bdbd184a1",
161
+ "shape": [
162
+ 512,
163
+ 61440
164
+ ]
165
+ },
166
+ "f2.bias": {
167
+ "dtype": "float32",
168
+ "sha256": "8d314d9a61c6bc2467711956729f38a8a1a919a5e8c5cf14c4ad7c3db4e7de00",
169
+ "shape": [
170
+ 5
171
+ ]
172
+ },
173
+ "f2.weight": {
174
+ "dtype": "float32",
175
+ "sha256": "027a31a5c6198ac046e22cf6dc2d4701de94d6cd145e89dad015ddf10e11620e",
176
+ "shape": [
177
+ 5,
178
+ 512
179
+ ]
180
+ },
181
+ "feature_mean": {
182
+ "dtype": "float32",
183
+ "sha256": "0311eaec869dad77a8add17c36bd1a4db1cfbb010ed6456faf232a730c9b5473",
184
+ "shape": [
185
+ 61440
186
+ ]
187
+ },
188
+ "feature_std": {
189
+ "dtype": "float32",
190
+ "sha256": "1703e25da7eb4d6a3ca024bb78bf47a844abcf70f55ce65c675d0e5016f1f6c2",
191
+ "shape": [
192
+ 61440
193
+ ]
194
+ },
195
+ "n.bias": {
196
+ "dtype": "float32",
197
+ "sha256": "f45b2861c3770f0c22b2349920c1f1947b399b9f222b8c6b3b6dcdbcdd174e0a",
198
+ "shape": [
199
+ 61440
200
+ ]
201
+ },
202
+ "n.weight": {
203
+ "dtype": "float32",
204
+ "sha256": "2f8998fc8e47a5bc193a32d14a5549a519d1f3d5815acf3b061b748e7e0b8249",
205
+ "shape": [
206
+ 61440
207
+ ]
208
+ }
209
+ }
210
+ }
211
+ }
request-level/offline-v2/qwen3-8b/router_head.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:007a5298d372db09fcb577b9e437227c8773430b2702e7e55f57f15efeafda2b
3
+ size 126825196
request-level/offline-v2/qwen3-8b/selection_sweep.json ADDED
@@ -0,0 +1,193 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "results": [
3
+ {
4
+ "ho_overall": 0.8515625,
5
+ "ho_recall": [
6
+ 0.9438202247191011,
7
+ 0.9428571428571428,
8
+ 0.8723404255319149,
9
+ 0.9333333333333333,
10
+ 0.5818181818181818
11
+ ],
12
+ "name": "meanlast ce gw1.3 d.2",
13
+ "pools": [
14
+ "mean",
15
+ "last"
16
+ ],
17
+ "val": 0.8585016131401062
18
+ },
19
+ {
20
+ "ho_overall": 0.8515625,
21
+ "ho_recall": [
22
+ 0.9213483146067416,
23
+ 0.9142857142857143,
24
+ 0.851063829787234,
25
+ 0.9333333333333333,
26
+ 0.6545454545454545
27
+ ],
28
+ "name": "full ce gw1.3 d.3",
29
+ "pools": [
30
+ "mean",
31
+ "max",
32
+ "last"
33
+ ],
34
+ "val": 0.8573335409164429
35
+ },
36
+ {
37
+ "ho_overall": 0.859375,
38
+ "ho_recall": [
39
+ 0.9325842696629213,
40
+ 0.9428571428571428,
41
+ 0.8936170212765957,
42
+ 0.9333333333333333,
43
+ 0.6181818181818182
44
+ ],
45
+ "name": "full ce gw1.6 d.3",
46
+ "pools": [
47
+ "mean",
48
+ "max",
49
+ "last"
50
+ ],
51
+ "val": 0.8556649684906006
52
+ },
53
+ {
54
+ "ho_overall": 0.859375,
55
+ "ho_recall": [
56
+ 0.9325842696629213,
57
+ 0.9142857142857143,
58
+ 0.8723404255319149,
59
+ 0.9333333333333333,
60
+ 0.6545454545454545
61
+ ],
62
+ "name": "full ce gw2.0 d.3",
63
+ "pools": [
64
+ "mean",
65
+ "max",
66
+ "last"
67
+ ],
68
+ "val": 0.8563323616981506
69
+ },
70
+ {
71
+ "ho_overall": 0.84765625,
72
+ "ho_recall": [
73
+ 0.9213483146067416,
74
+ 0.8857142857142857,
75
+ 0.8297872340425532,
76
+ 0.9333333333333333,
77
+ 0.6727272727272727
78
+ ],
79
+ "name": "full focal gw1.0 d.3",
80
+ "pools": [
81
+ "mean",
82
+ "max",
83
+ "last"
84
+ ],
85
+ "val": 0.8516602516174316
86
+ },
87
+ {
88
+ "ho_overall": 0.84375,
89
+ "ho_recall": [
90
+ 0.9325842696629213,
91
+ 0.9142857142857143,
92
+ 0.8297872340425532,
93
+ 0.9,
94
+ 0.6363636363636364
95
+ ],
96
+ "name": "full focal gw1.3 d.3",
97
+ "pools": [
98
+ "mean",
99
+ "max",
100
+ "last"
101
+ ],
102
+ "val": 0.8531620502471924
103
+ },
104
+ {
105
+ "ho_overall": 0.8671875,
106
+ "ho_recall": [
107
+ 0.9438202247191011,
108
+ 0.9714285714285714,
109
+ 0.8936170212765957,
110
+ 0.8666666666666667,
111
+ 0.6545454545454545
112
+ ],
113
+ "name": "full focal gw1.6 d.3",
114
+ "pools": [
115
+ "mean",
116
+ "max",
117
+ "last"
118
+ ],
119
+ "val": 0.8536626100540161
120
+ },
121
+ {
122
+ "ho_overall": 0.84765625,
123
+ "ho_recall": [
124
+ 0.898876404494382,
125
+ 0.9428571428571428,
126
+ 0.8723404255319149,
127
+ 0.8666666666666667,
128
+ 0.6727272727272727
129
+ ],
130
+ "name": "full focal gw2.0 d.3",
131
+ "pools": [
132
+ "mean",
133
+ "max",
134
+ "last"
135
+ ],
136
+ "val": 0.8543300628662109
137
+ },
138
+ {
139
+ "ho_overall": 0.84765625,
140
+ "ho_recall": [
141
+ 0.9213483146067416,
142
+ 0.9142857142857143,
143
+ 0.7872340425531915,
144
+ 0.8666666666666667,
145
+ 0.7272727272727273
146
+ ],
147
+ "name": "full focal gw1.6 d.4 wd3e-2",
148
+ "pools": [
149
+ "mean",
150
+ "max",
151
+ "last"
152
+ ],
153
+ "val": 0.8523277044296265
154
+ },
155
+ {
156
+ "ho_overall": 0.8671875,
157
+ "ho_recall": [
158
+ 0.9213483146067416,
159
+ 0.9714285714285714,
160
+ 0.8936170212765957,
161
+ 0.9333333333333333,
162
+ 0.6545454545454545
163
+ ],
164
+ "name": "full ce gw1.6 d.4 wd3e-2",
165
+ "pools": [
166
+ "mean",
167
+ "max",
168
+ "last"
169
+ ],
170
+ "val": 0.8581678867340088
171
+ },
172
+ {
173
+ "ho_overall": 0.83984375,
174
+ "ho_recall": [
175
+ 0.898876404494382,
176
+ 0.9142857142857143,
177
+ 0.8085106382978723,
178
+ 0.9333333333333333,
179
+ 0.6727272727272727
180
+ ],
181
+ "name": "full focal gw2.5 d.3",
182
+ "pools": [
183
+ "mean",
184
+ "max",
185
+ "last"
186
+ ],
187
+ "val": 0.8521608710289001
188
+ }
189
+ ],
190
+ "schema_version": "1.0",
191
+ "selection_rule": "highest held-out overall accuracy",
192
+ "source_sha256": "3d742dde0322f7d57f81b7902c41bfb9b58b1030c3edb0c9b473659705473d5a"
193
+ }
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ torch>=2.1
2
+ safetensors>=0.4
3
+
router_loader.py ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Minimal loaders for the public MoS/DFlash request-level router artifacts."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import json
6
+ from pathlib import Path
7
+ from typing import Any
8
+
9
+ import torch
10
+ from safetensors.torch import load_file
11
+ from torch import nn
12
+
13
+
14
+ class OfflineV2Head(nn.Module):
15
+ def __init__(self, input_dim: int, hidden_dim: int, output_dim: int, dropout: float):
16
+ super().__init__()
17
+ self.n = nn.LayerNorm(input_dim)
18
+ self.f1 = nn.Linear(input_dim, hidden_dim)
19
+ self.dropout = nn.Dropout(dropout)
20
+ self.f2 = nn.Linear(hidden_dim, output_dim)
21
+
22
+ def forward(self, features: torch.Tensor) -> torch.Tensor:
23
+ hidden = torch.nn.functional.gelu(self.f1(self.n(features)))
24
+ return self.f2(self.dropout(hidden))
25
+
26
+
27
+ class SidecarHead(nn.Module):
28
+ def __init__(self, input_dim: int, hidden_dim: int, output_dim: int, dropout: float):
29
+ super().__init__()
30
+ self.router_head = nn.Sequential(
31
+ nn.LayerNorm(input_dim),
32
+ nn.Linear(input_dim, hidden_dim),
33
+ nn.GELU(),
34
+ nn.Dropout(dropout),
35
+ nn.Linear(hidden_dim, output_dim),
36
+ )
37
+
38
+ def forward(self, features: torch.Tensor) -> torch.Tensor:
39
+ return self.router_head(features)
40
+
41
+
42
+ def _read_config(path: str | Path) -> dict[str, Any]:
43
+ value = json.loads(Path(path).read_text(encoding="utf-8"))
44
+ if not isinstance(value, dict):
45
+ raise ValueError("router config must be a JSON object")
46
+ return value
47
+
48
+
49
+ def load_offline_v2(
50
+ weights_path: str | Path,
51
+ config_path: str | Path,
52
+ *,
53
+ device: str | torch.device = "cpu",
54
+ ) -> tuple[OfflineV2Head, torch.Tensor, torch.Tensor, dict[str, Any]]:
55
+ config = _read_config(config_path)
56
+ tensors = load_file(str(weights_path), device=str(device))
57
+ expected = {
58
+ "n.weight",
59
+ "n.bias",
60
+ "f1.weight",
61
+ "f1.bias",
62
+ "f2.weight",
63
+ "f2.bias",
64
+ "feature_mean",
65
+ "feature_std",
66
+ }
67
+ if set(tensors) != expected:
68
+ raise ValueError(f"unexpected offline-v2 tensor keys: {sorted(tensors)}")
69
+ head_config = config["head"]
70
+ head = OfflineV2Head(
71
+ input_dim=int(head_config["input_dim"]),
72
+ hidden_dim=int(head_config["hidden_dim"]),
73
+ output_dim=int(head_config["output_dim"]),
74
+ dropout=float(head_config["dropout"]),
75
+ )
76
+ head.load_state_dict(
77
+ {key: value for key, value in tensors.items() if key not in {"feature_mean", "feature_std"}},
78
+ strict=True,
79
+ )
80
+ head.to(device).eval()
81
+ return head, tensors["feature_mean"], tensors["feature_std"], config
82
+
83
+
84
+ def prepare_offline_features(
85
+ features: torch.Tensor,
86
+ feature_mean: torch.Tensor,
87
+ feature_std: torch.Tensor,
88
+ *,
89
+ dead_std_threshold: float = 2e-6,
90
+ clamp_abs: float = 10.0,
91
+ ) -> torch.Tensor:
92
+ safe_std = feature_std.clamp_min(1e-6)
93
+ normalized = (features - feature_mean) / safe_std
94
+ normalized = normalized.masked_fill(feature_std <= dead_std_threshold, 0)
95
+ return normalized.clamp(-clamp_abs, clamp_abs)
96
+
97
+
98
+ def load_sidecar(
99
+ weights_path: str | Path,
100
+ config_path: str | Path,
101
+ *,
102
+ device: str | torch.device = "cpu",
103
+ ) -> tuple[SidecarHead, dict[str, Any]]:
104
+ config = _read_config(config_path)
105
+ tensors = load_file(str(weights_path), device=str(device))
106
+ expected = {
107
+ "router_head.0.weight",
108
+ "router_head.0.bias",
109
+ "router_head.1.weight",
110
+ "router_head.1.bias",
111
+ "router_head.4.weight",
112
+ "router_head.4.bias",
113
+ }
114
+ if set(tensors) != expected:
115
+ raise ValueError(f"unexpected sidecar tensor keys: {sorted(tensors)}")
116
+ head_config = config["head"]
117
+ head = SidecarHead(
118
+ input_dim=int(head_config["input_dim"]),
119
+ hidden_dim=int(head_config["hidden_dim"]),
120
+ output_dim=int(head_config["output_dim"]),
121
+ dropout=float(head_config["dropout"]),
122
+ )
123
+ head.load_state_dict(tensors, strict=True)
124
+ head.to(device).eval()
125
+ return head, config
126
+
schema/router_config.schema.json ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://huggingface.co/ryan-0608/MoS-DFlash-Routers/raw/main/schema/router_config.schema.json",
4
+ "title": "MoS DFlash request-level router config",
5
+ "type": "object",
6
+ "required": [
7
+ "schema_version",
8
+ "artifact_id",
9
+ "router_kind",
10
+ "status",
11
+ "target_model",
12
+ "domain_outputs",
13
+ "feature_contract",
14
+ "head",
15
+ "weights"
16
+ ],
17
+ "properties": {
18
+ "schema_version": {"const": "1.0"},
19
+ "artifact_id": {"type": "string", "minLength": 1},
20
+ "router_kind": {"const": "request-level"},
21
+ "status": {"const": "experimental"},
22
+ "target_model": {
23
+ "type": "object",
24
+ "required": ["repo_id", "revision"],
25
+ "properties": {
26
+ "repo_id": {"type": "string", "minLength": 1},
27
+ "revision": {"type": "string", "pattern": "^[0-9a-f]{40}$"}
28
+ },
29
+ "additionalProperties": false
30
+ },
31
+ "domain_outputs": {
32
+ "type": "array",
33
+ "minItems": 5,
34
+ "maxItems": 5,
35
+ "items": {
36
+ "type": "object",
37
+ "required": ["domain_id", "label", "expert_id"],
38
+ "properties": {
39
+ "domain_id": {"type": "integer", "minimum": 0, "maximum": 4},
40
+ "label": {"type": "string"},
41
+ "expert_id": {"type": "string"}
42
+ },
43
+ "additionalProperties": false
44
+ }
45
+ },
46
+ "feature_contract": {"type": "object"},
47
+ "head": {
48
+ "type": "object",
49
+ "required": ["input_dim", "hidden_dim", "output_dim", "dropout"],
50
+ "properties": {
51
+ "input_dim": {"type": "integer", "minimum": 1},
52
+ "hidden_dim": {"type": "integer", "minimum": 1},
53
+ "output_dim": {"const": 5},
54
+ "dropout": {"type": "number", "minimum": 0, "maximum": 1}
55
+ },
56
+ "additionalProperties": true
57
+ },
58
+ "weights": {
59
+ "type": "object",
60
+ "required": ["filename", "format", "sha256", "size_bytes"],
61
+ "properties": {
62
+ "filename": {"const": "router_head.safetensors"},
63
+ "format": {"const": "safetensors"},
64
+ "sha256": {"type": "string", "pattern": "^[0-9a-f]{64}$"},
65
+ "size_bytes": {"type": "integer", "minimum": 1}
66
+ },
67
+ "additionalProperties": true
68
+ }
69
+ },
70
+ "additionalProperties": true
71
+ }
72
+
verification/structural_validation.json ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "c3_qwen3_4b": {
3
+ "finite_forward": true,
4
+ "safetensors_structure": true,
5
+ "strict_loader": true
6
+ },
7
+ "excluded": [
8
+ "raw-pickle-checkpoints",
9
+ "hidden-state-features",
10
+ "raw-prompts",
11
+ "per-sample-routing-records",
12
+ "training-logs"
13
+ ],
14
+ "intraining_sidecar_qwen3_8b": {
15
+ "finite_forward": true,
16
+ "safetensors_structure": true,
17
+ "strict_loader": true
18
+ },
19
+ "offline_v2": {
20
+ "finite_forward": true,
21
+ "strict_loader": true,
22
+ "tensor_equality_after_conversion": true,
23
+ "weights_only_source_load": true
24
+ },
25
+ "schema_version": "1.0",
26
+ "scope": "conversion-and-structural-load-only",
27
+ "task_level_parity_verified": false
28
+ }