-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQwen3.5_Tensor_Analysis_Report.txt
More file actions
337 lines (270 loc) · 7.2 KB
/
Qwen3.5_Tensor_Analysis_Report.txt
File metadata and controls
337 lines (270 loc) · 7.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
============================================================
QWEN 3.5 GGUF TENSOR ANALYSIS REPORT
============================================================
Model: Qwen3.5-4B-Uncensored-HauhauCS-Aggressive-Q8_0.gguf
Analysis Date: 2026-03-30
METADATA:
hidden_dim (embedding_length): 2560
n_layers: 32
n_heads: 16
n_kv_heads: 4
head_dim: 160
ffn_dim: 9216
ssm_conv_kernel: 4
ssm_inner_size: 4096
ssm_dt_rank: 32
ssm_state_size: 128
ssm_group_count: 16
vocab_size: 248320
TOTALS:
Total tensors: 426
Total model size: 4.16 GB
============================================================
LAYER 0 TENSORS:
============================================================
blk.0.attn_gate.weight:
dtype: q8_0
shape: [2560, 4096]
size: 11,141,120 bytes
blk.0.attn_norm.weight:
dtype: f32
shape: [2560]
size: 10,240 bytes
blk.0.attn_qkv.weight:
dtype: q8_0
shape: [2560, 8192]
size: 22,282,240 bytes
blk.0.ffn_down.weight:
dtype: q8_0
shape: [9216, 2560]
size: 25,067,520 bytes
blk.0.ffn_gate.weight:
dtype: q8_0
shape: [2560, 9216]
size: 25,067,520 bytes
blk.0.ffn_up.weight:
dtype: q8_0
shape: [2560, 9216]
size: 25,067,520 bytes
blk.0.post_attention_norm.weight:
dtype: f32
shape: [2560]
size: 10,240 bytes
blk.0.ssm_a:
dtype: f32
shape: [32]
size: 128 bytes
blk.0.ssm_alpha.weight:
dtype: q8_0
shape: [2560, 32]
size: 87,040 bytes
blk.0.ssm_beta.weight:
dtype: q8_0
shape: [2560, 32]
size: 87,040 bytes
blk.0.ssm_conv1d.weight:
dtype: f32
shape: [4, 8192]
size: 131,072 bytes
blk.0.ssm_dt.bias:
dtype: f32
shape: [32]
size: 128 bytes
blk.0.ssm_norm.weight:
dtype: f32
shape: [128]
size: 512 bytes
blk.0.ssm_out.weight:
dtype: q8_0
shape: [4096, 2560]
size: 11,141,120 bytes
============================================================
LAYER 1 TENSORS:
============================================================
blk.1.attn_gate.weight:
dtype: q8_0
shape: [2560, 4096]
size: 11,141,120 bytes
blk.1.attn_norm.weight:
dtype: f32
shape: [2560]
size: 10,240 bytes
blk.1.attn_qkv.weight:
dtype: q8_0
shape: [2560, 8192]
size: 22,282,240 bytes
blk.1.ffn_down.weight:
dtype: q8_0
shape: [9216, 2560]
size: 25,067,520 bytes
blk.1.ffn_gate.weight:
dtype: q8_0
shape: [2560, 9216]
size: 25,067,520 bytes
blk.1.ffn_up.weight:
dtype: q8_0
shape: [2560, 9216]
size: 25,067,520 bytes
blk.1.post_attention_norm.weight:
dtype: f32
shape: [2560]
size: 10,240 bytes
blk.1.ssm_a:
dtype: f32
shape: [32]
size: 128 bytes
blk.1.ssm_alpha.weight:
dtype: q8_0
shape: [2560, 32]
size: 87,040 bytes
blk.1.ssm_beta.weight:
dtype: q8_0
shape: [2560, 32]
size: 87,040 bytes
blk.1.ssm_conv1d.weight:
dtype: f32
shape: [4, 8192]
size: 131,072 bytes
blk.1.ssm_dt.bias:
dtype: f32
shape: [32]
size: 128 bytes
blk.1.ssm_norm.weight:
dtype: f32
shape: [128]
size: 512 bytes
blk.1.ssm_out.weight:
dtype: q8_0
shape: [4096, 2560]
size: 11,141,120 bytes
============================================================
LAYER 2 TENSORS:
============================================================
blk.2.attn_gate.weight:
dtype: q8_0
shape: [2560, 4096]
size: 11,141,120 bytes
blk.2.attn_norm.weight:
dtype: f32
shape: [2560]
size: 10,240 bytes
blk.2.attn_qkv.weight:
dtype: q8_0
shape: [2560, 8192]
size: 22,282,240 bytes
blk.2.ffn_down.weight:
dtype: q8_0
shape: [9216, 2560]
size: 25,067,520 bytes
blk.2.ffn_gate.weight:
dtype: q8_0
shape: [2560, 9216]
size: 25,067,520 bytes
blk.2.ffn_up.weight:
dtype: q8_0
shape: [2560, 9216]
size: 25,067,520 bytes
blk.2.post_attention_norm.weight:
dtype: f32
shape: [2560]
size: 10,240 bytes
blk.2.ssm_a:
dtype: f32
shape: [32]
size: 128 bytes
blk.2.ssm_alpha.weight:
dtype: q8_0
shape: [2560, 32]
size: 87,040 bytes
blk.2.ssm_beta.weight:
dtype: q8_0
shape: [2560, 32]
size: 87,040 bytes
blk.2.ssm_conv1d.weight:
dtype: f32
shape: [4, 8192]
size: 131,072 bytes
blk.2.ssm_dt.bias:
dtype: f32
shape: [32]
size: 128 bytes
blk.2.ssm_norm.weight:
dtype: f32
shape: [128]
size: 512 bytes
blk.2.ssm_out.weight:
dtype: q8_0
shape: [4096, 2560]
size: 11,141,120 bytes
============================================================
CRITICAL MISMATCHES FOUND:
============================================================
1. ssm_conv1d.weight:
Metadata expects: [4, 2560]
Actual shape: [4, 8192]
Issue: shape[1] is 3.2x LARGER than metadata reports
Hidden_dim mismatch: 2560 (metadata) vs 8192 (actual)
This affects: ssm_conv1d.weight second dimension
Impact: 68% data loss if using metadata dimensions
2. attn_qkv.weight (fused tensor - not separate Q/K/V):
Shape: [2560, 8192]
Expected separate: attn_q.weight, attn_k.weight, attn_v.weight
Note: This model uses FUSED QKV tensors!
The 8192 dimension breakdown for GQA with 4 KV heads:
- Q: 2560 (16 heads × 160 head_dim)
- K: 2560 (4 heads × 160 head_dim × 4 for GQA?)
- V: 3072 (remainder?)
Actually: 8192 = 5120 + 3072 where:
- Q: 5120 = 32 heads (???) × 160
- K+V: 3072 = 4 heads × 2 × 384 (different head_dim?)
OR more likely: This uses a different projection scheme
where hidden_dim is expanded in the attention mechanism.
3. SSM tensor naming convention different:
Found tensors:
- ssm_a (1D vector, shape [32])
- ssm_alpha.weight (shape [2560, 32])
- ssm_beta.weight (shape [2560, 32])
- ssm_dt.bias (shape [32])
- ssm_conv1d.weight (shape [4, 8192])
- ssm_norm.weight (shape [128])
- ssm_out.weight (shape [4096, 2560])
Expected (from echo-core inference code):
- ssm_A.weight (matrix)
- ssm_B.weight (matrix)
- ssm_C.weight (matrix)
- ssm_D.weight (vector)
- ssm_dt.weight (matrix)
- ssm_x.weight (matrix)
This is a DIFFERENT SSM architecture than Mamba-2!
Qwen 3.5 appears to use a custom state space model design.
4. attn_gate.weight instead of attn_output.weight:
Found: blk.0.attn_gate.weight with shape [2560, 4096]
Expected: blk.0.attn_output.weight
This suggests the model uses:
- Fused QKV projection
- Attention gate mechanism
- Different output projection scheme
============================================================
KEY FINDINGS SUMMARY:
============================================================
Architecture: Qwen 3.5 with hybrid attention/SSM layers
Model Type: Hybrid transformer (every 4th layer is full attention)
Critical Issues:
1. Hidden dimension mismatch: metadata reports 2560, tensors use 8192
2. Uses fused QKV tensors instead of separate projections
3. SSM architecture is different from standard Mamba-2
4. Uses attn_gate instead of attn_output for attention
Recommendations:
1. Update detectActualDimensions() to handle 8192 hidden_dim
2. Add support for fused QKV tensor splitting
3. Implement new SSM kernel for Qwen 3.5's custom SSM design
4. Handle attn_gate tensors in attention mechanism
Tensor Counts:
- Total: 426 tensors
- SSM layers: 24 layers have SSM tensors
- Full attention layers: 8 layers (every 4th)
- Attention tensors per SSM layer: ~13
- Model size: 4.16 GB
Quantization: Q8_0 (8-bit quantization with block size 32)
File type: 7 (GGUF v3)
Architecture prefix: qwen35