0xSero commited on
Commit
5f827be
·
verified ·
1 Parent(s): 32e3e16

Add files using upload-large-folder tool

Browse files
Files changed (50) hide show
  1. .gitattributes +1 -0
  2. LICENSE.md +49 -0
  3. README.md +27 -13
  4. chat_template.jinja +94 -0
  5. config.json +337 -0
  6. configuration_laguna.py +256 -0
  7. generation_config.json +24 -0
  8. hybrid/provenance/compact-runtime-validation.json +27 -0
  9. hybrid/provenance/encoder-validation.json +59 -0
  10. hybrid/provenance/hot-nvfp4-compaction.json +101 -0
  11. hybrid/provenance/hybrid-validation.json +51 -0
  12. hybrid/release-manifest.json +0 -0
  13. hybrid/tails/tr3/layer-26/expert-013.json +82 -0
  14. hybrid/tails/tr3/layer-26/expert-021.json +82 -0
  15. hybrid/tails/tr3/layer-26/expert-041.json +82 -0
  16. hybrid/tails/tr3/layer-26/expert-045.json +82 -0
  17. hybrid/tails/tr3/layer-26/expert-047.json +82 -0
  18. hybrid/tails/tr3/layer-26/expert-050.json +82 -0
  19. hybrid/tails/tr3/layer-26/expert-051.json +82 -0
  20. hybrid/tails/tr3/layer-26/expert-062.json +82 -0
  21. hybrid/tails/tr3/layer-26/expert-073.json +82 -0
  22. hybrid/tails/tr3/layer-26/expert-074.json +82 -0
  23. hybrid/tails/tr3/layer-26/expert-102.json +82 -0
  24. hybrid/tails/tr3/layer-26/expert-107.json +82 -0
  25. hybrid/tails/tr3/layer-26/expert-112.json +82 -0
  26. hybrid/tails/tr3/layer-26/expert-129.json +82 -0
  27. hybrid/tails/tr3/layer-26/expert-132.json +82 -0
  28. hybrid/tails/tr3/layer-26/expert-135.json +82 -0
  29. hybrid/tails/tr3/layer-26/expert-138.json +82 -0
  30. hybrid/tails/tr3/layer-26/expert-140.json +82 -0
  31. hybrid/tails/tr3/layer-26/expert-151.json +82 -0
  32. hybrid/tails/tr3/layer-26/expert-164.json +82 -0
  33. hybrid/tails/tr3/layer-26/expert-165.json +82 -0
  34. hybrid/tails/tr3/layer-26/expert-184.json +82 -0
  35. hybrid/tails/tr3/layer-26/expert-189.json +82 -0
  36. hybrid/tails/tr3/layer-26/expert-194.json +82 -0
  37. hybrid/tails/tr3/layer-26/expert-199.json +82 -0
  38. hybrid/tails/tr3/layer-26/expert-204.json +82 -0
  39. hybrid/tails/tr3/layer-26/expert-206.json +82 -0
  40. hybrid/tier-map.json +0 -0
  41. model.safetensors.index.json +0 -0
  42. modeling_laguna.py +886 -0
  43. runtime/Dockerfile +53 -0
  44. runtime/launch_single_spark.sh +88 -0
  45. runtime/launch_tp2.sh +158 -0
  46. runtime/patch_exllamav3_arm64.py +120 -0
  47. runtime/sitecustomize.py +777 -0
  48. special_tokens_map.json +9 -0
  49. tokenizer.json +0 -0
  50. tokenizer_config.json +576 -0
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ model.safetensors.index.json filter=lfs diff=lfs merge=lfs -text
LICENSE.md ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ OpenMDW License Agreement, version 1.1 (OpenMDW-1.1)
2
+
3
+ By exercising rights granted to you under this agreement, you accept and agree
4
+ to its terms.
5
+
6
+ As used in this agreement, "Model Materials" means the materials provided to
7
+ you under this agreement, consisting of: (1) one or more machine learning
8
+ models (including architecture and parameters); and (2) all related artifacts
9
+ (including associated data, documentation and software) that are provided to
10
+ you hereunder.
11
+
12
+ Subject to your compliance with this agreement, permission is hereby granted,
13
+ free of charge, to deal in the Model Materials without restriction, including
14
+ under all copyright, patent, database, and trade secret rights included or
15
+ embodied therein.
16
+
17
+ If you distribute any portion of the Model Materials, you shall retain in your
18
+ distribution (1) a copy of this agreement, and (2) all copyright notices and
19
+ other notices of origin included in the Model Materials that are applicable to
20
+ your distribution.
21
+
22
+ If you file, maintain, or voluntarily participate in a lawsuit against any
23
+ person or entity asserting that the Model Materials directly or indirectly
24
+ infringe any patent or copyright, then all rights and grants made to you
25
+ hereunder are terminated, unless that lawsuit was in response to a
26
+ corresponding lawsuit first brought against you.
27
+
28
+ This agreement does not impose any restrictions or obligations with respect to
29
+ any use, modification, or sharing of any outputs generated by using the Model
30
+ Materials.
31
+
32
+ THE MODEL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
33
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
34
+ FITNESS FOR A PARTICULAR PURPOSE, TITLE, NONINFRINGEMENT, ACCURACY, OR THE
35
+ ABSENCE OF LATENT OR OTHER DEFECTS OR ERRORS, WHETHER OR NOT DISCOVERABLE, ALL
36
+ TO THE GREATEST EXTENT PERMISSIBLE UNDER APPLICABLE LAW.
37
+
38
+ YOU ARE SOLELY RESPONSIBLE FOR (1) CLEARING RIGHTS OF OTHER PERSONS THAT MAY
39
+ APPLY TO THE MODEL MATERIALS OR ANY USE THEREOF, INCLUDING WITHOUT LIMITATION
40
+ ANY PERSON'S COPYRIGHTS OR OTHER RIGHTS INCLUDED OR EMBODIED IN THE MODEL
41
+ MATERIALS; (2) OBTAINING ANY NECESSARY CONSENTS, PERMISSIONS OR OTHER RIGHTS
42
+ REQUIRED FOR ANY USE OF THE MODEL MATERIALS; OR (3) PERFORMING ANY DUE
43
+ DILIGENCE OR UNDERTAKING ANY OTHER INVESTIGATIONS INTO THE MODEL MATERIALS OR
44
+ ANYTHING INCORPORATED OR EMBODIED THEREIN.
45
+
46
+ IN NO EVENT SHALL THE PROVIDERS OF THE MODEL MATERIALS BE LIABLE FOR ANY CLAIM,
47
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
48
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MODEL MATERIALS, THE
49
+ USE THEREOF OR OTHER DEALINGS THEREIN.
README.md CHANGED
@@ -17,10 +17,10 @@ tags:
17
 
18
  # Laguna S 2.1 Hybrid 3.25bpw
19
 
20
- > **Pre-release build record.** This repository is intentionally private while
21
- > the weight transform and serving validation are in progress. Weight files are
22
- > not claimed to be available until the release manifest and validation evidence
23
- > are uploaded with them.
24
 
25
  Laguna S 2.1 Hybrid 3.25bpw is a two-tier, expert-level quantization of
