Schestex commited on
Commit
ff56f21
·
verified ·
1 Parent(s): d7ab072

update model and documentation

Browse files
.gitattributes CHANGED
@@ -1,36 +1,3 @@
1
- *.7z filter=lfs diff=lfs merge=lfs -text
2
- *.arrow filter=lfs diff=lfs merge=lfs -text
3
- *.bin filter=lfs diff=lfs merge=lfs -text
4
- *.bz2 filter=lfs diff=lfs merge=lfs -text
5
- *.ckpt filter=lfs diff=lfs merge=lfs -text
6
- *.ftz filter=lfs diff=lfs merge=lfs -text
7
- *.gz filter=lfs diff=lfs merge=lfs -text
8
- *.h5 filter=lfs diff=lfs merge=lfs -text
9
- *.joblib filter=lfs diff=lfs merge=lfs -text
10
- *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
- *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
- *.model filter=lfs diff=lfs merge=lfs -text
13
- *.msgpack filter=lfs diff=lfs merge=lfs -text
14
- *.npy filter=lfs diff=lfs merge=lfs -text
15
- *.npz filter=lfs diff=lfs merge=lfs -text
16
- *.onnx filter=lfs diff=lfs merge=lfs -text
17
- *.ot filter=lfs diff=lfs merge=lfs -text
18
- *.parquet filter=lfs diff=lfs merge=lfs -text
19
- *.pb filter=lfs diff=lfs merge=lfs -text
20
- *.pickle filter=lfs diff=lfs merge=lfs -text
21
- *.pkl filter=lfs diff=lfs merge=lfs -text
22
- *.pt filter=lfs diff=lfs merge=lfs -text
23
- *.pth filter=lfs diff=lfs merge=lfs -text
24
- *.rar filter=lfs diff=lfs merge=lfs -text
25
  *.safetensors filter=lfs diff=lfs merge=lfs -text
26
- saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
- *.tar.* filter=lfs diff=lfs merge=lfs -text
28
- *.tar filter=lfs diff=lfs merge=lfs -text
29
- *.tflite filter=lfs diff=lfs merge=lfs -text
30
- *.tgz filter=lfs diff=lfs merge=lfs -text
31
- *.wasm filter=lfs diff=lfs merge=lfs -text
32
- *.xz 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
- thinkingcap-qwen3.8-27b.ninfer filter=lfs diff=lfs merge=lfs -text
 
1
+ *.ninfer filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  *.safetensors filter=lfs diff=lfs merge=lfs -text
3
+ *.gguf filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
.gitignore ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ *.tmp
2
+ *.part
3
+ __pycache__/
MODEL_FILE.txt ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ Add the model binary to the repository root before pushing:
2
+
3
+ thinkingcap-qwen3.8-27b-d48.ninfer
4
+
5
+ Expected exact size:
6
+ 16705529348 bytes
7
+
8
+ The ZIP intentionally does not contain the model binary.
PROVENANCE.md ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Provenance
2
+
3
+ ## Target
4
+
5
+ - Model family: ThinkingCap-Qwen3.8-27B
6
+ - NInfer variant: D48
7
+ - Base recipe: `qwen3_8_27b`
8
+ - Components: text
9
+ - Additional override: 48 selected `mlp/down` projections to NVFP4
10
+ - Activation policy for those overrides: `AllowA4`
11
+ - Activation input divisor used in the current experiment: `1.0`
12
+
13
+ ## Converter / runtime development state
14
+
15
+ Base checkout commit:
16
+
17
+ ```text
18
+ 9e163eee4b8acec21ab0ac765107b6a3f287b217
19
+ ```
20
+
21
+ Recorded local `git diff` SHA256 from the experimental checkout:
22
+
23
+ ```text
24
+ 2e526a1eb2333992c146fde7324d7f615dc3e4a8dae1bc01f54357aaeed2befa
25
+ ```
26
+
27
+ Converter image used in the experiment:
28
+
29
+ ```text
30
+ ninfer:a2-convert
31
+ ```
32
+
33
+ Perplexity image used in the experiment:
34
+
35
+ ```text
36
+ ninfer-lab/weekly-cal-down-probe-ppl:9e163eee-local-20260922
37
+ ```
38
+
39
+ Benchmark image used in the experiment:
40
+
41
+ ```text
42
+ ninfer:a2-bench
43
+ ```
44
+
45
+ ## Model construction rule
46
+
47
+ All NInfer artifacts are generated directly from the original BF16/FP16 checkpoint. Existing `.ninfer` artifacts are not used as quantization sources.
48
+
49
+ ## Expected D48 artifact
50
+
51
+ Filename:
52
+
53
+ ```text
54
+ thinkingcap-qwen3.8-27b-d48.ninfer
55
+ ```
56
+
57
+ Exact file size:
58
+
59
+ ```text
60
+ 16705529348 bytes
61
+ ```
62
+
63
+ Runtime weight capacity observed during benchmark:
64
+
65
+ ```text
66
+ 16692422656 bytes
67
+ ```
68
+
69
+ Workspace capacity observed during benchmark:
70
+
71
+ ```text
72
+ 159981568 bytes
73
+ ```
74
+
75
+ The model binary itself is intentionally not included in this package.
README.md CHANGED
@@ -1,48 +1,211 @@
1
  ---