26
  [`poolside/Laguna-S-2.1-NVFP4`](https://huggingface.co/poolside/Laguna-S-2.1-NVFP4).
@@ -47,18 +47,32 @@ weighted expert-output activation saliency over a held-out calibration mixture
47
  covering coding, tool and agentic calls, reasoning, mathematics, science,
48
  terminal work, CUDA, cybersecurity, and long-context prompts. The score is the
49
  mean, over tokens routed to an expert, of the applied router weight multiplied
50
- by that expert's output L2 norm. The published release will include the exact
51
- tier map, source revision, calibration provenance, and artifact hashes.
52
 
53
  ## Runtime status and compatibility
54
 
55
- The hybrid requires the accompanying TP2 EXL3-tail runtime. It is not yet a
56
- drop-in stock-vLLM checkpoint. The release will include a pinned runtime overlay
57
- and an exact launch recipe only after the package passes load, reasoning,
58
- structured-output, tool-call, long-context, and throughput validation.
59
-
60
- Do not infer benchmark quality from this card. At the time this draft was
61
- created, no release benchmark result is claimed.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
 
63
  ## Provenance
64
 
 
17
 
18
  # Laguna S 2.1 Hybrid 3.25bpw
19
 
20
+ > **Verified package.** This package was materialized only after the weight
21
+ > transform, compact-package load, and hybrid-serving validation gates passed.
22
+ > The included release manifest seals the source revision, tier map, runtime
23
+ > overlay, validation evidence, and every packaged artifact hash.
24
 
25
  Laguna S 2.1 Hybrid 3.25bpw is a two-tier, expert-level quantization of
26
  [`poolside/Laguna-S-2.1-NVFP4`](https://huggingface.co/poolside/Laguna-S-2.1-NVFP4).
 
47
  covering coding, tool and agentic calls, reasoning, mathematics, science,
48
  terminal work, CUDA, cybersecurity, and long-context prompts. The score is the
49
  mean, over tokens routed to an expert, of the applied router weight multiplied
50
+ by that expert's output L2 norm. This release includes the exact tier map,
51
+ source revision, calibration provenance, and artifact hashes.
52
 
53
  ## Runtime status and compatibility
54
 
55
+ The hybrid requires the accompanying EXL3-tail runtime. It is not a drop-in
56
+ stock-vLLM checkpoint. The runtime supports two deployment layouts:
57
+
58
+ - single-Spark TP1, which reconstructs each calibrated tail expert from both
59
+ stored artifact slices on one device;
60
+ - two-Spark TP2, which loads one stored artifact slice per tensor-parallel
61
+ rank.
62
+
63
+ Both layouts retain normal compiled execution and CUDA graphs. The package
64
+ includes the pinned runtime overlay and exact launch recipes. The standalone
65
+ 53 GB package passed a fresh compact-package load on one DGX Spark with 200k
66
+ context, Poolside reasoning and tool parsers, structured output support, and
67
+ full/piecewise CUDA graph capture. Its sealed API suite covers reasoning,
68
+ parsed tool calls, tool history, JSON schema, exact ASCII output, and a
69
+ 194,978-token long-context marker-recovery request. The measured stable
70
+ single-Spark throughput sweep selected concurrency 4 at 58.20 aggregate
71
+ completion tokens/s. The source checkpoint contains no native MTP tensors;
72
+ the release therefore does not claim native-MTP throughput.
73
+
74
+ Do not infer benchmark quality from this card. At the time this package was
75
+ published, no Terminal-Bench 2.1 result was claimed.
76
 
77
  ## Provenance
78
 
chat_template.jinja ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {#- Iteration on laguna_glm_thinking_v8/chat_template.jinja -#}
2
+ {#- No formatting instructions -#}
3
+ {{- "〈|EOS|〉" -}}
4
+ {%- set enable_thinking = enable_thinking | default(true) -%}
5
+ {%- set add_generation_prompt = add_generation_prompt | default(false) -%}
6
+ {%- set preserve_thinking = preserve_thinking | default(false) -%}
7
+
8
+ {#- ───── header (system message) ───── -#}
9
+ {#- A caller-supplied system message with empty content opts out of the default below, producing no <system> block — used to train without a system message. -#}
10
+ {%- set system_message = "You are a helpful, conversationally-fluent assistant made by Poolside. You are here to be helpful to users through natural language conversations." -%}
11
+ {%- if messages and messages[0].role == "system" -%}
12
+ {%- set system_message = messages[0].content -%}
13
+ {%- set messages = messages[1:] -%}
14
+ {%- endif -%}
15
+
16
+ {%- set has_sys = system_message and system_message.strip() -%}
17
+ {%- if has_sys or tools or enable_thinking -%}
18
+ {{- "<system>" -}}
19
+
20
+ {%- if has_sys -%}
21
+ {{- system_message.rstrip() -}}
22
+ {%- if tools -%}{{- "\n\n" -}}{%- endif -%}
23
+ {%- endif -%}
24
+
25
+ {%- if tools -%}
26
+ {{- "### Tools\n\n" -}}
27
+ {{- "You may call functions to assist with the user query.\n" -}}
28
+ {{- "All available function signatures are listed below:\n" -}}
29
+ {{- "<available_tools>\n" -}}
30
+ {%- for tool in tools -%}
31
+ {{- (tool | tojson) ~ "\n" -}}
32
+ {%- endfor -%}
33
+ {{- "</available_tools>" -}}
34
+ {%- endif -%}
35
+
36
+ {{- "</system>\n" -}}
37
+ {%- endif -%}
38
+
39
+ {#- ───── main loop ───── -#}
40
+ {%- for message in messages -%}
41
+ {%- set content = message.content if message.content is string else "" -%}
42
+ {%- if message.role == "user" -%}
43
+ {{- "<user>" + content + "</user>\n" -}}
44
+ {%- elif message.role == "assistant" -%}
45
+ {%- generation -%}
46
+ {{- "<assistant>" -}}
47
+ {#- Extract reasoning content from message.reasoning (vLLM field name) or message.reasoning_content -#}
48
+ {%- set reasoning_content = '' -%}
49
+ {%- if message.reasoning is string -%}
50
+ {%- set reasoning_content = message.reasoning -%}
51
+ {%- elif message.reasoning_content is string -%}
52
+ {%- set reasoning_content = message.reasoning_content -%}
53
+ {%- endif -%}
54
+ {#- Display reasoning content for all messages if enable_thinking -#}
55
+ {%- if enable_thinking or preserve_thinking -%}
56
+ {{- '<think>' + reasoning_content + '</think>' -}}
57
+ {%- else -%}
58
+ {{- '</think>' -}}
59
+ {%- endif -%}
60
+ {#- Display main content (trailing newline only when no tool_calls follow) -#}
61
+ {%- if content -%}
62
+ {{- content -}}
63
+ {%- endif -%}
64
+ {%- if message.tool_calls -%}
65
+ {%- for tool_call in message.tool_calls -%}
66
+ {%- set function_data = tool_call.function -%}
67
+ {{- '<tool_call>' + function_data.name -}}
68
+ {%- set _args = function_data.arguments -%}
69
+ {%- for k, v in _args.items() -%}
70
+ {{- "<arg_key>" ~ k ~ "</arg_key>" -}}
71
+ {{- "<arg_value>" -}}{{- v | tojson(ensure_ascii=False) if v is not string else v -}}{{- "</arg_value>" -}}
72
+ {%- endfor -%}
73
+ {{- "</tool_call>" -}}
74
+ {%- endfor -%}
75
+ {%- endif -%}
76
+ {{- "</assistant>\n" -}}
77
+ {%- endgeneration -%}
78
+ {%- elif message.role == "tool" -%}
79
+ {{- "<tool_response>" + content + "</tool_response>\n" -}}
80
+ {%- elif message.role == "system" -%}
81
+ {#- Render additional system messages (the first one, if any, is handled separately in the header and was sliced off above) -#}
82
+ {{- "<system>" + content + "</system>\n" -}}
83
+ {%- endif -%}
84
+ {%- endfor -%}
85
+ {#- ───── generation prompt ───── -#}
86
+ {%- if add_generation_prompt -%}
87
+ {{- "<assistant>" -}}
88
+ {#- ───── Include reasoning mode directive ───── -#}
89
+ {%- if enable_thinking -%}
90
+ {{- '<think>' -}}
91
+ {%- else -%}
92
+ {{- '</think>' -}}
93
+ {%- endif -%}
94
+ {%- endif -%}
config.json ADDED
@@ -0,0 +1,337 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "LagunaForCausalLM"
4
+ ],
5
+ "auto_map": {
6
+ "AutoConfig": "configuration_laguna.LagunaConfig",
7
+ "AutoModelForCausalLM": "modeling_laguna.LagunaForCausalLM"
8
+ },
9
+ "model_type": "laguna",
10
+ "vocab_size": 100352,
11
+ "hidden_size": 3072,
12
+ "intermediate_size": 12288,
13
+ "num_hidden_layers": 48,
14
+ "num_attention_heads": 48,
15
+ "num_key_value_heads": 8,
16
+ "head_dim": 128,
17
+ "max_position_embeddings": 262144,
18
+ "attention_bias": false,
19
+ "attention_dropout": 0.0,
20
+ "rms_norm_eps": 1e-06,
21
+ "num_experts": 256,
22
+ "num_experts_per_tok": 10,
23
+ "moe_intermediate_size": 1024,
24
+ "shared_expert_intermediate_size": 1024,
25
+ "norm_topk_prob": true,
26
+ "router_aux_loss_coef": 0.0,
27
+ "moe_router_logit_softcapping": 0.0,
28
+ "decoder_sparse_step": 1,
29
+ "mlp_only_layers": [
30
+ 0
31
+ ],
32
+ "bos_token_id": 2,
33
+ "eos_token_id": [
34
+ 2,
35
+ 24
36
+ ],
37
+ "pad_token_id": 9,
38
+ "tie_word_embeddings": false,
39
+ "use_cache": true,
40
+ "torch_dtype": "bfloat16",
41
+ "gating": "per-head",
42
+ "sliding_window": 512,
43
+ "rope_parameters": {
44
+ "full_attention": {
45
+ "rope_theta": 500000.0,
46
+ "rope_type": "yarn",
47
+ "factor": 32.0,
48
+ "original_max_position_embeddings": 8192,
49
+ "beta_slow": 1.0,
50
+ "beta_fast": 32.0,
51
+ "attention_factor": 1.3465735902799727,
52
+ "partial_rotary_factor": 0.5
53
+ },
54
+ "sliding_attention": {
55
+ "rope_type": "default",
56
+ "rope_theta": 10000.0,
57
+ "partial_rotary_factor": 1.0
58
+ }
59
+ },
60
+ "layer_types": [
61
+ "full_attention",
62
+ "sliding_attention",
63
+ "sliding_attention",
64
+ "sliding_attention",
65
+ "full_attention",
66
+ "sliding_attention",
67
+ "sliding_attention",
68
+ "sliding_attention",
69
+ "full_attention",
70
+ "sliding_attention",
71
+ "sliding_attention",
72
+ "sliding_attention",
73
+ "full_attention",
74
+ "sliding_attention",
75
+ "sliding_attention",
76
+ "sliding_attention",
77
+ "full_attention",
78
+ "sliding_attention",
79
+ "sliding_attention",
80
+ "sliding_attention",
81
+ "full_attention",
82
+ "sliding_attention",
83
+ "sliding_attention",
84
+ "sliding_attention",
85
+ "full_attention",
86
+ "sliding_attention",
87
+ "sliding_attention",
88
+ "sliding_attention",
89
+ "full_attention",
90
+ "sliding_attention",
91
+ "sliding_attention",
92
+ "sliding_attention",
93
+ "full_attention",
94
+ "sliding_attention",
95
+ "sliding_attention",
96
+ "sliding_attention",
97
+ "full_attention",
98
+ "sliding_attention",
99
+ "sliding_attention",
100
+ "sliding_attention",
101
+ "full_attention",
102
+ "sliding_attention",
103
+ "sliding_attention",
104
+ "sliding_attention",
105
+ "full_attention",
106
+ "sliding_attention",
107
+ "sliding_attention",
108
+ "sliding_attention"
109
+ ],
110
+ "moe_apply_router_weight_on_input": false,
111
+ "mlp_layer_types": [
112
+ "dense",
113
+ "sparse",
114
+ "sparse",
115
+ "sparse",
116
+ "sparse",
117
+ "sparse",
118
+ "sparse",
119
+ "sparse",
120
+ "sparse",
121
+ "sparse",
122
+ "sparse",
123
+ "sparse",
124
+ "sparse",
125
+ "sparse",
126
+ "sparse",
127
+ "sparse",
128
+ "sparse",
129
+ "sparse",
130
+ "sparse",
131
+ "sparse",
132
+ "sparse",
133
+ "sparse",
134
+ "sparse",
135
+ "sparse",
136
+ "sparse",
137
+ "sparse",
138
+ "sparse",
139
+ "sparse",
140
+ "sparse",
141
+ "sparse",
142
+ "sparse",
143
+ "sparse",
144
+ "sparse",
145
+ "sparse",
146
+ "sparse",
147
+ "sparse",
148
+ "sparse",
149
+ "sparse",
150
+ "sparse",
151
+ "sparse",
152
+ "sparse",
153
+ "sparse",
154
+ "sparse",
155
+ "sparse",
156
+ "sparse",
157
+ "sparse",
158
+ "sparse",
159
+ "sparse"
160
+ ],
161
+ "gating_types": [
162
+ "per_head",
163
+ "per_head",
164
+ "per_head",
165
+ "per_head",
166
+ "per_head",
167
+ "per_head",
168
+ "per_head",
169
+ "per_head",
170
+ "per_head",
171
+ "per_head",
172
+ "per_head",
173
+ "per_head",
174
+ "per_head",
175
+ "per_head",
176
+ "per_head",
177
+ "per_head",
178
+ "per_head",
179
+ "per_head",
180
+ "per_head",
181
+ "per_head",
182
+ "per_head",
183
+ "per_head",
184
+ "per_head",
185
+ "per_head",
186
+ "per_head",
187
+ "per_head",
188
+ "per_head",
189
+ "per_head",
190
+ "per_head",
191
+ "per_head",
192
+ "per_head",
193
+ "per_head",
194
+ "per_head",
195
+ "per_head",
196
+ "per_head",
197
+ "per_head",
198
+ "per_head",
199
+ "per_head",
200
+ "per_head",
201
+ "per_head",
202
+ "per_head",
203
+ "per_head",
204
+ "per_head",
205
+ "per_head",
206
+ "per_head",
207
+ "per_head",
208
+ "per_head",
209
+ "per_head"
210
+ ],
211
+ "moe_routed_scaling_factor": 2.5,
212
+ "num_attention_heads_per_layer": [
213
+ 48,
214
+ 72,
215
+ 72,
216
+ 72,
217
+ 48,
218
+ 72,
219
+ 72,
220
+ 72,
221
+ 48,
222
+ 72,
223
+ 72,
224
+ 72,
225
+ 48,
226
+ 72,
227
+ 72,
228
+ 72,
229
+ 48,
230
+ 72,
231
+ 72,
232
+ 72,
233
+ 48,
234
+ 72,
235
+ 72,
236
+ 72,
237
+ 48,
238
+ 72,
239
+ 72,
240
+ 72,
241
+ 48,
242
+ 72,
243
+ 72,
244
+ 72,
245
+ 48,
246
+ 72,
247
+ 72,
248
+ 72,
249
+ 48,
250
+ 72,
251
+ 72,
252
+ 72,
253
+ 48,
254
+ 72,
255
+ 72,
256
+ 72,
257
+ 48,
258
+ 72,
259
+ 72,
260
+ 72
261
+ ],
262
+ "quantization_config": {
263
+ "config_groups": {
264
+ "group_0": {
265
+ "format": "nvfp4-pack-quantized",
266
+ "input_activations": {
267
+ "actorder": null,
268
+ "block_structure": null,
269
+ "dynamic": "local",
270
+ "group_size": 16,
271
+ "num_bits": 4,
272
+ "observer": "static_minmax",
273
+ "observer_kwargs": {},
274
+ "scale_dtype": "torch.float8_e4m3fn",
275
+ "strategy": "tensor_group",
276
+ "symmetric": true,
277
+ "type": "float",
278
+ "zp_dtype": null
279
+ },
280
+ "output_activations": null,
281
+ "targets": [
282
+ "re:.*experts\\.[0-9]+\\.(gate_proj|up_proj|down_proj)$"
283
+ ],
284
+ "weights": {
285
+ "actorder": null,
286
+ "block_structure": null,
287
+ "dynamic": false,
288
+ "group_size": 16,
289
+ "num_bits": 4,
290
+ "observer": "memoryless_minmax",
291
+ "observer_kwargs": {},
292
+ "scale_dtype": "torch.float8_e4m3fn",
293
+ "strategy": "tensor_group",
294
+ "symmetric": true,
295
+ "type": "float",
296
+ "zp_dtype": null
297
+ }
298
+ }
299
+ },
300
+ "format": "nvfp4-pack-quantized",
301
+ "global_compression_ratio": null,
302
+ "ignore": [
303
+ "lm_head",
304
+ "re:.*\\.self_attn\\.q_proj$",
305
+ "re:.*\\.self_attn\\.k_proj$",
306
+ "re:.*\\.self_attn\\.v_proj$",
307
+ "re:.*\\.self_attn\\.o_proj$",
308
+ "re:.*\\.self_attn\\.g_proj$",
309
+ "re:.*\\.mlp\\.gate$",
310
+ "model.layers.0.mlp.gate_proj",
311
+ "model.layers.0.mlp.up_proj",
312
+ "model.layers.0.mlp.down_proj",
313
+ "re:.*\\.mlp\\.shared_expert\\.gate_proj$",
314
+ "re:.*\\.mlp\\.shared_expert\\.up_proj$",
315
+ "re:.*\\.mlp\\.shared_expert\\.down_proj$"
316
+ ],
317
+ "kv_cache_scheme": {
318
+ "actorder": null,
319
+ "block_structure": null,
320
+ "dynamic": false,
321
+ "group_size": null,
322
+ "num_bits": 8,
323
+ "observer": "minmax",
324
+ "observer_kwargs": {},
325
+ "scale_dtype": null,
326
+ "strategy": "tensor",
327
+ "symmetric": true,
328
+ "type": "float",
329
+ "zp_dtype": null
330
+ },
331
+ "quant_method": "compressed-tensors",
332
+ "quantization_status": "compressed",
333
+ "sparsity_config": {},
334
+ "transform_config": {},
335
+ "version": "0.14.1.dev11+gf2ee47b"
336
+ }
337
+ }
configuration_laguna.py ADDED
@@ -0,0 +1,256 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ruff: noqa
2
+ # Copyright 2025 Poolside and the HuggingFace Inc. team. All rights reserved.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ from transformers.configuration_utils import PretrainedConfig as PreTrainedConfig
16
+ try:
17
+ from transformers.modeling_rope_utils import RopeParameters
18
+ except ImportError:
19
+ RopeParameters = dict
20
+ try:
21
+ from transformers.utils.import_utils import is_causal_conv1d_available, is_flash_linear_attention_available
22
+ except ImportError:
23
+ def is_causal_conv1d_available(): return False
24
+ def is_flash_linear_attention_available(): return False
25
+
26
+
27
+ class LagunaConfig(PreTrainedConfig):
28
+ r"""
29
+ Configuration class for Laguna model.
30
+
31
+ Laguna is Poolside's MoE architecture with:
32
+ - Attention output gating (softplus gate)
33
+ - Sigmoid routing instead of softmax
34
+ - No QKV bias
35
+ - Explicit head_dim parameter
36
+
37
+ Args:
38
+ head_dim (`int`, *optional*, defaults to 128):
39
+ Dimension of attention heads. Laguna uses explicit head_dim rather than
40
+ computing it from hidden_size // num_attention_heads.
41
+ qkv_bias (`bool`, *optional*, defaults to `False`):
42
+ Whether to add bias to QKV projections. Laguna uses no QKV bias.
43
+ attention_bias (`bool`, *optional*, defaults to `False`):
44
+ Whether to add bias to attention output projection. Laguna uses no attention bias.
45
+ gating (`bool` or `str`, *optional*, defaults to `True`):
46
+ Attention output gating mode. When ``True`` or ``"per-element"`` a g_proj
47
+ linear layer with output size ``num_attention_heads * head_dim`` is added
48
+ and ``attn_output = attn_output * softplus(g_proj(x))``. When ``"per-head"``
49
+ g_proj has output size ``num_attention_heads`` and the gate broadcasts across
50
+ ``head_dim``. When ``False`` no gating is applied.
51
+ partial_rotary_factor (`float`, *optional*):
52
+ Fraction of head_dim to apply rotary embeddings to. When set, this value is
53
+ injected into ``rope_parameters`` (and ``swa_rope_parameters``) if not already
54
+ specified there. When ``None`` the default behaviour of the rope implementation
55
+ is used (typically full rotary).
56
+ num_attention_heads_per_layer (`list[int]`, *optional*):
57
+ Optional per-layer override for ``num_attention_heads``. When provided the list
58
+ length must equal ``num_hidden_layers`` and each entry is the head count used by
59
+ that layer. When ``None`` every layer uses ``num_attention_heads``.
60
+ vocab_size (`int`, *optional*, defaults to 100352):
61
+ Vocabulary size of the Laguna model.
62
+ hidden_size (`int`, *optional*, defaults to 2048):
63
+ Dimension of the hidden representations.
64
+ intermediate_size (`int`, *optional*, defaults to 8192):
65
+ Dimension of the MLP representations for dense layers.
66
+ num_hidden_layers (`int`, *optional*, defaults to 48):
67
+ Number of hidden layers in the Transformer.
68
+ num_attention_heads (`int`, *optional*, defaults to 32):
69
+ Number of attention heads.
70
+ num_key_value_heads (`int`, *optional*, defaults to 8):
71
+ Number of key-value heads for GQA.
72
+ max_position_embeddings (`int`, *optional*, defaults to 4096):
73
+ Maximum sequence length.
74
+ rms_norm_eps (`float`, *optional*, defaults to 1e-6):
75
+ Epsilon for RMSNorm layers.
76
+ sliding_window (`int`, *optional*):
77
+ Sliding window attention size. Used by layers whose type in ``layer_types``
78
+ is ``"sliding_attention"``. When ``None``, all layers use full attention.
79
+ layer_types (`list[str]`, *optional*):
80
+ Per-layer attention type. Each element should be ``"sliding_attention"`` or
81
+ ``"full_attention"``. Length must equal ``num_hidden_layers``. When ``None``,
82
+ all layers default to global attention.
83
+ swa_attention_sink_enabled (`bool`, *optional*, defaults to `False`):
84
+ Whether to enable learnable attention sinks on sliding-window attention layers.
85
+ When enabled, a per-head bias parameter is added that allows the model to attend
86
+ to position 0 even when it falls outside the sliding window.
87
+ swa_rope_parameters (`RopeParameters`, *optional*):
88
+ Separate RoPE configuration for sliding-window attention layers. When ``None``,
89
+ SWA layers use the same RoPE as global attention layers.
90
+ num_experts (`int`, *optional*, defaults to 256):
91
+ Number of routed experts.
92
+ num_experts_per_tok (`int`, *optional*, defaults to 16):
93
+ Number of experts selected per token (top-k).
94
+ moe_intermediate_size (`int`, *optional*, defaults to 1024):
95
+ Intermediate size of routed experts.
96
+ shared_expert_intermediate_size (`int`, *optional*, defaults to 1024):
97
+ Intermediate size of the shared expert.
98
+ norm_topk_prob (`bool`, *optional*, defaults to `True`):
99
+ Whether to normalize top-k routing probabilities.
100
+ decoder_sparse_step (`int`, *optional*, defaults to 1):
101
+ Frequency of MoE layers (1 = every layer is MoE after mlp_only_layers).
102
+ mlp_only_layers (`list[int]`, *optional*, defaults to `[0]`):
103
+ Layer indices that use dense MLP instead of MoE.
104
+ router_aux_loss_coef (`float`, *optional*, defaults to 0.001):
105
+ Auxiliary loss coefficient for load balancing.
106
+ moe_routed_scaling_factor (`float`, *optional*, defaults to 1.0):
107
+ Scalar multiplier applied to the routed-expert output before combining with the
108
+ shared-expert output.
109
+ moe_apply_router_weight_on_input (`bool`, *optional*, defaults to `False`):
110
+ When ``True`` the top-k routing weights are multiplied into each expert's input
111
+ rather than its output. Matches the numerical form used by the trained checkpoint.
112
+ moe_router_logit_softcapping (`float`, *optional*, defaults to 0.0):
113
+ Optional soft-capping value ``c`` applied to router logits as
114
+ ``x = tanh(x / c) * c`` before sigmoid + top-k. Disabled when ``0``.
115
+ rope_parameters (`RopeParameters`, *optional*):
116
+ RoPE configuration. Defaults to rope_theta=500000.0.
117
+ """
118
+
119
+ model_type = "laguna"
120
+ keys_to_ignore_at_inference = ["past_key_values"]
121
+ # PreTrainedConfig in transformers v5 no longer auto-declares these; subclasses
122
+ # opt in by providing class-level annotations with defaults.
123
+ pad_token_id: int | None = None
124
+ bos_token_id: int | None = None
125
+ eos_token_id: int | list[int] | None = None
126
+ base_model_tp_plan = {
127
+ "layers.*.self_attn.q_proj": "colwise",
128
+ "layers.*.self_attn.k_proj": "colwise",
129
+ "layers.*.self_attn.v_proj": "colwise",
130
+ "layers.*.self_attn.g_proj": "colwise", # Laguna-specific gating projection
131
+ "layers.*.self_attn.o_proj": "rowwise",
132
+ "layers.*.mlp.gate_proj": "colwise",
133
+ "layers.*.mlp.up_proj": "colwise",
134
+ "layers.*.mlp.down_proj": "rowwise",
135
+ }
136
+ base_model_pp_plan = {
137
+ "embed_tokens": (["input_ids"], ["inputs_embeds"]),
138
+ "layers": (["hidden_states", "attention_mask"], ["hidden_states"]),
139
+ "norm": (["hidden_states"], ["hidden_states"]),
140
+ }
141
+
142
+ def __init__(
143
+ self,
144
+ vocab_size: int = 100352,
145
+ hidden_size: int = 2048,
146
+ intermediate_size: int = 8192,
147
+ num_hidden_layers: int = 48,
148
+ num_attention_heads: int = 32,
149
+ num_key_value_heads: int = 8,
150
+ head_dim: int = 128,
151
+ qkv_bias: bool = False,
152
+ attention_bias: bool = False,
153
+ gating: bool | str = True,
154
+ hidden_act: str = "silu",
155
+ max_position_embeddings: int = 4096,
156
+ initializer_range: float = 0.02,
157
+ rms_norm_eps: float = 1e-6,
158
+ use_cache: bool = True,
159
+ tie_word_embeddings: bool = False,
160
+ rope_parameters: RopeParameters | dict[str, RopeParameters] | None = None,
161
+ partial_rotary_factor: float | None = None,
162
+ attention_dropout: float = 0.0,
163
+ sliding_window: int | None = None,
164
+ layer_types: list[str] | None = None,
165
+ num_attention_heads_per_layer: list[int] | None = None,
166
+ swa_attention_sink_enabled: bool = False,
167
+ swa_rope_parameters: RopeParameters | None = None,
168
+ num_experts: int = 256,
169
+ num_experts_per_tok: int = 16,
170
+ moe_intermediate_size: int = 1024,
171
+ shared_expert_intermediate_size: int = 1024,
172
+ norm_topk_prob: bool = True,
173
+ decoder_sparse_step: int = 1,
174
+ mlp_only_layers: list[int] | None = None,
175
+ router_aux_loss_coef: float = 0.001,
176
+ moe_routed_scaling_factor: float = 1.0,
177
+ moe_apply_router_weight_on_input: bool = False,
178
+ moe_router_logit_softcapping: float = 0.0,
179
+ output_router_logits: bool = False,
180
+ **kwargs,
181
+ ):
182
+ # Default mlp_only_layers: first layer is dense (moe_first_k_dense_replace=1)
183
+ if mlp_only_layers is None:
184
+ mlp_only_layers = [0]
185
+
186
+ # Default layer_types: all layers use full attention (Laguna-M). Laguna-XS
187
+ # ships an explicit list with a mix of "full_attention" and "sliding_attention".
188
+ # Downstream mask builders (``create_masks_for_generate``) iterate
189
+ # ``layer_types``, so it must be a list — not left as ``None``.
190
+ if layer_types is None:
191
+ layer_types = ["full_attention"] * num_hidden_layers
192
+
193
+ # Default rope_parameters with Laguna's theta
194
+ if rope_parameters is None:
195
+ rope_parameters = {"rope_type": "default", "rope_theta": 500000.0}
196
+
197
+ # config.json stores SWA rope nested in rope_parameters["sliding_attention"]
198
+ # and carries no top-level swa_rope_parameters. Derive it here, else the
199
+ # sliding-window layers silently reuse the full-attention rope.
200
+ if swa_rope_parameters is None and isinstance(rope_parameters, dict):
201
+ swa_rope_parameters = rope_parameters.get("sliding_attention")
202
+
203
+ # If ``partial_rotary_factor`` is set at the top level, inject it into any
204
+ # rope dict that does not already carry one so the rotary embedding picks
205
+ # it up consistently for both full-attention and SWA layers.
206
+ if partial_rotary_factor is not None:
207
+ if isinstance(rope_parameters, dict) and "partial_rotary_factor" not in rope_parameters:
208
+ rope_parameters = {**rope_parameters, "partial_rotary_factor": partial_rotary_factor}
209
+ if isinstance(swa_rope_parameters, dict) and "partial_rotary_factor" not in swa_rope_parameters:
210
+ swa_rope_parameters = {
211
+ **swa_rope_parameters,
212
+ "partial_rotary_factor": partial_rotary_factor,
213
+ }
214
+
215
+ self.vocab_size = vocab_size
216
+ self.hidden_size = hidden_size
217
+ self.intermediate_size = intermediate_size
218
+ self.num_hidden_layers = num_hidden_layers
219
+ self.num_attention_heads = num_attention_heads
220
+ self.num_key_value_heads = num_key_value_heads
221
+ self.head_dim = head_dim
222
+ self.qkv_bias = qkv_bias
223
+ self.attention_bias = attention_bias
224
+ self.gating = gating
225
+ self.hidden_act = hidden_act
226
+ self.max_position_embeddings = max_position_embeddings
227
+ self.initializer_range = initializer_range
228
+ self.rms_norm_eps = rms_norm_eps
229
+ self.use_cache = use_cache
230
+ self.rope_parameters = rope_parameters
231
+ self.partial_rotary_factor = partial_rotary_factor
232
+ self.attention_dropout = attention_dropout
233
+ # Sliding window attention arguments
234
+ self.sliding_window = sliding_window
235
+ self.layer_types = layer_types
236
+ self.num_attention_heads_per_layer = num_attention_heads_per_layer
237
+ self.swa_attention_sink_enabled = swa_attention_sink_enabled
238
+ self.swa_rope_parameters = swa_rope_parameters
239
+ # MoE arguments
240
+ self.num_experts = num_experts
241
+ self.num_experts_per_tok = num_experts_per_tok
242
+ self.moe_intermediate_size = moe_intermediate_size
243
+ self.shared_expert_intermediate_size = shared_expert_intermediate_size
244
+ self.norm_topk_prob = norm_topk_prob
245
+ self.decoder_sparse_step = decoder_sparse_step
246
+ self.mlp_only_layers = mlp_only_layers
247
+ self.router_aux_loss_coef = router_aux_loss_coef
248
+ self.moe_routed_scaling_factor = moe_routed_scaling_factor
249
+ self.moe_apply_router_weight_on_input = moe_apply_router_weight_on_input
250
+ self.moe_router_logit_softcapping = moe_router_logit_softcapping
251
+ self.output_router_logits = output_router_logits
252
+
253
+ super().__init__(tie_word_embeddings=tie_word_embeddings, **kwargs)
254
+
255
+
256
+ __all__ = ["LagunaConfig"]
generation_config.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 2,
3
+ "do_sample": true,
4
+ "eos_token_id": [
5
+ 2,
6
+ 24
7
+ ],
8
+ "pad_token_id": 9,
9
+ "temperature": 1.0,
10
+ "top_p": 1.0,
11
+ "speculative_config": {
12
+ "method": "dflash",
13
+ "source": "huggingface",
14
+ "model": "poolside/Laguna-S-2.1-DFlash-NVFP4",
15
+ "num_speculative_tokens": 15
16
+ },
17
+ "tool_call_parser": "poolside_v1",
18
+ "reasoning_parser": "poolside_v1",
19
+ "default_chat_template_kwargs": {
20
+ "enable_thinking": true
21
+ },
22
+ "top_k": 20,
23
+ "min_p": 0.0
24
+ }
hybrid/provenance/compact-runtime-validation.json ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "api": {
3
+ "ascii_exact.json": "d612d240beba543a0195b14bda552dbd11d99ce12bc8922a41cdbcd3e05edc5f",
4
+ "json_schema.json": "df181e6bfeaca7467ef1da7157424d9a9888c4490ad2ba70930f16bd016e793f",
5
+ "manifest.json": "66bde0d76afa10216756cb5414e28d67de11af12ace319a732a23b734cf6cd54",
6
+ "reasoning.json": "cfc1aedd8b12893dfd28fd511a8c146fdd54d2ade964e8da5cf3045838f3b2e3",
7
+ "tool_call.json": "375b6e470e6f17cc6f02a14ac46e33bb584ecf4887e91ded008e736493a23998",
8
+ "tool_history.json": "2b62deca1ef70c8f7b4176d0318bcf69c908b65e9b70658c2132400ce7af94c9"
9
+ },
10
+ "compacted_index_sha256": "7f6e2d40d6a6f4571d99a0f2a5c7f987af729beebdb66af98301f77c521e3de5",
11
+ "compaction_evidence_sha256": "425f7ec4ee5fc0f857f183e73ad4efe738d44c4c272e68cd788f5f842f5b7031",
12
+ "context_configured": 200000,
13
+ "cuda_graphs": true,
14
+ "generation_limit_fields_present": false,
15
+ "package": "/home/sero/laguna-reap-saliency-v1/hf-release-staging-20260725-a3/Laguna-S-2.1-Hybrid-3.25bpw",
16
+ "schema": "laguna-compact-runtime-validation/v1",
17
+ "service": {
18
+ "artifact_tensor_parallel_size": 2,
19
+ "head_inspect_sha256": "dbf827997fb08f73bc26190b2aa43c166c2825a9190221b537786baef7fe954f",
20
+ "head_log_sha256": "eb7841603c44358b9d7352e44a4c5f98e290422b09769c9e716def32df62fff1",
21
+ "runtime_tensor_parallel_size": 1,
22
+ "worker_inspect_sha256": null,
23
+ "worker_log_sha256": null
24
+ },
25
+ "speculative_decode_method": "none",
26
+ "status": "complete"
27
+ }
hybrid/provenance/encoder-validation.json ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "capture_manifest_sha256": "976ba9935c2ae028117276f32bd33195862733a2b76cacb5514d3f2c2fb12a69",
3
+ "codebook": "mcg",
4
+ "encoded_bytes_total": 50432669432,
5
+ "encoder_script_sha256": "30ccbf529dcab421ec904d8069a0ef33714d25408abf615ff76fccbcffae6b44",
6
+ "experts_per_sparse_layer": 256,
7
+ "fallback_slices": 0,
8
+ "generated_at": "2026-07-25T16:19:07.556438+00:00",
9
+ "hessian": "routed-real-activations",
10
+ "mcg_multiplier": "0xcbac1fed",
11
+ "partition_manifests": {
12
+ "0": {
13
+ "path": "/work/exl3-tail-current-encode-20260723-a4/partition-0.manifest.json",
14
+ "sha256": "b2e2377dea353f883e72c563063f36866d00f9acb04cd6fad030e437f4c6fd3e"
15
+ },
16
+ "1": {
17
+ "path": "/work/exl3-tail-current-encode-20260723-a4/partition-1.manifest.json",
18
+ "sha256": "1ed41207a55fc462952340945de6843f0a8f4aa507affb7cc037dffc345549b7"
19
+ }
20
+ },
21
+ "schema": "laguna-exl3-tail-validation/v1",
22
+ "source_index_sha256": "c872bd9b5ac116cebfd78a5f27565787dbceae76985cef041179110d0b03cd2b",
23
+ "sparse_layers": 47,
24
+ "status": "complete",
25
+ "tiers": {
26
+ "TR2": {
27
+ "bits": 2,
28
+ "encoded_bytes": 18085239032,
29
+ "expert_files": 7520,
30
+ "fallback_slices": 0,
31
+ "hot_nvfp4_experts_per_layer": 96,
32
+ "hot_saliency_coverage_mean": 0.5584435128448573,
33
+ "hot_saliency_coverage_min": 0.4937639739328926,
34
+ "maximum_calibration_rows_per_expert": 2048,
35
+ "minimum_calibration_rows_per_expert": 4,
36
+ "projection_rank_slices": 45120,
37
+ "tail_trellis_experts_per_layer": 160,
38
+ "tier_map": "/work/final-current-observations-20260723-a1/tier-maps/laguna-tr2-tier-map.json",
39
+ "tier_map_sha256": "bef6b3cda9d47938cfef8c0a50e2f088e7f2471c6a88a93571f3904e5bd02406"
40
+ },
41
+ "TR3": {
42
+ "bits": 3,
43
+ "encoded_bytes": 32347430400,
44
+ "expert_files": 9024,
45
+ "fallback_slices": 0,
46
+ "hot_nvfp4_experts_per_layer": 64,
47
+ "hot_saliency_coverage_mean": 0.4211937699439102,
48
+ "hot_saliency_coverage_min": 0.35016990543040455,
49
+ "maximum_calibration_rows_per_expert": 2048,
50
+ "minimum_calibration_rows_per_expert": 4,
51
+ "projection_rank_slices": 54144,
52
+ "tail_trellis_experts_per_layer": 192,
53
+ "tier_map": "/work/final-current-observations-20260723-a1/tier-maps/laguna-tr3-tier-map.json",
54
+ "tier_map_sha256": "98bb2a6cfab92807201180c1cde4447d50fc7bd991bde8f2f6a869a84e2ff45a"
55
+ }
56
+ },
57
+ "tp": 2,
58
+ "validator_script_sha256": "ac83b4b1db7f325c8f33cf7f1da58e01963a45090e3a563341371644ea1502b3"
59
+ }
hybrid/provenance/hot-nvfp4-compaction.json ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "compacted_index_sha256": "7f6e2d40d6a6f4571d99a0f2a5c7f987af729beebdb66af98301f77c521e3de5",
3
+ "hot_nvfp4_experts_per_sparse_layer": 64,
4
+ "kept_expert_tensor_names": 36096,
5
+ "kept_tensor_names": 36865,
6
+ "package": "/package",
7
+ "removed_cold_expert_tensor_names": 108288,
8
+ "schema": "laguna-hot-nvfp4-compaction/v1",
9
+ "shards": [
10
+ {
11
+ "bytes": 5086273312,
12
+ "path": "model-00001-of-00014.safetensors",
13
+ "sha256": "80518caa724f3ec5bd0470767196354a7f64abdb35d48272d4e99ad69033f5bc",
14
+ "tensors": 568
15
+ },
16
+ {
17
+ "bytes": 3711336800,
18
+ "path": "model-00002-of-00014.safetensors",
19
+ "sha256": "18428e5d5c5b4b613abd6cbd87c1df1a83317956408a1922bab071a27c465f27",
20
+ "tensors": 1941
21
+ },
22
+ {
23
+ "bytes": 1261986736,
24
+ "path": "model-00003-of-00014.safetensors",
25
+ "sha256": "1f04555a5d0b62586899d8a03230810996ab56b68a002a14395454ce4304b0cd",
26
+ "tensors": 2852
27
+ },
28
+ {
29
+ "bytes": 1281456824,
30
+ "path": "model-00004-of-00014.safetensors",
31
+ "sha256": "54a9f15b8b7847eda2dae096ebab2809e0581e619e0c165977eb60998da2a393",
32
+ "tensors": 2896
33
+ },
34
+ {
35
+ "bytes": 1290308968,
36
+ "path": "model-00005-of-00014.safetensors",
37
+ "sha256": "6f880b76d49467e6607115d319a4c9951485e21edb970d36b139e21feac671a5",
38
+ "tensors": 2916
39
+ },
40
+ {
41
+ "bytes": 1274379368,
42
+ "path": "model-00006-of-00014.safetensors",
43
+ "sha256": "a53e29d037d4dc8fc75c66b27d01c0d93379ea724bf18da2a4c0538f13a21ad1",
44
+ "tensors": 2880
45
+ },
46
+ {
47
+ "bytes": 1269069432,
48
+ "path": "model-00007-of-00014.safetensors",
49
+ "sha256": "dde2007d751a617b88be63e09182569ae9ccf677152fae952fe43eb5cc337279",
50
+ "tensors": 2868
51
+ },
52
+ {
53
+ "bytes": 1295618832,
54
+ "path": "model-00008-of-00014.safetensors",
55
+ "sha256": "209a3440bb4a2fc4bab013c996da84409099e2937aa33e21c0b0dad99170c04c",
56
+ "tensors": 2928
57
+ },
58
+ {
59
+ "bytes": 1261989344,
60
+ "path": "model-00009-of-00014.safetensors",
61
+ "sha256": "844d74c0e0dcb4c15a90b1fe14b470f1f89c45f81c0d638524c2a52439db6c1a",
62
+ "tensors": 2852
63
+ },
64
+ {
65
+ "bytes": 1281459120,
66
+ "path": "model-00010-of-00014.safetensors",
67
+ "sha256": "cdeee15029516ff926f56aeaccbf74f5d5ba28caec0c30b7c4a1609360c7e6d4",
68
+ "tensors": 2896
69
+ },
70
+ {
71
+ "bytes": 1269069432,
72
+ "path": "model-00011-of-00014.safetensors",
73
+ "sha256": "2432c5b7f5fcb066f6f72bbc7fd5464e843bd017ebef40372c305f9daaa21d8c",
74
+ "tensors": 2868
75
+ },
76
+ {
77
+ "bytes": 1300928888,
78
+ "path": "model-00012-of-00014.safetensors",
79
+ "sha256": "a011d968f6201e75622e15c3efa724b4632971314b6399dd748460d9bb411079",
80
+ "tensors": 2940
81
+ },
82
+ {
83
+ "bytes": 1269069264,
84
+ "path": "model-00013-of-00014.safetensors",
85
+ "sha256": "55bc235a0f77c1ba75d15736d4ef4f3d121b89e64da8cd071e67508f9a45a7da",
86
+ "tensors": 2868
87
+ },
88
+ {
89
+ "bytes": 1146941096,
90
+ "path": "model-00014-of-00014.safetensors",
91
+ "sha256": "d6971de0d660d9d3a4ff71c904df692aa43e866ad78bd9c1dc064ee62c171fda",
92
+ "tensors": 2592
93
+ }
94
+ ],
95
+ "source_index_sha256": "c872bd9b5ac116cebfd78a5f27565787dbceae76985cef041179110d0b03cd2b",
96
+ "status": "complete",
97
+ "tail_experts_per_sparse_layer": 192,
98
+ "tensor_bytes": 23995371200,
99
+ "tier": "TR3",
100
+ "tier_map_sha256": "98bb2a6cfab92807201180c1cde4447d50fc7bd991bde8f2f6a869a84e2ff45a"
101
+ }
hybrid/provenance/hybrid-validation.json ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "api_validator_script_sha256": "805b211515cb38261ddf5e008392963dd9ba2a22d44b22e24e0862fc3e4f5ce5",
3
+ "artifact_tensor_parallel_size": 2,
4
+ "bundle_validator_script_sha256": "65fe66b618817598511cb0719548886acebd191c9053a69d293938613259b967",
5
+ "dflash_audit_sha256": "59a5df3241775bf55434dda37715e06f319233eae98bc4afee9d40cbb940af9b",
6
+ "full_195k": {
7
+ "ascii_exact.json": "45b0b5aa3a1eafa51386acd29ec944cd4c4391c820a3a22a33a60aa44a6a18ce",
8
+ "json_schema.json": "b8977c3d565fb6c2a5efcac2e3c92133b7e7827f506db2256df00941f27a3d90",
9
+ "long_context_195k.json": "4b7cb9e1b942a726f0afe1b7bb539b559f4ae6f154a74aa5358c655037ee58f7",
10
+ "manifest.json": "1364cc601d549c288ccd7f13e812bd1b4ea2b084feae55c4dd9c2ffe214c0d72",
11
+ "reasoning.json": "149a13f2b5791fd3d2a94ad1f3493cafca11b19f8c50fd2afd424e4348ced751",
12
+ "tool_call.json": "0a6b51f5a806ff347718abbda6d46e4de024086ac5839a3242e06a366ea4d75e",
13
+ "tool_history.json": "c35494a39d89818eea3c013b69b97873c2d03bc6e8334b20d01d9d5272bfd3d7"
14
+ },
15
+ "model": "laguna-s-2.1-hybrid-3.25bpw",
16
+ "mtp_audit_sha256": "9fcd8af34988fd8a6e24fcf5fc2eac2fb996f7567d1f9dc9a74ea3bc8a1b148b",
17
+ "runtime_tensor_parallel_size": 1,
18
+ "schema": "laguna-hybrid-validation-bundle/v1",
19
+ "service": {
20
+ "head.inspect.json": "fc7dbca5c5d353dca3d1f24e7787e8aaa6cb044996aa549d621a22a76efc0198",
21
+ "head.log": "629ebe4763c2f9324a1fea37add4afb6fdddbe41a980197fafa8dbcc5e017eae"
22
+ },
23
+ "small": {
24
+ "ascii_exact.json": "45b0b5aa3a1eafa51386acd29ec944cd4c4391c820a3a22a33a60aa44a6a18ce",
25
+ "json_schema.json": "b8977c3d565fb6c2a5efcac2e3c92133b7e7827f506db2256df00941f27a3d90",
26
+ "manifest.json": "4f10e592b0e74a8ab88d77f1893e0920b047ce6a50532b2cc7e50595a89c255f",
27
+ "reasoning.json": "149a13f2b5791fd3d2a94ad1f3493cafca11b19f8c50fd2afd424e4348ced751",
28
+ "tool_call.json": "0a6b51f5a806ff347718abbda6d46e4de024086ac5839a3242e06a366ea4d75e",
29
+ "tool_history.json": "c35494a39d89818eea3c013b69b97873c2d03bc6e8334b20d01d9d5272bfd3d7"
30
+ },
31
+ "status": "complete",
32
+ "throughput": {
33
+ "completion_tokens": 1220,
34
+ "dflash_draft_acceptance_rate": null,
35
+ "dflash_mean_acceptance_length": null,
36
+ "native_mtp_available": false,
37
+ "native_mtp_measured": false,
38
+ "selected_aggregate_completion_tokens_per_second": 58.19561887597636,
39
+ "selected_concurrency": 4,
40
+ "sha256": "907a6e5da8f6e70843818dcc741ef8a05aa179ad6ae8fb87f3d1be1962e1587a",
41
+ "speculative_decode_method": "none",
42
+ "speculative_decode_native_mtp": false,
43
+ "sweeps": {
44
+ "1": 16.157817458300887,
45
+ "2": 29.467371630315867,
46
+ "4": 58.19561887597636
47
+ }
48
+ },
49
+ "throughput_validator_script_sha256": "cfa026eff1b7af6a52717a0de3a9235d28c1b5a78ab0e20fbece48fdd5aa72f8",
50
+ "tier": "TR3"
51
+ }
hybrid/release-manifest.json ADDED
The diff for this file is too large to render. See raw diff
 
hybrid/tails/tr3/layer-26/expert-013.json ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bits": 3,
3
+ "bytes": 3584600,
4
+ "calibration_rows": 2048,
5
+ "calibration_sampling": "deterministic evenly spaced routed-row indices",
6
+ "capture_manifest_sha256": "976ba9935c2ae028117276f32bd33195862733a2b76cacb5514d3f2c2fb12a69",
7
+ "encoder_script_sha256": "30ccbf529dcab421ec904d8069a0ef33714d25408abf615ff76fccbcffae6b44",
8
+ "expert": 13,
9
+ "fallback_slices": 0,
10
+ "layer": 26,
11
+ "output": "/out/tr3/layer-26/expert-013.safetensors",
12
+ "routed_observation_rows_total": "3353",
13
+ "schema": "laguna-exl3-expert-encode/v1",
14
+ "sha256": "e559e50c55d624f0938c66dc8710faaac617fee7570d12cd71f7368f2ec91f03",
15
+ "slices": {
16
+ "down_proj.rank0": {
17
+ "apply_out_scales": true,
18
+ "calibration_rows": 2048,
19
+ "g_scale": 0.9397321041054102,
20
+ "pack_unpack_pack_equal": true,
21
+ "proxy_error": 0.01190834367455955,
22
+ "q_fallback": false,
23
+ "reconstruction_max_abs": 0.0001220703125,
24
+ "reconstruction_mismatch_ratio": 0.0
25
+ },
26
+ "down_proj.rank1": {
27
+ "apply_out_scales": true,
28
+ "calibration_rows": 2048,
29
+ "g_scale": 0.9216421086391007,
30
+ "pack_unpack_pack_equal": true,
31
+ "proxy_error": 0.011454986657873702,
32
+ "q_fallback": false,
33
+ "reconstruction_max_abs": 0.0001220703125,
34
+ "reconstruction_mismatch_ratio": 0.0
35
+ },
36
+ "gate_proj.rank0": {
37
+ "apply_out_scales": true,
38
+ "calibration_rows": 2048,
39
+ "g_scale": 0.9453222201326655,
40
+ "pack_unpack_pack_equal": true,
41
+ "proxy_error": 0.0037454840254873543,
42
+ "q_fallback": false,
43
+ "reconstruction_max_abs": 0.00018310546875,
44
+ "reconstruction_mismatch_ratio": 0.0
45
+ },
46
+ "gate_proj.rank1": {
47
+ "apply_out_scales": true,
48
+ "calibration_rows": 2048,
49
+ "g_scale": 0.9509123361599208,
50
+ "pack_unpack_pack_equal": true,
51
+ "proxy_error": 0.003748725730490386,
52
+ "q_fallback": false,
53
+ "reconstruction_max_abs": 0.0001220703125,
54
+ "reconstruction_mismatch_ratio": 0.0
55
+ },
56
+ "up_proj.rank0": {
57
+ "apply_out_scales": true,
58
+ "calibration_rows": 2048,
59
+ "g_scale": 0.9250969903450001,
60
+ "pack_unpack_pack_equal": true,
61
+ "proxy_error": 0.0047551796588070185,
62
+ "q_fallback": false,
63
+ "reconstruction_max_abs": 0.0001220703125,
64
+ "reconstruction_mismatch_ratio": 0.0
65
+ },
66
+ "up_proj.rank1": {
67
+ "apply_out_scales": true,
68
+ "calibration_rows": 2048,
69
+ "g_scale": 0.9543672178658202,
70
+ "pack_unpack_pack_equal": true,
71
+ "proxy_error": 0.004773790994314254,
72
+ "q_fallback": false,
73
+ "reconstruction_max_abs": 0.0001220703125,
74
+ "reconstruction_mismatch_ratio": 0.0
75
+ }
76
+ },
77
+ "source_index_sha256": "c872bd9b5ac116cebfd78a5f27565787dbceae76985cef041179110d0b03cd2b",
78
+ "status": "complete",
79
+ "tier": "TR3",
80
+ "tier_map_sha256": "98bb2a6cfab92807201180c1cde4447d50fc7bd991bde8f2f6a869a84e2ff45a",
81
+ "tp": 2
82
+ }
hybrid/tails/tr3/layer-26/expert-021.json ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bits": 3,
3
+ "bytes": 3584600,
4
+ "calibration_rows": 2048,
5
+ "calibration_sampling": "deterministic evenly spaced routed-row indices",
6
+ "capture_manifest_sha256": "976ba9935c2ae028117276f32bd33195862733a2b76cacb5514d3f2c2fb12a69",
7
+ "encoder_script_sha256": "30ccbf529dcab421ec904d8069a0ef33714d25408abf615ff76fccbcffae6b44",
8
+ "expert": 21,
9
+ "fallback_slices": 0,
10
+ "layer": 26,
11
+ "output": "/out/tr3/layer-26/expert-021.safetensors",
12
+ "routed_observation_rows_total": "5304",
13
+ "schema": "laguna-exl3-expert-encode/v1",
14
+ "sha256": "6ee0248a1ce23dbeddfa2f3550ea1ac897be848485b3480d9affc09829ec539f",
15
+ "slices": {
16
+ "down_proj.rank0": {
17
+ "apply_out_scales": true,
18
+ "calibration_rows": 2048,
19
+ "g_scale": 0.9397321041054102,
20
+ "pack_unpack_pack_equal": true,
21
+ "proxy_error": 0.01222266101919929,
22
+ "q_fallback": false,
23
+ "reconstruction_max_abs": 0.0001220703125,
24
+ "reconstruction_mismatch_ratio": 0.0
25
+ },
26
+ "down_proj.rank1": {
27
+ "apply_out_scales": true,
28
+ "calibration_rows": 2048,
29
+ "g_scale": 0.9453222201326655,
30
+ "pack_unpack_pack_equal": true,
31
+ "proxy_error": 0.01249527955800585,
32
+ "q_fallback": false,
33
+ "reconstruction_max_abs": 0.00018310546875,
34
+ "reconstruction_mismatch_ratio": 0.0
35
+ },
36
+ "gate_proj.rank0": {
37
+ "apply_out_scales": true,
38
+ "calibration_rows": 2048,
39
+ "g_scale": 0.9599573338930756,
40
+ "pack_unpack_pack_equal": true,
41
+ "proxy_error": 0.0030492760547702444,
42
+ "q_fallback": false,
43
+ "reconstruction_max_abs": 0.0001220703125,
44
+ "reconstruction_mismatch_ratio": 0.0
45
+ },
46
+ "gate_proj.rank1": {
47
+ "apply_out_scales": true,
48
+ "calibration_rows": 2048,
49
+ "g_scale": 0.9306871063722555,
50
+ "pack_unpack_pack_equal": true,
51
+ "proxy_error": 0.0031049715569851986,
52
+ "q_fallback": false,
53
+ "reconstruction_max_abs": 0.000244140625,
54
+ "reconstruction_mismatch_ratio": 0.0
55
+ },
56
+ "up_proj.rank0": {
57
+ "apply_out_scales": true,
58
+ "calibration_rows": 2048,
59
+ "g_scale": 0.9362772223995108,
60
+ "pack_unpack_pack_equal": true,
61
+ "proxy_error": 0.0037786707120726687,
62
+ "q_fallback": false,
63
+ "reconstruction_max_abs": 0.0001220703125,
64
+ "reconstruction_mismatch_ratio": 0.0
65
+ },
66
+ "up_proj.rank1": {
67
+ "apply_out_scales": true,
68
+ "calibration_rows": 2048,
69
+ "g_scale": 0.9397321041054102,
70
+ "pack_unpack_pack_equal": true,
71
+ "proxy_error": 0.003703849894337033,
72
+ "q_fallback": false,
73
+ "reconstruction_max_abs": 0.0001220703125,
74
+ "reconstruction_mismatch_ratio": 0.0
75
+ }
76
+ },
77
+ "source_index_sha256": "c872bd9b5ac116cebfd78a5f27565787dbceae76985cef041179110d0b03cd2b",
78
+ "status": "complete",
79
+ "tier": "TR3",
80
+ "tier_map_sha256": "98bb2a6cfab92807201180c1cde4447d50fc7bd991bde8f2f6a869a84e2ff45a",
81
+ "tp": 2
82
+ }
hybrid/tails/tr3/layer-26/expert-041.json ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bits": 3,
3
+ "bytes": 3584600,
4
+ "calibration_rows": 2048,
5
+ "calibration_sampling": "deterministic evenly spaced routed-row indices",
6
+ "capture_manifest_sha256": "976ba9935c2ae028117276f32bd33195862733a2b76cacb5514d3f2c2fb12a69",
7
+ "encoder_script_sha256": "30ccbf529dcab421ec904d8069a0ef33714d25408abf615ff76fccbcffae6b44",
8
+ "expert": 41,
9
+ "fallback_slices": 0,
10
+ "layer": 26,
11
+ "output": "/out/tr3/layer-26/expert-041.safetensors",
12
+ "routed_observation_rows_total": "4804",
13
+ "schema": "laguna-exl3-expert-encode/v1",
14
+ "sha256": "3dc04471555461b5b13a77723d06d5640e8d9912572c56f9534fbf2cca4af92f",
15
+ "slices": {
16
+ "down_proj.rank0": {
17
+ "apply_out_scales": true,
18
+ "calibration_rows": 2048,
19
+ "g_scale": 0.9397321041054102,
20
+ "pack_unpack_pack_equal": true,
21
+ "proxy_error": 0.011156002251789211,
22
+ "q_fallback": false,
23
+ "reconstruction_max_abs": 0.0001220703125,
24
+ "reconstruction_mismatch_ratio": 0.0
25
+ },
26
+ "down_proj.rank1": {
27
+ "apply_out_scales": true,
28
+ "calibration_rows": 2048,
29
+ "g_scale": 0.9397321041054102,
30
+ "pack_unpack_pack_equal": true,
31
+ "proxy_error": 0.011212271551339418,
32
+ "q_fallback": false,
33
+ "reconstruction_max_abs": 0.0001220703125,
34
+ "reconstruction_mismatch_ratio": 0.0
35
+ },
36
+ "gate_proj.rank0": {
37
+ "apply_out_scales": true,
38
+ "calibration_rows": 2048,
39
+ "g_scale": 0.9453222201326655,
40
+ "pack_unpack_pack_equal": true,
41
+ "proxy_error": 0.003350300688952894,
42
+ "q_fallback": false,
43
+ "reconstruction_max_abs": 0.000244140625,
44
+ "reconstruction_mismatch_ratio": 0.0
45
+ },
46
+ "gate_proj.rank1": {
47
+ "apply_out_scales": true,
48
+ "calibration_rows": 2048,
49
+ "g_scale": 0.9397321041054102,
50
+ "pack_unpack_pack_equal": true,
51
+ "proxy_error": 0.003351279587542907,
52
+ "q_fallback": false,
53
+ "reconstruction_max_abs": 0.000244140625,
54
+ "reconstruction_mismatch_ratio": 0.0
55
+ },
56
+ "up_proj.rank0": {
57
+ "apply_out_scales": true,
58
+ "calibration_rows": 2048,
59
+ "g_scale": 0.9362772223995108,
60
+ "pack_unpack_pack_equal": true,
61
+ "proxy_error": 0.0038472564203765134,
62
+ "q_fallback": false,
63
+ "reconstruction_max_abs": 0.0001220703125,
64
+ "reconstruction_mismatch_ratio": 0.0
65
+ },
66
+ "up_proj.rank1": {
67
+ "apply_out_scales": true,
68
+ "calibration_rows": 2048,
69
+ "g_scale": 0.9362772223995108,
70
+ "pack_unpack_pack_equal": true,
71
+ "proxy_error": 0.0038839594189082325,
72
+ "q_fallback": false,
73
+ "reconstruction_max_abs": 0.0001220703125,
74
+ "reconstruction_mismatch_ratio": 0.0
75
+ }
76
+ },
77
+ "source_index_sha256": "c872bd9b5ac116cebfd78a5f27565787dbceae76985cef041179110d0b03cd2b",
78
+ "status": "complete",
79
+ "tier": "TR3",
80
+ "tier_map_sha256": "98bb2a6cfab92807201180c1cde4447d50fc7bd991bde8f2f6a869a84e2ff45a",
81
+ "tp": 2
82
+ }
hybrid/tails/tr3/layer-26/expert-045.json ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bits": 3,
3
+ "bytes": 3584600,
4
+ "calibration_rows": 2048,
5
+ "calibration_sampling": "deterministic evenly spaced routed-row indices",
6
+ "capture_manifest_sha256": "976ba9935c2ae028117276f32bd33195862733a2b76cacb5514d3f2c2fb12a69",
7
+ "encoder_script_sha256": "30ccbf529dcab421ec904d8069a0ef33714d25408abf615ff76fccbcffae6b44",
8
+ "expert": 45,
9
+ "fallback_slices": 0,
10
+ "layer": 26,
11
+ "output": "/out/tr3/layer-26/expert-045.safetensors",
12
+ "routed_observation_rows_total": "6557",
13
+ "schema": "laguna-exl3-expert-encode/v1",
14
+ "sha256": "a7a3f0f5763ae6240de79566833d92943104c92af6c6810a41246e6acef9db50",
15
+ "slices": {
16
+ "down_proj.rank0": {
17
+ "apply_out_scales": true,
18
+ "calibration_rows": 2048,
19
+ "g_scale": 0.9453222201326655,
20
+ "pack_unpack_pack_equal": true,
21
+ "proxy_error": 0.013418506434469695,
22
+ "q_fallback": false,
23
+ "reconstruction_max_abs": 0.0001220703125,
24
+ "reconstruction_mismatch_ratio": 0.0
25
+ },
26
+ "down_proj.rank1": {
27
+ "apply_out_scales": true,
28
+ "calibration_rows": 2048,
29
+ "g_scale": 0.9509123361599208,
30
+ "pack_unpack_pack_equal": true,
31
+ "proxy_error": 0.013560148070835793,
32
+ "q_fallback": false,
33
+ "reconstruction_max_abs": 0.000244140625,
34
+ "reconstruction_mismatch_ratio": 0.0
35
+ },
36
+ "gate_proj.rank0": {
37
+ "apply_out_scales": true,
38
+ "calibration_rows": 2048,
39
+ "g_scale": 0.9599573338930756,
40
+ "pack_unpack_pack_equal": true,
41
+ "proxy_error": 0.003650578700766417,
42
+ "q_fallback": false,
43
+ "reconstruction_max_abs": 0.0001220703125,
44
+ "reconstruction_mismatch_ratio": 0.0
45
+ },
46
+ "gate_proj.rank1": {
47
+ "apply_out_scales": true,
48
+ "calibration_rows": 2048,
49
+ "g_scale": 0.9509123361599208,
50
+ "pack_unpack_pack_equal": true,
51
+ "proxy_error": 0.003670895211106669,
52
+ "q_fallback": false,
53
+ "reconstruction_max_abs": 0.0001220703125,
54
+ "reconstruction_mismatch_ratio": 0.0
55
+ },
56
+ "up_proj.rank0": {
57
+ "apply_out_scales": true,
58
+ "calibration_rows": 2048,
59
+ "g_scale": 0.9453222201326655,
60
+ "pack_unpack_pack_equal": true,
61
+ "proxy_error": 0.005038167534271601,
62
+ "q_fallback": false,
63
+ "reconstruction_max_abs": 0.0001220703125,
64
+ "reconstruction_mismatch_ratio": 0.0
65
+ },
66
+ "up_proj.rank1": {
67
+ "apply_out_scales": true,
68
+ "calibration_rows": 2048,
69
+ "g_scale": 0.9362772223995108,
70
+ "pack_unpack_pack_equal": true,
71
+ "proxy_error": 0.005084570639361082,
72
+ "q_fallback": false,
73
+ "reconstruction_max_abs": 0.0001220703125,
74
+ "reconstruction_mismatch_ratio": 0.0
75
+ }
76
+ },
77
+ "source_index_sha256": "c872bd9b5ac116cebfd78a5f27565787dbceae76985cef041179110d0b03cd2b",
78
+ "status": "complete",
79
+ "tier": "TR3",
80
+ "tier_map_sha256": "98bb2a6cfab92807201180c1cde4447d50fc7bd991bde8f2f6a869a84e2ff45a",
81
+ "tp": 2
82
+ }
hybrid/tails/tr3/layer-26/expert-047.json ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bits": 3,
3
+ "bytes": 3584600,
4
+ "calibration_rows": 263,
5
+ "calibration_sampling": "deterministic evenly spaced routed-row indices",
6
+ "capture_manifest_sha256": "976ba9935c2ae028117276f32bd33195862733a2b76cacb5514d3f2c2fb12a69",
7
+ "encoder_script_sha256": "30ccbf529dcab421ec904d8069a0ef33714d25408abf615ff76fccbcffae6b44",
8
+ "expert": 47,
9
+ "fallback_slices": 0,
10
+ "layer": 26,
11
+ "output": "/out/tr3/layer-26/expert-047.safetensors",
12
+ "routed_observation_rows_total": "263",
13
+ "schema": "laguna-exl3-expert-encode/v1",
14
+ "sha256": "dc3f1998f04872b903dfb7982f6fb8f744f09366587fd384246787b7398ae9fb",
15
+ "slices": {
16
+ "down_proj.rank0": {
17
+ "apply_out_scales": true,
18
+ "calibration_rows": 263,
19
+ "g_scale": 0.9453222201326655,
20
+ "pack_unpack_pack_equal": true,
21
+ "proxy_error": 0.004581292799514752,
22
+ "q_fallback": false,
23
+ "reconstruction_max_abs": 0.000244140625,
24
+ "reconstruction_mismatch_ratio": 0.0
25
+ },
26
+ "down_proj.rank1": {
27
+ "apply_out_scales": true,
28
+ "calibration_rows": 263,
29
+ "g_scale": 0.9250969903450001,
30
+ "pack_unpack_pack_equal": true,
31
+ "proxy_error": 0.004442808941635246,
32
+ "q_fallback": false,
33
+ "reconstruction_max_abs": 0.000244140625,
34
+ "reconstruction_mismatch_ratio": 0.0
35
+ },
36
+ "gate_proj.rank0": {
37
+ "apply_out_scales": true,
38
+ "calibration_rows": 263,
39
+ "g_scale": 0.9543672178658202,
40
+ "pack_unpack_pack_equal": true,
41
+ "proxy_error": 0.0007419767118913538,
42
+ "q_fallback": false,
43
+ "reconstruction_max_abs": 0.0001220703125,
44
+ "reconstruction_mismatch_ratio": 0.0
45
+ },
46
+ "gate_proj.rank1": {
47
+ "apply_out_scales": true,
48
+ "calibration_rows": 263,
49
+ "g_scale": 0.9509123361599208,
50
+ "pack_unpack_pack_equal": true,
51
+ "proxy_error": 0.0007530752266272285,
52
+ "q_fallback": false,
53
+ "reconstruction_max_abs": 0.0009765625,
54
+ "reconstruction_mismatch_ratio": 0.0
55
+ },
56
+ "up_proj.rank0": {
57
+ "apply_out_scales": true,
58
+ "calibration_rows": 263,
59
+ "g_scale": 0.9543672178658202,
60
+ "pack_unpack_pack_equal": true,
61
+ "proxy_error": 0.0009514474878519153,
62
+ "q_fallback": false,
63
+ "reconstruction_max_abs": 0.0001220703125,
64
+ "reconstruction_mismatch_ratio": 0.0
65
+ },
66
+ "up_proj.rank1": {
67
+ "apply_out_scales": true,
68
+ "calibration_rows": 263,
69
+ "g_scale": 0.9397321041054102,
70
+ "pack_unpack_pack_equal": true,
71
+ "proxy_error": 0.0009681822044176422,
72
+ "q_fallback": false,
73
+ "reconstruction_max_abs": 0.0001220703125,
74
+ "reconstruction_mismatch_ratio": 0.0
75
+ }
76
+ },
77
+ "source_index_sha256": "c872bd9b5ac116cebfd78a5f27565787dbceae76985cef041179110d0b03cd2b",
78
+ "status": "complete",
79
+ "tier": "TR3",
80
+ "tier_map_sha256": "98bb2a6cfab92807201180c1cde4447d50fc7bd991bde8f2f6a869a84e2ff45a",
81
+ "tp": 2
82
+ }
hybrid/tails/tr3/layer-26/expert-050.json ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bits": 3,
3
+ "bytes": 3584600,
4
+ "calibration_rows": 2048,
5
+ "calibration_sampling": "deterministic evenly spaced routed-row indices",
6
+ "capture_manifest_sha256": "976ba9935c2ae028117276f32bd33195862733a2b76cacb5514d3f2c2fb12a69",
7
+ "encoder_script_sha256": "30ccbf529dcab421ec904d8069a0ef33714d25408abf615ff76fccbcffae6b44",
8
+ "expert": 50,
9
+ "fallback_slices": 0,
10
+ "layer": 26,
11
+ "output": "/out/tr3/layer-26/expert-050.safetensors",
12
+ "routed_observation_rows_total": "9191",
13
+ "schema": "laguna-exl3-expert-encode/v1",
14
+ "sha256": "0ae928ca358285ec8812d36c4edae6fe867dc542763ea1d8f5fd1cbcb4092e0b",
15
+ "slices": {
16
+ "down_proj.rank0": {
17
+ "apply_out_scales": true,
18
+ "calibration_rows": 2048,
19
+ "g_scale": 0.9453222201326655,
20
+ "pack_unpack_pack_equal": true,
21
+ "proxy_error": 0.011779910660187153,
22
+ "q_fallback": false,
23
+ "reconstruction_max_abs": 0.0001220703125,
24
+ "reconstruction_mismatch_ratio": 0.0
25
+ },
26
+ "down_proj.rank1": {
27
+ "apply_out_scales": true,
28
+ "calibration_rows": 2048,
29
+ "g_scale": 0.9453222201326655,
30
+ "pack_unpack_pack_equal": true,
31
+ "proxy_error": 0.012099880125766788,
32
+ "q_fallback": false,
33
+ "reconstruction_max_abs": 0.0001220703125,
34
+ "reconstruction_mismatch_ratio": 0.0
35
+ },
36
+ "gate_proj.rank0": {
37
+ "apply_out_scales": true,
38
+ "calibration_rows": 2048,
39
+ "g_scale": 0.9453222201326655,
40
+ "pack_unpack_pack_equal": true,
41
+ "proxy_error": 0.002730701414743581,
42
+ "q_fallback": false,
43
+ "reconstruction_max_abs": 0.000244140625,
44
+ "reconstruction_mismatch_ratio": 0.0
45
+ },
46
+ "gate_proj.rank1": {
47
+ "apply_out_scales": true,
48
+ "calibration_rows": 2048,
49
+ "g_scale": 0.9509123361599208,
50
+ "pack_unpack_pack_equal": true,
51
+ "proxy_error": 0.0026910380859019012,
52
+ "q_fallback": false,
53
+ "reconstruction_max_abs": 0.0001220703125,
54
+ "reconstruction_mismatch_ratio": 0.0
55
+ },
56
+ "up_proj.rank0": {
57
+ "apply_out_scales": true,
58
+ "calibration_rows": 2048,
59
+ "g_scale": 0.9543672178658202,
60
+ "pack_unpack_pack_equal": true,
61
+ "proxy_error": 0.0031192887907079783,
62
+ "q_fallback": false,
63
+ "reconstruction_max_abs": 0.0001220703125,
64
+ "reconstruction_mismatch_ratio": 0.0
65
+ },
66
+ "up_proj.rank1": {
67
+ "apply_out_scales": true,
68
+ "calibration_rows": 2048,
69
+ "g_scale": 0.9509123361599208,
70
+ "pack_unpack_pack_equal": true,
71
+ "proxy_error": 0.003098162624897391,
72
+ "q_fallback": false,
73
+ "reconstruction_max_abs": 0.0001220703125,
74
+ "reconstruction_mismatch_ratio": 0.0
75
+ }
76
+ },
77
+ "source_index_sha256": "c872bd9b5ac116cebfd78a5f27565787dbceae76985cef041179110d0b03cd2b",
78
+ "status": "complete",
79
+ "tier": "TR3",
80
+ "tier_map_sha256": "98bb2a6cfab92807201180c1cde4447d50fc7bd991bde8f2f6a869a84e2ff45a",
81
+ "tp": 2
82
+ }
hybrid/tails/tr3/layer-26/expert-051.json ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bits": 3,
3
+ "bytes": 3584600,
4
+ "calibration_rows": 2048,
5
+ "calibration_sampling": "deterministic evenly spaced routed-row indices",
6
+ "capture_manifest_sha256": "976ba9935c2ae028117276f32bd33195862733a2b76cacb5514d3f2c2fb12a69",
7
+ "encoder_script_sha256": "30ccbf529dcab421ec904d8069a0ef33714d25408abf615ff76fccbcffae6b44",
8
+ "expert": 51,
9
+ "fallback_slices": 0,
10
+ "layer": 26,
11
+ "output": "/out/tr3/layer-26/expert-051.safetensors",
12
+ "routed_observation_rows_total": "5191",
13
+ "schema": "laguna-exl3-expert-encode/v1",
14
+ "sha256": "704ba011c9e392a3401012a1b6c95b6bf4c7bd9baf454af311626f4d0aaebfe6",
15
+ "slices": {
16
+ "down_proj.rank0": {
17
+ "apply_out_scales": true,
18
+ "calibration_rows": 2048,
19
+ "g_scale": 0.9306871063722555,
20
+ "pack_unpack_pack_equal": true,
21
+ "proxy_error": 0.011228021244543845,
22
+ "q_fallback": false,
23
+ "reconstruction_max_abs": 0.0001220703125,
24
+ "reconstruction_mismatch_ratio": 0.0
25
+ },
26
+ "down_proj.rank1": {
27
+ "apply_out_scales": true,
28
+ "calibration_rows": 2048,
29
+ "g_scale": 0.9397321041054102,
30
+ "pack_unpack_pack_equal": true,
31
+ "proxy_error": 0.011355284666927118,
32
+ "q_fallback": false,
33
+ "reconstruction_max_abs": 0.0001220703125,
34
+ "reconstruction_mismatch_ratio": 0.0
35
+ },
36
+ "gate_proj.rank0": {
37
+ "apply_out_scales": true,
38
+ "calibration_rows": 2048,
39
+ "g_scale": 0.9509123361599208,
40
+ "pack_unpack_pack_equal": true,
41
+ "proxy_error": 0.0032538705944831748,
42
+ "q_fallback": false,
43
+ "reconstruction_max_abs": 0.000244140625,
44
+ "reconstruction_mismatch_ratio": 0.0
45
+ },
46
+ "gate_proj.rank1": {
47
+ "apply_out_scales": true,
48
+ "calibration_rows": 2048,
49
+ "g_scale": 0.9397321041054102,
50
+ "pack_unpack_pack_equal": true,
51
+ "proxy_error": 0.0033172352150124774,
52
+ "q_fallback": false,
53
+ "reconstruction_max_abs": 0.0001220703125,
54
+ "reconstruction_mismatch_ratio": 0.0
55
+ },
56
+ "up_proj.rank0": {
57
+ "apply_out_scales": true,
58
+ "calibration_rows": 2048,
59
+ "g_scale": 0.9634122155989749,
60
+ "pack_unpack_pack_equal": true,
61
+ "proxy_error": 0.004028058318016975,
62
+ "q_fallback": false,
63
+ "reconstruction_max_abs": 0.0001220703125,
64
+ "reconstruction_mismatch_ratio": 0.0
65
+ },
66
+ "up_proj.rank1": {
67
+ "apply_out_scales": true,
68
+ "calibration_rows": 2048,
69
+ "g_scale": 0.9509123361599208,
70
+ "pack_unpack_pack_equal": true,
71
+ "proxy_error": 0.003993520838633128,
72
+ "q_fallback": false,
73
+ "reconstruction_max_abs": 0.0001220703125,
74
+ "reconstruction_mismatch_ratio": 0.0
75
+ }
76
+ },
77
+ "source_index_sha256": "c872bd9b5ac116cebfd78a5f27565787dbceae76985cef041179110d0b03cd2b",
78
+ "status": "complete",
79
+ "tier": "TR3",
80
+ "tier_map_sha256": "98bb2a6cfab92807201180c1cde4447d50fc7bd991bde8f2f6a869a84e2ff45a",
81
+ "tp": 2
82
+ }
hybrid/tails/tr3/layer-26/expert-062.json ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bits": 3,
3
+ "bytes": 3584600,
4
+ "calibration_rows": 2048,
5
+ "calibration_sampling": "deterministic evenly spaced routed-row indices",
6
+ "capture_manifest_sha256": "976ba9935c2ae028117276f32bd33195862733a2b76cacb5514d3f2c2fb12a69",
7
+ "encoder_script_sha256": "30ccbf529dcab421ec904d8069a0ef33714d25408abf615ff76fccbcffae6b44",
8
+ "expert": 62,
9
+ "fallback_slices": 0,
10
+ "layer": 26,
11
+ "output": "/out/tr3/layer-26/expert-062.safetensors",
12
+ "routed_observation_rows_total": "8132",
13
+ "schema": "laguna-exl3-expert-encode/v1",
14
+ "sha256": "c14253bda0bc5ed7c58639fc31d46819017fbbc951c56fbdf00d5b47c1150db9",
15
+ "slices": {
16
+ "down_proj.rank0": {
17
+ "apply_out_scales": true,
18
+ "calibration_rows": 2048,
19
+ "g_scale": 0.9509123361599208,
20
+ "pack_unpack_pack_equal": true,
21
+ "proxy_error": 0.013346146630912905,
22
+ "q_fallback": false,
23
+ "reconstruction_max_abs": 0.0001220703125,
24
+ "reconstruction_mismatch_ratio": 0.0
25
+ },
26
+ "down_proj.rank1": {
27
+ "apply_out_scales": true,
28
+ "calibration_rows": 2048,
29
+ "g_scale": 0.9397321041054102,
30
+ "pack_unpack_pack_equal": true,
31
+ "proxy_error": 0.013242899463589843,
32
+ "q_fallback": false,
33
+ "reconstruction_max_abs": 0.0001220703125,
34
+ "reconstruction_mismatch_ratio": 0.0
35
+ },
36
+ "gate_proj.rank0": {
37
+ "apply_out_scales": true,
38
+ "calibration_rows": 2048,
39
+ "g_scale": 0.9453222201326655,
40
+ "pack_unpack_pack_equal": true,
41
+ "proxy_error": 0.003617838391116708,
42
+ "q_fallback": false,
43
+ "reconstruction_max_abs": 0.0001220703125,
44
+ "reconstruction_mismatch_ratio": 0.0
45
+ },
46
+ "gate_proj.rank1": {
47
+ "apply_out_scales": true,
48
+ "calibration_rows": 2048,
49
+ "g_scale": 0.9509123361599208,
50
+ "pack_unpack_pack_equal": true,
51
+ "proxy_error": 0.0036358786379500517,
52
+ "q_fallback": false,
53
+ "reconstruction_max_abs": 0.0001220703125,
54
+ "reconstruction_mismatch_ratio": 0.0
55
+ },
56
+ "up_proj.rank0": {
57
+ "apply_out_scales": true,
58
+ "calibration_rows": 2048,
59
+ "g_scale": 0.9509123361599208,
60
+ "pack_unpack_pack_equal": true,
61
+ "proxy_error": 0.004334873889221136,
62
+ "q_fallback": false,
63
+ "reconstruction_max_abs": 0.0001220703125,
64
+ "reconstruction_mismatch_ratio": 0.0
65
+ },
66
+ "up_proj.rank1": {
67
+ "apply_out_scales": true,
68
+ "calibration_rows": 2048,
69
+ "g_scale": 0.9453222201326655,
70
+ "pack_unpack_pack_equal": true,
71
+ "proxy_error": 0.004331254367431256,
72
+ "q_fallback": false,
73
+ "reconstruction_max_abs": 0.0001220703125,
74
+ "reconstruction_mismatch_ratio": 0.0
75
+ }
76
+ },
77
+ "source_index_sha256": "c872bd9b5ac116cebfd78a5f27565787dbceae76985cef041179110d0b03cd2b",
78
+ "status": "complete",
79
+ "tier": "TR3",
80
+ "tier_map_sha256": "98bb2a6cfab92807201180c1cde4447d50fc7bd991bde8f2f6a869a84e2ff45a",
81
+ "tp": 2
82
+ }
hybrid/tails/tr3/layer-26/expert-073.json ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bits": 3,
3
+ "bytes": 3584600,
4
+ "calibration_rows": 2048,
5
+ "calibration_sampling": "deterministic evenly spaced routed-row indices",
6
+ "capture_manifest_sha256": "976ba9935c2ae028117276f32bd33195862733a2b76cacb5514d3f2c2fb12a69",
7
+ "encoder_script_sha256": "30ccbf529dcab421ec904d8069a0ef33714d25408abf615ff76fccbcffae6b44",
8
+ "expert": 73,
9
+ "fallback_slices": 0,
10
+ "layer": 26,
11
+ "output": "/out/tr3/layer-26/expert-073.safetensors",
12
+ "routed_observation_rows_total": "3432",
13
+ "schema": "laguna-exl3-expert-encode/v1",
14
+ "sha256": "1d743261a4fd7da8a67ebe06c3b9b92958bf3948ee5361cd029bc7201b95009e",
15
+ "slices": {
16
+ "down_proj.rank0": {
17
+ "apply_out_scales": true,
18
+ "calibration_rows": 2048,
19
+ "g_scale": 0.9362772223995108,
20
+ "pack_unpack_pack_equal": true,
21
+ "proxy_error": 0.011544699497591645,
22
+ "q_fallback": false,
23
+ "reconstruction_max_abs": 0.000244140625,
24
+ "reconstruction_mismatch_ratio": 0.0
25
+ },
26
+ "down_proj.rank1": {
27
+ "apply_out_scales": true,
28
+ "calibration_rows": 2048,
29
+ "g_scale": 0.9453222201326655,
30
+ "pack_unpack_pack_equal": true,
31
+ "proxy_error": 0.011705302223544295,
32
+ "q_fallback": false,
33
+ "reconstruction_max_abs": 0.000244140625,
34
+ "reconstruction_mismatch_ratio": 0.0
35
+ },
36
+ "gate_proj.rank0": {
37
+ "apply_out_scales": true,
38
+ "calibration_rows": 2048,
39
+ "g_scale": 0.9509123361599208,
40
+ "pack_unpack_pack_equal": true,
41
+ "proxy_error": 0.0031108557967209093,
42
+ "q_fallback": false,
43
+ "reconstruction_max_abs": 0.000244140625,
44
+ "reconstruction_mismatch_ratio": 0.0
45
+ },
46
+ "gate_proj.rank1": {
47
+ "apply_out_scales": true,
48
+ "calibration_rows": 2048,
49
+ "g_scale": 0.9362772223995108,
50
+ "pack_unpack_pack_equal": true,
51
+ "proxy_error": 0.00307365995702531,
52
+ "q_fallback": false,
53
+ "reconstruction_max_abs": 0.000244140625,
54
+ "reconstruction_mismatch_ratio": 0.0
55
+ },
56
+ "up_proj.rank0": {
57
+ "apply_out_scales": true,
58
+ "calibration_rows": 2048,
59
+ "g_scale": 0.9397321041054103,
60
+ "pack_unpack_pack_equal": true,
61
+ "proxy_error": 0.0036444665215095715,
62
+ "q_fallback": false,
63
+ "reconstruction_max_abs": 0.0001220703125,
64
+ "reconstruction_mismatch_ratio": 0.0
65
+ },
66
+ "up_proj.rank1": {
67
+ "apply_out_scales": true,
68
+ "calibration_rows": 2048,
69
+ "g_scale": 0.9453222201326655,
70
+ "pack_unpack_pack_equal": true,
71
+ "proxy_error": 0.0036778327632856485,
72
+ "q_fallback": false,
73
+ "reconstruction_max_abs": 0.0001220703125,
74
+ "reconstruction_mismatch_ratio": 0.0
75
+ }
76
+ },
77
+ "source_index_sha256": "c872bd9b5ac116cebfd78a5f27565787dbceae76985cef041179110d0b03cd2b",
78
+ "status": "complete",
79
+ "tier": "TR3",
80
+ "tier_map_sha256": "98bb2a6cfab92807201180c1cde4447d50fc7bd991bde8f2f6a869a84e2ff45a",
81
+ "tp": 2
82
+ }
hybrid/tails/tr3/layer-26/expert-074.json ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bits": 3,
3
+ "bytes": 3584600,
4
+ "calibration_rows": 2048,
5
+ "calibration_sampling": "deterministic evenly spaced routed-row indices",
6
+ "capture_manifest_sha256": "976ba9935c2ae028117276f32bd33195862733a2b76cacb5514d3f2c2fb12a69",
7
+ "encoder_script_sha256": "30ccbf529dcab421ec904d8069a0ef33714d25408abf615ff76fccbcffae6b44",
8
+ "expert": 74,
9
+ "fallback_slices": 0,
10
+ "layer": 26,
11
+ "output": "/out/tr3/layer-26/expert-074.safetensors",
12
+ "routed_observation_rows_total": "5368",
13
+ "schema": "laguna-exl3-expert-encode/v1",
14
+ "sha256": "f11894746748e6c9b9fa9294bef82eef1271259e98afe1c9df4754261070c1ce",
15
+ "slices": {
16
+ "down_proj.rank0": {
17
+ "apply_out_scales": true,
18
+ "calibration_rows": 2048,
19
+ "g_scale": 0.9453222201326655,
20
+ "pack_unpack_pack_equal": true,
21
+ "proxy_error": 0.011217107712484553,
22
+ "q_fallback": false,
23
+ "reconstruction_max_abs": 0.0001220703125,
24
+ "reconstruction_mismatch_ratio": 0.0
25
+ },
26
+ "down_proj.rank1": {
27
+ "apply_out_scales": true,
28
+ "calibration_rows": 2048,
29
+ "g_scale": 0.9543672178658202,
30
+ "pack_unpack_pack_equal": true,
31
+ "proxy_error": 0.010506694236282192,
32
+ "q_fallback": false,
33
+ "reconstruction_max_abs": 0.0001220703125,
34
+ "reconstruction_mismatch_ratio": 0.0
35
+ },
36
+ "gate_proj.rank0": {
37
+ "apply_out_scales": true,
38
+ "calibration_rows": 2048,
39
+ "g_scale": 0.9397321041054102,
40
+ "pack_unpack_pack_equal": true,
41
+ "proxy_error": 0.0033860802794123523,
42
+ "q_fallback": false,
43
+ "reconstruction_max_abs": 0.0001220703125,
44
+ "reconstruction_mismatch_ratio": 0.0
45
+ },
46
+ "gate_proj.rank1": {
47
+ "apply_out_scales": true,
48
+ "calibration_rows": 2048,
49
+ "g_scale": 0.9362772223995108,
50
+ "pack_unpack_pack_equal": true,
51
+ "proxy_error": 0.003419268075599958,
52
+ "q_fallback": false,
53
+ "reconstruction_max_abs": 0.000244140625,
54
+ "reconstruction_mismatch_ratio": 0.0
55
+ },
56
+ "up_proj.rank0": {
57
+ "apply_out_scales": true,
58
+ "calibration_rows": 2048,
59
+ "g_scale": 0.9509123361599208,
60
+ "pack_unpack_pack_equal": true,
61
+ "proxy_error": 0.004271929378551926,
62
+ "q_fallback": false,
63
+ "reconstruction_max_abs": 0.0001220703125,
64
+ "reconstruction_mismatch_ratio": 0.0
65
+ },
66
+ "up_proj.rank1": {
67
+ "apply_out_scales": true,
68
+ "calibration_rows": 2048,
69
+ "g_scale": 0.9453222201326655,
70
+ "pack_unpack_pack_equal": true,
71
+ "proxy_error": 0.00427387342955624,
72
+ "q_fallback": false,
73
+ "reconstruction_max_abs": 0.0001220703125,
74
+ "reconstruction_mismatch_ratio": 0.0
75
+ }
76
+ },
77
+ "source_index_sha256": "c872bd9b5ac116cebfd78a5f27565787dbceae76985cef041179110d0b03cd2b",
78
+ "status": "complete",
79
+ "tier": "TR3",
80
+ "tier_map_sha256": "98bb2a6cfab92807201180c1cde4447d50fc7bd991bde8f2f6a869a84e2ff45a",
81
+ "tp": 2
82
+ }
hybrid/tails/tr3/layer-26/expert-102.json ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bits": 3,
3
+ "bytes": 3584600,
4
+ "calibration_rows": 2048,
5
+ "calibration_sampling": "deterministic evenly spaced routed-row indices",
6
+ "capture_manifest_sha256": "976ba9935c2ae028117276f32bd33195862733a2b76cacb5514d3f2c2fb12a69",
7
+ "encoder_script_sha256": "30ccbf529dcab421ec904d8069a0ef33714d25408abf615ff76fccbcffae6b44",
8
+ "expert": 102,
9
+ "fallback_slices": 0,
10
+ "layer": 26,
11
+ "output": "/out/tr3/layer-26/expert-102.safetensors",
12
+ "routed_observation_rows_total": "8287",
13
+ "schema": "laguna-exl3-expert-encode/v1",
14
+ "sha256": "6993d14b66cc930c0c7796e0e8ed7c9ce0fbcb7d99e4bcb37c66210b3392a431",
15
+ "slices": {
16
+ "down_proj.rank0": {
17
+ "apply_out_scales": true,
18
+ "calibration_rows": 2048,
19
+ "g_scale": 0.9453222201326655,
20
+ "pack_unpack_pack_equal": true,
21
+ "proxy_error": 0.011878555360705884,
22
+ "q_fallback": false,
23
+ "reconstruction_max_abs": 0.0001220703125,
24
+ "reconstruction_mismatch_ratio": 0.0
25
+ },
26
+ "down_proj.rank1": {
27
+ "apply_out_scales": true,
28
+ "calibration_rows": 2048,
29
+ "g_scale": 0.9362772223995108,
30
+ "pack_unpack_pack_equal": true,
31
+ "proxy_error": 0.01177035119606449,
32
+ "q_fallback": false,
33
+ "reconstruction_max_abs": 0.0001220703125,
34
+ "reconstruction_mismatch_ratio": 0.0
35
+ },
36
+ "gate_proj.rank0": {
37
+ "apply_out_scales": true,
38
+ "calibration_rows": 2048,
39
+ "g_scale": 0.9397321041054103,
40
+ "pack_unpack_pack_equal": true,
41
+ "proxy_error": 0.0031464580340177586,
42
+ "q_fallback": false,
43
+ "reconstruction_max_abs": 0.000244140625,
44
+ "reconstruction_mismatch_ratio": 0.0
45
+ },
46
+ "gate_proj.rank1": {
47
+ "apply_out_scales": true,
48
+ "calibration_rows": 2048,
49
+ "g_scale": 0.9543672178658202,
50
+ "pack_unpack_pack_equal": true,
51
+ "proxy_error": 0.0031737514982912362,
52
+ "q_fallback": false,
53
+ "reconstruction_max_abs": 0.00018310546875,
54
+ "reconstruction_mismatch_ratio": 0.0
55
+ },
56
+ "up_proj.rank0": {
57
+ "apply_out_scales": true,
58
+ "calibration_rows": 2048,
59
+ "g_scale": 0.9250969903450001,
60
+ "pack_unpack_pack_equal": true,
61
+ "proxy_error": 0.004056537001417225,
62
+ "q_fallback": false,
63
+ "reconstruction_max_abs": 0.0001220703125,
64
+ "reconstruction_mismatch_ratio": 0.0
65
+ },
66
+ "up_proj.rank1": {
67
+ "apply_out_scales": true,
68
+ "calibration_rows": 2048,
69
+ "g_scale": 0.9453222201326655,
70
+ "pack_unpack_pack_equal": true,
71
+ "proxy_error": 0.003995592575612048,
72
+ "q_fallback": false,
73
+ "reconstruction_max_abs": 0.0001220703125,
74
+ "reconstruction_mismatch_ratio": 0.0
75
+ }
76
+ },
77
+ "source_index_sha256": "c872bd9b5ac116cebfd78a5f27565787dbceae76985cef041179110d0b03cd2b",
78
+ "status": "complete",
79
+ "tier": "TR3",
80
+ "tier_map_sha256": "98bb2a6cfab92807201180c1cde4447d50fc7bd991bde8f2f6a869a84e2ff45a",
81
+ "tp": 2
82
+ }
hybrid/tails/tr3/layer-26/expert-107.json ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bits": 3,
3
+ "bytes": 3584600,
4
+ "calibration_rows": 2048,
5
+ "calibration_sampling": "deterministic evenly spaced routed-row indices",
6
+ "capture_manifest_sha256": "976ba9935c2ae028117276f32bd33195862733a2b76cacb5514d3f2c2fb12a69",
7
+ "encoder_script_sha256": "30ccbf529dcab421ec904d8069a0ef33714d25408abf615ff76fccbcffae6b44",
8
+ "expert": 107,
9
+ "fallback_slices": 0,
10
+ "layer": 26,
11
+ "output": "/out/tr3/layer-26/expert-107.safetensors",
12
+ "routed_observation_rows_total": "15992",
13
+ "schema": "laguna-exl3-expert-encode/v1",
14
+ "sha256": "efd2b628067d6097dccd9e0c13f982d17d410517b5378a77450f7326333c3a29",
15
+ "slices": {
16
+ "down_proj.rank0": {
17
+ "apply_out_scales": true,
18
+ "calibration_rows": 2048,
19
+ "g_scale": 0.9453222201326655,
20
+ "pack_unpack_pack_equal": true,
21
+ "proxy_error": 0.011894459825396603,
22
+ "q_fallback": false,
23
+ "reconstruction_max_abs": 0.000244140625,
24
+ "reconstruction_mismatch_ratio": 0.0
25
+ },
26
+ "down_proj.rank1": {
27
+ "apply_out_scales": true,
28
+ "calibration_rows": 2048,
29
+ "g_scale": 0.9599573338930756,
30
+ "pack_unpack_pack_equal": true,
31
+ "proxy_error": 0.011983845460879472,
32
+ "q_fallback": false,
33
+ "reconstruction_max_abs": 0.000244140625,
34
+ "reconstruction_mismatch_ratio": 0.0
35
+ },
36
+ "gate_proj.rank0": {
37
+ "apply_out_scales": true,
38
+ "calibration_rows": 2048,
39
+ "g_scale": 0.9397321041054102,
40
+ "pack_unpack_pack_equal": true,
41
+ "proxy_error": 0.003291044465538201,
42
+ "q_fallback": false,
43
+ "reconstruction_max_abs": 0.0001220703125,
44
+ "reconstruction_mismatch_ratio": 0.0
45
+ },
46
+ "gate_proj.rank1": {
47
+ "apply_out_scales": true,
48
+ "calibration_rows": 2048,
49
+ "g_scale": 0.9362772223995108,
50
+ "pack_unpack_pack_equal": true,
51
+ "proxy_error": 0.003412380821643795,
52
+ "q_fallback": false,
53
+ "reconstruction_max_abs": 0.0001220703125,
54
+ "reconstruction_mismatch_ratio": 0.0
55
+ },
56
+ "up_proj.rank0": {
57
+ "apply_out_scales": true,
58
+ "calibration_rows": 2048,
59
+ "g_scale": 0.9397321041054103,
60
+ "pack_unpack_pack_equal": true,
61
+ "proxy_error": 0.003734575489724514,
62
+ "q_fallback": false,
63
+ "reconstruction_max_abs": 0.0001220703125,
64
+ "reconstruction_mismatch_ratio": 0.0
65
+ },
66
+ "up_proj.rank1": {
67
+ "apply_out_scales": true,
68
+ "calibration_rows": 2048,
69
+ "g_scale": 0.9543672178658202,
70
+ "pack_unpack_pack_equal": true,
71
+ "proxy_error": 0.003833148055553648,
72
+ "q_fallback": false,
73
+ "reconstruction_max_abs": 0.0001220703125,
74
+ "reconstruction_mismatch_ratio": 0.0
75
+ }
76
+ },
77
+ "source_index_sha256": "c872bd9b5ac116cebfd78a5f27565787dbceae76985cef041179110d0b03cd2b",
78
+ "status": "complete",
79
+ "tier": "TR3",
80
+ "tier_map_sha256": "98bb2a6cfab92807201180c1cde4447d50fc7bd991bde8f2f6a869a84e2ff45a",
81
+ "tp": 2
82
+ }
hybrid/tails/tr3/layer-26/expert-112.json ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bits": 3,
3
+ "bytes": 3584600,
4
+ "calibration_rows": 2048,
5
+ "calibration_sampling": "deterministic evenly spaced routed-row indices",
6
+ "capture_manifest_sha256": "976ba9935c2ae028117276f32bd33195862733a2b76cacb5514d3f2c2fb12a69",
7
+ "encoder_script_sha256": "30ccbf529dcab421ec904d8069a0ef33714d25408abf615ff76fccbcffae6b44",
8
+ "expert": 112,
9
+ "fallback_slices": 0,
10
+ "layer": 26,
11
+ "output": "/out/tr3/layer-26/expert-112.safetensors",
12
+ "routed_observation_rows_total": "5055",
13
+ "schema": "laguna-exl3-expert-encode/v1",
14
+ "sha256": "557fe6f29a1b5a8c0dac2b61bf2d8b7db767984824eabd7fa2984c43b0b6f16a",
15
+ "slices": {
16
+ "down_proj.rank0": {
17
+ "apply_out_scales": true,
18
+ "calibration_rows": 2048,
19
+ "g_scale": 0.9453222201326655,
20
+ "pack_unpack_pack_equal": true,
21
+ "proxy_error": 0.009245232755793815,
22
+ "q_fallback": false,
23
+ "reconstruction_max_abs": 0.0001220703125,
24
+ "reconstruction_mismatch_ratio": 0.0
25
+ },
26
+ "down_proj.rank1": {
27
+ "apply_out_scales": true,
28
+ "calibration_rows": 2048,
29
+ "g_scale": 0.9509123361599208,
30
+ "pack_unpack_pack_equal": true,
31
+ "proxy_error": 0.010273713108750577,
32
+ "q_fallback": false,
33
+ "reconstruction_max_abs": 0.0001220703125,
34
+ "reconstruction_mismatch_ratio": 0.0
35
+ },
36
+ "gate_proj.rank0": {
37
+ "apply_out_scales": true,
38
+ "calibration_rows": 2048,
39
+ "g_scale": 0.9453222201326655,
40
+ "pack_unpack_pack_equal": true,
41
+ "proxy_error": 0.003566257270597336,
42
+ "q_fallback": false,
43
+ "reconstruction_max_abs": 0.000244140625,
44
+ "reconstruction_mismatch_ratio": 0.0
45
+ },
46
+ "gate_proj.rank1": {
47
+ "apply_out_scales": true,
48
+ "calibration_rows": 2048,
49
+ "g_scale": 0.9509123361599208,
50
+ "pack_unpack_pack_equal": true,
51
+ "proxy_error": 0.003615594251938286,
52
+ "q_fallback": false,
53
+ "reconstruction_max_abs": 0.000244140625,
54
+ "reconstruction_mismatch_ratio": 0.0
55
+ },
56
+ "up_proj.rank0": {
57
+ "apply_out_scales": true,
58
+ "calibration_rows": 2048,
59
+ "g_scale": 0.9306871063722555,
60
+ "pack_unpack_pack_equal": true,
61
+ "proxy_error": 0.004498458901675987,
62
+ "q_fallback": false,
63
+ "reconstruction_max_abs": 0.000244140625,
64
+ "reconstruction_mismatch_ratio": 0.0
65
+ },
66
+ "up_proj.rank1": {
67
+ "apply_out_scales": true,
68
+ "calibration_rows": 2048,
69
+ "g_scale": 0.9397321041054102,
70
+ "pack_unpack_pack_equal": true,
71
+ "proxy_error": 0.004479393538456486,
72
+ "q_fallback": false,
73
+ "reconstruction_max_abs": 0.0001220703125,
74
+ "reconstruction_mismatch_ratio": 0.0
75
+ }
76
+ },
77
+ "source_index_sha256": "c872bd9b5ac116cebfd78a5f27565787dbceae76985cef041179110d0b03cd2b",
78
+ "status": "complete",
79
+ "tier": "TR3",
80
+ "tier_map_sha256": "98bb2a6cfab92807201180c1cde4447d50fc7bd991bde8f2f6a869a84e2ff45a",
81
+ "tp": 2
82
+ }
hybrid/tails/tr3/layer-26/expert-129.json ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bits": 3,
3
+ "bytes": 3584600,
4
+ "calibration_rows": 2048,
5
+ "calibration_sampling": "deterministic evenly spaced routed-row indices",
6
+ "capture_manifest_sha256": "976ba9935c2ae028117276f32bd33195862733a2b76cacb5514d3f2c2fb12a69",
7
+ "encoder_script_sha256": "30ccbf529dcab421ec904d8069a0ef33714d25408abf615ff76fccbcffae6b44",
8
+ "expert": 129,
9
+ "fallback_slices": 0,
10
+ "layer": 26,
11
+ "output": "/out/tr3/layer-26/expert-129.safetensors",
12
+ "routed_observation_rows_total": "8855",
13
+ "schema": "laguna-exl3-expert-encode/v1",
14
+ "sha256": "e5be4d2ad1e51a29850706541209c3829d55874336d56e18e0066160f04f3095",
15
+ "slices": {
16
+ "down_proj.rank0": {
17
+ "apply_out_scales": true,
18
+ "calibration_rows": 2048,
19
+ "g_scale": 0.9453222201326655,
20
+ "pack_unpack_pack_equal": true,
21
+ "proxy_error": 0.012331515789121667,
22
+ "q_fallback": false,
23
+ "reconstruction_max_abs": 0.0001220703125,
24
+ "reconstruction_mismatch_ratio": 0.0
25
+ },
26
+ "down_proj.rank1": {
27
+ "apply_out_scales": true,
28
+ "calibration_rows": 2048,
29
+ "g_scale": 0.9453222201326655,
30
+ "pack_unpack_pack_equal": true,
31
+ "proxy_error": 0.012238527082040129,
32
+ "q_fallback": false,
33
+ "reconstruction_max_abs": 0.0001220703125,
34
+ "reconstruction_mismatch_ratio": 0.0
35
+ },
36
+ "gate_proj.rank0": {
37
+ "apply_out_scales": true,
38
+ "calibration_rows": 2048,
39
+ "g_scale": 0.9453222201326655,
40
+ "pack_unpack_pack_equal": true,
41
+ "proxy_error": 0.0032811251152776834,
42
+ "q_fallback": false,
43
+ "reconstruction_max_abs": 0.0001220703125,
44
+ "reconstruction_mismatch_ratio": 0.0
45
+ },
46
+ "gate_proj.rank1": {
47
+ "apply_out_scales": true,
48
+ "calibration_rows": 2048,
49
+ "g_scale": 0.9599573338930756,
50
+ "pack_unpack_pack_equal": true,
51
+ "proxy_error": 0.0033327011440708355,
52
+ "q_fallback": false,
53
+ "reconstruction_max_abs": 0.0001220703125,
54
+ "reconstruction_mismatch_ratio": 0.0
55
+ },
56
+ "up_proj.rank0": {
57
+ "apply_out_scales": true,
58
+ "calibration_rows": 2048,
59
+ "g_scale": 0.9453222201326655,
60
+ "pack_unpack_pack_equal": true,
61
+ "proxy_error": 0.0047660500765981115,
62
+ "q_fallback": false,
63
+ "reconstruction_max_abs": 0.0001220703125,
64
+ "reconstruction_mismatch_ratio": 0.0
65
+ },
66
+ "up_proj.rank1": {
67
+ "apply_out_scales": true,
68
+ "calibration_rows": 2048,
69
+ "g_scale": 0.9397321041054102,
70
+ "pack_unpack_pack_equal": true,
71
+ "proxy_error": 0.004690801732999302,
72
+ "q_fallback": false,
73
+ "reconstruction_max_abs": 0.000244140625,
74
+ "reconstruction_mismatch_ratio": 0.0
75
+ }
76
+ },
77
+ "source_index_sha256": "c872bd9b5ac116cebfd78a5f27565787dbceae76985cef041179110d0b03cd2b",
78
+ "status": "complete",
79
+ "tier": "TR3",
80
+ "tier_map_sha256": "98bb2a6cfab92807201180c1cde4447d50fc7bd991bde8f2f6a869a84e2ff45a",
81
+ "tp": 2
82
+ }
hybrid/tails/tr3/layer-26/expert-132.json ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bits": 3,
3
+ "bytes": 3584600,
4
+ "calibration_rows": 2048,
5
+ "calibration_sampling": "deterministic evenly spaced routed-row indices",
6
+ "capture_manifest_sha256": "976ba9935c2ae028117276f32bd33195862733a2b76cacb5514d3f2c2fb12a69",
7
+ "encoder_script_sha256": "30ccbf529dcab421ec904d8069a0ef33714d25408abf615ff76fccbcffae6b44",
8
+ "expert": 132,
9
+ "fallback_slices": 0,
10
+ "layer": 26,
11
+ "output": "/out/tr3/layer-26/expert-132.safetensors",
12
+ "routed_observation_rows_total": "4585",
13
+ "schema": "laguna-exl3-expert-encode/v1",
14
+ "sha256": "7fa90ebc79f7c3c4eaf65c33c63d60c4f5925ab0307d1dd586a6d20e69036064",
15
+ "slices": {
16
+ "down_proj.rank0": {
17
+ "apply_out_scales": true,
18
+ "calibration_rows": 2048,
19
+ "g_scale": 0.9397321041054102,
20
+ "pack_unpack_pack_equal": true,
21
+ "proxy_error": 0.011349068188812764,
22
+ "q_fallback": false,
23
+ "reconstruction_max_abs": 0.000244140625,
24
+ "reconstruction_mismatch_ratio": 0.0
25
+ },
26
+ "down_proj.rank1": {
27
+ "apply_out_scales": true,
28
+ "calibration_rows": 2048,
29
+ "g_scale": 0.9453222201326655,
30
+ "pack_unpack_pack_equal": true,
31
+ "proxy_error": 0.011698707323318172,
32
+ "q_fallback": false,
33
+ "reconstruction_max_abs": 0.000244140625,
34
+ "reconstruction_mismatch_ratio": 0.0
35
+ },
36
+ "gate_proj.rank0": {
37
+ "apply_out_scales": true,
38
+ "calibration_rows": 2048,
39
+ "g_scale": 0.9453222201326655,
40
+ "pack_unpack_pack_equal": true,
41
+ "proxy_error": 0.002344417538619204,
42
+ "q_fallback": false,
43
+ "reconstruction_max_abs": 0.000244140625,
44
+ "reconstruction_mismatch_ratio": 0.0
45
+ },
46
+ "gate_proj.rank1": {
47
+ "apply_out_scales": true,
48
+ "calibration_rows": 2048,
49
+ "g_scale": 0.9397321041054102,
50
+ "pack_unpack_pack_equal": true,
51
+ "proxy_error": 0.0023378519653806896,
52
+ "q_fallback": false,
53
+ "reconstruction_max_abs": 0.000244140625,
54
+ "reconstruction_mismatch_ratio": 0.0
55
+ },
56
+ "up_proj.rank0": {
57
+ "apply_out_scales": true,
58
+ "calibration_rows": 2048,
59
+ "g_scale": 0.9543672178658202,
60
+ "pack_unpack_pack_equal": true,
61
+ "proxy_error": 0.003004228855430139,
62
+ "q_fallback": false,
63
+ "reconstruction_max_abs": 0.0001220703125,
64
+ "reconstruction_mismatch_ratio": 0.0
65
+ },
66
+ "up_proj.rank1": {
67
+ "apply_out_scales": true,
68
+ "calibration_rows": 2048,
69
+ "g_scale": 0.9599573338930756,
70
+ "pack_unpack_pack_equal": true,
71
+ "proxy_error": 0.0029677362662067315,
72
+ "q_fallback": false,
73
+ "reconstruction_max_abs": 0.0001220703125,
74
+ "reconstruction_mismatch_ratio": 0.0
75
+ }
76
+ },
77
+ "source_index_sha256": "c872bd9b5ac116cebfd78a5f27565787dbceae76985cef041179110d0b03cd2b",
78
+ "status": "complete",
79
+ "tier": "TR3",
80
+ "tier_map_sha256": "98bb2a6cfab92807201180c1cde4447d50fc7bd991bde8f2f6a869a84e2ff45a",
81
+ "tp": 2
82
+ }
hybrid/tails/tr3/layer-26/expert-135.json ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bits": 3,
3
+ "bytes": 3584600,
4
+ "calibration_rows": 2048,
5
+ "calibration_sampling": "deterministic evenly spaced routed-row indices",
6
+ "capture_manifest_sha256": "976ba9935c2ae028117276f32bd33195862733a2b76cacb5514d3f2c2fb12a69",
7
+ "encoder_script_sha256": "30ccbf529dcab421ec904d8069a0ef33714d25408abf615ff76fccbcffae6b44",
8
+ "expert": 135,
9
+ "fallback_slices": 0,
10
+ "layer": 26,
11
+ "output": "/out/tr3/layer-26/expert-135.safetensors",
12
+ "routed_observation_rows_total": "7041",
13
+ "schema": "laguna-exl3-expert-encode/v1",
14
+ "sha256": "04569dd410d6cf3b5c7f1fa7de40e4dff2c51fc58eed373dd42bb5f59dd3ea7e",
15
+ "slices": {
16
+ "down_proj.rank0": {
17
+ "apply_out_scales": true,
18
+ "calibration_rows": 2048,
19
+ "g_scale": 0.9509123361599208,
20
+ "pack_unpack_pack_equal": true,
21
+ "proxy_error": 0.01314117071913363,
22
+ "q_fallback": false,
23
+ "reconstruction_max_abs": 0.0001220703125,
24
+ "reconstruction_mismatch_ratio": 0.0
25
+ },
26
+ "down_proj.rank1": {
27
+ "apply_out_scales": true,
28
+ "calibration_rows": 2048,
29
+ "g_scale": 0.9543672178658202,
30
+ "pack_unpack_pack_equal": true,
31
+ "proxy_error": 0.013159933190621004,
32
+ "q_fallback": false,
33
+ "reconstruction_max_abs": 0.0001220703125,
34
+ "reconstruction_mismatch_ratio": 0.0
35
+ },
36
+ "gate_proj.rank0": {
37
+ "apply_out_scales": true,
38
+ "calibration_rows": 2048,
39
+ "g_scale": 0.9509123361599208,
40
+ "pack_unpack_pack_equal": true,
41
+ "proxy_error": 0.003780736590079384,
42
+ "q_fallback": false,
43
+ "reconstruction_max_abs": 0.000244140625,
44
+ "reconstruction_mismatch_ratio": 0.0
45
+ },
46
+ "gate_proj.rank1": {
47
+ "apply_out_scales": true,
48
+ "calibration_rows": 2048,
49
+ "g_scale": 0.9509123361599208,
50
+ "pack_unpack_pack_equal": true,
51
+ "proxy_error": 0.003786506991632136,
52
+ "q_fallback": false,
53
+ "reconstruction_max_abs": 0.0001220703125,
54
+ "reconstruction_mismatch_ratio": 0.0
55
+ },
56
+ "up_proj.rank0": {
57
+ "apply_out_scales": true,
58
+ "calibration_rows": 2048,
59
+ "g_scale": 0.9509123361599208,
60
+ "pack_unpack_pack_equal": true,
61
+ "proxy_error": 0.00432152794586183,
62
+ "q_fallback": false,
63
+ "reconstruction_max_abs": 0.0001220703125,
64
+ "reconstruction_mismatch_ratio": 0.0
65
+ },
66
+ "up_proj.rank1": {
67
+ "apply_out_scales": true,
68
+ "calibration_rows": 2048,
69
+ "g_scale": 0.9306871063722555,
70
+ "pack_unpack_pack_equal": true,
71
+ "proxy_error": 0.00435990242892599,
72
+ "q_fallback": false,
73
+ "reconstruction_max_abs": 0.000244140625,
74
+ "reconstruction_mismatch_ratio": 0.0
75
+ }
76
+ },
77
+ "source_index_sha256": "c872bd9b5ac116cebfd78a5f27565787dbceae76985cef041179110d0b03cd2b",
78
+ "status": "complete",
79
+ "tier": "TR3",
80
+ "tier_map_sha256": "98bb2a6cfab92807201180c1cde4447d50fc7bd991bde8f2f6a869a84e2ff45a",
81
+ "tp": 2
82
+ }
hybrid/tails/tr3/layer-26/expert-138.json ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bits": 3,
3
+ "bytes": 3584600,
4
+ "calibration_rows": 2048,
5
+ "calibration_sampling": "deterministic evenly spaced routed-row indices",
6
+ "capture_manifest_sha256": "976ba9935c2ae028117276f32bd33195862733a2b76cacb5514d3f2c2fb12a69",
7
+ "encoder_script_sha256": "30ccbf529dcab421ec904d8069a0ef33714d25408abf615ff76fccbcffae6b44",
8
+ "expert": 138,
9
+ "fallback_slices": 0,
10
+ "layer": 26,
11
+ "output": "/out/tr3/layer-26/expert-138.safetensors",
12
+ "routed_observation_rows_total": "4291",
13
+ "schema": "laguna-exl3-expert-encode/v1",
14
+ "sha256": "76e4d1913f7db9981e8f0efa555405443c754abaa58fa212bb88e53d21410100",
15
+ "slices": {
16
+ "down_proj.rank0": {
17
+ "apply_out_scales": true,
18
+ "calibration_rows": 2048,
19
+ "g_scale": 0.9397321041054102,
20
+ "pack_unpack_pack_equal": true,
21
+ "proxy_error": 0.011041938259091574,
22
+ "q_fallback": false,
23
+ "reconstruction_max_abs": 0.0001220703125,
24
+ "reconstruction_mismatch_ratio": 0.0
25
+ },
26
+ "down_proj.rank1": {
27
+ "apply_out_scales": true,
28
+ "calibration_rows": 2048,
29
+ "g_scale": 0.9453222201326655,
30
+ "pack_unpack_pack_equal": true,
31
+ "proxy_error": 0.011210197693413073,
32
+ "q_fallback": false,
33
+ "reconstruction_max_abs": 0.000244140625,
34
+ "reconstruction_mismatch_ratio": 0.0
35
+ },
36
+ "gate_proj.rank0": {
37
+ "apply_out_scales": true,
38
+ "calibration_rows": 2048,
39
+ "g_scale": 0.9397321041054103,
40
+ "pack_unpack_pack_equal": true,
41
+ "proxy_error": 0.001253200723420547,
42
+ "q_fallback": false,
43
+ "reconstruction_max_abs": 0.000244140625,
44
+ "reconstruction_mismatch_ratio": 0.0
45
+ },
46
+ "gate_proj.rank1": {
47
+ "apply_out_scales": true,
48
+ "calibration_rows": 2048,
49
+ "g_scale": 0.9509123361599208,
50
+ "pack_unpack_pack_equal": true,
51
+ "proxy_error": 0.001261341186704722,
52
+ "q_fallback": false,
53
+ "reconstruction_max_abs": 0.000244140625,
54
+ "reconstruction_mismatch_ratio": 0.0
55
+ },
56
+ "up_proj.rank0": {
57
+ "apply_out_scales": true,
58
+ "calibration_rows": 2048,
59
+ "g_scale": 0.9509123361599208,
60
+ "pack_unpack_pack_equal": true,
61
+ "proxy_error": 0.004417570643665325,
62
+ "q_fallback": false,
63
+ "reconstruction_max_abs": 0.0001220703125,
64
+ "reconstruction_mismatch_ratio": 0.0
65
+ },
66
+ "up_proj.rank1": {
67
+ "apply_out_scales": true,
68
+ "calibration_rows": 2048,
69
+ "g_scale": 0.9509123361599208,
70
+ "pack_unpack_pack_equal": true,
71
+ "proxy_error": 0.004521752059385283,
72
+ "q_fallback": false,
73
+ "reconstruction_max_abs": 0.00018310546875,
74
+ "reconstruction_mismatch_ratio": 0.0
75
+ }
76
+ },
77
+ "source_index_sha256": "c872bd9b5ac116cebfd78a5f27565787dbceae76985cef041179110d0b03cd2b",
78
+ "status": "complete",
79
+ "tier": "TR3",
80
+ "tier_map_sha256": "98bb2a6cfab92807201180c1cde4447d50fc7bd991bde8f2f6a869a84e2ff45a",
81
+ "tp": 2
82
+ }
hybrid/tails/tr3/layer-26/expert-140.json ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bits": 3,
3
+ "bytes": 3584600,
4
+ "calibration_rows": 2048,
5
+ "calibration_sampling": "deterministic evenly spaced routed-row indices",
6
+ "capture_manifest_sha256": "976ba9935c2ae028117276f32bd33195862733a2b76cacb5514d3f2c2fb12a69",
7
+ "encoder_script_sha256": "30ccbf529dcab421ec904d8069a0ef33714d25408abf615ff76fccbcffae6b44",
8
+ "expert": 140,
9
+ "fallback_slices": 0,
10
+ "layer": 26,
11
+ "output": "/out/tr3/layer-26/expert-140.safetensors",
12
+ "routed_observation_rows_total": "8099",
13
+ "schema": "laguna-exl3-expert-encode/v1",
14
+ "sha256": "27c61aa4b5eced20b5c06fe7c7aa8f5aa79115b419c59d8837cf664eda4953c8",
15
+ "slices": {
16
+ "down_proj.rank0": {
17
+ "apply_out_scales": true,
18
+ "calibration_rows": 2048,
19
+ "g_scale": 0.9509123361599208,
20
+ "pack_unpack_pack_equal": true,
21
+ "proxy_error": 0.010973506476197844,
22
+ "q_fallback": false,
23
+ "reconstruction_max_abs": 0.0001220703125,
24
+ "reconstruction_mismatch_ratio": 0.0
25
+ },
26
+ "down_proj.rank1": {
27
+ "apply_out_scales": true,
28
+ "calibration_rows": 2048,
29
+ "g_scale": 0.9216421086391007,
30
+ "pack_unpack_pack_equal": true,
31
+ "proxy_error": 0.011077125283919242,
32
+ "q_fallback": false,
33
+ "reconstruction_max_abs": 0.0001220703125,
34
+ "reconstruction_mismatch_ratio": 0.0
35
+ },
36
+ "gate_proj.rank0": {
37
+ "apply_out_scales": true,
38
+ "calibration_rows": 2048,
39
+ "g_scale": 0.9362772223995108,
40
+ "pack_unpack_pack_equal": true,
41
+ "proxy_error": 0.002200342451839082,
42
+ "q_fallback": false,
43
+ "reconstruction_max_abs": 0.000244140625,
44
+ "reconstruction_mismatch_ratio": 0.0
45
+ },
46
+ "gate_proj.rank1": {
47
+ "apply_out_scales": true,
48
+ "calibration_rows": 2048,
49
+ "g_scale": 0.9397321041054103,
50
+ "pack_unpack_pack_equal": true,
51
+ "proxy_error": 0.0023201265665101617,
52
+ "q_fallback": false,
53
+ "reconstruction_max_abs": 0.00018310546875,
54
+ "reconstruction_mismatch_ratio": 0.0
55
+ },
56
+ "up_proj.rank0": {
57
+ "apply_out_scales": true,
58
+ "calibration_rows": 2048,
59
+ "g_scale": 0.9509123361599208,
60
+ "pack_unpack_pack_equal": true,
61
+ "proxy_error": 0.0028949514416910576,
62
+ "q_fallback": false,
63
+ "reconstruction_max_abs": 0.000244140625,
64
+ "reconstruction_mismatch_ratio": 0.0
65
+ },
66
+ "up_proj.rank1": {
67
+ "apply_out_scales": true,
68
+ "calibration_rows": 2048,
69
+ "g_scale": 0.9509123361599208,
70
+ "pack_unpack_pack_equal": true,
71
+ "proxy_error": 0.002856161038369223,
72
+ "q_fallback": false,
73
+ "reconstruction_max_abs": 0.0001220703125,
74
+ "reconstruction_mismatch_ratio": 0.0
75
+ }
76
+ },
77
+ "source_index_sha256": "c872bd9b5ac116cebfd78a5f27565787dbceae76985cef041179110d0b03cd2b",
78
+ "status": "complete",
79
+ "tier": "TR3",
80
+ "tier_map_sha256": "98bb2a6cfab92807201180c1cde4447d50fc7bd991bde8f2f6a869a84e2ff45a",
81
+ "tp": 2
82
+ }
hybrid/tails/tr3/layer-26/expert-151.json ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bits": 3,
3
+ "bytes": 3584600,
4
+ "calibration_rows": 2048,
5
+ "calibration_sampling": "deterministic evenly spaced routed-row indices",
6
+ "capture_manifest_sha256": "976ba9935c2ae028117276f32bd33195862733a2b76cacb5514d3f2c2fb12a69",
7
+ "encoder_script_sha256": "30ccbf529dcab421ec904d8069a0ef33714d25408abf615ff76fccbcffae6b44",
8
+ "expert": 151,
9
+ "fallback_slices": 0,
10
+ "layer": 26,
11
+ "output": "/out/tr3/layer-26/expert-151.safetensors",
12
+ "routed_observation_rows_total": "8691",
13
+ "schema": "laguna-exl3-expert-encode/v1",
14
+ "sha256": "ce94186b6e32ea5dd055533e786241f9af36a3175044d85d4e0a04dfa6d0f466",
15
+ "slices": {
16
+ "down_proj.rank0": {
17
+ "apply_out_scales": true,
18
+ "calibration_rows": 2048,
19
+ "g_scale": 0.9543672178658202,
20
+ "pack_unpack_pack_equal": true,
21
+ "proxy_error": 0.012372725387243612,
22
+ "q_fallback": false,
23
+ "reconstruction_max_abs": 0.0001220703125,
24
+ "reconstruction_mismatch_ratio": 0.0
25
+ },
26
+ "down_proj.rank1": {
27
+ "apply_out_scales": true,
28
+ "calibration_rows": 2048,
29
+ "g_scale": 0.9453222201326655,
30
+ "pack_unpack_pack_equal": true,
31
+ "proxy_error": 0.012176130903093435,
32
+ "q_fallback": false,
33
+ "reconstruction_max_abs": 0.0001220703125,
34
+ "reconstruction_mismatch_ratio": 0.0
35
+ },
36
+ "gate_proj.rank0": {
37
+ "apply_out_scales": true,
38
+ "calibration_rows": 2048,
39
+ "g_scale": 0.9509123361599208,
40
+ "pack_unpack_pack_equal": true,
41
+ "proxy_error": 0.003371398938060717,
42
+ "q_fallback": false,
43
+ "reconstruction_max_abs": 0.000244140625,
44
+ "reconstruction_mismatch_ratio": 0.0
45
+ },
46
+ "gate_proj.rank1": {
47
+ "apply_out_scales": true,
48
+ "calibration_rows": 2048,
49
+ "g_scale": 0.9453222201326655,
50
+ "pack_unpack_pack_equal": true,
51
+ "proxy_error": 0.0033323399808304678,
52
+ "q_fallback": false,
53
+ "reconstruction_max_abs": 0.000244140625,
54
+ "reconstruction_mismatch_ratio": 0.0
55
+ },
56
+ "up_proj.rank0": {
57
+ "apply_out_scales": true,
58
+ "calibration_rows": 2048,
59
+ "g_scale": 0.9453222201326655,
60
+ "pack_unpack_pack_equal": true,
61
+ "proxy_error": 0.003809018373833184,
62
+ "q_fallback": false,
63
+ "reconstruction_max_abs": 0.0001220703125,
64
+ "reconstruction_mismatch_ratio": 0.0
65
+ },
66
+ "up_proj.rank1": {
67
+ "apply_out_scales": true,
68
+ "calibration_rows": 2048,
69
+ "g_scale": 0.9509123361599208,
70
+ "pack_unpack_pack_equal": true,
71
+ "proxy_error": 0.003777047238847949,
72
+ "q_fallback": false,
73
+ "reconstruction_max_abs": 0.0001220703125,
74
+ "reconstruction_mismatch_ratio": 0.0
75
+ }
76
+ },
77
+ "source_index_sha256": "c872bd9b5ac116cebfd78a5f27565787dbceae76985cef041179110d0b03cd2b",
78
+ "status": "complete",
79
+ "tier": "TR3",
80
+ "tier_map_sha256": "98bb2a6cfab92807201180c1cde4447d50fc7bd991bde8f2f6a869a84e2ff45a",
81
+ "tp": 2
82
+ }
hybrid/tails/tr3/layer-26/expert-164.json ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bits": 3,
3
+ "bytes": 3584600,
4
+ "calibration_rows": 2048,
5
+ "calibration_sampling": "deterministic evenly spaced routed-row indices",
6
+ "capture_manifest_sha256": "976ba9935c2ae028117276f32bd33195862733a2b76cacb5514d3f2c2fb12a69",
7
+ "encoder_script_sha256": "30ccbf529dcab421ec904d8069a0ef33714d25408abf615ff76fccbcffae6b44",
8
+ "expert": 164,
9
+ "fallback_slices": 0,
10
+ "layer": 26,
11
+ "output": "/out/tr3/layer-26/expert-164.safetensors",
12
+ "routed_observation_rows_total": "24752",
13
+ "schema": "laguna-exl3-expert-encode/v1",
14
+ "sha256": "2f2dc7d83238a8a8016e7fbf43fa19b18de8f34fb393d33e09eb51294928efec",
15
+ "slices": {
16
+ "down_proj.rank0": {
17
+ "apply_out_scales": true,
18
+ "calibration_rows": 2048,
19
+ "g_scale": 0.9362772223995108,
20
+ "pack_unpack_pack_equal": true,
21
+ "proxy_error": 0.012347316276682915,
22
+ "q_fallback": false,
23
+ "reconstruction_max_abs": 0.0001220703125,
24
+ "reconstruction_mismatch_ratio": 0.0
25
+ },
26
+ "down_proj.rank1": {
27
+ "apply_out_scales": true,
28
+ "calibration_rows": 2048,
29
+ "g_scale": 0.9397321041054102,
30
+ "pack_unpack_pack_equal": true,
31
+ "proxy_error": 0.01275300844718002,
32
+ "q_fallback": false,
33
+ "reconstruction_max_abs": 0.0001220703125,
34
+ "reconstruction_mismatch_ratio": 0.0
35
+ },
36
+ "gate_proj.rank0": {
37
+ "apply_out_scales": true,
38
+ "calibration_rows": 2048,
39
+ "g_scale": 0.9453222201326655,
40
+ "pack_unpack_pack_equal": true,
41
+ "proxy_error": 0.0037603398536440627,
42
+ "q_fallback": false,
43
+ "reconstruction_max_abs": 0.0001220703125,
44
+ "reconstruction_mismatch_ratio": 0.0
45
+ },
46
+ "gate_proj.rank1": {
47
+ "apply_out_scales": true,
48
+ "calibration_rows": 2048,
49
+ "g_scale": 0.9397321041054102,
50
+ "pack_unpack_pack_equal": true,
51
+ "proxy_error": 0.0038696171192667463,
52
+ "q_fallback": false,
53
+ "reconstruction_max_abs": 0.000244140625,
54
+ "reconstruction_mismatch_ratio": 0.0
55
+ },
56
+ "up_proj.rank0": {
57
+ "apply_out_scales": true,
58
+ "calibration_rows": 2048,
59
+ "g_scale": 0.9543672178658202,
60
+ "pack_unpack_pack_equal": true,
61
+ "proxy_error": 0.00430643569536159,
62
+ "q_fallback": false,
63
+ "reconstruction_max_abs": 0.0001220703125,
64
+ "reconstruction_mismatch_ratio": 0.0
65
+ },
66
+ "up_proj.rank1": {
67
+ "apply_out_scales": true,
68
+ "calibration_rows": 2048,
69
+ "g_scale": 0.9543672178658202,
70
+ "pack_unpack_pack_equal": true,
71
+ "proxy_error": 0.004361414311432928,
72
+ "q_fallback": false,
73
+ "reconstruction_max_abs": 0.0001220703125,
74
+ "reconstruction_mismatch_ratio": 0.0
75
+ }
76
+ },
77
+ "source_index_sha256": "c872bd9b5ac116cebfd78a5f27565787dbceae76985cef041179110d0b03cd2b",
78
+ "status": "complete",
79
+ "tier": "TR3",
80
+ "tier_map_sha256": "98bb2a6cfab92807201180c1cde4447d50fc7bd991bde8f2f6a869a84e2ff45a",
81
+ "tp": 2
82
+ }
hybrid/tails/tr3/layer-26/expert-165.json ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bits": 3,
3
+ "bytes": 3584600,
4
+ "calibration_rows": 2048,
5
+ "calibration_sampling": "deterministic evenly spaced routed-row indices",
6
+ "capture_manifest_sha256": "976ba9935c2ae028117276f32bd33195862733a2b76cacb5514d3f2c2fb12a69",
7
+ "encoder_script_sha256": "30ccbf529dcab421ec904d8069a0ef33714d25408abf615ff76fccbcffae6b44",
8
+ "expert": 165,
9
+ "fallback_slices": 0,
10
+ "layer": 26,
11
+ "output": "/out/tr3/layer-26/expert-165.safetensors",
12
+ "routed_observation_rows_total": "6391",
13
+ "schema": "laguna-exl3-expert-encode/v1",
14
+ "sha256": "cc910a6a81a90690771d7da40fa43c30d709cf9a5802e65e1af5651adbb97348",
15
+ "slices": {
16
+ "down_proj.rank0": {
17
+ "apply_out_scales": true,
18
+ "calibration_rows": 2048,
19
+ "g_scale": 0.9362772223995108,
20
+ "pack_unpack_pack_equal": true,
21
+ "proxy_error": 0.011168691747213624,
22
+ "q_fallback": false,
23
+ "reconstruction_max_abs": 0.0001220703125,
24
+ "reconstruction_mismatch_ratio": 0.0
25
+ },
26
+ "down_proj.rank1": {
27
+ "apply_out_scales": true,
28
+ "calibration_rows": 2048,
29
+ "g_scale": 0.9306871063722555,
30
+ "pack_unpack_pack_equal": true,
31
+ "proxy_error": 0.011067914371880346,
32
+ "q_fallback": false,
33
+ "reconstruction_max_abs": 0.0001220703125,
34
+ "reconstruction_mismatch_ratio": 0.0
35
+ },
36
+ "gate_proj.rank0": {
37
+ "apply_out_scales": true,
38
+ "calibration_rows": 2048,
39
+ "g_scale": 0.9216421086391007,
40
+ "pack_unpack_pack_equal": true,
41
+ "proxy_error": 0.002239688514422917,
42
+ "q_fallback": false,
43
+ "reconstruction_max_abs": 0.0001220703125,
44
+ "reconstruction_mismatch_ratio": 0.0
45
+ },
46
+ "gate_proj.rank1": {
47
+ "apply_out_scales": true,
48
+ "calibration_rows": 2048,
49
+ "g_scale": 0.9599573338930756,
50
+ "pack_unpack_pack_equal": true,
51
+ "proxy_error": 0.0022020749643125886,
52
+ "q_fallback": false,
53
+ "reconstruction_max_abs": 0.0001220703125,
54
+ "reconstruction_mismatch_ratio": 0.0
55
+ },
56
+ "up_proj.rank0": {
57
+ "apply_out_scales": true,
58
+ "calibration_rows": 2048,
59
+ "g_scale": 0.9543672178658202,
60
+ "pack_unpack_pack_equal": true,
61
+ "proxy_error": 0.003005852833459597,
62
+ "q_fallback": false,
63
+ "reconstruction_max_abs": 0.000244140625,
64
+ "reconstruction_mismatch_ratio": 0.0
65
+ },
66
+ "up_proj.rank1": {
67
+ "apply_out_scales": true,
68
+ "calibration_rows": 2048,
69
+ "g_scale": 0.9634122155989749,
70
+ "pack_unpack_pack_equal": true,
71
+ "proxy_error": 0.0029746279697012586,
72
+ "q_fallback": false,
73
+ "reconstruction_max_abs": 0.0001220703125,
74
+ "reconstruction_mismatch_ratio": 0.0
75
+ }
76
+ },
77
+ "source_index_sha256": "c872bd9b5ac116cebfd78a5f27565787dbceae76985cef041179110d0b03cd2b",
78
+ "status": "complete",
79
+ "tier": "TR3",
80
+ "tier_map_sha256": "98bb2a6cfab92807201180c1cde4447d50fc7bd991bde8f2f6a869a84e2ff45a",
81
+ "tp": 2
82
+ }
hybrid/tails/tr3/layer-26/expert-184.json ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bits": 3,
3
+ "bytes": 3584600,
4
+ "calibration_rows": 2048,
5
+ "calibration_sampling": "deterministic evenly spaced routed-row indices",
6
+ "capture_manifest_sha256": "976ba9935c2ae028117276f32bd33195862733a2b76cacb5514d3f2c2fb12a69",
7
+ "encoder_script_sha256": "30ccbf529dcab421ec904d8069a0ef33714d25408abf615ff76fccbcffae6b44",
8
+ "expert": 184,
9
+ "fallback_slices": 0,
10
+ "layer": 26,
11
+ "output": "/out/tr3/layer-26/expert-184.safetensors",
12
+ "routed_observation_rows_total": "3877",
13
+ "schema": "laguna-exl3-expert-encode/v1",
14
+ "sha256": "0097b58998b515ea0bbd8f0e1e1a2c6a9952c6e5b0e6c8f99690dffcef543e98",
15
+ "slices": {
16
+ "down_proj.rank0": {
17
+ "apply_out_scales": true,
18
+ "calibration_rows": 2048,
19
+ "g_scale": 0.9453222201326655,
20
+ "pack_unpack_pack_equal": true,
21
+ "proxy_error": 0.012838662769301299,
22
+ "q_fallback": false,
23
+ "reconstruction_max_abs": 0.0001220703125,
24
+ "reconstruction_mismatch_ratio": 0.0
25
+ },
26
+ "down_proj.rank1": {
27
+ "apply_out_scales": true,
28
+ "calibration_rows": 2048,
29
+ "g_scale": 0.9362772223995108,
30
+ "pack_unpack_pack_equal": true,
31
+ "proxy_error": 0.012657011176535674,
32
+ "q_fallback": false,
33
+ "reconstruction_max_abs": 0.0001220703125,
34
+ "reconstruction_mismatch_ratio": 0.0
35
+ },
36
+ "gate_proj.rank0": {
37
+ "apply_out_scales": true,
38
+ "calibration_rows": 2048,
39
+ "g_scale": 0.9599573338930756,
40
+ "pack_unpack_pack_equal": true,
41
+ "proxy_error": 0.0034886447367760056,
42
+ "q_fallback": false,
43
+ "reconstruction_max_abs": 0.0001220703125,
44
+ "reconstruction_mismatch_ratio": 0.0
45
+ },
46
+ "gate_proj.rank1": {
47
+ "apply_out_scales": true,
48
+ "calibration_rows": 2048,
49
+ "g_scale": 0.9543672178658202,
50
+ "pack_unpack_pack_equal": true,
51
+ "proxy_error": 0.0034523103501488198,
52
+ "q_fallback": false,
53
+ "reconstruction_max_abs": 0.0001220703125,
54
+ "reconstruction_mismatch_ratio": 0.0
55
+ },
56
+ "up_proj.rank0": {
57
+ "apply_out_scales": true,
58
+ "calibration_rows": 2048,
59
+ "g_scale": 0.9509123361599208,
60
+ "pack_unpack_pack_equal": true,
61
+ "proxy_error": 0.00472809139818344,
62
+ "q_fallback": false,
63
+ "reconstruction_max_abs": 0.0001220703125,
64
+ "reconstruction_mismatch_ratio": 0.0
65
+ },
66
+ "up_proj.rank1": {
67
+ "apply_out_scales": true,
68
+ "calibration_rows": 2048,
69
+ "g_scale": 0.9453222201326655,
70
+ "pack_unpack_pack_equal": true,
71
+ "proxy_error": 0.004726522159240503,
72
+ "q_fallback": false,
73
+ "reconstruction_max_abs": 0.0001220703125,
74
+ "reconstruction_mismatch_ratio": 0.0
75
+ }
76
+ },
77
+ "source_index_sha256": "c872bd9b5ac116cebfd78a5f27565787dbceae76985cef041179110d0b03cd2b",
78
+ "status": "complete",
79
+ "tier": "TR3",
80
+ "tier_map_sha256": "98bb2a6cfab92807201180c1cde4447d50fc7bd991bde8f2f6a869a84e2ff45a",
81
+ "tp": 2
82
+ }
hybrid/tails/tr3/layer-26/expert-189.json ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bits": 3,
3
+ "bytes": 3584600,
4
+ "calibration_rows": 2048,
5
+ "calibration_sampling": "deterministic evenly spaced routed-row indices",
6
+ "capture_manifest_sha256": "976ba9935c2ae028117276f32bd33195862733a2b76cacb5514d3f2c2fb12a69",
7
+ "encoder_script_sha256": "30ccbf529dcab421ec904d8069a0ef33714d25408abf615ff76fccbcffae6b44",
8
+ "expert": 189,
9
+ "fallback_slices": 0,
10
+ "layer": 26,
11
+ "output": "/out/tr3/layer-26/expert-189.safetensors",
12
+ "routed_observation_rows_total": "4906",
13
+ "schema": "laguna-exl3-expert-encode/v1",
14
+ "sha256": "56da71ac7d6e37678d5d47e71c61ccbdbd7c9ec7eacc5a554a33bea54059325f",
15
+ "slices": {
16
+ "down_proj.rank0": {
17
+ "apply_out_scales": true,
18
+ "calibration_rows": 2048,
19
+ "g_scale": 0.9362772223995108,
20
+ "pack_unpack_pack_equal": true,
21
+ "proxy_error": 0.01209903249192329,
22
+ "q_fallback": false,
23
+ "reconstruction_max_abs": 0.0001220703125,
24
+ "reconstruction_mismatch_ratio": 0.0
25
+ },
26
+ "down_proj.rank1": {
27
+ "apply_out_scales": true,
28
+ "calibration_rows": 2048,
29
+ "g_scale": 0.9543672178658202,
30
+ "pack_unpack_pack_equal": true,
31
+ "proxy_error": 0.011807675405275792,
32
+ "q_fallback": false,
33
+ "reconstruction_max_abs": 0.0001220703125,
34
+ "reconstruction_mismatch_ratio": 0.0
35
+ },
36
+ "gate_proj.rank0": {
37
+ "apply_out_scales": true,
38
+ "calibration_rows": 2048,
39
+ "g_scale": 0.9362772223995108,
40
+ "pack_unpack_pack_equal": true,
41
+ "proxy_error": 0.0031502343327367882,
42
+ "q_fallback": false,
43
+ "reconstruction_max_abs": 0.0001220703125,
44
+ "reconstruction_mismatch_ratio": 0.0
45
+ },
46
+ "gate_proj.rank1": {
47
+ "apply_out_scales": true,
48
+ "calibration_rows": 2048,
49
+ "g_scale": 0.9509123361599208,
50
+ "pack_unpack_pack_equal": true,
51
+ "proxy_error": 0.003166299844559142,
52
+ "q_fallback": false,
53
+ "reconstruction_max_abs": 0.0001220703125,
54
+ "reconstruction_mismatch_ratio": 0.0
55
+ },
56
+ "up_proj.rank0": {
57
+ "apply_out_scales": true,
58
+ "calibration_rows": 2048,
59
+ "g_scale": 0.9362772223995108,
60
+ "pack_unpack_pack_equal": true,
61
+ "proxy_error": 0.004337512502993425,
62
+ "q_fallback": false,
63
+ "reconstruction_max_abs": 0.0001220703125,
64
+ "reconstruction_mismatch_ratio": 0.0
65
+ },
66
+ "up_proj.rank1": {
67
+ "apply_out_scales": true,
68
+ "calibration_rows": 2048,
69
+ "g_scale": 0.9543672178658202,
70
+ "pack_unpack_pack_equal": true,
71
+ "proxy_error": 0.004420601067241631,
72
+ "q_fallback": false,
73
+ "reconstruction_max_abs": 0.0001220703125,
74
+ "reconstruction_mismatch_ratio": 0.0
75
+ }
76
+ },
77
+ "source_index_sha256": "c872bd9b5ac116cebfd78a5f27565787dbceae76985cef041179110d0b03cd2b",
78
+ "status": "complete",
79
+ "tier": "TR3",
80
+ "tier_map_sha256": "98bb2a6cfab92807201180c1cde4447d50fc7bd991bde8f2f6a869a84e2ff45a",
81
+ "tp": 2
82
+ }
hybrid/tails/tr3/layer-26/expert-194.json ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bits": 3,
3
+ "bytes": 3584600,
4
+ "calibration_rows": 2048,
5
+ "calibration_sampling": "deterministic evenly spaced routed-row indices",
6
+ "capture_manifest_sha256": "976ba9935c2ae028117276f32bd33195862733a2b76cacb5514d3f2c2fb12a69",
7
+ "encoder_script_sha256": "30ccbf529dcab421ec904d8069a0ef33714d25408abf615ff76fccbcffae6b44",
8
+ "expert": 194,
9
+ "fallback_slices": 0,
10
+ "layer": 26,
11
+ "output": "/out/tr3/layer-26/expert-194.safetensors",
12
+ "routed_observation_rows_total": "5775",
13
+ "schema": "laguna-exl3-expert-encode/v1",
14
+ "sha256": "45adaaeb52aea1af74438bc89d43bddc79bd6f265367dd46a1cb2c88526dc8dd",
15
+ "slices": {
16
+ "down_proj.rank0": {
17
+ "apply_out_scales": true,
18
+ "calibration_rows": 2048,
19
+ "g_scale": 0.9509123361599208,
20
+ "pack_unpack_pack_equal": true,
21
+ "proxy_error": 0.012321118066526844,
22
+ "q_fallback": false,
23
+ "reconstruction_max_abs": 0.0001220703125,
24
+ "reconstruction_mismatch_ratio": 0.0
25
+ },
26
+ "down_proj.rank1": {
27
+ "apply_out_scales": true,
28
+ "calibration_rows": 2048,
29
+ "g_scale": 0.9509123361599208,
30
+ "pack_unpack_pack_equal": true,
31
+ "proxy_error": 0.012036087436401529,
32
+ "q_fallback": false,
33
+ "reconstruction_max_abs": 0.0001220703125,
34
+ "reconstruction_mismatch_ratio": 0.0
35
+ },
36
+ "gate_proj.rank0": {
37
+ "apply_out_scales": true,
38
+ "calibration_rows": 2048,
39
+ "g_scale": 0.9453222201326655,
40
+ "pack_unpack_pack_equal": true,
41
+ "proxy_error": 0.0033936758210734034,
42
+ "q_fallback": false,
43
+ "reconstruction_max_abs": 0.000244140625,
44
+ "reconstruction_mismatch_ratio": 0.0
45
+ },
46
+ "gate_proj.rank1": {
47
+ "apply_out_scales": true,
48
+ "calibration_rows": 2048,
49
+ "g_scale": 0.9397321041054103,
50
+ "pack_unpack_pack_equal": true,
51
+ "proxy_error": 0.003432042814141155,
52
+ "q_fallback": false,
53
+ "reconstruction_max_abs": 0.0001220703125,
54
+ "reconstruction_mismatch_ratio": 0.0
55
+ },
56
+ "up_proj.rank0": {
57
+ "apply_out_scales": true,
58
+ "calibration_rows": 2048,
59
+ "g_scale": 0.9509123361599208,
60
+ "pack_unpack_pack_equal": true,
61
+ "proxy_error": 0.0043342974892542395,
62
+ "q_fallback": false,
63
+ "reconstruction_max_abs": 0.0001220703125,
64
+ "reconstruction_mismatch_ratio": 0.0
65
+ },
66
+ "up_proj.rank1": {
67
+ "apply_out_scales": true,
68
+ "calibration_rows": 2048,
69
+ "g_scale": 0.9362772223995108,
70
+ "pack_unpack_pack_equal": true,
71
+ "proxy_error": 0.004325905997546744,
72
+ "q_fallback": false,
73
+ "reconstruction_max_abs": 0.000244140625,
74
+ "reconstruction_mismatch_ratio": 0.0
75
+ }
76
+ },
77
+ "source_index_sha256": "c872bd9b5ac116cebfd78a5f27565787dbceae76985cef041179110d0b03cd2b",
78
+ "status": "complete",
79
+ "tier": "TR3",
80
+ "tier_map_sha256": "98bb2a6cfab92807201180c1cde4447d50fc7bd991bde8f2f6a869a84e2ff45a",
81
+ "tp": 2
82
+ }
hybrid/tails/tr3/layer-26/expert-199.json ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bits": 3,
3
+ "bytes": 3584600,
4
+ "calibration_rows": 2048,
5
+ "calibration_sampling": "deterministic evenly spaced routed-row indices",
6
+ "capture_manifest_sha256": "976ba9935c2ae028117276f32bd33195862733a2b76cacb5514d3f2c2fb12a69",
7
+ "encoder_script_sha256": "30ccbf529dcab421ec904d8069a0ef33714d25408abf615ff76fccbcffae6b44",
8
+ "expert": 199,
9
+ "fallback_slices": 0,
10
+ "layer": 26,
11
+ "output": "/out/tr3/layer-26/expert-199.safetensors",
12
+ "routed_observation_rows_total": "2450",
13
+ "schema": "laguna-exl3-expert-encode/v1",
14
+ "sha256": "6bad28e33150695c328c9c1c3d024e24fd4114bcc0199d0c4795bcb739909e0b",
15
+ "slices": {
16
+ "down_proj.rank0": {
17
+ "apply_out_scales": true,
18
+ "calibration_rows": 2048,
19
+ "g_scale": 0.9453222201326655,
20
+ "pack_unpack_pack_equal": true,
21
+ "proxy_error": 0.012850600932133565,
22
+ "q_fallback": false,
23
+ "reconstruction_max_abs": 0.0001220703125,
24
+ "reconstruction_mismatch_ratio": 0.0
25
+ },
26
+ "down_proj.rank1": {
27
+ "apply_out_scales": true,
28
+ "calibration_rows": 2048,
29
+ "g_scale": 0.9362772223995108,
30
+ "pack_unpack_pack_equal": true,
31
+ "proxy_error": 0.012772774469988304,
32
+ "q_fallback": false,
33
+ "reconstruction_max_abs": 0.0001220703125,
34
+ "reconstruction_mismatch_ratio": 0.0
35
+ },
36
+ "gate_proj.rank0": {
37
+ "apply_out_scales": true,
38
+ "calibration_rows": 2048,
39
+ "g_scale": 0.9509123361599208,
40
+ "pack_unpack_pack_equal": true,
41
+ "proxy_error": 0.0035834865980615555,
42
+ "q_fallback": false,
43
+ "reconstruction_max_abs": 0.000244140625,
44
+ "reconstruction_mismatch_ratio": 0.0
45
+ },
46
+ "gate_proj.rank1": {
47
+ "apply_out_scales": true,
48
+ "calibration_rows": 2048,
49
+ "g_scale": 0.9250969903450001,
50
+ "pack_unpack_pack_equal": true,
51
+ "proxy_error": 0.0035417390848722875,
52
+ "q_fallback": false,
53
+ "reconstruction_max_abs": 0.0001220703125,
54
+ "reconstruction_mismatch_ratio": 0.0
55
+ },
56
+ "up_proj.rank0": {
57
+ "apply_out_scales": true,
58
+ "calibration_rows": 2048,
59
+ "g_scale": 0.9453222201326655,
60
+ "pack_unpack_pack_equal": true,
61
+ "proxy_error": 0.00398742502383989,
62
+ "q_fallback": false,
63
+ "reconstruction_max_abs": 0.0001220703125,
64
+ "reconstruction_mismatch_ratio": 0.0
65
+ },
66
+ "up_proj.rank1": {
67
+ "apply_out_scales": true,
68
+ "calibration_rows": 2048,
69
+ "g_scale": 0.9543672178658202,
70
+ "pack_unpack_pack_equal": true,
71
+ "proxy_error": 0.003993167261212206,
72
+ "q_fallback": false,
73
+ "reconstruction_max_abs": 0.0001220703125,
74
+ "reconstruction_mismatch_ratio": 0.0
75
+ }
76
+ },
77
+ "source_index_sha256": "c872bd9b5ac116cebfd78a5f27565787dbceae76985cef041179110d0b03cd2b",
78
+ "status": "complete",
79
+ "tier": "TR3",
80
+ "tier_map_sha256": "98bb2a6cfab92807201180c1cde4447d50fc7bd991bde8f2f6a869a84e2ff45a",
81
+ "tp": 2
82
+ }
hybrid/tails/tr3/layer-26/expert-204.json ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bits": 3,
3
+ "bytes": 3584600,
4
+ "calibration_rows": 2048,
5
+ "calibration_sampling": "deterministic evenly spaced routed-row indices",
6
+ "capture_manifest_sha256": "976ba9935c2ae028117276f32bd33195862733a2b76cacb5514d3f2c2fb12a69",
7
+ "encoder_script_sha256": "30ccbf529dcab421ec904d8069a0ef33714d25408abf615ff76fccbcffae6b44",
8
+ "expert": 204,
9
+ "fallback_slices": 0,
10
+ "layer": 26,
11
+ "output": "/out/tr3/layer-26/expert-204.safetensors",
12
+ "routed_observation_rows_total": "8520",
13
+ "schema": "laguna-exl3-expert-encode/v1",
14
+ "sha256": "0088b2f2c45b6db2617225395f62ce527133cd0ade9bcb1f2d923189929a6874",
15
+ "slices": {
16
+ "down_proj.rank0": {
17
+ "apply_out_scales": true,
18
+ "calibration_rows": 2048,
19
+ "g_scale": 0.9397321041054102,
20
+ "pack_unpack_pack_equal": true,
21
+ "proxy_error": 0.011788392009966795,
22
+ "q_fallback": false,
23
+ "reconstruction_max_abs": 0.0001220703125,
24
+ "reconstruction_mismatch_ratio": 0.0
25
+ },
26
+ "down_proj.rank1": {
27
+ "apply_out_scales": true,
28
+ "calibration_rows": 2048,
29
+ "g_scale": 0.9509123361599208,
30
+ "pack_unpack_pack_equal": true,
31
+ "proxy_error": 0.01147542452937945,
32
+ "q_fallback": false,
33
+ "reconstruction_max_abs": 0.000244140625,
34
+ "reconstruction_mismatch_ratio": 0.0
35
+ },
36
+ "gate_proj.rank0": {
37
+ "apply_out_scales": true,
38
+ "calibration_rows": 2048,
39
+ "g_scale": 0.9509123361599208,
40
+ "pack_unpack_pack_equal": true,
41
+ "proxy_error": 0.002699792380161709,
42
+ "q_fallback": false,
43
+ "reconstruction_max_abs": 0.000244140625,
44
+ "reconstruction_mismatch_ratio": 0.0
45
+ },
46
+ "gate_proj.rank1": {
47
+ "apply_out_scales": true,
48
+ "calibration_rows": 2048,
49
+ "g_scale": 0.9509123361599208,
50
+ "pack_unpack_pack_equal": true,
51
+ "proxy_error": 0.002669911977152665,
52
+ "q_fallback": false,
53
+ "reconstruction_max_abs": 0.000244140625,
54
+ "reconstruction_mismatch_ratio": 0.0
55
+ },
56
+ "up_proj.rank0": {
57
+ "apply_out_scales": true,
58
+ "calibration_rows": 2048,
59
+ "g_scale": 0.9397321041054102,
60
+ "pack_unpack_pack_equal": true,
61
+ "proxy_error": 0.004358584819215757,
62
+ "q_fallback": false,
63
+ "reconstruction_max_abs": 0.0001220703125,
64
+ "reconstruction_mismatch_ratio": 0.0
65
+ },
66
+ "up_proj.rank1": {
67
+ "apply_out_scales": true,
68
+ "calibration_rows": 2048,
69
+ "g_scale": 0.9453222201326655,
70
+ "pack_unpack_pack_equal": true,
71
+ "proxy_error": 0.004334854962648009,
72
+ "q_fallback": false,
73
+ "reconstruction_max_abs": 0.000244140625,
74
+ "reconstruction_mismatch_ratio": 0.0
75
+ }
76
+ },
77
+ "source_index_sha256": "c872bd9b5ac116cebfd78a5f27565787dbceae76985cef041179110d0b03cd2b",
78
+ "status": "complete",
79
+ "tier": "TR3",
80
+ "tier_map_sha256": "98bb2a6cfab92807201180c1cde4447d50fc7bd991bde8f2f6a869a84e2ff45a",
81
+ "tp": 2
82
+ }
hybrid/tails/tr3/layer-26/expert-206.json ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bits": 3,
3
+ "bytes": 3584600,
4
+ "calibration_rows": 2048,
5
+ "calibration_sampling": "deterministic evenly spaced routed-row indices",
6
+ "capture_manifest_sha256": "976ba9935c2ae028117276f32bd33195862733a2b76cacb5514d3f2c2fb12a69",
7
+ "encoder_script_sha256": "30ccbf529dcab421ec904d8069a0ef33714d25408abf615ff76fccbcffae6b44",
8
+ "expert": 206,
9
+ "fallback_slices": 0,
10
+ "layer": 26,
11
+ "output": "/out/tr3/layer-26/expert-206.safetensors",
12
+ "routed_observation_rows_total": "7293",
13
+ "schema": "laguna-exl3-expert-encode/v1",
14
+ "sha256": "78a2af944a45683ad8fef5de60949309edbff588a64c3b4059aa64260dd16a99",
15
+ "slices": {
16
+ "down_proj.rank0": {
17
+ "apply_out_scales": true,
18
+ "calibration_rows": 2048,
19
+ "g_scale": 0.9453222201326655,
20
+ "pack_unpack_pack_equal": true,
21
+ "proxy_error": 0.009819756574190895,
22
+ "q_fallback": false,
23
+ "reconstruction_max_abs": 0.0001220703125,
24
+ "reconstruction_mismatch_ratio": 0.0
25
+ },
26
+ "down_proj.rank1": {
27
+ "apply_out_scales": true,
28
+ "calibration_rows": 2048,
29
+ "g_scale": 0.9453222201326655,
30
+ "pack_unpack_pack_equal": true,
31
+ "proxy_error": 0.009307429208444613,
32
+ "q_fallback": false,
33
+ "reconstruction_max_abs": 0.0001220703125,
34
+ "reconstruction_mismatch_ratio": 0.0
35
+ },
36
+ "gate_proj.rank0": {
37
+ "apply_out_scales": true,
38
+ "calibration_rows": 2048,
39
+ "g_scale": 0.9509123361599208,
40
+ "pack_unpack_pack_equal": true,
41
+ "proxy_error": 0.00334784260019728,
42
+ "q_fallback": false,
43
+ "reconstruction_max_abs": 0.0001220703125,
44
+ "reconstruction_mismatch_ratio": 0.0
45
+ },
46
+ "gate_proj.rank1": {
47
+ "apply_out_scales": true,
48
+ "calibration_rows": 2048,
49
+ "g_scale": 0.9453222201326655,
50
+ "pack_unpack_pack_equal": true,
51
+ "proxy_error": 0.0033013031938355646,
52
+ "q_fallback": false,
53
+ "reconstruction_max_abs": 0.0001220703125,
54
+ "reconstruction_mismatch_ratio": 0.0
55
+ },
56
+ "up_proj.rank0": {
57
+ "apply_out_scales": true,
58
+ "calibration_rows": 2048,
59
+ "g_scale": 0.9509123361599208,
60
+ "pack_unpack_pack_equal": true,
61
+ "proxy_error": 0.004271086510602213,
62
+ "q_fallback": false,
63
+ "reconstruction_max_abs": 0.0001220703125,
64
+ "reconstruction_mismatch_ratio": 0.0
65
+ },
66
+ "up_proj.rank1": {
67
+ "apply_out_scales": true,
68
+ "calibration_rows": 2048,
69
+ "g_scale": 0.9397321041054102,
70
+ "pack_unpack_pack_equal": true,
71
+ "proxy_error": 0.004335320221539458,
72
+ "q_fallback": false,
73
+ "reconstruction_max_abs": 0.0001220703125,
74
+ "reconstruction_mismatch_ratio": 0.0
75
+ }
76
+ },
77
+ "source_index_sha256": "c872bd9b5ac116cebfd78a5f27565787dbceae76985cef041179110d0b03cd2b",
78
+ "status": "complete",
79
+ "tier": "TR3",
80
+ "tier_map_sha256": "98bb2a6cfab92807201180c1cde4447d50fc7bd991bde8f2f6a869a84e2ff45a",
81
+ "tp": 2
82
+ }
hybrid/tier-map.json ADDED
The diff for this file is too large to render. See raw diff
 