2
- license: apache-2.0
3
- language:
4
- - en
5
- base_model:
6
- - bottlecapai/ThinkingCap-Qwen3.8-27B
7
  tags:
8
- - Blackwell
9
- - Ninfer
10
- - ThinkingCap
11
- - Qwen3.8
12
- - quantization
13
- - text-generation
14
  ---
15
- # ThinkingCap-Qwen3.8-27B — NInfer
16
 
17
- NInfer conversions of **ThinkingCap-Qwen3.8-27B**, optimized for NVIDIA Blackwell GPUs.
18
 
19
- This repository currently contains two target-model variants:
20
 
21
- | Variant | File | Size | Description |
22
- |---|---|---:|---|
23
- | Baseline | `thinkingcap-qwen3.8-27b.ninfer` | 17,106,573,056 bytes | Standard NInfer `qwen3_8_27b` conversion |
24
- | **D48** | `thinkingcap-qwen3.8-27b-d48.ninfer` | **16,705,529,348 bytes** | Quality-first optimized variant with 48 selected MLP Down projections converted to NVFP4 |
25
 
26
- ## Recommended variant
27
 
28
- For current use, **D48 is the recommended quality-first optimized anchor**.
29
 
30
- Compared with the standard NInfer conversion, D48:
31
 
32
- - reduces the artifact by approximately **401 MB**
33
- - reduces model size by approximately **2.34%**
34
- - improves prefill throughput substantially relative to the unoptimized baseline architecture
35
- - shows no measurable overall perplexity regression on the development corpus used during optimization
36
- - keeps the most sensitive MLP Down layers at the precision chosen by the standard NInfer recipe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
 
38
- The optimization is deliberately conservative.
39
 
40
- The goal is not minimum file size.
 
 
 
 
 
 
 
 
 
 
41
 
42
- The priority is:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
 