model.safetensors.index.json ADDED
The diff for this file is too large to render. See raw diff
 
modeling_laguna.py ADDED
@@ -0,0 +1,886 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ruff: noqa
2
+ # Copyright 2025 Poolside and the HuggingFace Inc. team. All rights reserved.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ from collections.abc import Callable
17
+
18
+ import torch
19
+ import torch.nn.functional as F
20
+ from torch import nn
21
+
22
+ from transformers.activations import ACT2FN
23
+ from transformers.cache_utils import Cache
24
+ from transformers.integrations import use_experts_implementation, use_kernelized_func
25
+ from transformers.modeling_flash_attention_utils import FlashAttentionKwargs
26
+ from transformers.modeling_layers import GradientCheckpointingLayer
27
+ from transformers.modeling_outputs import MoeModelOutputWithPast
28
+ from transformers.modeling_utils import ALL_ATTENTION_FUNCTIONS
29
+ from transformers.processing_utils import Unpack
30
+ from transformers.utils import auto_docstring, can_return_tuple, is_grouped_mm_available
31
+ from transformers.utils.generic import TransformersKwargs, merge_with_config_defaults
32
+ from transformers.utils.output_capturing import OutputRecorder, capture_outputs
33
+ from transformers.cache_utils import DynamicCache
34
+ from transformers.generation import GenerationMixin
35
+ from transformers.integrations import use_kernel_forward_from_hub
36
+ from transformers.masking_utils import create_causal_mask
37
+ from transformers.modeling_rope_utils import ROPE_INIT_FUNCTIONS, dynamic_rope_update
38
+ from transformers.modeling_utils import PreTrainedModel
39
+ from transformers.utils.generic import maybe_autocast
40
+ from .configuration_laguna import LagunaConfig
41
+
42
+ from transformers import initialization as init
43
+ from transformers.masking_utils import create_sliding_window_causal_mask
44
+ from transformers.modeling_outputs import MoeCausalLMOutputWithPast
45
+ from transformers.utils.import_utils import is_causal_conv1d_available, is_flash_linear_attention_available
46
+
47
+
48
+ @use_kernel_forward_from_hub("RMSNorm")
49
+ class LagunaRMSNorm(nn.Module):
50
+ def __init__(self, hidden_size, eps: float = 1e-6) -> None:
51
+ """
52
+ LagunaRMSNorm is equivalent to T5LayerNorm
53
+ """
54
+ super().__init__()
55
+ self.weight = nn.Parameter(torch.ones(hidden_size))
56
+ self.variance_epsilon = eps
57
+
58
+ def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
59
+ input_dtype = hidden_states.dtype
60
+ hidden_states = hidden_states.to(torch.float32)
61
+ variance = hidden_states.pow(2).mean(-1, keepdim=True)
62
+ hidden_states = hidden_states * torch.rsqrt(variance + self.variance_epsilon)
63
+ return self.weight * hidden_states.to(input_dtype)
64
+
65
+ def extra_repr(self):
66
+ return f"{tuple(self.weight.shape)}, eps={self.variance_epsilon}"
67
+
68
+
69
+ class LagunaRotaryEmbedding(nn.Module):
70
+ inv_freq: torch.Tensor # fix linting for `register_buffer`
71
+
72
+ def __init__(self, config: LagunaConfig, device=None):
73
+ super().__init__()
74
+ self.max_seq_len_cached = config.max_position_embeddings
75
+ self.original_max_seq_len = config.max_position_embeddings
76
+
77
+ self.config = config
78
+
79
+ self.rope_type = self.config.rope_parameters["rope_type"]
80
+ rope_init_fn: Callable = self.compute_default_rope_parameters
81
+ if self.rope_type != "default":
82
+ rope_init_fn = ROPE_INIT_FUNCTIONS[self.rope_type]
83
+ inv_freq, self.attention_scaling = rope_init_fn(self.config, device)
84
+
85
+ self.register_buffer("inv_freq", inv_freq, persistent=False)
86
+ self.register_buffer("original_inv_freq", inv_freq.clone(), persistent=False)
87
+
88
+ @staticmethod
89
+ def compute_default_rope_parameters(config, device=None, seq_len=None) -> tuple["torch.Tensor", float]:
90
+ """
91
+ Computes the inverse frequencies according to the original RoPE implementation
92
+ Args:
93
+ config ([`~transformers.PreTrainedConfig`]):
94
+ The model configuration.
95
+ device (`torch.device`):
96
+ The device to use for initialization of the inverse frequencies.
97
+ seq_len (`int`, *optional*):
98
+ The current sequence length. Unused for this type of RoPE.
99
+ Returns:
100
+ Tuple of (`torch.Tensor`, `float`), containing the inverse frequencies for the RoPE embeddings and the
101
+ post-processing scaling factor applied to the computed cos/sin (unused in this type of RoPE).
102
+ """
103
+ base = config.rope_parameters["rope_theta"]
104
+ head_dim = getattr(config, "head_dim", None) or config.hidden_size // config.num_attention_heads
105
+ partial = config.rope_parameters.get("partial_rotary_factor", 1.0)
106
+ dim = int(head_dim * partial)
107
+ inv_freq = 1.0 / (
108
+ base ** (torch.arange(0, dim, 2, dtype=torch.int64).to(device=device, dtype=torch.float) / dim)
109
+ )
110
+ return inv_freq, 1.0
111
+
112
+ @torch.no_grad()
113
+ @dynamic_rope_update # power user: used with advanced RoPE types (e.g. dynamic rope)
114
+ def forward(self, x, position_ids):
115
+ inv_freq_expanded = self.inv_freq[None, :, None].float().expand(position_ids.shape[0], -1, 1).to(x.device)
116
+ position_ids_expanded = position_ids[:, None, :].float()
117
+
118
+ device_type = x.device.type if isinstance(x.device.type, str) and x.device.type != "mps" else "cpu"
119
+ with maybe_autocast(device_type=device_type, enabled=False): # Force float32
120
+ freqs = (inv_freq_expanded.float() @ position_ids_expanded.float()).transpose(1, 2)
121
+ emb = torch.cat((freqs, freqs), dim=-1)
122
+ cos = emb.cos() * self.attention_scaling
123
+ sin = emb.sin() * self.attention_scaling
124
+
125
+ return cos.to(dtype=x.dtype), sin.to(dtype=x.dtype)
126
+
127
+
128
+ class LagunaMLP(nn.Module):
129
+ def __init__(self, config, intermediate_size=None):
130
+ super().__init__()
131
+ self.config = config
132
+ self.hidden_size = config.hidden_size
133
+ self.intermediate_size = config.intermediate_size if intermediate_size is None else intermediate_size
134
+ self.gate_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=False)
135
+ self.up_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=False)
136
+ self.down_proj = nn.Linear(self.intermediate_size, self.hidden_size, bias=False)
137
+ self.act_fn = ACT2FN[config.hidden_act]
138
+
139
+ def forward(self, x):
140
+ down_proj = self.down_proj(self.act_fn(self.gate_proj(x)) * self.up_proj(x))
141
+ return down_proj
142
+
143
+
144
+ class LagunaTopKRouter(nn.Module):
145
+ """Laguna MoE router using sigmoid scoring (not softmax).
146
+
147
+ Supports optional router-logit soft-capping and auxiliary-loss-free load
148
+ balancing (arXiv:2408.15664): the per-expert bias ``e_score_correction_bias``
149
+ is added to selection scores but the returned routing weights remain unbiased.
150
+ The bias lives on the router so accelerate's per-module hooks can co-locate it
151
+ with the gate — moving it to the experts module would cross a hook boundary
152
+ and leave the bias on meta under ``device_map="auto"`` / CPU-offload.
153
+ """
154
+
155
+ def __init__(self, config):
156
+ super().__init__()
157
+ self.top_k = config.num_experts_per_tok
158
+ self.num_experts = config.num_experts
159
+ self.norm_topk_prob = config.norm_topk_prob
160
+ self.hidden_dim = config.hidden_size
161
+ self.weight = nn.Parameter(torch.zeros(self.num_experts, self.hidden_dim))
162
+ # Zero-initialised so inference on checkpoints that don't ship the bias
163
+ # is a no-op. ``_checkpoint_conversion_mapping`` below remaps the
164
+ # ``mlp.experts.e_score_correction_bias`` key from vLLM-trained
165
+ # checkpoints onto this attribute.
166
+ self.e_score_correction_bias = nn.Parameter(torch.zeros(config.num_experts), requires_grad=False)
167
+ self.router_logit_softcapping = float(getattr(config, "moe_router_logit_softcapping", 0.0) or 0.0)
168
+
169
+ def forward(
170
+ self,
171
+ hidden_states: torch.Tensor,
172
+ ) -> tuple[torch.Tensor, torch.Tensor, torch.Tensor]:
173
+ hidden_states = hidden_states.reshape(-1, self.hidden_dim)
174
+ router_logits = F.linear(hidden_states, self.weight).float()
175
+ if self.router_logit_softcapping > 0.0:
176
+ router_logits = torch.tanh(router_logits / self.router_logit_softcapping) * self.router_logit_softcapping
177
+ routing_scores = torch.sigmoid(router_logits)
178
+ scores_for_selection = routing_scores + self.e_score_correction_bias.to(routing_scores.dtype)
179
+ _, selected_experts = torch.topk(scores_for_selection, self.top_k, dim=-1)
180
+ routing_weights = routing_scores.gather(-1, selected_experts)
181
+ if self.norm_topk_prob:
182
+ routing_weights = routing_weights / routing_weights.sum(dim=-1, keepdim=True)
183
+ routing_weights = routing_weights.to(hidden_states.dtype)
184
+ return router_logits, routing_weights, selected_experts
185
+
186
+
187
+ @use_experts_implementation
188
+ class LagunaExperts(nn.Module):
189
+ """Fused expert weights as 3D tensors for batched execution."""
190
+
191
+ def __init__(self, config):
192
+ super().__init__()
193
+ self.num_experts = config.num_experts
194
+ self.hidden_dim = config.hidden_size
195
+ self.intermediate_dim = config.moe_intermediate_size
196
+ self.gate_up_proj = nn.Parameter(torch.empty(self.num_experts, 2 * self.intermediate_dim, self.hidden_dim))
197
+ self.down_proj = nn.Parameter(torch.empty(self.num_experts, self.hidden_dim, self.intermediate_dim))
198
+ self.act_fn = ACT2FN[config.hidden_act]
199
+
200
+ def forward(
201
+ self,
202
+ hidden_states: torch.Tensor,
203
+ top_k_index: torch.Tensor,
204
+ top_k_weights: torch.Tensor,
205
+ ) -> torch.Tensor:
206
+ final_hidden_states = torch.zeros_like(hidden_states)
207
+ with torch.no_grad():
208
+ expert_mask = F.one_hot(top_k_index, num_classes=self.num_experts)
209
+ expert_mask = expert_mask.permute(2, 1, 0)
210
+ expert_hit = torch.greater(expert_mask.sum(dim=(-1, -2)), 0).nonzero()
211
+
212
+ for expert_idx in expert_hit:
213
+ expert_idx = expert_idx[0]
214
+ if expert_idx == self.num_experts:
215
+ continue
216
+ top_k_pos, token_idx = torch.where(expert_mask[expert_idx])
217
+ current_state = hidden_states[token_idx]
218
+ gate, up = F.linear(current_state, self.gate_up_proj[expert_idx]).chunk(2, dim=-1)
219
+ current_hidden_states = self.act_fn(gate) * up
220
+ current_hidden_states = F.linear(current_hidden_states, self.down_proj[expert_idx])
221
+ current_hidden_states = current_hidden_states * top_k_weights[token_idx, top_k_pos, None]
222
+ final_hidden_states.index_add_(0, token_idx, current_hidden_states.to(final_hidden_states.dtype))
223
+
224
+ return final_hidden_states
225
+
226
+
227
+ class LagunaSparseMoeBlock(nn.Module):
228
+ """Laguna MoE block using sigmoid router, fused expert tensors, and a shared expert."""
229
+
230
+ def __init__(self, config):
231
+ super().__init__()
232
+ self.num_experts = config.num_experts
233
+ self.routed_scaling_factor = float(getattr(config, "moe_routed_scaling_factor", 1.0))
234
+ # ``moe_apply_router_weight_on_input=True`` would require scaling each expert's
235
+ # input (rather than its output) by the routing weight. Supporting it cleanly
236
+ # alongside the fused experts kernels (``grouped_mm`` / ``batched_mm``) is future
237
+ # work; for now we fail loudly so a checkpoint that needs it can't silently
238
+ # diverge from its numerical form.
239
+ if getattr(config, "moe_apply_router_weight_on_input", False):
240
+ raise NotImplementedError(
241
+ "moe_apply_router_weight_on_input=True is not yet supported in the "
242
+ "transformers implementation of Laguna."
243
+ )
244
+ self.gate = LagunaTopKRouter(config)
245
+ self.experts = LagunaExperts(config)
246
+ self.shared_expert = LagunaMLP(config, intermediate_size=config.shared_expert_intermediate_size)
247
+
248
+ def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
249
+ batch_size, sequence_length, hidden_dim = hidden_states.shape
250
+ hidden_states = hidden_states.view(-1, hidden_dim)
251
+
252
+ shared_expert_output = self.shared_expert(hidden_states)
253
+ _, routing_weights, selected_experts = self.gate(hidden_states)
254
+ expert_output = self.experts(hidden_states, selected_experts, routing_weights)
255
+ if self.routed_scaling_factor != 1.0:
256
+ expert_output = expert_output * self.routed_scaling_factor
257
+
258
+ expert_output = expert_output + shared_expert_output
259
+ expert_output = expert_output.reshape(batch_size, sequence_length, hidden_dim)
260
+ return expert_output
261
+
262
+
263
+ def rotate_half(x):
264
+ """Rotates half the hidden dims of the input."""
265
+ x1 = x[..., : x.shape[-1] // 2]
266
+ x2 = x[..., x.shape[-1] // 2 :]
267
+ return torch.cat((-x2, x1), dim=-1)
268
+
269
+
270
+ # Adapted from transformers.models.glm.modular_glm.apply_rotary_pos_emb
271
+ def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1):
272
+ """Applies Rotary Position Embedding to the query and key tensors.
273
+
274
+ Removes the interleaving of cos and sin from GLM
275
+
276
+ Args:
277
+ q (`torch.Tensor`): The query tensor.
278
+ k (`torch.Tensor`): The key tensor.
279
+ cos (`torch.Tensor`): The cosine part of the rotary embedding.
280
+ sin (`torch.Tensor`): The sine part of the rotary embedding.
281
+ unsqueeze_dim (`int`, *optional*, defaults to 1):
282
+ The 'unsqueeze_dim' argument specifies the dimension along which to unsqueeze cos[position_ids] and
283
+ sin[position_ids] so that they can be properly broadcasted to the dimensions of q and k. For example, note
284
+ that cos[position_ids] and sin[position_ids] have the shape [batch_size, seq_len, head_dim]. Then, if q and
285
+ k have the shape [batch_size, heads, seq_len, head_dim], then setting unsqueeze_dim=1 makes
286
+ cos[position_ids] and sin[position_ids] broadcastable to the shapes of q and k. Similarly, if q and k have
287
+ the shape [batch_size, seq_len, heads, head_dim], then set unsqueeze_dim=2.
288
+ Returns:
289
+ `tuple(torch.Tensor)` comprising of the query and key tensors rotated using the Rotary Position Embedding.
290
+ """
291
+ cos = cos.unsqueeze(unsqueeze_dim)
292
+ sin = sin.unsqueeze(unsqueeze_dim)
293
+
294
+ # Keep half or full tensor for later concatenation
295
+ rotary_dim = cos.shape[-1]
296
+ q_rot, q_pass = q[..., :rotary_dim], q[..., rotary_dim:]
297
+ k_rot, k_pass = k[..., :rotary_dim], k[..., rotary_dim:]
298
+
299
+ # Apply rotary embeddings on the first half or full tensor
300
+ q_embed = (q_rot * cos) + (rotate_half(q_rot) * sin)
301
+ k_embed = (k_rot * cos) + (rotate_half(k_rot) * sin)
302
+
303
+ # Concatenate back to full shape
304
+ q_embed = torch.cat([q_embed, q_pass], dim=-1)
305
+ k_embed = torch.cat([k_embed, k_pass], dim=-1)
306
+ return q_embed, k_embed
307
+
308
+
309
+ def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor:
310
+ """
311
+ This is the equivalent of torch.repeat_interleave(x, dim=1, repeats=n_rep). The hidden states go from (batch,
312
+ num_key_value_heads, seqlen, head_dim) to (batch, num_attention_heads, seqlen, head_dim)
313
+ """
314
+ batch, num_key_value_heads, slen, head_dim = hidden_states.shape
315
+ if n_rep == 1:
316
+ return hidden_states
317
+ hidden_states = hidden_states[:, :, None, :, :].expand(batch, num_key_value_heads, n_rep, slen, head_dim)
318
+ return hidden_states.reshape(batch, num_key_value_heads * n_rep, slen, head_dim)
319
+
320
+
321
+ def eager_attention_forward(
322
+ module: nn.Module,
323
+ query: torch.Tensor,
324
+ key: torch.Tensor,
325
+ value: torch.Tensor,
326
+ attention_mask: torch.Tensor | None,
327
+ scaling: float,
328
+ dropout: float = 0.0,
329
+ **kwargs: Unpack[TransformersKwargs],
330
+ ):
331
+ key_states = repeat_kv(key, module.num_key_value_groups)
332
+ value_states = repeat_kv(value, module.num_key_value_groups)
333
+
334
+ attn_weights = torch.matmul(query, key_states.transpose(2, 3)) * scaling
335
+ if attention_mask is not None:
336
+ attn_weights = attn_weights + attention_mask
337
+
338
+ attn_weights = nn.functional.softmax(attn_weights, dim=-1, dtype=torch.float32).to(query.dtype)
339
+ attn_weights = nn.functional.dropout(attn_weights, p=dropout, training=module.training)
340
+ attn_output = torch.matmul(attn_weights, value_states)
341
+ attn_output = attn_output.transpose(1, 2).contiguous()
342
+
343
+ return attn_output, attn_weights
344
+
345
+
346
+ # Laguna attention is identical to Qwen2MoE attention except:
347
+ # - No QKV bias
348
+ # - Explicit head_dim from config
349
+ # - Output gating: attn_output = attn_output * softplus(g_proj(hidden_states)) (optional)
350
+ # - Per-layer sliding window attention with optional attention sinks
351
+ @use_kernelized_func(apply_rotary_pos_emb)
352
+ class LagunaAttention(nn.Module):
353
+ def __init__(self, config: LagunaConfig, layer_idx: int, num_heads: int | None = None):
354
+ super().__init__()
355
+ self.config = config
356
+ self.layer_idx = layer_idx
357
+ self.head_dim = config.head_dim
358
+ # Allow the caller (decoder layer) to supply a per-layer head count; fall back
359
+ # to config.num_attention_heads when not provided.
360
+ self.num_heads = num_heads if num_heads is not None else config.num_attention_heads
361
+ self.num_key_value_groups = self.num_heads // config.num_key_value_heads
362
+ self.scaling = self.head_dim**-0.5
363
+ self.attention_dropout = config.attention_dropout
364
+ self.is_causal = True
365
+
366
+ # Per-layer sliding window (follows Gemma2/Cohere2 convention)
367
+ layer_types = getattr(config, "layer_types", None)
368
+ if layer_types is not None:
369
+ self.is_sliding = layer_types[layer_idx] == "sliding_attention"
370
+ self.sliding_window = config.sliding_window if self.is_sliding else None
371
+ else:
372
+ self.is_sliding = False
373
+ self.sliding_window = None
374
+
375
+ # Laguna: no QKV bias, explicit head_dim
376
+ self.q_proj = nn.Linear(config.hidden_size, self.num_heads * config.head_dim, bias=False)
377
+ self.k_proj = nn.Linear(config.hidden_size, config.num_key_value_heads * config.head_dim, bias=False)
378
+ self.v_proj = nn.Linear(config.hidden_size, config.num_key_value_heads * config.head_dim, bias=False)
379
+ self.o_proj = nn.Linear(self.num_heads * config.head_dim, config.hidden_size, bias=False)
380
+
381
+ # Laguna-specific: optional gating projection.
382
+ # ``gating`` may be:
383
+ # - True / "per-element": one gate per (head, head_dim) channel
384
+ # - "per-head": one gate per head, broadcast across head_dim
385
+ # - False: no gating
386
+ gating = getattr(config, "gating", True)
387
+ self.gating = bool(gating)
388
+ self.gate_per_head = gating == "per-head"
389
+ if self.gating:
390
+ g_out = self.num_heads if self.gate_per_head else self.num_heads * config.head_dim
391
+ self.g_proj = nn.Linear(config.hidden_size, g_out, bias=False)
392
+
393
+ # Attention sinks (learnable per-head bias for SWA layers)
394
+ if self.is_sliding and getattr(config, "swa_attention_sink_enabled", False):
395
+ self.sink = nn.Parameter(torch.zeros(self.num_heads))
396
+
397
+ # QK normalization (RMSNorm applied per-head after reshape, before RoPE)
398
+ self.q_norm = LagunaRMSNorm(config.head_dim, eps=config.rms_norm_eps)
399
+ self.k_norm = LagunaRMSNorm(config.head_dim, eps=config.rms_norm_eps)
400
+
401
+ def forward(
402
+ self,
403
+ hidden_states: torch.Tensor,
404
+ position_embeddings: tuple[torch.Tensor, torch.Tensor],
405
+ attention_mask: torch.Tensor | None,
406
+ past_key_values: Cache | None = None,
407
+ **kwargs: Unpack[FlashAttentionKwargs],
408
+ ) -> tuple[torch.Tensor, torch.Tensor | None]:
409
+ input_shape = hidden_states.shape[:-1]
410
+ hidden_shape = (*input_shape, -1, self.head_dim)
411
+
412
+ query_states = self.q_proj(hidden_states)
413
+ key_states = self.k_proj(hidden_states)
414
+ value_states = self.v_proj(hidden_states)
415
+
416
+ query_states = query_states.view(hidden_shape).transpose(1, 2)
417
+ key_states = key_states.view(hidden_shape).transpose(1, 2)
418
+ value_states = value_states.view(hidden_shape).transpose(1, 2)
419
+
420
+ # QK normalization (applied per-head before RoPE)
421
+ query_states = self.q_norm(query_states)
422
+ key_states = self.k_norm(key_states)
423
+
424
+ cos, sin = position_embeddings
425
+ query_states, key_states = apply_rotary_pos_emb(query_states, key_states, cos, sin)
426
+
427
+ if past_key_values is not None:
428
+ key_states, value_states = past_key_values.update(key_states, value_states, self.layer_idx)
429
+
430
+ # ``attention_mask`` here is already the correct mask for this layer type —
431
+ # ``LagunaModel.forward`` builds separate full-attention and sliding-attention
432
+ # masks (using ``create_causal_mask`` / ``create_sliding_window_causal_mask``)
433
+ # and the decoder layer passes the right one in.
434
+ attention_interface: Callable = eager_attention_forward
435
+ if self.config._attn_implementation != "eager":
436
+ attention_interface = ALL_ATTENTION_FUNCTIONS[self.config._attn_implementation]
437
+
438
+ attn_output, attn_weights = attention_interface(
439
+ self,
440
+ query_states,
441
+ key_states,
442
+ value_states,
443
+ attention_mask,
444
+ dropout=0.0 if not self.training else self.attention_dropout,
445
+ scaling=self.scaling,
446
+ **kwargs,
447
+ )
448
+
449
+ attn_output = attn_output.reshape(*input_shape, -1).contiguous()
450
+
451
+ # Laguna-specific: apply gating BEFORE o_proj (optional)
452
+ if self.gating:
453
+ gate = F.softplus(self.g_proj(hidden_states).float()).to(attn_output.dtype)
454
+ if self.gate_per_head:
455
+ # gate: [..., num_heads]; broadcast across head_dim
456
+ attn_shape = attn_output.shape
457
+ attn_output = (
458
+ attn_output.view(*attn_shape[:-1], self.num_heads, self.head_dim) * gate.unsqueeze(-1)
459
+ ).view(attn_shape)
460
+ else:
461
+ attn_output = attn_output * gate
462
+
463
+ attn_output = self.o_proj(attn_output)
464
+
465
+ return attn_output, attn_weights
466
+
467
+
468
+ class LagunaDecoderLayer(GradientCheckpointingLayer):
469
+ """Laguna decoder layer with gated attention and sigmoid-routed MoE."""
470
+
471
+ def __init__(self, config: LagunaConfig, layer_idx: int):
472
+ super().__init__()
473
+ per_layer_heads = getattr(config, "num_attention_heads_per_layer", None)
474
+ layer_num_heads = per_layer_heads[layer_idx] if per_layer_heads is not None else config.num_attention_heads
475
+ # Layer type drives mask and position-embedding dispatch in ``LagunaModel.forward``.
476
+ layer_types = getattr(config, "layer_types", None)
477
+ self.attention_type = layer_types[layer_idx] if layer_types is not None else "full_attention"
478
+ self.self_attn = LagunaAttention(config, layer_idx, num_heads=layer_num_heads)
479
+ # Use MoE or dense MLP based on layer configuration
480
+ if (layer_idx not in config.mlp_only_layers) and (
481
+ config.num_experts > 0 and (layer_idx + 1) % config.decoder_sparse_step == 0
482
+ ):
483
+ self.mlp = LagunaSparseMoeBlock(config)
484
+ else:
485
+ self.mlp = LagunaMLP(config, intermediate_size=config.intermediate_size)
486
+ self.input_layernorm = LagunaRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
487
+ self.post_attention_layernorm = LagunaRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
488
+ self.hidden_size = config.hidden_size
489
+
490
+ def forward(
491
+ self,
492
+ hidden_states: torch.Tensor,
493
+ attention_mask: torch.Tensor | None = None,
494
+ position_ids: torch.LongTensor | None = None,
495
+ past_key_values: Cache | None = None,
496
+ use_cache: bool | None = False,
497
+ position_embeddings: tuple[torch.Tensor, torch.Tensor] | None = None,
498
+ **kwargs: Unpack[TransformersKwargs],
499
+ ) -> torch.Tensor:
500
+ residual = hidden_states
501
+ hidden_states = self.input_layernorm(hidden_states)
502
+ # Self Attention
503
+ hidden_states, _ = self.self_attn(
504
+ hidden_states=hidden_states,
505
+ attention_mask=attention_mask,
506
+ position_ids=position_ids,
507
+ past_key_values=past_key_values,
508
+ use_cache=use_cache,
509
+ position_embeddings=position_embeddings,
510
+ **kwargs,
511
+ )
512
+ hidden_states = residual + hidden_states
513
+
514
+ # Fully Connected
515
+ residual = hidden_states
516
+ hidden_states = self.post_attention_layernorm(hidden_states)
517
+ hidden_states = self.mlp(hidden_states)
518
+ hidden_states = residual + hidden_states
519
+ return hidden_states
520
+
521
+
522
+ @auto_docstring
523
+ class LagunaPreTrainedModel(PreTrainedModel):
524
+ config: LagunaConfig
525
+ base_model_prefix = "model"
526
+ supports_gradient_checkpointing = True
527
+ _no_split_modules = ["LagunaDecoderLayer"]
528
+ _skip_keys_device_placement = ["past_key_values"]
529
+ _supports_flash_attn = True
530
+ _supports_sdpa = True
531
+ _supports_flex_attn = True
532
+ _can_compile_fullgraph = (
533
+ is_grouped_mm_available()
534
+ ) # https://huggingface.co/docs/transformers/experts_interface#torchcompile
535
+ _supports_attention_backend = True
536
+ _can_record_outputs = {
537
+ "router_logits": OutputRecorder(LagunaTopKRouter, index=0),
538
+ "hidden_states": LagunaDecoderLayer,
539
+ "attentions": LagunaAttention,
540
+ }
541
+ # vLLM-trained Laguna checkpoints store the aux-loss-free routing bias on the
542
+ # experts module (``mlp.experts.e_score_correction_bias``). In this impl the
543
+ # bias lives on the router to stay co-located with its consumer across
544
+ # accelerate's per-module hooks, so remap the legacy key on load.
545
+ _checkpoint_conversion_mapping = {
546
+ r"^(.*)\.mlp\.experts\.e_score_correction_bias$": r"\1.mlp.gate.e_score_correction_bias",
547
+ }
548
+
549
+ @torch.no_grad()
550
+ def _init_weights(self, module):
551
+ super()._init_weights(module)
552
+ std = self.config.initializer_range
553
+ if isinstance(module, LagunaExperts):
554
+ init.normal_(module.gate_up_proj, mean=0.0, std=std)
555
+ init.normal_(module.down_proj, mean=0.0, std=std)
556
+ elif isinstance(module, LagunaTopKRouter):
557
+ init.normal_(module.weight, mean=0.0, std=std)
558
+ # Bare ``nn.Parameter``s that are not covered by the parent's generic
559
+ # Linear/Embedding/norm handling need their own rules so that the
560
+ # __init__ and from_pretrained(state_dict={}) paths produce identical
561
+ # weights under a fixed seed.
562
+ if isinstance(module, LagunaTopKRouter):
563
+ torch.nn.init.zeros_(module.e_score_correction_bias)
564
+ if isinstance(module, LagunaAttention) and hasattr(module, "sink"):
565
+ torch.nn.init.zeros_(module.sink)
566
+
567
+
568
+ class LagunaModel(LagunaPreTrainedModel):
569
+ def __init__(self, config: LagunaConfig):
570
+ super().__init__(config)
571
+ self.padding_idx = config.pad_token_id
572
+ self.vocab_size = config.vocab_size
573
+
574
+ self.embed_tokens = nn.Embedding(config.vocab_size, config.hidden_size, self.padding_idx)
575
+ self.layers = nn.ModuleList(
576
+ [LagunaDecoderLayer(config, layer_idx) for layer_idx in range(config.num_hidden_layers)]
577
+ )
578
+ self.norm = LagunaRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
579
+
580
+ # ``LagunaRotaryEmbedding`` inherits ``Qwen2MoeRotaryEmbedding``'s flat-shape
581
+ # contract — it reads ``config.rope_parameters["rope_type"]`` at the outer
582
+ # level. Laguna stores rope nested by layer type (``{"full_attention": {...},
583
+ # ...}``), so pass a config clone with the full-attention sub-dict flattened.
584
+ rp = getattr(config, "rope_parameters", None)
585
+ if isinstance(rp, dict) and isinstance(rp.get("full_attention"), dict):
586
+ import copy
587
+
588
+ full_config = copy.deepcopy(config)
589
+ full_config.rope_parameters = dict(rp["full_attention"])
590
+ self.rotary_emb = LagunaRotaryEmbedding(config=full_config)
591
+ else:
592
+ self.rotary_emb = LagunaRotaryEmbedding(config=config)
593
+
594
+ # Separate RoPE for sliding-window attention layers (when configured).
595
+ # Be careful with ``partial_rotary_factor`` — ``PreTrainedConfig.standardize_rope_params``
596
+ # unconditionally overwrites ``rope_parameters["partial_rotary_factor"]`` with
597
+ # ``self.partial_rotary_factor``, so we must align the top-level field on the
598
+ # cloned config to the SWA value, otherwise the global partial factor silently
599
+ # clobbers the SWA one.
600
+ if getattr(config, "swa_rope_parameters", None) is not None:
601
+ import copy
602
+
603
+ swa_config = copy.deepcopy(config)
604
+ swa_config.rope_parameters = dict(config.swa_rope_parameters)
605
+ swa_partial = swa_config.rope_parameters.get("partial_rotary_factor")
606
+ swa_config.partial_rotary_factor = swa_partial
607
+ self.swa_rotary_emb = LagunaRotaryEmbedding(config=swa_config)
608
+ else:
609
+ self.swa_rotary_emb = None
610
+
611
+ self.gradient_checkpointing = False
612
+
613
+ # Initialize weights and apply final processing
614
+ self.post_init()
615
+
616
+ @merge_with_config_defaults
617
+ @capture_outputs
618
+ @auto_docstring
619
+ def forward(
620
+ self,
621
+ input_ids: torch.LongTensor | None = None,
622
+ attention_mask: torch.Tensor | None = None,
623
+ position_ids: torch.LongTensor | None = None,
624
+ past_key_values: Cache | None = None,
625
+ inputs_embeds: torch.FloatTensor | None = None,
626
+ use_cache: bool | None = None,
627
+ **kwargs: Unpack[TransformersKwargs],
628
+ ) -> MoeModelOutputWithPast:
629
+ from transformers.cache_utils import DynamicCache
630
+ from transformers.masking_utils import create_causal_mask, create_sliding_window_causal_mask
631
+
632
+ if (input_ids is None) ^ (inputs_embeds is not None):
633
+ raise ValueError("You must specify exactly one of input_ids or inputs_embeds")
634
+
635
+ if inputs_embeds is None:
636
+ inputs_embeds = self.embed_tokens(input_ids)
637
+
638
+ if use_cache and past_key_values is None:
639
+ past_key_values = DynamicCache(config=self.config)
640
+
641
+ if position_ids is None:
642
+ past_seen_tokens = past_key_values.get_seq_length() if past_key_values is not None else 0
643
+ position_ids = (
644
+ torch.arange(inputs_embeds.shape[1], device=inputs_embeds.device) + past_seen_tokens
645
+ ).unsqueeze(0)
646
+
647
+ # Build one mask per layer-type so each layer can be dispatched with the right
648
+ # attention pattern (follows the afmoe / cohere2 v5 convention).
649
+ layer_types = getattr(self.config, "layer_types", None)
650
+ has_swa = layer_types is not None and "sliding_attention" in layer_types
651
+ if not isinstance(causal_mask_mapping := attention_mask, dict):
652
+ mask_kwargs = {
653
+ "config": self.config,
654
+ "inputs_embeds": inputs_embeds,
655
+ "attention_mask": attention_mask,
656
+ "past_key_values": past_key_values,
657
+ "position_ids": position_ids,
658
+ }
659
+ causal_mask_mapping = {"full_attention": create_causal_mask(**mask_kwargs)}
660
+ if has_swa:
661
+ causal_mask_mapping["sliding_attention"] = create_sliding_window_causal_mask(**mask_kwargs)
662
+
663
+ hidden_states = inputs_embeds
664
+ global_pe = self.rotary_emb(hidden_states, position_ids)
665
+ # Per-layer-type position embeddings: Laguna optionally uses a different rope for
666
+ # sliding layers (``swa_rope_parameters``). When absent, SWA layers share the
667
+ # global rope.
668
+ if has_swa:
669
+ swa_pe = self.swa_rotary_emb(hidden_states, position_ids) if self.swa_rotary_emb is not None else global_pe
670
+ position_embeddings_mapping = {"full_attention": global_pe, "sliding_attention": swa_pe}
671
+ else:
672
+ position_embeddings_mapping = None
673
+
674
+ for decoder_layer in self.layers[: self.config.num_hidden_layers]:
675
+ layer_attn_mask = causal_mask_mapping[decoder_layer.attention_type]
676
+ layer_pos_emb = (
677
+ position_embeddings_mapping[decoder_layer.attention_type]
678
+ if position_embeddings_mapping is not None
679
+ else global_pe
680
+ )
681
+ hidden_states = decoder_layer(
682
+ hidden_states,
683
+ attention_mask=layer_attn_mask,
684
+ position_ids=position_ids,
685
+ past_key_values=past_key_values,
686
+ use_cache=use_cache,
687
+ position_embeddings=layer_pos_emb,
688
+ **kwargs,
689
+ )
690
+
691
+ hidden_states = self.norm(hidden_states)
692
+
693
+ return MoeModelOutputWithPast(
694
+ last_hidden_state=hidden_states,
695
+ past_key_values=past_key_values,
696
+ )
697
+
698
+
699
+ def load_balancing_loss_func(
700
+ gate_logits: torch.Tensor | tuple[torch.Tensor] | None,
701
+ num_experts: int | None = None,
702
+ top_k=2,
703
+ attention_mask: torch.Tensor | None = None,
704
+ ) -> torch.Tensor | int:
705
+ r"""
706
+ Computes auxiliary load balancing loss as in Switch Transformer - implemented in Pytorch.
707
+
708
+ See Switch Transformer (https://huggingface.co/papers/2101.03961) for more details. This function implements the loss
709
+ function presented in equations (4) - (6) of the paper. It aims at penalizing cases where the routing between
710
+ experts is too unbalanced.
711
+
712
+ Args:
713
+ gate_logits:
714
+ Logits from the `gate`, should be a tuple of model.config.num_hidden_layers tensors of
715
+ shape [batch_size X sequence_length, num_experts].
716
+ num_experts:
717
+ Number of experts
718
+ top_k:
719
+ The number of experts to route per-token, can be also interpreted as the `top-k` routing
720
+ parameter.
721
+ attention_mask (`torch.Tensor`, *optional*):
722
+ The attention_mask used in forward function
723
+ shape [batch_size X sequence_length] if not None.
724
+
725
+ Returns:
726
+ The auxiliary loss.
727
+ """
728
+ if gate_logits is None or not isinstance(gate_logits, tuple):
729
+ return 0
730
+
731
+ if isinstance(gate_logits, tuple):
732
+ compute_device = gate_logits[0].device
733
+ concatenated_gate_logits = torch.cat([layer_gate.to(compute_device) for layer_gate in gate_logits], dim=0)
734
+
735
+ routing_weights = torch.nn.functional.softmax(concatenated_gate_logits, dim=-1)
736
+
737
+ _, selected_experts = torch.topk(routing_weights, top_k, dim=-1)
738
+
739
+ expert_mask = torch.nn.functional.one_hot(selected_experts, num_experts)
740
+
741
+ if attention_mask is None:
742
+ # Compute the percentage of tokens routed to each experts
743
+ tokens_per_expert = torch.mean(expert_mask.float(), dim=0)
744
+
745
+ # Compute the average probability of routing to these experts
746
+ router_prob_per_expert = torch.mean(routing_weights, dim=0)
747
+ else:
748
+ batch_size, sequence_length = attention_mask.shape
749
+ num_hidden_layers = concatenated_gate_logits.shape[0] // (batch_size * sequence_length)
750
+
751
+ # Compute the mask that masks all padding tokens as 0 with the same shape of expert_mask
752
+ expert_attention_mask = (
753
+ attention_mask[None, :, :, None, None]
754
+ .expand((num_hidden_layers, batch_size, sequence_length, top_k, num_experts))
755
+ .reshape(-1, top_k, num_experts)
756
+ .to(compute_device)
757
+ )
758
+
759
+ # Compute the percentage of tokens routed to each experts
760
+ tokens_per_expert = torch.sum(expert_mask.float() * expert_attention_mask, dim=0) / torch.sum(
761
+ expert_attention_mask, dim=0
762
+ )
763
+
764
+ # Compute the mask that masks all padding tokens as 0 with the same shape of tokens_per_expert
765
+ router_per_expert_attention_mask = (
766
+ attention_mask[None, :, :, None]
767
+ .expand((num_hidden_layers, batch_size, sequence_length, num_experts))
768
+ .reshape(-1, num_experts)
769
+ .to(compute_device)
770
+ )
771
+
772
+ # Compute the average probability of routing to these experts
773
+ router_prob_per_expert = torch.sum(routing_weights * router_per_expert_attention_mask, dim=0) / torch.sum(
774
+ router_per_expert_attention_mask, dim=0
775
+ )
776
+
777
+ overall_loss = torch.sum(tokens_per_expert * router_prob_per_expert.unsqueeze(0))
778
+ return overall_loss * num_experts
779
+
780
+
781
+ @auto_docstring
782
+ class LagunaForCausalLM(LagunaPreTrainedModel, GenerationMixin):
783
+ _tied_weights_keys = {"lm_head.weight": "model.embed_tokens.weight"}
784
+ _tp_plan = {"lm_head": "colwise_gather_output"}
785
+ _pp_plan = {"lm_head": (["hidden_states"], ["logits"])}
786
+
787
+ def __init__(self, config):
788
+ super().__init__(config)
789
+ self.model = LagunaModel(config)
790
+ self.vocab_size = config.vocab_size
791
+ self.lm_head = nn.Linear(config.hidden_size, config.vocab_size, bias=False)
792
+ self.router_aux_loss_coef = config.router_aux_loss_coef
793
+ self.num_experts = config.num_experts
794
+ self.num_experts_per_tok = config.num_experts_per_tok
795
+
796
+ # Initialize weights and apply final processing
797
+ self.post_init()
798
+
799
+ @can_return_tuple
800
+ @auto_docstring
801
+ def forward(
802
+ self,
803
+ input_ids: torch.LongTensor | None = None,
804
+ attention_mask: torch.Tensor | None = None,
805
+ position_ids: torch.LongTensor | None = None,
806
+ past_key_values: Cache | None = None,
807
+ inputs_embeds: torch.FloatTensor | None = None,
808
+ labels: torch.LongTensor | None = None,
809
+ use_cache: bool | None = None,
810
+ output_router_logits: bool | None = None,
811
+ logits_to_keep: int | torch.Tensor = 0,
812
+ **kwargs: Unpack[TransformersKwargs],
813
+ ) -> MoeCausalLMOutputWithPast:
814
+ r"""
815
+ labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
816
+ Labels for computing the masked language modeling loss. Indices should either be in `[0, ...,
817
+ config.vocab_size]` or -100 (see `input_ids` docstring). Tokens with indices set to `-100` are ignored
818
+ (masked), the loss is only computed for the tokens with labels in `[0, ..., config.vocab_size]`.
819
+ """
820
+
821
+ output_router_logits = (
822
+ output_router_logits if output_router_logits is not None else self.config.output_router_logits
823
+ )
824
+
825
+ # decoder outputs consists of (dec_features, layer_state, dec_hidden, dec_attn)
826
+ outputs: MoeModelOutputWithPast = self.model(
827
+ input_ids=input_ids,
828
+ attention_mask=attention_mask,
829
+ position_ids=position_ids,
830
+ past_key_values=past_key_values,
831
+ inputs_embeds=inputs_embeds,
832
+ use_cache=use_cache,
833
+ output_router_logits=output_router_logits,
834
+ **kwargs,
835
+ )
836
+
837
+ hidden_states = outputs.last_hidden_state
838
+ # Only compute necessary logits, and do not upcast them to float if we are not computing the loss
839
+ slice_indices = slice(-logits_to_keep, None) if isinstance(logits_to_keep, int) else logits_to_keep
840
+ logits = self.lm_head(hidden_states[:, slice_indices, :])
841
+
842
+ loss = None
843
+ if labels is not None:
844
+ loss = self.loss_function(logits, labels, self.vocab_size, **kwargs)
845
+
846
+ aux_loss = None
847
+ if output_router_logits:
848
+ aux_loss = load_balancing_loss_func(
849
+ outputs.router_logits,
850
+ self.num_experts,
851
+ self.num_experts_per_tok,
852
+ attention_mask,
853
+ )
854
+ if labels is not None:
855
+ loss += self.router_aux_loss_coef * aux_loss.to(loss.device) # make sure to reside in the same device
856
+
857
+ return MoeCausalLMOutputWithPast(
858
+ loss=loss,
859
+ aux_loss=aux_loss,
860
+ logits=logits,
861
+ past_key_values=outputs.past_key_values,
862
+ hidden_states=outputs.hidden_states,
863
+ attentions=outputs.attentions,
864
+ router_logits=outputs.router_logits,
865
+ )
866
+
867
+
868
+ __all__ = ["LagunaForCausalLM", "LagunaModel", "LagunaPreTrainedModel"]
869
+
870
+
871
+ # --- Added: register the native Laguna checkpoint-conversion for trust_remote_code loads.
872
+ # transformers >=5.12 skips checkpoint-conversion mappings for custom (remote) code
873
+ # unless explicitly registered, which broke loading the shipped per-expert MoE weights.
874
+ try:
875
+ from transformers.conversion_mapping import (
876
+ get_checkpoint_conversion_mapping as _lg_get,
877
+ register_checkpoint_conversion_mapping as _lg_reg,
878
+ USER_REGISTERED_MAPPINGS as _lg_user,
879
+ )
880
+
881
+ if "laguna" not in _lg_user:
882
+ _lg_m = _lg_get("laguna")
883
+ if _lg_m is not None:
884
+ _lg_reg("laguna", _lg_m, overwrite=True)
885
+ except Exception:
886
+ pass
runtime/Dockerfile ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM ghcr.io/anemll/dspark-vllm-gx10:0.1.1
2
+
3
+ ARG EXLLAMAV3_COMMIT=c5d9c657966ffeeaa9353f0cc899f18629da4a13
4
+ ARG EXLLAMAV3_ARCHIVE_SHA256=87cf1ed1abad0fd2eb84744418e6a2ea3ec09a874552c1a3e0f226eac03cb8f9
5
+ ARG FLASHINFER_VERSION=0.6.13
6
+
7
+ ENV DEBIAN_FRONTEND=noninteractive \
8
+ TORCH_CUDA_ARCH_LIST=12.1 \
9
+ MAX_JOBS=4 \
10
+ LIBRARY_PATH=/usr/local/lib/python3.12/dist-packages/nvidia/cu13/lib
11
+
12
+ COPY patch_exllamav3_arm64.py /opt/patch_exllamav3_arm64.py
13
+ COPY vendor/exllamav3-c5d9c657966ffeeaa9353f0cc899f18629da4a13.tar.gz /opt/exllamav3.tar.gz
14
+
15
+ RUN echo "${EXLLAMAV3_ARCHIVE_SHA256} /opt/exllamav3.tar.gz" | sha256sum -c - \
16
+ && for header in \
17
+ /usr/local/lib/python3.12/dist-packages/nvidia/cu13/include/cusparse*.h \
18
+ /usr/local/lib/python3.12/dist-packages/nvidia/cu13/include/cusolver*.h; \
19
+ do \
20
+ ln -sf "$header" "/usr/local/cuda/include/$(basename "$header")"; \
21
+ done \
22
+ && EXLLAMA_NOCOMPILE=1 python3 -m pip install \
23
+ --no-cache-dir --no-deps --no-build-isolation \
24
+ /opt/exllamav3.tar.gz \
25
+ && python3 /opt/patch_exllamav3_arm64.py \
26
+ /usr/local/lib/python3.12/dist-packages/exllamav3/exllamav3_ext \
27
+ && python3 -m pip install --no-cache-dir --force-reinstall --no-deps \
28
+ "flashinfer-python==${FLASHINFER_VERSION}" \
29
+ && python3 - <<'PY'
30
+ import importlib.metadata as im
31
+ import flashinfer
32
+
33
+ expected = "0.6.13"
34
+ actual = im.version("flashinfer-python")
35
+ cubin = im.version("flashinfer-cubin")
36
+ if actual != expected or cubin != expected or flashinfer.__version__ != expected:
37
+ raise SystemExit(
38
+ f"FlashInfer ABI mismatch: python={actual} cubin={cubin} "
39
+ f"module={flashinfer.__version__} expected={expected}"
40
+ )
41
+ print(f"FlashInfer ABI coherent: python={actual} cubin={cubin}")
42
+ PY
43
+
44
+ COPY sitecustomize.py /usr/local/lib/python3.12/dist-packages/sitecustomize.py
45
+
46
+ LABEL org.opencontainers.image.source="https://github.com/turboderp-org/exllamav3" \
47
+ org.opencontainers.image.revision="${EXLLAMAV3_COMMIT}" \
48
+ ai.laguna.exllamav3_archive_sha256="${EXLLAMAV3_ARCHIVE_SHA256}" \
49
+ ai.laguna.flashinfer_python="${FLASHINFER_VERSION}" \
50
+ ai.laguna.flashinfer_cubin="${FLASHINFER_VERSION}" \
51
+ ai.laguna.runtime_fix="graph-safe hot expert remap and additive TP1 reconstruction of TP2 EXL3 slices" \
52
+ ai.laguna.cuda_graphs="required" \
53
+ ai.laguna.purpose="Laguna TP1 or TP2 saliency hybrid NVFP4 plus EXL3 tails"
runtime/launch_single_spark.sh ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ if [[ $# -ne 5 ]]; then
5
+ echo "usage: $0 TR2_OR_TR3 ATTEMPT_NAME API_PORT TAIL_DIR MAP_DIR" >&2
6
+ exit 2
7
+ fi
8
+
9
+ TIER="${1^^}"
10
+ ATTEMPT_NAME="$2"
11
+ API_PORT="$3"
12
+ TAIL_DIR="$4"
13
+ MAP_DIR="$5"
14
+
15
+ if [[ "$TIER" != "TR2" && "$TIER" != "TR3" ]]; then
16
+ echo "tier must be TR2 or TR3" >&2
17
+ exit 2
18
+ fi
19
+ case "$API_PORT" in
20
+ ''|*[!0-9]*) echo "API port must be an integer" >&2; exit 2 ;;
21
+ esac
22
+
23
+ IMAGE="${LAGUNA_IMAGE:-laguna-vllm-hybrid:20260725-a10-tp1}"
24
+ MODEL_DIR="${LAGUNA_MODEL_DIR:-/home/sero/models/Laguna-S-2.1-NVFP4}"
25
+ MAP_FILE="${LAGUNA_MAP_FILE:-laguna-${TIER,,}-tier-map.json}"
26
+ SERVED_MODEL="${LAGUNA_SERVED_MODEL:-laguna-s-2.1-${TIER,,}-hybrid}"
27
+ MAX_NUM_SEQS="${LAGUNA_MAX_NUM_SEQS:-4}"
28
+ MAX_BATCHED_TOKENS="${LAGUNA_MAX_BATCHED_TOKENS:-4096}"
29
+ GPU_MEMORY_UTILIZATION="${LAGUNA_GPU_MEMORY_UTILIZATION:-0.86}"
30
+
31
+ for value in "$MAX_NUM_SEQS" "$MAX_BATCHED_TOKENS"; do
32
+ case "$value" in
33
+ ''|*[!0-9]*) echo "sequence and batching settings must be integers" >&2; exit 2 ;;
34
+ 0) echo "sequence and batching settings must be positive" >&2; exit 2 ;;
35
+ esac
36
+ done
37
+
38
+ docker inspect "$ATTEMPT_NAME" >/dev/null 2>&1 \
39
+ && { echo "container already exists: $ATTEMPT_NAME" >&2; exit 3; }
40
+ docker image inspect "$IMAGE" >/dev/null
41
+ [[ -d "$MODEL_DIR" ]] || { echo "missing source model: $MODEL_DIR" >&2; exit 3; }
42
+ [[ -d "$TAIL_DIR/${TIER,,}" ]] \
43
+ || { echo "missing tail tier: $TAIL_DIR/${TIER,,}" >&2; exit 3; }
44
+ [[ -s "$MAP_DIR/$MAP_FILE" ]] \
45
+ || { echo "missing tier map: $MAP_DIR/$MAP_FILE" >&2; exit 3; }
46
+
47
+ docker run -d \
48
+ --name "$ATTEMPT_NAME" \
49
+ --gpus all \
50
+ --network host \
51
+ --ipc host \
52
+ --shm-size 64g \
53
+ --ulimit memlock=-1 \
54
+ --ulimit stack=67108864 \
55
+ -v "$MODEL_DIR:/model:ro" \
56
+ -v "$TAIL_DIR:/tail:ro" \
57
+ -v "$MAP_DIR:/maps:ro" \
58
+ -e "PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True" \
59
+ -e "TORCH_CUDA_ARCH_LIST=12.1a" \
60
+ -e "CUTE_DSL_ARCH=sm_121a" \
61
+ -e "MAX_JOBS=4" \
62
+ -e "VLLM_NO_USAGE_STATS=1" \
63
+ -e "LAGUNA_HYBRID_TIER=$TIER" \
64
+ -e "LAGUNA_HYBRID_MODEL_DIR=/model" \
65
+ -e "LAGUNA_HYBRID_TAIL_DIR=/tail" \
66
+ -e "LAGUNA_HYBRID_TIER_MAP=/maps/$MAP_FILE" \
67
+ -e "LAGUNA_HYBRID_TRELLIS_CHUNK=128" \
68
+ -e "PYTHONPATH=/usr/local/lib/python3.12/dist-packages" \
69
+ "$IMAGE" \
70
+ /model \
71
+ --served-model-name "$SERVED_MODEL" \
72
+ --enable-auto-tool-choice \
73
+ --tool-call-parser poolside_v1 \
74
+ --reasoning-parser poolside_v1 \
75
+ --structured-outputs-config '{"enable_in_reasoning":true}' \
76
+ --compilation-config '{"inductor_compile_config":{"benchmark_combo_kernel":false}}' \
77
+ --override-generation-config '{"temperature":0.7,"top_p":0.95}' \
78
+ --max-num-seqs "$MAX_NUM_SEQS" \
79
+ --max-num-batched-tokens "$MAX_BATCHED_TOKENS" \
80
+ --max-model-len 200000 \
81
+ --gpu-memory-utilization "$GPU_MEMORY_UTILIZATION" \
82
+ --tensor-parallel-size 1 \
83
+ --moe-backend flashinfer_cutlass \
84
+ --attention-backend TRITON_ATTN \
85
+ --host 0.0.0.0 \
86
+ --port "$API_PORT"
87
+
88
+ printf '%s\n' "$ATTEMPT_NAME"
runtime/launch_tp2.sh ADDED
@@ -0,0 +1,158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ if [[ $# -ne 5 ]]; then
5
+ echo "usage: $0 TR2_OR_TR3 ATTEMPT_NAME MASTER_PORT API_PORT TAIL_DIR" >&2
6
+ exit 2
7
+ fi
8
+
9
+ TIER="${1^^}"
10
+ ATTEMPT_NAME="$2"
11
+ MASTER_PORT="$3"
12
+ API_PORT="$4"
13
+ TAIL_DIR="$5"
14
+
15
+ if [[ "$TIER" != "TR2" && "$TIER" != "TR3" ]]; then
16
+ echo "tier must be TR2 or TR3" >&2
17
+ exit 2
18
+ fi
19
+ SPECULATIVE_MODE="${LAGUNA_SPECULATIVE_MODE:-none}"
20
+ if [[ "$SPECULATIVE_MODE" != "dflash" && "$SPECULATIVE_MODE" != "none" ]]; then
21
+ echo "LAGUNA_SPECULATIVE_MODE must be dflash or none" >&2
22
+ exit 2
23
+ fi
24
+ for value in "$MASTER_PORT" "$API_PORT"; do
25
+ case "$value" in
26
+ ''|*[!0-9]*) echo "ports must be integers" >&2; exit 2 ;;
27
+ esac
28
+ done
29
+
30
+ IMAGE="laguna-vllm-hybrid:20260724-a9-hot-remap"
31
+ MODEL_DIR="${LAGUNA_MODEL_DIR:-/home/sero/models/Laguna-S-2.1-NVFP4}"
32
+ DFLASH_DIR="${LAGUNA_DFLASH_DIR:-/home/sero/models/Laguna-S-2.1-DFlash-NVFP4}"
33
+ MAP_DIR="${LAGUNA_MAP_DIR:-/home/sero/laguna-reap-saliency-v1/final-20260723-a2/tier-maps}"
34
+ WORKER_HOST="10.0.0.2"
35
+ HEAD_IP="10.0.0.1"
36
+ SERVED_MODEL="laguna-s-2.1-${TIER,,}-hybrid"
37
+ MAP_FILE="${LAGUNA_MAP_FILE:-laguna-${TIER,,}-tier-map.json}"
38
+
39
+ for host in head worker; do
40
+ if [[ "$host" == "head" ]]; then
41
+ docker inspect "$ATTEMPT_NAME" >/dev/null 2>&1 \
42
+ && { echo "head container already exists: $ATTEMPT_NAME" >&2; exit 3; }
43
+ else
44
+ ssh -o BatchMode=yes -o ConnectTimeout=10 "$WORKER_HOST" \
45
+ "docker inspect '$ATTEMPT_NAME' >/dev/null 2>&1" \
46
+ && { echo "worker container already exists: $ATTEMPT_NAME" >&2; exit 3; }
47
+ fi
48
+ done
49
+ [[ -d "$TAIL_DIR/${TIER,,}" ]] || { echo "missing tail tier: $TAIL_DIR/${TIER,,}" >&2; exit 3; }
50
+ [[ -s "$MAP_DIR/$MAP_FILE" ]] || { echo "missing tier map: $MAP_DIR/$MAP_FILE" >&2; exit 3; }
51
+ if [[ "$SPECULATIVE_MODE" == "dflash" ]]; then
52
+ [[ -s "$DFLASH_DIR/model.safetensors" ]] \
53
+ || { echo "missing pinned Laguna DFlash checkpoint" >&2; exit 3; }
54
+ ssh -o BatchMode=yes -o ConnectTimeout=10 "$WORKER_HOST" \
55
+ "test -s '$DFLASH_DIR/model.safetensors'" \
56
+ || { echo "worker is missing pinned Laguna DFlash checkpoint" >&2; exit 3; }
57
+ fi
58
+ DFLASH_MOUNT=()
59
+ if [[ "$SPECULATIVE_MODE" == "dflash" ]]; then
60
+ DFLASH_MOUNT=(-v "$DFLASH_DIR:/dflash:ro")
61
+ fi
62
+
63
+ cleanup_failed_launch() {
64
+ docker stop "$ATTEMPT_NAME" >/dev/null 2>&1 || true
65
+ ssh -o BatchMode=yes -o ConnectTimeout=10 "$WORKER_HOST" \
66
+ "docker stop '$ATTEMPT_NAME' >/dev/null 2>&1 || true" || true
67
+ }
68
+ trap cleanup_failed_launch ERR
69
+
70
+ COMMON_ENV=(
71
+ -e "NCCL_IB_DISABLE=0"
72
+ -e "NCCL_IB_HCA=rocep1s0f1,roceP2p1s0f1"
73
+ -e "NCCL_IB_GID_INDEX=0"
74
+ -e "NCCL_CUMEM_ENABLE=0"
75
+ -e "NCCL_DEBUG=WARN"
76
+ -e "TORCH_CUDA_ARCH_LIST=12.1a"
77
+ -e MASTER_ADDR="$HEAD_IP"
78
+ -e MASTER_PORT="$MASTER_PORT"
79
+ -e "GLOO_SOCKET_IFNAME=enp1s0f1np1"
80
+ -e "NCCL_IB_ROCE_VERSION_NUM=2"
81
+ -e "MN_IF_NAME=enp1s0f1np1"
82
+ -e "PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True"
83
+ -e "MAX_JOBS=4"
84
+ -e "NCCL_SOCKET_IFNAME=enp1s0f1np1"
85
+ -e "NCCL_NET=IB"
86
+ -e "NCCL_CROSS_NIC=1"
87
+ -e "NCCL_IGNORE_CPU_AFFINITY=1"
88
+ -e "OMPI_MCA_btl_tcp_if_include=enp1s0f1np1"
89
+ -e "CUTE_DSL_ARCH=sm_121a"
90
+ -e "NCCL_IB_ADDR_FAMILY=AF_INET"
91
+ -e "NCCL_NVLS_ENABLE=0"
92
+ -e "TP_SOCKET_IFNAME=enp1s0f1np1"
93
+ -e "LAGUNA_HYBRID_TIER=$TIER"
94
+ -e "LAGUNA_HYBRID_MODEL_DIR=/model"
95
+ -e "LAGUNA_HYBRID_TAIL_DIR=/tail"
96
+ -e "LAGUNA_HYBRID_TIER_MAP=/maps/$MAP_FILE"
97
+ -e "LAGUNA_HYBRID_TRELLIS_CHUNK=128"
98
+ -e "PYTHONPATH=/usr/local/lib/python3.12/dist-packages"
99
+ )
100
+
101
+ COMMON_ARGS=(
102
+ /model
103
+ --served-model-name "$SERVED_MODEL"
104
+ --enable-auto-tool-choice
105
+ --tool-call-parser poolside_v1
106
+ --reasoning-parser poolside_v1
107
+ --structured-outputs-config '{"enable_in_reasoning":true}'
108
+ --override-generation-config '{"temperature":0.7,"top_p":0.95}'
109
+ --max-num-seqs 4
110
+ --max-num-batched-tokens 4096
111
+ --max-model-len 200000
112
+ --gpu-memory-utilization 0.86
113
+ --tensor-parallel-size 2
114
+ --distributed-executor-backend mp
115
+ --moe-backend flashinfer_cutlass
116
+ --attention-backend TRITON_ATTN
117
+ --host 0.0.0.0
118
+ --port "$API_PORT"
119
+ --nnodes 2
120
+ --master-addr "$HEAD_IP"
121
+ --master-port "$MASTER_PORT"
122
+ )
123
+ if [[ "$SPECULATIVE_MODE" == "dflash" ]]; then
124
+ COMMON_ARGS+=(
125
+ --speculative-config '{"model":"/dflash","num_speculative_tokens":15,"method":"dflash"}'
126
+ )
127
+ fi
128
+
129
+ printf -v WORKER_ENV ' %q' "${COMMON_ENV[@]}"
130
+ printf -v WORKER_ARGS ' %q' "${COMMON_ARGS[@]}"
131
+ WORKER_DFLASH_MOUNT=""
132
+ if ((${#DFLASH_MOUNT[@]})); then
133
+ printf -v WORKER_DFLASH_MOUNT ' %q' "${DFLASH_MOUNT[@]}"
134
+ fi
135
+ ssh -o BatchMode=yes -o ConnectTimeout=10 "$WORKER_HOST" \
136
+ "docker run -d --name '$ATTEMPT_NAME' --gpus all --network host --ipc host --shm-size 64g --device /dev/infiniband --ulimit memlock=-1 --ulimit stack=67108864 -v '$MODEL_DIR:/model:ro'$WORKER_DFLASH_MOUNT -v '$TAIL_DIR:/tail:ro' -v '$MAP_DIR:/maps:ro'$WORKER_ENV -e VLLM_HOST_IP=10.0.0.2 '$IMAGE'$WORKER_ARGS --node-rank 1 --headless"
137
+
138
+ docker run -d \
139
+ --name "$ATTEMPT_NAME" \
140
+ --gpus all \
141
+ --network host \
142
+ --ipc host \
143
+ --shm-size 64g \
144
+ --device /dev/infiniband \
145
+ --ulimit memlock=-1 \
146
+ --ulimit stack=67108864 \
147
+ -v "$MODEL_DIR:/model:ro" \
148
+ "${DFLASH_MOUNT[@]}" \
149
+ -v "$TAIL_DIR:/tail:ro" \
150
+ -v "$MAP_DIR:/maps:ro" \
151
+ "${COMMON_ENV[@]}" \
152
+ -e VLLM_HOST_IP=10.0.0.1 \
153
+ "$IMAGE" \
154
+ "${COMMON_ARGS[@]}" \
155
+ --node-rank 0
156
+
157
+ trap - ERR
158
+ printf '%s\n' "$ATTEMPT_NAME"
runtime/patch_exllamav3_arm64.py ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Disable ExLlamaV3's x86-only CPU all-reduce sources on pinned ARM64 builds.
3
+
4
+ Laguna hybrid inference uses vLLM TP2 collectives, not ExLlamaV3's optional
5
+ native CPU all-reduce backend. The CUDA EXL3 quantizer, trellis pack/unpack,
6
+ reconstruction, and MoE kernels remain compiled. Every upstream x86 source is
7
+ hash-gated so a source revision cannot be patched accidentally.
8
+ """
9
+
10
+ from __future__ import annotations
11
+
12
+ import hashlib
13
+ import platform
14
+ import sys
15
+ from pathlib import Path
16
+
17
+
18
+ EXPECTED = {
19
+ "avx2_target.cpp": "40e7445f6d25d0ec26185c9c258dc5409291218141e11b22352e96e0f0e9d7d0",
20
+ "avx512_target.cpp": "4f9b51075f769c34884e2b1510328b814b71fa0bb71fb0fdd92b72ebc9ba447a",
21
+ "parallel/all_reduce_cpu_avx2.cpp": "903f14178e4e1451b259fe06d5c3987f86e3c0f5de2de4715998faafd6040b81",
22
+ "parallel/all_reduce_cpu_avx512.cpp": "ccfd0eedfba4ace032bbcc5d2864b8118f30e6447080e4b5cb925f6d082b865b",
23
+ }
24
+
25
+ PACKAGE_INITIALIZERS = {
26
+ "__init__.py": "59430846a04ceba4e33b0ab0233f551b68ec580fb034534c11a965d3cfb42856",
27
+ "modules/__init__.py": "a820ac4a5ab202b8862f7e42a6c21afae78a9653f4e5aaed3b12b271aa69fa21",
28
+ "modules/quant/__init__.py": "cb10d8f118205ce78a35e8c27e322d8cfb2a3bc32be2ca63807437ae055f3df5",
29
+ }
30
+
31
+ MINIMAL_INITIALIZERS = {
32
+ "__init__.py": (
33
+ 'from importlib.metadata import version\n\n'
34
+ '__version__ = version("exllamav3")\n'
35
+ ),
36
+ "modules/__init__.py": (
37
+ '"""Minimal module namespace for the Laguna EXL3 encoder image."""\n'
38
+ ),
39
+ "modules/quant/__init__.py": (
40
+ '"""EXL3 quantizer submodules are imported explicitly by the encoder."""\n'
41
+ ),
42
+ }
43
+
44
+ STUB = r"""#include <cstddef>
45
+ #include <cstdint>
46
+ #include <stdexcept>
47
+ #include "avx2_target.h"
48
+ #include "avx512_target.h"
49
+ #include "parallel/all_reduce_cpu_avx2.h"
50
+ #include "parallel/all_reduce_cpu_avx512.h"
51
+
52
+ bool is_avx2_supported() { return false; }
53
+ bool is_avx512_supported() { return false; }
54
+ void enable_fast_fp() {}
55
+ void enable_fast_fp_avx2() {}
56
+ void enable_fast_fp_avx512() {}
57
+
58
+ [[noreturn]] static void unavailable()
59
+ {
60
+ throw std::runtime_error(
61
+ "ExLlamaV3 native x86 CPU all-reduce is unavailable on ARM64; "
62
+ "use the serving runtime's device collective backend");
63
+ }
64
+
65
+ void perform_cpu_reduce(
66
+ PGContext*, size_t, uint32_t, uint8_t*, size_t) { unavailable(); }
67
+ void perform_cpu_reduce_avx2(
68
+ PGContext*, size_t, uint32_t, uint8_t*, size_t) { unavailable(); }
69
+ void perform_cpu_reduce_avx512(
70
+ PGContext*, size_t, uint32_t, uint8_t*, size_t) { unavailable(); }
71
+ void bf16_add_inplace_avx512(
72
+ uint16_t*, const uint16_t*, size_t) { unavailable(); }
73
+ """
74
+
75
+
76
+ def digest(path: Path) -> str:
77
+ return hashlib.sha256(path.read_bytes()).hexdigest()
78
+
79
+
80
+ def main() -> int:
81
+ if len(sys.argv) != 2:
82
+ raise SystemExit("usage: patch_exllamav3_arm64.py EXLLAMAV3_EXT_DIR")
83
+ machine = platform.machine().lower()
84
+ if machine not in {"aarch64", "arm64"}:
85
+ raise RuntimeError(f"refusing ARM64 patch on architecture {machine!r}")
86
+ root = Path(sys.argv[1]).resolve()
87
+ if not root.is_dir():
88
+ raise FileNotFoundError(root)
89
+ for relative, expected in EXPECTED.items():
90
+ source = root / relative
91
+ if digest(source) != expected:
92
+ raise RuntimeError(f"upstream source hash mismatch: {relative}")
93
+ disabled = source.with_suffix(source.suffix + ".x86-disabled")
94
+ if disabled.exists():
95
+ raise FileExistsError(disabled)
96
+ source.rename(disabled)
97
+ package = root.parent
98
+ for relative, expected in PACKAGE_INITIALIZERS.items():
99
+ initializer = package / relative
100
+ if digest(initializer) != expected:
101
+ raise RuntimeError(
102
+ f"upstream package initializer hash mismatch: {relative}"
103
+ )
104
+ initializer.write_text(
105
+ MINIMAL_INITIALIZERS[relative], encoding="utf-8"
106
+ )
107
+ stub = root / "arm64_no_x86.cpp"
108
+ if stub.exists():
109
+ raise FileExistsError(stub)
110
+ stub.write_text(STUB, encoding="utf-8")
111
+ print(
112
+ "ARM64 compatibility applied: disabled four x86-only CPU "
113
+ "all-reduce sources and narrowed optional package imports; "
114
+ "CUDA EXL3 sources retained"
115
+ )
116
+ return 0
117
+
118
+
119
+ if __name__ == "__main__":
120
+ raise SystemExit(main())
runtime/sitecustomize.py ADDED
@@ -0,0 +1,777 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Laguna hybrid NVFP4 + calibrated EXL3 tail runtime for TP1 or TP2.
2
+
3
+ Enabled only when LAGUNA_HYBRID_TIER is TR2 or TR3. The stock compressed-
4
+ tensors NVFP4 MoE method is replaced with a fail-closed two-tier method:
5
+
6
+ * saliency-selected hot experts are loaded byte-for-byte from the source
7
+ checkpoint into a compact native vLLM CUTLASS NVFP4 kernel;
8
+ * the remaining experts are loaded from the calibrated TP2 rank-sliced EXL3
9
+ tail; TP1 reconstructs the full expert by executing both stored slices into
10
+ the kernel's additive fp32 output buffer;
11
+ * both tiers consume the same router weights and their local outputs are added
12
+ before vLLM performs its normal TP reduction.
13
+
14
+ The trellis path uses preallocated scratch and fixed chunking and is therefore
15
+ compatible with normal CUDA graph capture. This module does not change vLLM's
16
+ execution mode or graph configuration.
17
+ """
18
+
19
+ from __future__ import annotations
20
+
21
+ import dataclasses
22
+ import json
23
+ import os
24
+ import re
25
+ import threading
26
+ from pathlib import Path
27
+ from typing import Any
28
+
29
+
30
+ TIER = os.environ.get("LAGUNA_HYBRID_TIER", "").upper()
31
+
32
+
33
+ if TIER in ("TR2", "TR3"):
34
+ import torch
35
+ import torch.nn as nn
36
+ from safetensors import safe_open
37
+ from vllm.distributed import (
38
+ get_tensor_model_parallel_rank,
39
+ get_tensor_model_parallel_world_size,
40
+ )
41
+ from vllm.model_executor.layers.fused_moe import SharedExperts
42
+ from vllm.model_executor.layers.fused_moe.activation import MoEActivation
43
+ from vllm.model_executor.layers.fused_moe.config import FusedMoEParallelConfig
44
+ from vllm.model_executor.layers.fused_moe.oracle.nvfp4 import (
45
+ convert_to_nvfp4_moe_kernel_format,
46
+ make_nvfp4_moe_kernel,
47
+ make_nvfp4_moe_quant_config,
48
+ select_nvfp4_moe_backend,
49
+ )
50
+ from vllm.model_executor.layers.quantization.compressed_tensors.compressed_tensors_moe.compressed_tensors_moe_w4a4_nvfp4 import (
51
+ CompressedTensorsW4A4Nvfp4MoEMethod as _StockNvfp4MoE,
52
+ )
53
+ from vllm.model_executor.layers.quantization.utils.quant_utils import (
54
+ kNvfp4Dynamic,
55
+ kNvfp4Static,
56
+ )
57
+ from vllm.model_executor.utils import set_weight_attrs
58
+
59
+ from exllamav3.ext import exllamav3_ext as _exl3
60
+
61
+ BITS = 2 if TIER == "TR2" else 3
62
+ ARTIFACT_TP = 2
63
+ EXPERTS = 256
64
+ HIDDEN = 3072
65
+ INTERMEDIATE = 1024
66
+ TOP_K = 10
67
+ MCG = 0xCBAC1FED
68
+ CHUNK = int(os.environ.get("LAGUNA_HYBRID_TRELLIS_CHUNK", "128"))
69
+ if CHUNK <= 0:
70
+ raise RuntimeError("LAGUNA_HYBRID_TRELLIS_CHUNK must be positive")
71
+
72
+ MODEL_DIR = Path(os.environ.get("LAGUNA_HYBRID_MODEL_DIR", "/model"))
73
+ TAIL_DIR = Path(os.environ.get("LAGUNA_HYBRID_TAIL_DIR", "/tail"))
74
+ MAP_PATH = Path(
75
+ os.environ.get(
76
+ "LAGUNA_HYBRID_TIER_MAP",
77
+ str(TAIL_DIR / f"laguna-{TIER.lower()}-tier-map.json"),
78
+ )
79
+ )
80
+ if not MAP_PATH.is_file():
81
+ raise FileNotFoundError(f"Laguna hybrid tier map is missing: {MAP_PATH}")
82
+ _MAP_PAYLOAD = json.loads(MAP_PATH.read_text(encoding="utf-8"))
83
+ if _MAP_PAYLOAD.get("tier") != TIER:
84
+ raise RuntimeError(
85
+ f"tier map says {_MAP_PAYLOAD.get('tier')!r}, runtime requested {TIER}"
86
+ )
87
+ if not _MAP_PAYLOAD.get("coverage_gate", {}).get("passed"):
88
+ raise RuntimeError("Laguna hybrid tier map failed its coverage gate")
89
+ _EXPECTED_BUDGET = {
90
+ "TR2": {
91
+ "tail_encoding": "trellis2",
92
+ "tail_weight_bits": 2,
93
+ "hot_experts_per_sparse_layer": 96,
94
+ "tail_experts_per_sparse_layer": 160,
95
+ "average_weight_bits": 2.75,
96
+ },
97
+ "TR3": {
98
+ "tail_encoding": "trellis3",
99
+ "tail_weight_bits": 3,
100
+ "hot_experts_per_sparse_layer": 64,
101
+ "tail_experts_per_sparse_layer": 192,
102
+ "average_weight_bits": 3.25,
103
+ },
104
+ }[TIER]
105
+ _BUDGET = _MAP_PAYLOAD.get("bit_budget")
106
+ if not isinstance(_BUDGET, dict):
107
+ raise RuntimeError("Laguna hybrid tier map lacks a bit-budget contract")
108
+ _REQUIRED_BUDGET = {
109
+ "hot_encoding": "nvfp4",
110
+ "hot_weight_bits": 4,
111
+ "tail_encoding": _EXPECTED_BUDGET["tail_encoding"],
112
+ "tail_weight_bits": _EXPECTED_BUDGET["tail_weight_bits"],
113
+ "hot_experts_per_sparse_layer": _EXPECTED_BUDGET[
114
+ "hot_experts_per_sparse_layer"
115
+ ],
116
+ "tail_experts_per_sparse_layer": _EXPECTED_BUDGET[
117
+ "tail_experts_per_sparse_layer"
118
+ ],
119
+ }
120
+ for _field, _value in _REQUIRED_BUDGET.items():
121
+ if _BUDGET.get(_field) != _value:
122
+ raise RuntimeError(
123
+ f"Laguna {TIER} bit budget {_field}="
124
+ f"{_BUDGET.get(_field)!r} != {_value!r}"
125
+ )
126
+ _average = _EXPECTED_BUDGET["average_weight_bits"]
127
+ if (
128
+ float(_BUDGET.get("target_average_weight_bits", -1.0)) != _average
129
+ or float(_BUDGET.get("nominal_average_weight_bits", -1.0)) != _average
130
+ or _BUDGET.get("budget_passed") is not True
131
+ ):
132
+ raise RuntimeError(
133
+ f"Laguna {TIER} tier map failed its exact bit-budget contract"
134
+ )
135
+
136
+ _LAYER_RE = re.compile(r"(?:^|\.)layers\.(\d+)(?:\.|$)")
137
+ _RUNTIME: dict[tuple[int, int], dict[str, torch.Tensor | int]] = {}
138
+ _RUNTIME_LOCK = threading.Lock()
139
+
140
+
141
+ def _layer_index(value: str | None) -> int:
142
+ match = _LAYER_RE.search(str(value or ""))
143
+ if match is None:
144
+ raise RuntimeError(f"cannot resolve Laguna layer index from {value!r}")
145
+ layer = int(match.group(1))
146
+ if not 1 <= layer <= 47:
147
+ raise RuntimeError(f"unexpected Laguna sparse layer index: {layer}")
148
+ return layer
149
+
150
+
151
+ def _tier_layer(layer: int) -> tuple[list[int], list[int]]:
152
+ entry = _MAP_PAYLOAD["layers"].get(str(layer))
153
+ if entry is None:
154
+ raise RuntimeError(f"tier map has no sparse layer {layer}")
155
+ hot = [int(value) for value in entry["hot_experts"]]
156
+ tail = [int(value) for value in entry["tail_experts"]]
157
+ expected_hot = 96 if TIER == "TR2" else 64
158
+ expected_tail = EXPERTS - expected_hot
159
+ if len(hot) != expected_hot or len(tail) != expected_tail:
160
+ raise RuntimeError(
161
+ f"layer {layer}: hot/tail counts {len(hot)}/{len(tail)} "
162
+ f"!= {expected_hot}/{expected_tail}"
163
+ )
164
+ if set(hot) | set(tail) != set(range(EXPERTS)) or set(hot) & set(tail):
165
+ raise RuntimeError(f"layer {layer}: tier map is not a 256-expert partition")
166
+ expected_tail_encoding = "trellis2" if TIER == "TR2" else "trellis3"
167
+ if (
168
+ entry.get("hot_encoding") != "nvfp4"
169
+ or entry.get("tail_encoding") != expected_tail_encoding
170
+ ):
171
+ raise RuntimeError(
172
+ f"layer {layer}: tier encodings do not match {TIER}"
173
+ )
174
+ return hot, tail
175
+
176
+
177
+ def _runtime(device: torch.device, max_rows: int) -> dict[str, Any]:
178
+ key = (device.index if device.index is not None else torch.cuda.current_device(), max_rows)
179
+ with _RUNTIME_LOCK:
180
+ existing = _RUNTIME.get(key)
181
+ if existing is not None:
182
+ return existing
183
+ concurrency = int(_exl3.exl3_moe_max_concurrency(key[0]))
184
+ value: dict[str, Any] = {
185
+ "max_rows": max_rows,
186
+ "cap": CHUNK,
187
+ "xh": torch.empty((max_rows, HIDDEN), dtype=torch.float16, device=device),
188
+ "out32": torch.empty((max_rows, HIDDEN), dtype=torch.float32, device=device),
189
+ "tg": torch.empty(
190
+ (concurrency, CHUNK, HIDDEN), dtype=torch.float16, device=device
191
+ ),
192
+ "tu": torch.empty(
193
+ (concurrency, CHUNK, HIDDEN), dtype=torch.float16, device=device
194
+ ),
195
+ "ig": torch.empty(
196
+ (concurrency, CHUNK, INTERMEDIATE // ARTIFACT_TP),
197
+ dtype=torch.float16,
198
+ device=device,
199
+ ),
200
+ "iu": torch.empty(
201
+ (concurrency, CHUNK, INTERMEDIATE // ARTIFACT_TP),
202
+ dtype=torch.float16,
203
+ device=device,
204
+ ),
205
+ "flat_token": torch.arange(
206
+ CHUNK, dtype=torch.int64, device=device
207
+ ).repeat_interleave(TOP_K),
208
+ "ones": torch.ones(CHUNK * TOP_K, dtype=torch.int64, device=device),
209
+ }
210
+ _RUNTIME[key] = value
211
+ print(
212
+ f"[laguna-hybrid] shared EXL3 runtime allocated: max_rows={max_rows} "
213
+ f"chunk={CHUNK} concurrency={concurrency}",
214
+ flush=True,
215
+ )
216
+ return value
217
+
218
+
219
+ class LagunaHybridNvfp4Exl3MoE(_StockNvfp4MoE):
220
+ def __init__(self, moe, layer_name: str | None = None, use_a16: bool = False):
221
+ super().__init__(moe, layer_name, use_a16)
222
+ self.layer_name = layer_name
223
+ self.layer_index = _layer_index(layer_name)
224
+ self.hot, self.tail = _tier_layer(self.layer_index)
225
+ self.hot_pos = {expert: index for index, expert in enumerate(self.hot)}
226
+ self.tail_pos = {expert: index for index, expert in enumerate(self.tail)}
227
+ self._seen: set[tuple[int, str, str]] = set()
228
+ self.hot_kernel = None
229
+ self.hot_layer = None
230
+ self.hot_quant_config = None
231
+ self.tail_slabs: dict[int, dict[str, dict[str, torch.Tensor]]] = {}
232
+ self.tail_ptrs: dict[int, list[torch.Tensor]] = {}
233
+ self.runtime_tp = 0
234
+ self.hot_expert_map = None
235
+ self.tail_lut = None
236
+ self.runtime = None
237
+
238
+ def create_weights(
239
+ self,
240
+ layer: torch.nn.Module,
241
+ num_experts: int,
242
+ hidden_size: int,
243
+ intermediate_size_per_partition: int,
244
+ params_dtype: torch.dtype,
245
+ **extra_weight_attrs,
246
+ ) -> None:
247
+ if num_experts != EXPERTS or hidden_size != HIDDEN:
248
+ raise RuntimeError(
249
+ f"unexpected Laguna MoE geometry E={num_experts} H={hidden_size}"
250
+ )
251
+ runtime_tp = get_tensor_model_parallel_world_size()
252
+ if runtime_tp not in (1, ARTIFACT_TP):
253
+ raise RuntimeError(
254
+ "Laguna hybrid runtime supports tensor parallel world size 1 or 2"
255
+ )
256
+ expected_local_i = INTERMEDIATE // runtime_tp
257
+ if intermediate_size_per_partition != expected_local_i:
258
+ raise RuntimeError(
259
+ "Laguna hybrid intermediate partition mismatch: "
260
+ f"{intermediate_size_per_partition} != {expected_local_i} "
261
+ f"for TP{runtime_tp}"
262
+ )
263
+ self.runtime_tp = runtime_tp
264
+ layer.num_experts = num_experts
265
+ layer.params_dtype = params_dtype
266
+ hot_count = len(self.hot)
267
+ rank = get_tensor_model_parallel_rank()
268
+
269
+ def weight_loader(
270
+ param,
271
+ loaded,
272
+ name_mapped=None,
273
+ *,
274
+ shard_id=None,
275
+ expert_id=None,
276
+ return_success=False,
277
+ **_kwargs,
278
+ ):
279
+ expert = int(expert_id)
280
+ if expert in self.tail_pos:
281
+ return True if return_success else None
282
+ local = self.hot_pos.get(expert)
283
+ if local is None:
284
+ return False if return_success else None
285
+ name = str(name_mapped or "")
286
+ shard = str(shard_id)
287
+ if shard not in ("w1", "w2", "w3"):
288
+ raise RuntimeError(f"unexpected expert shard {shard!r}")
289
+ family = "w13" if ".w13_" in name else "w2"
290
+ if "input_global_scale" in name:
291
+ field = "input_global_scale"
292
+ elif "weight_global_scale" in name:
293
+ field = "weight_global_scale"
294
+ elif "weight_scale" in name:
295
+ field = "weight_scale"
296
+ elif "weight_packed" in name:
297
+ field = "weight_packed"
298
+ else:
299
+ raise RuntimeError(f"unrecognized compact NVFP4 parameter: {name}")
300
+
301
+ if loaded.ndim >= 2 and runtime_tp == ARTIFACT_TP:
302
+ if shard in ("w1", "w3"):
303
+ loaded = loaded.chunk(ARTIFACT_TP, 0)[rank]
304
+ else:
305
+ loaded = loaded.chunk(ARTIFACT_TP, 1)[rank]
306
+ destination = param.data[local]
307
+ if family == "w13":
308
+ if field in ("weight_packed", "weight_scale"):
309
+ half = destination.shape[0] // 2
310
+ destination = (
311
+ destination[:half] if shard == "w1" else destination[half:]
312
+ )
313
+ elif field in ("weight_global_scale", "input_global_scale"):
314
+ destination = destination[0 if shard == "w1" else 1]
315
+ destination.copy_(loaded.reshape(destination.shape).to(destination.dtype))
316
+ self._seen.add((expert, shard, field))
317
+ return True if return_success else None
318
+
319
+ def parameter(name: str, shape: tuple[int, ...], dtype: torch.dtype) -> None:
320
+ value = nn.Parameter(
321
+ torch.empty(
322
+ shape,
323
+ dtype=dtype,
324
+ device=torch.cuda.current_device(),
325
+ ),
326
+ requires_grad=False,
327
+ )
328
+ set_weight_attrs(value, {**extra_weight_attrs, "weight_loader": weight_loader})
329
+ layer.register_parameter(name, value)
330
+
331
+ local_i = expected_local_i
332
+ parameter(
333
+ "w13_weight_packed",
334
+ (hot_count, 2 * local_i, HIDDEN // 2),
335
+ torch.uint8,
336
+ )
337
+ parameter(
338
+ "w2_weight_packed",
339
+ (hot_count, HIDDEN, local_i // 2),
340
+ torch.uint8,
341
+ )
342
+ parameter(
343
+ "w13_weight_scale",
344
+ (hot_count, 2 * local_i, HIDDEN // 16),
345
+ torch.float8_e4m3fn,
346
+ )
347
+ parameter(
348
+ "w2_weight_scale",
349
+ (hot_count, HIDDEN, local_i // 16),
350
+ torch.float8_e4m3fn,
351
+ )
352
+ parameter("w13_weight_global_scale", (hot_count, 2), torch.float32)
353
+ parameter("w2_weight_global_scale", (hot_count,), torch.float32)
354
+ parameter("w13_input_global_scale", (hot_count, 2), torch.float32)
355
+ parameter("w2_input_global_scale", (hot_count,), torch.float32)
356
+ print(
357
+ f"[laguna-hybrid] layer {self.layer_index}: allocated "
358
+ f"{hot_count} NVFP4 + {len(self.tail)} trellis{BITS} experts "
359
+ f"for TP{runtime_tp} rank {rank}",
360
+ flush=True,
361
+ )
362
+
363
+ def _validate_hot_load(self) -> None:
364
+ required = {
365
+ (expert, shard, field)
366
+ for expert in self.hot
367
+ for shard in ("w1", "w2", "w3")
368
+ for field in (
369
+ "weight_packed",
370
+ "weight_scale",
371
+ "weight_global_scale",
372
+ "input_global_scale",
373
+ )
374
+ }
375
+ missing = required - self._seen
376
+ if missing:
377
+ raise RuntimeError(
378
+ f"layer {self.layer_index}: missing {len(missing)} hot NVFP4 tensors; "
379
+ f"first={sorted(missing)[:5]}"
380
+ )
381
+
382
+ def _build_hot_kernel(self, layer) -> None:
383
+ backend, experts_cls = select_nvfp4_moe_backend(
384
+ config=dataclasses.replace(
385
+ self.moe,
386
+ num_experts=len(self.hot),
387
+ num_local_experts=len(self.hot),
388
+ num_logical_experts=len(self.hot),
389
+ intermediate_size=self.moe.intermediate_size_per_partition,
390
+ moe_parallel_config=FusedMoEParallelConfig.make_no_parallel(),
391
+ ),
392
+ weight_key=kNvfp4Static,
393
+ activation_key=kNvfp4Dynamic,
394
+ )
395
+ kept_moe = dataclasses.replace(
396
+ self.moe,
397
+ num_experts=len(self.hot),
398
+ num_local_experts=len(self.hot),
399
+ num_logical_experts=len(self.hot),
400
+ intermediate_size=self.moe.intermediate_size_per_partition,
401
+ moe_parallel_config=FusedMoEParallelConfig.make_no_parallel(),
402
+ )
403
+ compact = nn.Module()
404
+ compact.activation = getattr(layer, "activation", MoEActivation.SILU)
405
+ compact.moe_config = kept_moe
406
+ compact.local_num_experts = len(self.hot)
407
+ compact.swiglu_limit = getattr(layer, "swiglu_limit", None)
408
+ converted = convert_to_nvfp4_moe_kernel_format(
409
+ nvfp4_backend=backend,
410
+ layer=compact,
411
+ w13=layer.w13_weight_packed,
412
+ w13_scale=layer.w13_weight_scale,
413
+ w13_scale_2=(1.0 / layer.w13_weight_global_scale[:, 0].contiguous()),
414
+ a13_scale=(1.0 / layer.w13_input_global_scale),
415
+ w2=layer.w2_weight_packed,
416
+ w2_scale=layer.w2_weight_scale,
417
+ w2_scale_2=(1.0 / layer.w2_weight_global_scale),
418
+ a2_scale=(1.0 / layer.w2_input_global_scale),
419
+ is_act_and_mul=True,
420
+ )
421
+ (
422
+ compact.w13_weight,
423
+ compact.w13_weight_scale,
424
+ compact.w13_weight_scale_2,
425
+ compact.w13_input_scale,
426
+ compact.w2_weight,
427
+ compact.w2_weight_scale,
428
+ compact.w2_weight_scale_2,
429
+ compact.w2_input_scale,
430
+ ) = converted
431
+ quant_config = make_nvfp4_moe_quant_config(
432
+ backend=backend,
433
+ w13_scale=compact.w13_weight_scale,
434
+ w2_scale=compact.w2_weight_scale,
435
+ w13_scale_2=compact.w13_weight_scale_2,
436
+ w2_scale_2=compact.w2_weight_scale_2,
437
+ a13_scale=compact.w13_input_scale,
438
+ a2_scale=compact.w2_input_scale,
439
+ swiglu_limit=compact.swiglu_limit,
440
+ layer=compact,
441
+ )
442
+ kernel = make_nvfp4_moe_kernel(
443
+ moe_quant_config=quant_config,
444
+ moe_config=kept_moe,
445
+ experts_cls=experts_cls,
446
+ backend=backend,
447
+ routing_tables=None,
448
+ layer=compact,
449
+ )
450
+ kernel.fused_experts.process_weights_after_loading(compact)
451
+ self.hot_kernel = kernel
452
+ self.hot_layer = compact
453
+ self.hot_quant_config = quant_config
454
+ self.moe_kernel = kernel
455
+ self._hot_keepalive = converted
456
+
457
+ device = compact.w13_weight.device
458
+ # CutlassExpertsFp4 explicitly does not support expert_map. Its
459
+ # apply implementation accepts that argument for the modular
460
+ # kernel interface but does not forward it to run_cutlass_moe_fp4.
461
+ # Keep a lookup table here and remap router IDs before invoking the
462
+ # compact kernel instead.
463
+ hot_expert_map = torch.full(
464
+ (EXPERTS,), -1, dtype=torch.int32, device=device
465
+ )
466
+ for expert, local in self.hot_pos.items():
467
+ hot_expert_map[expert] = local
468
+ self.hot_expert_map = hot_expert_map
469
+
470
+ for name in (
471
+ "w13_weight_packed",
472
+ "w2_weight_packed",
473
+ "w13_weight_scale",
474
+ "w2_weight_scale",
475
+ "w13_weight_global_scale",
476
+ "w2_weight_global_scale",
477
+ "w13_input_global_scale",
478
+ "w2_input_global_scale",
479
+ ):
480
+ if hasattr(layer, name):
481
+ delattr(layer, name)
482
+ print(
483
+ f"[laguna-hybrid] layer {self.layer_index}: native hot kernel built "
484
+ f"with backend={backend} experts={len(self.hot)}",
485
+ flush=True,
486
+ )
487
+
488
+ def _load_tail(self, layer) -> None:
489
+ runtime_tp = get_tensor_model_parallel_world_size()
490
+ rank = get_tensor_model_parallel_rank()
491
+ if runtime_tp != self.runtime_tp:
492
+ raise RuntimeError(
493
+ f"Laguna hybrid TP changed during load: {self.runtime_tp} -> {runtime_tp}"
494
+ )
495
+ artifact_ranks = (
496
+ [rank] if runtime_tp == ARTIFACT_TP else list(range(ARTIFACT_TP))
497
+ )
498
+ device = self.hot_layer.w13_weight.device
499
+ count = len(self.tail)
500
+ shapes = {
501
+ "gate_proj": {
502
+ "trellis": (
503
+ count,
504
+ HIDDEN // 16,
505
+ (INTERMEDIATE // ARTIFACT_TP) // 16,
506
+ 16 * BITS,
507
+ ),
508
+ "suh": (count, HIDDEN),
509
+ "svh": (count, INTERMEDIATE // ARTIFACT_TP),
510
+ },
511
+ "up_proj": {
512
+ "trellis": (
513
+ count,
514
+ HIDDEN // 16,
515
+ (INTERMEDIATE // ARTIFACT_TP) // 16,
516
+ 16 * BITS,
517
+ ),
518
+ "suh": (count, HIDDEN),
519
+ "svh": (count, INTERMEDIATE // ARTIFACT_TP),
520
+ },
521
+ "down_proj": {
522
+ "trellis": (
523
+ count,
524
+ (INTERMEDIATE // ARTIFACT_TP) // 16,
525
+ HIDDEN // 16,
526
+ 16 * BITS,
527
+ ),
528
+ "suh": (count, INTERMEDIATE // ARTIFACT_TP),
529
+ "svh": (count, HIDDEN),
530
+ },
531
+ }
532
+ slabs_by_rank: dict[int, dict[str, dict[str, torch.Tensor]]] = {}
533
+ for artifact_rank in artifact_ranks:
534
+ slabs: dict[str, dict[str, torch.Tensor]] = {}
535
+ for projection, fields in shapes.items():
536
+ slabs[projection] = {
537
+ field: torch.empty(
538
+ shape,
539
+ dtype=(
540
+ torch.int16
541
+ if field == "trellis"
542
+ else torch.float16
543
+ ),
544
+ device=device,
545
+ )
546
+ for field, shape in fields.items()
547
+ }
548
+ slabs_by_rank[artifact_rank] = slabs
549
+ for local, expert in enumerate(self.tail):
550
+ path = (
551
+ TAIL_DIR
552
+ / TIER.lower()
553
+ / f"layer-{self.layer_index:02d}"
554
+ / f"expert-{expert:03d}.safetensors"
555
+ )
556
+ if not path.is_file():
557
+ raise FileNotFoundError(f"missing Laguna tail expert artifact: {path}")
558
+ with safe_open(str(path), framework="pt", device="cpu") as handle:
559
+ metadata = handle.metadata() or {}
560
+ expected_meta = {
561
+ "format": "exl3-trellis",
562
+ "bits": str(BITS),
563
+ "tp": str(ARTIFACT_TP),
564
+ "layer": str(self.layer_index),
565
+ "expert": str(expert),
566
+ "mcg_multiplier": hex(MCG),
567
+ "hessian": "routed-real-activations",
568
+ }
569
+ for key, expected in expected_meta.items():
570
+ if metadata.get(key) != expected:
571
+ raise RuntimeError(
572
+ f"{path}: metadata {key}={metadata.get(key)!r} != {expected!r}"
573
+ )
574
+ for artifact_rank in artifact_ranks:
575
+ for projection in ("gate_proj", "up_proj", "down_proj"):
576
+ marker = handle.get_tensor(
577
+ f"{projection}.rank{artifact_rank}.mcg"
578
+ )
579
+ if (int(marker.item()) & 0xFFFFFFFF) != MCG:
580
+ raise RuntimeError(f"{path}: wrong MCG marker")
581
+ for field in ("trellis", "suh", "svh"):
582
+ source = handle.get_tensor(
583
+ f"{projection}.rank{artifact_rank}.{field}"
584
+ )
585
+ destination = slabs_by_rank[artifact_rank][projection][
586
+ field
587
+ ][local]
588
+ if tuple(source.shape) != tuple(destination.shape):
589
+ raise RuntimeError(
590
+ f"{path}:{projection}.rank{artifact_rank}.{field} "
591
+ f"shape {tuple(source.shape)} != "
592
+ f"{tuple(destination.shape)}"
593
+ )
594
+ destination.copy_(source.to(destination.dtype))
595
+ self.tail_slabs = slabs_by_rank
596
+ pointers_by_rank: dict[int, list[torch.Tensor]] = {}
597
+ for artifact_rank, slabs in slabs_by_rank.items():
598
+ pointers: list[torch.Tensor] = []
599
+ for projection in ("gate_proj", "up_proj", "down_proj"):
600
+ for field in ("trellis", "suh", "svh"):
601
+ slab = slabs[projection][field]
602
+ step = slab.stride(0) * slab.element_size()
603
+ pointers.append(
604
+ torch.tensor(
605
+ [
606
+ slab.data_ptr() + index * step
607
+ for index in range(count)
608
+ ],
609
+ dtype=torch.int64,
610
+ device=device,
611
+ )
612
+ )
613
+ pointers_by_rank[artifact_rank] = pointers
614
+ self.tail_ptrs = pointers_by_rank
615
+ tail_lut = torch.full((EXPERTS,), count, dtype=torch.int64, device=device)
616
+ for expert, local in self.tail_pos.items():
617
+ tail_lut[expert] = local
618
+ self.tail_lut = tail_lut
619
+
620
+ from vllm.config import get_current_vllm_config
621
+
622
+ max_rows = int(
623
+ get_current_vllm_config().scheduler_config.max_num_batched_tokens
624
+ )
625
+ self.runtime = _runtime(device, max_rows)
626
+ print(
627
+ f"[laguna-hybrid] layer {self.layer_index}: loaded {count} calibrated "
628
+ f"trellis{BITS} experts from artifact ranks {artifact_ranks} "
629
+ f"for TP{runtime_tp} rank {rank}",
630
+ flush=True,
631
+ )
632
+
633
+ def _validate_execution_contract(self, layer) -> None:
634
+ if not bool(getattr(self.moe, "is_act_and_mul", False)):
635
+ raise RuntimeError(
636
+ "Laguna hybrid requires SwiGLU act-and-multiply experts"
637
+ )
638
+ activation = getattr(layer, "activation", MoEActivation.SILU)
639
+ if activation != MoEActivation.SILU:
640
+ raise RuntimeError(
641
+ f"Laguna hybrid requires SiLU experts, got {activation!r}"
642
+ )
643
+ swiglu_limit = getattr(layer, "swiglu_limit", None)
644
+ if swiglu_limit not in (None, 0, 0.0):
645
+ raise RuntimeError(
646
+ "Laguna hybrid EXL3 tail does not support a nonzero "
647
+ f"SwiGLU limit, got {swiglu_limit!r}"
648
+ )
649
+ if bool(getattr(layer, "apply_router_weight_on_input", False)):
650
+ raise RuntimeError(
651
+ "Laguna hybrid requires router weights to be applied to "
652
+ "expert outputs"
653
+ )
654
+
655
+ def process_weights_after_loading(self, layer) -> None:
656
+ self._validate_execution_contract(layer)
657
+ self._validate_hot_load()
658
+ self._build_hot_kernel(layer)
659
+ self._load_tail(layer)
660
+
661
+ def get_fused_moe_quant_config(self, layer):
662
+ if self.hot_quant_config is None:
663
+ raise RuntimeError("Laguna hot quant config requested before initialization")
664
+ return self.hot_quant_config
665
+
666
+ def _apply_tail(self, x, topk_weights, topk_ids):
667
+ runtime = self.runtime
668
+ if runtime is None or self.tail_lut is None:
669
+ raise RuntimeError("Laguna trellis runtime is not initialized")
670
+ rows = int(x.shape[0])
671
+ if rows > int(runtime["max_rows"]):
672
+ raise RuntimeError(
673
+ f"Laguna trellis rows {rows} exceed planned capacity "
674
+ f"{runtime['max_rows']}"
675
+ )
676
+ xh = runtime["xh"][:rows]
677
+ xh.copy_(x)
678
+ out = runtime["out32"][:rows]
679
+ out.zero_()
680
+ local_ids = self.tail_lut[topk_ids.long()]
681
+ weights = topk_weights.to(torch.float16)
682
+ count = len(self.tail)
683
+ cap = int(runtime["cap"])
684
+ for start in range(0, rows, cap):
685
+ chunk_rows = min(cap, rows - start)
686
+ flat = local_ids[start : start + chunk_rows].reshape(-1)
687
+ order = torch.argsort(flat)
688
+ token = runtime["flat_token"][: chunk_rows * TOP_K].index_select(
689
+ 0, order
690
+ ).contiguous()
691
+ sorted_weights = weights[start : start + chunk_rows].reshape(-1).index_select(
692
+ 0, order
693
+ ).contiguous()
694
+ counts = torch.zeros(count + 1, dtype=torch.int64, device=x.device)
695
+ counts.scatter_add_(0, flat, runtime["ones"][: chunk_rows * TOP_K])
696
+ # The EXL3 fused down projection scatter-adds with atomicAdd.
697
+ # In TP1, executing both physically stored TP2 artifact slices
698
+ # into the same zeroed fp32 buffer reconstructs the exact
699
+ # tensor-parallel sum without allocating inside graph replay.
700
+ for artifact_rank in sorted(self.tail_ptrs):
701
+ _exl3.exl3_moe(
702
+ xh[start : start + chunk_rows],
703
+ out[start : start + chunk_rows],
704
+ counts,
705
+ token,
706
+ sorted_weights,
707
+ runtime["tg"],
708
+ runtime["tu"],
709
+ runtime["ig"],
710
+ runtime["iu"],
711
+ 0,
712
+ BITS,
713
+ BITS,
714
+ BITS,
715
+ *self.tail_ptrs[artifact_rank],
716
+ True,
717
+ False,
718
+ True,
719
+ False,
720
+ True,
721
+ False,
722
+ 0.0,
723
+ )
724
+ return out
725
+
726
+ def apply(
727
+ self,
728
+ layer,
729
+ x,
730
+ topk_weights,
731
+ topk_ids,
732
+ shared_experts: SharedExperts | None,
733
+ shared_experts_input,
734
+ ):
735
+ if (
736
+ self.hot_kernel is None
737
+ or self.hot_expert_map is None
738
+ or self.hot_layer is None
739
+ ):
740
+ raise RuntimeError("Laguna hot kernel is not initialized")
741
+ # The router produces original IDs in [0, 256). Remap hot routes
742
+ # into the compact [0, hot_count) space. Tail routes are sent to
743
+ # the valid placeholder expert 0 with an exact zero router weight;
744
+ # this avoids unsupported/out-of-range IDs without renormalizing
745
+ # the original top-k weights.
746
+ local_hot_ids = self.hot_expert_map[topk_ids.long()]
747
+ hot_route = local_hot_ids >= 0
748
+ local_hot_ids = torch.where(
749
+ hot_route, local_hot_ids, torch.zeros_like(local_hot_ids)
750
+ )
751
+ local_hot_weights = topk_weights * hot_route.to(topk_weights.dtype)
752
+ hot = self.hot_kernel.apply(
753
+ x,
754
+ self.hot_layer.w13_weight,
755
+ self.hot_layer.w2_weight,
756
+ local_hot_weights,
757
+ local_hot_ids,
758
+ activation=self.hot_layer.activation,
759
+ global_num_experts=len(self.hot),
760
+ expert_map=None,
761
+ apply_router_weight_on_input=layer.apply_router_weight_on_input,
762
+ shared_experts=shared_experts,
763
+ shared_experts_input=shared_experts_input,
764
+ )
765
+ tail = self._apply_tail(x, topk_weights, topk_ids)
766
+ return torch.add(hot.float(), tail).to(x.dtype)
767
+
768
+
769
+ import vllm.model_executor.layers.quantization.compressed_tensors.compressed_tensors_moe.compressed_tensors_moe_w4a4_nvfp4 as _target
770
+
771
+ _target.CompressedTensorsW4A4Nvfp4MoEMethod = LagunaHybridNvfp4Exl3MoE
772
+ print(
773
+ f"[laguna-hybrid] installed {TIER} runtime: bits={BITS} "
774
+ f"artifact_tp={ARTIFACT_TP} runtime_tp=1-or-2 "
775
+ f"map={MAP_PATH} tail={TAIL_DIR} CUDA graphs unchanged",
776
+ flush=True,
777
+ )
special_tokens_map.json ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": "〈|EOS|〉",
3
+ "cls_token": "〈|CLS|〉",
4
+ "eos_token": "〈|EOS|〉",
5
+ "mask_token": "〈|MASK|〉",
6
+ "pad_token": "〈|PAD|〉",
7
+ "sep_token": "〈|SEP|〉",
8
+ "unk_token": "〈|UNK|〉"
9
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,576 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "0": {
4
+ "content": "〈|UNK|〉",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false,
9
+ "special": true
10
+ },
11
+ "1": {
12
+ "content": "〈|CODE_START|〉",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "2": {
20
+ "content": "〈|EOS|〉",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "3": {
28
+ "content": "〈|CODE_END|〉",
29
+ "lstrip": false,
30
+ "normalized": false,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ },
35
+ "4": {
36
+ "content": "〈|META_START|〉",
37
+ "lstrip": false,
38
+ "normalized": false,
39
+ "rstrip": false,
40
+ "single_word": false,
41
+ "special": true
42
+ },
43
+ "5": {
44
+ "content": "〈|META_END|〉",
45
+ "lstrip": false,
46
+ "normalized": false,
47
+ "rstrip": false,
48
+ "single_word": false,
49
+ "special": true
50
+ },
51
+ "6": {
52
+ "content": "〈|FIM_MIDDLE|〉",
53
+ "lstrip": false,
54
+ "normalized": false,
55
+ "rstrip": false,
56
+ "single_word": false,
57
+ "special": true
58
+ },
59
+ "7": {
60
+ "content": "〈|FIM_SUFFIX|〉",
61
+ "lstrip": false,
62
+ "normalized": false,
63
+ "rstrip": false,
64
+ "single_word": false,
65
+ "special": true
66
+ },
67
+ "8": {
68
+ "content": "〈|SEP|〉",
69
+ "lstrip": false,
70
+ "normalized": false,
71
+ "rstrip": false,
72
+ "single_word": false,
73
+ "special": true
74
+ },
75
+ "9": {
76
+ "content": "〈|PAD|〉",
77
+ "lstrip": false,
78
+ "normalized": false,
79
+ "rstrip": false,
80
+ "single_word": false,
81
+ "special": true
82
+ },
83
+ "10": {
84
+ "content": "〈|CLS|〉",
85
+ "lstrip": false,
86
+ "normalized": false,
87
+ "rstrip": false,
88
+ "single_word": false,
89
+ "special": true
90
+ },
91
+ "11": {
92
+ "content": "〈|FIM_START|〉",
93
+ "lstrip": false,
94
+ "normalized": false,
95
+ "rstrip": false,
96
+ "single_word": false,
97
+ "special": true
98
+ },
99
+ "12": {
100
+ "content": "〈|MASK|〉",
101
+ "lstrip": false,
102
+ "normalized": false,
103
+ "rstrip": false,
104
+ "single_word": false,
105
+ "special": true
106
+ },
107
+ "13": {
108
+ "content": "|◊|",
109
+ "lstrip": false,
110
+ "normalized": false,
111
+ "rstrip": false,
112
+ "single_word": false,
113
+ "special": true
114
+ },
115
+ "14": {
116
+ "content": "〈|",
117
+ "lstrip": false,
118
+ "normalized": false,
119
+ "rstrip": false,
120
+ "single_word": false,
121
+ "special": true
122
+ },
123
+ "15": {
124
+ "content": "|〉",
125
+ "lstrip": false,
126
+ "normalized": false,
127
+ "rstrip": false,
128
+ "single_word": false,
129
+ "special": true
130
+ },
131
+ "16": {
132
+ "content": "〈|/",
133
+ "lstrip": false,
134
+ "normalized": false,
135
+ "rstrip": false,
136
+ "single_word": false,
137
+ "special": true
138
+ },
139
+ "17": {
140
+ "content": "/|〉",
141
+ "lstrip": false,
142
+ "normalized": false,
143
+ "rstrip": false,
144
+ "single_word": false,
145
+ "special": true
146
+ },
147
+ "20": {
148
+ "content": "〈|SPECIAL_1|〉",
149
+ "lstrip": false,
150
+ "normalized": false,
151
+ "rstrip": false,
152
+ "single_word": false,
153
+ "special": true
154
+ },
155
+ "21": {
156
+ "content": "〈|SPECIAL_2|〉",
157
+ "lstrip": false,
158
+ "normalized": false,
159
+ "rstrip": false,
160
+ "single_word": false,
161
+ "special": true
162
+ },
163
+ "22": {
164
+ "content": "〈|SPECIAL_3|〉",
165
+ "lstrip": false,
166
+ "normalized": false,
167
+ "rstrip": false,
168
+ "single_word": false,
169
+ "special": true
170
+ },
171
+ "27": {
172
+ "content": "〈|SPECIAL_8|〉",
173
+ "lstrip": false,
174
+ "normalized": false,
175
+ "rstrip": false,
176
+ "single_word": false,
177
+ "special": true
178
+ },
179
+ "28": {
180
+ "content": "〈|SPECIAL_9|〉",
181
+ "lstrip": false,
182
+ "normalized": false,
183
+ "rstrip": false,
184
+ "single_word": false,
185
+ "special": true
186
+ },
187
+ "29": {
188
+ "content": "〈|SPECIAL_10|〉",
189
+ "lstrip": false,
190
+ "normalized": false,
191
+ "rstrip": false,
192
+ "single_word": false,
193
+ "special": true
194
+ },
195
+ "30": {
196
+ "content": "〈|SPECIAL_11|〉",
197
+ "lstrip": false,
198
+ "normalized": false,
199
+ "rstrip": false,
200
+ "single_word": false,
201
+ "special": true
202
+ },
203
+ "31": {
204
+ "content": "〈|SPECIAL_12|〉",
205
+ "lstrip": false,
206
+ "normalized": false,
207
+ "rstrip": false,
208
+ "single_word": false,
209
+ "special": true
210
+ },
211
+ "32": {
212
+ "content": "〈|SPECIAL_13|〉",
213
+ "lstrip": false,
214
+ "normalized": false,
215
+ "rstrip": false,
216
+ "single_word": false,
217
+ "special": true
218
+ },
219
+ "33": {
220
+ "content": "〈|SPECIAL_14|〉",
221
+ "lstrip": false,
222
+ "normalized": false,
223
+ "rstrip": false,
224
+ "single_word": false,
225
+ "special": true
226
+ },
227
+ "34": {
228
+ "content": "〈|SPECIAL_15|〉",
229
+ "lstrip": false,
230
+ "normalized": false,
231
+ "rstrip": false,
232
+ "single_word": false,
233
+ "special": true
234
+ },
235
+ "35": {
236
+ "content": "〈|SPECIAL_16|〉",
237
+ "lstrip": false,
238
+ "normalized": false,
239
+ "rstrip": false,
240
+ "single_word": false,
241
+ "special": true
242
+ },
243
+ "36": {
244
+ "content": "〈|SPECIAL_17|〉",
245
+ "lstrip": false,
246
+ "normalized": false,
247
+ "rstrip": false,
248
+ "single_word": false,
249
+ "special": true
250
+ },
251
+ "37": {
252
+ "content": "〈|SPECIAL_18|〉",
253
+ "lstrip": false,
254
+ "normalized": false,
255
+ "rstrip": false,
256
+ "single_word": false,
257
+ "special": true
258
+ },
259
+ "38": {
260
+ "content": "〈|SPECIAL_19|〉",
261
+ "lstrip": false,
262
+ "normalized": false,
263
+ "rstrip": false,
264
+ "single_word": false,
265
+ "special": true
266
+ },
267
+ "39": {
268
+ "content": "〈|SPECIAL_20|〉",
269
+ "lstrip": false,
270
+ "normalized": false,
271
+ "rstrip": false,
272
+ "single_word": false,
273
+ "special": true
274
+ },
275
+ "40": {
276
+ "content": "〈|SPECIAL_21|〉",
277
+ "lstrip": false,
278
+ "normalized": false,
279
+ "rstrip": false,
280
+ "single_word": false,
281
+ "special": true
282
+ },
283
+ "41": {
284
+ "content": "〈|SPECIAL_22|〉",
285
+ "lstrip": false,
286
+ "normalized": false,
287
+ "rstrip": false,
288
+ "single_word": false,
289
+ "special": true
290
+ },
291
+ "42": {
292
+ "content": "〈|SPECIAL_23|〉",
293
+ "lstrip": false,
294
+ "normalized": false,
295
+ "rstrip": false,
296
+ "single_word": false,
297
+ "special": true
298
+ },
299
+ "43": {
300
+ "content": "〈|SPECIAL_24|〉",
301
+ "lstrip": false,
302
+ "normalized": false,
303
+ "rstrip": false,
304
+ "single_word": false,
305
+ "special": true
306
+ },
307
+ "44": {
308
+ "content": "〈|SPECIAL_25|〉",
309
+ "lstrip": false,
310
+ "normalized": false,
311
+ "rstrip": false,
312
+ "single_word": false,
313
+ "special": true
314
+ },
315
+ "45": {
316
+ "content": "〈|SPECIAL_26|〉",
317
+ "lstrip": false,
318
+ "normalized": false,
319
+ "rstrip": false,
320
+ "single_word": false,
321
+ "special": true
322
+ },
323
+ "46": {
324
+ "content": "〈|SPECIAL_27|〉",
325
+ "lstrip": false,
326
+ "normalized": false,
327
+ "rstrip": false,
328
+ "single_word": false,
329
+ "special": true
330
+ },
331
+ "47": {
332
+ "content": "〈|SPECIAL_28|〉",
333
+ "lstrip": false,
334
+ "normalized": false,
335
+ "rstrip": false,
336
+ "single_word": false,
337
+ "special": true
338
+ },
339
+ "48": {
340
+ "content": "〈|SPECIAL_29|〉",
341
+ "lstrip": false,
342
+ "normalized": false,
343
+ "rstrip": false,
344
+ "single_word": false,
345
+ "special": true
346
+ },
347
+ "49": {
348
+ "content": "〈|SPECIAL_30|〉",
349
+ "lstrip": false,
350
+ "normalized": false,
351
+ "rstrip": false,
352
+ "single_word": false,
353
+ "special": true
354
+ },
355
+ "50": {
356
+ "content": "〈|SPECIAL_31|〉",
357
+ "lstrip": false,
358
+ "normalized": false,
359
+ "rstrip": false,
360
+ "single_word": false,
361
+ "special": true
362
+ },
363
+ "51": {
364
+ "content": "〈|SPECIAL_32|〉",
365
+ "lstrip": false,
366
+ "normalized": false,
367
+ "rstrip": false,
368
+ "single_word": false,
369
+ "special": true
370
+ },
371
+ "52": {
372
+ "content": "〈|SPECIAL_33|〉",
373
+ "lstrip": false,
374
+ "normalized": false,
375
+ "rstrip": false,
376
+ "single_word": false,
377
+ "special": true
378
+ },
379
+ "53": {
380
+ "content": "〈|SPECIAL_34|〉",
381
+ "lstrip": false,
382
+ "normalized": false,
383
+ "rstrip": false,
384
+ "single_word": false,
385
+ "special": true
386
+ },
387
+ "54": {
388
+ "content": "〈|SPECIAL_35|〉",
389
+ "lstrip": false,
390
+ "normalized": false,
391
+ "rstrip": false,
392
+ "single_word": false,
393
+ "special": true
394
+ },
395
+ "55": {
396
+ "content": "〈|SPECIAL_36|〉",
397
+ "lstrip": false,
398
+ "normalized": false,
399
+ "rstrip": false,
400
+ "single_word": false,
401
+ "special": true
402
+ },
403
+ "56": {
404
+ "content": "〈|SPECIAL_37|〉",
405
+ "lstrip": false,
406
+ "normalized": false,
407
+ "rstrip": false,
408
+ "single_word": false,
409
+ "special": true
410
+ },
411
+ "57": {
412
+ "content": "〈|SPECIAL_38|〉",
413
+ "lstrip": false,
414
+ "normalized": false,
415
+ "rstrip": false,
416
+ "single_word": false,
417
+ "special": true
418
+ },
419
+ "58": {
420
+ "content": "〈|SPECIAL_39|〉",
421
+ "lstrip": false,
422
+ "normalized": false,
423
+ "rstrip": false,
424
+ "single_word": false,
425
+ "special": true
426
+ },
427
+ "59": {
428
+ "content": "〈|SPECIAL_40|〉",
429
+ "lstrip": false,
430
+ "normalized": false,
431
+ "rstrip": false,
432
+ "single_word": false,
433
+ "special": true
434
+ },
435
+ "60": {
436
+ "content": "〈|SPECIAL_41|〉",
437
+ "lstrip": false,
438
+ "normalized": false,
439
+ "rstrip": false,
440
+ "single_word": false,
441
+ "special": true
442
+ },
443
+ "61": {
444
+ "content": "〈|SPECIAL_42|〉",
445
+ "lstrip": false,
446
+ "normalized": false,
447
+ "rstrip": false,
448
+ "single_word": false,
449
+ "special": true
450
+ },
451
+ "62": {
452
+ "content": "〈|SPECIAL_43|〉",
453
+ "lstrip": false,
454
+ "normalized": false,
455
+ "rstrip": false,
456
+ "single_word": false,
457
+ "special": true
458
+ },
459
+ "63": {
460
+ "content": "〈|SPECIAL_44|〉",
461
+ "lstrip": false,
462
+ "normalized": false,
463
+ "rstrip": false,
464
+ "single_word": false,
465
+ "special": true
466
+ },
467
+ "64": {
468
+ "content": "〈|SPECIAL_45|〉",
469
+ "lstrip": false,
470
+ "normalized": false,
471
+ "rstrip": false,
472
+ "single_word": false,
473
+ "special": true
474
+ },
475
+ "65": {
476
+ "content": "〈|SPECIAL_46|〉",
477
+ "lstrip": false,
478
+ "normalized": false,
479
+ "rstrip": false,
480
+ "single_word": false,
481
+ "special": true
482
+ },
483
+ "66": {
484
+ "content": "〈|SPECIAL_47|〉",
485
+ "lstrip": false,
486
+ "normalized": false,
487
+ "rstrip": false,
488
+ "single_word": false,
489
+ "special": true
490
+ },
491
+ "67": {
492
+ "content": "〈|SPECIAL_48|〉",
493
+ "lstrip": false,
494
+ "normalized": false,
495
+ "rstrip": false,
496
+ "single_word": false,
497
+ "special": true
498
+ },
499
+ "68": {
500
+ "content": "〈|SPECIAL_49|〉",
501
+ "lstrip": false,
502
+ "normalized": false,
503
+ "rstrip": false,
504
+ "single_word": false,
505
+ "special": true
506
+ },
507
+ "69": {
508
+ "content": "〈|SPECIAL_50|〉",
509
+ "lstrip": false,
510
+ "normalized": false,
511
+ "rstrip": false,
512
+ "single_word": false,
513
+ "special": true
514
+ },
515
+ "18": {
516
+ "content": "<think>",
517
+ "single_word": false,
518
+ "lstrip": false,
519
+ "rstrip": false,
520
+ "normalized": false,
521
+ "special": false
522
+ },
523
+ "19": {
524
+ "content": "</think>",
525
+ "single_word": false,
526
+ "lstrip": false,
527
+ "rstrip": false,
528
+ "normalized": false,
529
+ "special": false
530
+ },
531
+ "23": {
532
+ "content": "<assistant>",
533
+ "single_word": false,
534
+ "lstrip": false,
535
+ "rstrip": false,
536
+ "normalized": false,
537
+ "special": false
538
+ },
539
+ "24": {
540
+ "content": "</assistant>",
541
+ "single_word": false,
542
+ "lstrip": false,
543
+ "rstrip": false,
544
+ "normalized": false,
545
+ "special": true
546
+ },
547
+ "25": {
548
+ "content": "<tool_call>",
549
+ "single_word": false,
550
+ "lstrip": false,
551
+ "rstrip": false,
552
+ "normalized": false,
553
+ "special": false
554
+ },
555
+ "26": {
556
+ "content": "</tool_call>",
557
+ "single_word": false,
558
+ "lstrip": false,
559
+ "rstrip": false,
560
+ "normalized": false,
561
+ "special": false
562
+ }
563
+ },
564
+ "bos_token": "〈|EOS|〉",
565
+ "clean_up_tokenization_spaces": false,
566
+ "cls_token": "〈|CLS|〉",
567
+ "eos_token": "〈|EOS|〉",
568
+ "extra_special_tokens": {},
569
+ "mask_token": "〈|MASK|〉",
570
+ "model_max_length": 1000000000000000019884624838656,
571
+ "pad_token": "〈|PAD|〉",
572
+ "sep_token": "〈|SEP|〉",
573
+ "tokenizer_class": "PreTrainedTokenizerFast",
574
+ "unk_token": "〈|UNK|〉",
575
+ "chat_template": "{% include 'chat_template.jinja' %}"
576
+ }