44
  ```text
45
  1. Preserve model quality
46
- 2. Improve inference throughput
47
- 3. Reduce VRAM / model footprint
48
- 4. Keep the configuration reproducible
 
 
 
 
 
 
1
  ---
2
+ pipeline_tag: text-generation
 
 
 
 
3
  tags:
4
+ - qwen
5
+ - ninfer
6
+ - quantization
7
+ - nvfp4
8
+ - blackwell
9
+ - text-generation
10
  ---
 
11
 
12
+ # ThinkingCap-Qwen3.8-27B — NInfer D48 NVFP4
13
 
14
+ Experimental **NInfer** conversion of **ThinkingCap-Qwen3.8-27B**, optimized for NVIDIA Blackwell GPUs with a quality-first mixed-precision strategy.
15
 
16
+ The current recommended artifact is the **D48 anchor**.
 
 
 
17
 
18
+ It starts from NInfer's standard `qwen3_8_27b` recipe and adds model-specific NVFP4 quantization to selected MLP Down projections. The D48 layers were selected from a complete 64-layer single-change sensitivity sweep and then validated cumulatively with full perplexity and runtime benchmarks.
19
 
20
+ ## Artifact
21
 
22
+ Place the model file in the repository root with this name:
23
 
24
+ ```text
25
+ thinkingcap-qwen3.8-27b-d48.ninfer
26
+ ```
27
+
28
+ | Property | Value |
29
+ |---|---:|
30
+ | Model | ThinkingCap-Qwen3.8-27B |
31
+ | Runtime format | NInfer |
32
+ | Variant | D48 |
33
+ | Artifact size | 16,705,529,348 bytes |
34
+ | Runtime weight capacity | 16,692,422,656 bytes |
35
+ | Workspace | 159,981,568 bytes |
36
+ | Target GPU | NVIDIA RTX PRO 4000 Blackwell 24 GB |
37
+ | Base NInfer recipe | `qwen3_8_27b` |
38
+ | Additional optimization | 48 selected MLP Down projections → NVFP4 |
39
+
40
+ The corresponding standard NInfer baseline artifact was **17,106,573,056 bytes**. D48 reduces the artifact by **401,043,708 bytes (~382.5 MiB / 2.34%)**.
41
+
42
+ ## What D48 means
43
+
44
+ D48 does **not** mean “layers 0–47”. Every one of the 64 MLP Down projections was tested individually. The 48 most tolerant layers were selected for the cumulative D48 build.
45
+
46
+ ### NVFP4 MLP Down layers
47
+
48
+ ```text
49
+ 0, 1, 4, 5, 6, 7, 9,
50
+ 13, 14, 15, 16, 17, 19, 20, 22, 23, 24,
51
+ 28, 29, 30, 31,
52
+ 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
53
+ 53, 54, 55, 56, 58, 59, 60, 61, 62
54
+ ```
55
+
56
+ ### Protected MLP Down layers
57
+
58
+ ```text
59
+ 2, 3, 8, 10, 11, 12, 18, 21,
60
+ 25, 26, 27, 32,
61
+ 51, 52, 57, 63
62
+ ```
63
+
64
+ These remain at the precision selected by the standard NInfer recipe.
65
+
66
+ ## Quantization strategy
67
+
68
+ New artifacts are generated directly from the original BF16/FP16 ThinkingCap checkpoint. Existing `.ninfer` files are **not** requantized.
69
+
70
+ ```text
71
+ ThinkingCap BF16/FP16 Safetensors
72
+ │
73
+ ▼
74
+ NInfer qwen3_8_27b recipe
75
+ │
76
+ ▼
77
+ standard mixed-precision NInfer baseline
78
+ │
79
+ ▼
80
+ selected MLP Down projections → NVFP4
81
+ │
82
+ ▼
83
+ ThinkingCap D48 NInfer
84
+ ```
85
+
86
+ D48 is still a mixed-precision model. Only the selected MLP Down projections receive the additional NVFP4 override; all other tensors continue to use the formats chosen by the standard NInfer recipe.
87
+
88
+ ## Full perplexity validation
89
+
90
+ Development corpus configuration:
91
+
92
+ ```text
93
+ context: 4096
94
+ stride: 2048
95
+ KV cache: BF16
96
+ scored tokens: 782,535
97
+ streams: 12
98
+ ```
99
+
100
+ The corpus contains English long-form text, English reference text, and code. It is a **development/sensitivity corpus**, not an untouched final holdout.
101
+
102
+ | Domain | Standard NInfer baseline | D48 |
103
+ |---|---:|---:|
104
+ | English long-form | 7.918420 | 7.944685 |
105
+ | English reference | 6.264029 | 6.219786 |
106
+ | Code | 1.651905 | 1.654696 |
107
+ | **Overall** | **4.351060** | **4.348019** |
108
+
109
+ Overall D48 delta versus the baseline is approximately **−0.070% PPL** on this development corpus.
110
+
111
+ The negative aggregate delta must not be interpreted as evidence that quantization improves the underlying model. The individual domains move in different directions; the result is best read as **no measurable aggregate quality loss on this development corpus at the tested resolution**.
112
+
113
+ ## Runtime benchmark
114
 
115
+ Measured on an **NVIDIA RTX PRO 4000 Blackwell 24 GB** with FP8 KV cache, prefill chunk 1024, 2 warmups and 5 measured repetitions.
116
 
117
+ | Test | Throughput |
118
+ |---|---:|
119
+ | PP512 | 1293.37 tok/s |
120
+ | PP2048 | 1333.02 tok/s |
121
+ | PP8192 | 1310.12 tok/s |
122
+ | TG256 | 32.46 tok/s |
123
+ | TG1024 | 32.03 tok/s |
124
+ | PP2048 + TG512 — prefill | 1323.95 tok/s |
125
+ | PP2048 + TG512 — decode | 31.92 tok/s |
126
+ | PP8192 + TG512 — prefill | 1297.68 tok/s |
127
+ | PP8192 + TG512 — decode | 31.43 tok/s |
128
 
129
+ These values are intended for comparisons within the same NInfer/hardware/software setup. They should not be treated as directly comparable to unrelated runtimes or benchmark methodologies.
130
+
131
+ ## Why D48 is the current anchor
132
+
133
+ More aggressive cumulative candidates were also tested:
134
+
135
+ | Variant | Extra NVFP4 Down layers | Full PPL | Artifact size |
136
+ |---|---:|---:|---:|
137
+ | Standard baseline | 0 | 4.351060 | 17,106,573,056 B |
138
+ | **D48** | **48** | **4.348019** | **16,705,529,348 B** |
139
+ | D50 | 50 | 4.350115 | 16,688,818,692 B |
140
+ | D53 | 53 | 4.355314 | 16,663,752,708 B |
141
+
142
+ D50 was only about **16 MiB smaller** than D48 and measured roughly **+0.31% mean prefill / −0.12% mean decode** versus D48 in the same benchmark setup. D53 produced a clearer prefill gain, but also a clearer perplexity regression.
143
+
144
+ For the current **quality-first** target, D48 is therefore the working Down anchor.
145
+
146
+ ## Current optimization status
147
+
148
+ ```text
149
+ 1. Standard NInfer conversion
150
+ 2. Full 64-layer MLP Down sensitivity sweep
151
+ 3. D48 quality-first Down anchor ← this release
152
+ 4. ThinkingCap-specific IMatrix
153
+ 5. Gate / Up sensitivity analysis
154
+ 6. Combined mixed-precision optimization
155
+ 7. Final task-level quality validation
156
+ 8. MTP and/or DFlash2 integration
157
+ ```
158
+
159
+ ### Not yet included
160
+
161
+ This D48 artifact does **not** yet include:
162
+
163
+ - ThinkingCap-specific IMatrix optimization
164
+ - Agentic-workload importance calibration
165
+ - dedicated Gate optimization
166
+ - dedicated Up optimization
167
+ - final Gate/Up + Down joint optimization
168
+ - MTP speculative decoding model
169
+ - DFlash2 speculative decoding model
170
+ - final task-level evaluation suite
171
+
172
+ ## Planned IMatrix work
173
+
174
+ A ThinkingCap-specific importance matrix is planned from the original BF16/FP16 weights using an agentic/code-oriented calibration corpus.
175
+
176
+ The IMatrix will be used to prioritize Gate/Up candidates, identify important tensors/channels, reduce the search space, and cross-check the existing empirical sensitivity results. It will **not** replace direct single-change and cumulative-group quality measurements.
177
+
178
+ ## Reproducibility
179
+
180
+ Converter checkout base commit:
181
+
182
+ ```text
183
+ 9e163eee4b8acec21ab0ac765107b6a3f287b217
184
+ ```
185
+
186
+ The local build also contains experimental changes required for the NVFP4 path, so exact compatibility can depend on the corresponding NInfer runtime implementation.
187
+
188
+ See `PROVENANCE.md`, `quantization/d48-layers.txt`, and `benchmarks/` for compact experiment metadata.
189
+
190
+ ## Intended use
191
+
192
+ This release is primarily intended for:
193
+
194
+ - ThinkingCap-Qwen3.8-27B experiments with NInfer
195
+ - NVIDIA Blackwell inference
196
+ - mixed-precision / NVFP4 research
197
+ - quality/performance trade-off analysis
198
+ - further model-specific optimization work
199
+
200
+ The optimization priority is:
201
 
202
  ```text
203
  1. Preserve model quality
204
+ 2. Improve real inference throughput
205
+ 3. Reduce persistent model/VRAM footprint
206
+ 4. Keep experiments reproducible
207
+ ```
208
+
209
+ ## License and upstream terms
210
+
211
+ This repository does not redefine the licenses of the upstream ThinkingCap model, its base model, NInfer, or NVIDIA components. Users should review and comply with the applicable upstream licenses and terms before redistribution or use.
benchmarks/d48-runtime.csv ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ test,metric,tok_per_s
2
+ pp512,prefill,1293.37
3
+ pp2048,prefill,1333.02
4
+ pp8192,prefill,1310.12
5
+ tg256,decode,32.46
6
+ tg1024,decode,32.03
7
+ pp2048+tg512,prefill,1323.95
8
+ pp2048+tg512,decode,31.92
9
+ pp8192+tg512,prefill,1297.68
10
+ pp8192+tg512,decode,31.43
benchmarks/full-ppl.csv ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ variant,english_long_form,english_reference,ninfer_code,overall,scored_tokens,context,stride,kv_dtype
2
+ baseline,7.918420,6.264029,1.651905,4.3510600961173225,782535,4096,2048,bf16
3
+ d48,7.944685,6.219786,1.654696,4.348019,782535,4096,2048,bf16
4
+ d50,7.949046,6.223909,1.655082,4.350115,782535,4096,2048,bf16
5
+ d53,7.953046,6.243357,1.655006,4.355314,782535,4096,2048,bf16
quantization/d48-layers.txt ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ThinkingCap-Qwen3.8-27B NInfer D48
2
+
3
+ Selected MLP Down layers converted to NVFP4 (48):
4
+ 0
5
+ 1
6
+ 4
7
+ 5
8
+ 6
9
+ 7
10
+ 9
11
+ 13
12
+ 14
13
+ 15
14
+ 16
15
+ 17
16
+ 19
17
+ 20
18
+ 22
19
+ 23
20
+ 24
21
+ 28
22
+ 29
23
+ 30
24
+ 31
25
+ 33
26
+ 34
27
+ 35
28
+ 36
29
+ 37
30
+ 38
31
+ 39
32
+ 40
33
+ 41
34
+ 42
35
+ 43
36
+ 44
37
+ 45
38
+ 46
39
+ 47
40
+ 48
41
+ 49
42
+ 50
43
+ 53
44
+ 54
45
+ 55
46
+ 56
47
+ 58
48
+ 59
49
+ 60
50
+ 61
51
+ 62
52
+
53
+ Protected MLP Down layers (16):
54
+ 2
55
+ 3
56
+ 8
57
+ 10
58
+ 11
59
+ 12
60
+ 18
61
+ 21
62
+ 25
63
+ 26
64
+ 27
65
+ 32
66
+ 51
67
+ 52
68
+ 57
69
+ 63
thinkingcap-d48.ninfer ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fdc304dca679849512e52c075194185193788ccaaf009148a9116f30eac69d36
3
+ size 16705529348
thinkingcap-d48.ninfer.conversion.json ADDED
The diff for this file is too large to render. See raw diff
 
thinkingcap-qwen3.8-27b.ninfer.conversion.json ADDED
The diff for this file is too large to render. See raw diff
 
verify-model.sh ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -u
3
+ MODEL="${1:-thinkingcap-qwen3.8-27b-d48.ninfer}"
4
+ EXPECTED=16705529348
5
+
6
+ if [ ! -f "$MODEL" ]; then
7
+ echo "ERROR: model not found: $MODEL" >&2
8
+ exit 1
9
+ fi
10
+
11
+ ACTUAL=$(stat -c '%s' "$MODEL")
12
+ echo "file: $MODEL"
13
+ echo "bytes: $ACTUAL"
14
+
15
+ if [ "$ACTUAL" -ne "$EXPECTED" ]; then
16
+ echo "ERROR: expected $EXPECTED bytes" >&2
17
+ exit 1
18
+ fi
19
+
20
+ echo "size check: PASS"
21
+ echo
22
+ sha256sum "$MODEL"