infosave commited on
Commit
6966c67
·
verified ·
1 Parent(s): 89dec06

Add README.md

Browse files
Files changed (1) hide show
  1. README.md +101 -88
README.md CHANGED
@@ -31,11 +31,12 @@ single [CMF](https://github.com/infosave2007/cmf) files for `cortiq`, a Rust inf
31
  no ML framework. The model routes 16 of 512 experts on a 1536-wide latent, mixes 30 sliding-window and 12 sparse
32
  attention layers, keeps four residual streams, and looks up bigram and trigram tables (Engram) on four layers.
33
 
34
- - **A40 (48 GB), CUDA:** `q2tp` answers at **10.1 tok/s** and `q4tp` at 8.5 tok/s after a 1 000-token
35
- prompt, which the card reads in 14 s.
36
  - **Within 24 GB of the card:** the experts live in host memory and the card keeps the hot ones: `q2tp`
37
- 13.6 tok/s, `q4tp` 10.1 tok/s, 23.5 GB in use at the peak.
38
- - **Vulkan / DX12 / Metal:** the same files decode on the card through wgpu: `q4tp` 11.9 tok/s on the A40 with a 24 GB weight budget.
 
39
 
40
  [English](#quick-start) · [Русский](#документация-на-русском) · [中文](#中文说明)
41
 
@@ -63,55 +64,58 @@ reads the rest from the file — slower on every expert it misses.
63
  |---|---|---|---:|---|
64
  | `hy4-flash-q4tp.cmf` | 4-bit · 4-bit | 8-bit, Engram 8-bit as released | 150.5 GB | **default** |
65
  | `hy4-flash-q2tp.cmf` | 2-bit · 4-bit | 4-bit, Engram 8-bit as released | 122.8 GB | smaller and faster: more experts fit the card |
 
66
 
67
  `q4tp` and `q2tp` are converted from the FP8 release (e4m3 with 128×128 block scales, decoded exactly) with the bf16
68
  attention shards of `tencent/Hy4-flash` on top. The vision tower travels in the files; cortiq reads text only
69
- for now.
 
 
70
 
71
  ## Quality
72
 
73
  | file | WikiText-2 | Chinese docs | Rust source |
74
  |---|---:|---:|---:|
75
- | `q4tp` | 35.18 | 38.92 | 3.93 |
76
- | `q2tp` | 33.19 | 36.38 | 4.62 |
 
77
 
78
  Perplexity, windows of 512 tokens on the card's prompt graph: WikiText-2 test (16 windows), Chinese
79
- documentation (8), Rust source (8). The 2-bit experts cost code more than prose.
80
 
81
- ## CUDA · A40
82
 
83
- Stand: NVIDIA A40 (48 GB), the CUDA backend (`CMF_GPU=cuda`), cortiq 0.9.6, a release build, host memory
84
- outside the container's limit for the RAM tier. `cortiq run --greedy --no-think`, 256 tokens after a prompt of
85
- WikiText-2 text; `CMF_GPU_VRAM_MB` caps the card.
86
 
87
- | card limit | `q4tp` decode, tok/s | first token, s | `q2tp` decode, tok/s | first token, s | peak in use `q4tp` / `q2tp`, GB |
88
  |---:|---:|---:|---:|---:|---:|
89
- | 48 GB (whole) | **8.5** | 57.5 | 10.1 | 58.1 | 42.0 / 42.1 |
90
- | 24 GB | **10.1** | 78.0 | 13.6 | 62.8 | 23.5 / 23.6 |
91
- | 16 GB | **7.5** | 80.3 | 11.3 | 64.0 | 16.5 / 16.6 |
92
- | 12 GB | **4.9** | 80.0 | 9.9 | 62.0 | 13.0 / 13.1 |
 
 
93
 
94
  ![Decode by card size](https://huggingface.co/infosave/Hy4-flash-cmf/resolve/main/assets/perf_cuda_en.png)
95
 
96
  The first token is timed from a cold process: it includes building the plan and filling the RAM tier (about
97
- 41 s, once a process); reading the 1 000-token prompt itself takes 14 s on the whole card.
98
- `CMF_GPU_VRAM_MB` caps what the engine places; under the 16 and 12 GB limits the process still peaks at
99
- 16.5 and 13.0 GB, so the smallest card these figures cover
100
- is 24 GB.
101
 
102
- ## Vulkan · A40
103
 
104
- The same card through Vulkan (`CMF_GPU=wgpu`), the same 1 000-token prompt and 256 greedy tokens, first token from
105
- a cold process. The prompt goes through the batch graph in 16-token chunks.
106
 
107
- | weights' budget (`CMF_GPU_VRAM_MB`) | `q4tp` decode, tok/s | first token, s | peak in use, GB |
108
- |---:|---:|---:|---:|
109
- | 24 GB | **11.9** | 200.3 | 33.3 |
110
- | 16 GB | **10.3** | 197.7 | 25.7 |
111
 
112
  On wgpu `CMF_GPU_VRAM_MB` budgets the weights; the K/V, the prompt's buffers and the experts' staging take the card
113
- beside them (the peak column). Without a budget the A40's expert caches do not all fit beside the rest and some
114
- layers read their experts over the bus: on a 48 GB card set `CMF_GPU_VRAM_MB=24576`.
115
 
116
  ## Server
117
 
@@ -139,11 +143,12 @@ Rust без Python и ML-фреймворков. Модель выбирает 1
139
  скользящего окна и 12 разреженных слоёв внимания, держит четыре остаточных потока и на четырёх слоях читает
140
  таблицы биграмм и триграмм (Engram).
141
 
142
- - **A40 (48 ГБ), CUDA:** `q2tp` отвечает со скоростью **10,1 ток/с**, `q4tp` — 8,5 ток/с
143
- после промпта в 1 000 токенов, который карта читает за 14 с.
144
- - **В 24 ГБ карты:** эксперты живут в памяти хоста, карта держит горячие: `q2tp` 13,6 ток/с, `q4tp`
145
- 10,1 ток/с, пик занятой памяти 23,5 ГБ.
146
- - **Vulkan / DX12 / Metal:** те же файлы декодируются на карте через wgpu: `q4tp` 11,9 ток/с на A40 с бюджетом весов 24 ГБ.
 
147
 
148
  ### Быстрый старт
149
 
@@ -169,54 +174,57 @@ RAM движок держит ярус меньше и дочитывает ос
169
  |---|---|---|---:|---|
170
  | `hy4-flash-q4tp.cmf` | 4 бита · 4 бита | 8 бит, Engram 8 бит как в релизе | 150,5 ГБ | **по умолчанию** |
171
  | `hy4-flash-q2tp.cmf` | 2 бита · 4 бита | 4 бита, Engram 8 бит как в релизе | 122,8 ГБ | меньше и быстрее: на карту помещается больше экспертов |
 
172
 
173
  `q4tp` и `q2tp` сконвертированы из FP8-релиза (e4m3 с масштабами блоков 128×128, декодируются точно) с bf16-шардами внимания
174
- из `tencent/Hy4-flash` поверх. Визуальная башня лежит в файлах; cortiq пока читает только текст.
 
 
175
 
176
  ### Качество
177
 
178
  | файл | WikiText-2 | китайские доки | код на Rust |
179
  |---|---:|---:|---:|
180
- | `q4tp` | 35,18 | 38,92 | 3,93 |
181
- | `q2tp` | 33,19 | 36,38 | 4,62 |
 
182
 
183
  Перплексия, окна по 512 токенов на prompt-графе карты: WikiText-2 test (16 окон), китайская документация
184
- (8), код на Rust (8). 2-битные эксперты сильнее бьют по коду, чем по прозе.
185
 
186
- ### CUDA · A40
187
 
188
- Стенд: NVIDIA A40 (48 ГБ), бэкенд CUDA (`CMF_GPU=cuda`), cortiq 0.9.6, release-сборка, память хоста под
189
- RAM-ярус вне лимита контейнера. `cortiq run --greedy --no-think`, 256 токенов после промпта из текста WikiText-2;
190
- `CMF_GPU_VRAM_MB` ограничивает карту.
191
 
192
- | лимит карты | `q4tp` декод, ток/с | первый токен, с | `q2tp` декод, ток/с | первый токен, с | пик занятой памяти `q4tp` / `q2tp`, ГБ |
193
  |---:|---:|---:|---:|---:|---:|
194
- | 48 ГБ (вся) | **8,5** | 57,5 | 10,1 | 58,1 | 42,0 / 42,1 |
195
- | 24 ГБ | **10,1** | 78,0 | 13,6 | 62,8 | 23,5 / 23,6 |
196
- | 16 ГБ | **7,5** | 80,3 | 11,3 | 64,0 | 16,5 / 16,6 |
197
- | 12 ГБ | **4,9** | 80,0 | 9,9 | 62,0 | 13,0 / 13,1 |
 
 
198
 
199
  ![Декод по размеру карты](https://huggingface.co/infosave/Hy4-flash-cmf/resolve/main/assets/perf_cuda_ru.png)
200
 
201
  Первый токен засекается от холодного процесса: в него входят построение плана и заполнение RAM-яруса (около
202
- 41 с, один раз на процесс); само чтение промпта из 1 000 токенов на всей карте занимает 14 с.
203
- `CMF_GPU_VRAM_MB` ограничивает то, что размещает движок; под лимитами 16 и 12 ГБ процесс всё же доходит до
204
- 16,5 и 13,0 ГБ, так что наименьшая карта, для
205
- которой верны эти цифры, — 24 ГБ.
206
 
207
- ### Vulkan · A40
208
 
209
- Та же карта через Vulkan (`CMF_GPU=wgpu`), тот же промпт из 1 000 токенов и 256 жадных токенов, первый токен от
210
- холодного процесса. Промпт идёт через пакетный граф кусками по 16 токенов.
211
 
212
- | бюджет весов (`CMF_GPU_VRAM_MB`) | `q4tp` декод, ток/с | первый токен, с | пик занятой памяти, ГБ |
213
- |---:|---:|---:|---:|
214
- | 24 ГБ | **11,9** | 200,3 | 33,3 |
215
- | 16 ГБ | **10,3** | 197,7 | 25,7 |
216
 
217
  В wgpu `CMF_GPU_VRAM_MB` задаёт бюджет весов; K/V, буферы промпта и промежуточная загрузка экспертов занимают карту
218
- рядом с ними (столбец пика). Без бюджета кэши экспертов A40 не помещаются целиком, и часть слоёв читает экспертов
219
- по шине: на карте 48 ГБ задайте `CMF_GPU_VRAM_MB=24576`.
220
 
221
  ### Сервер
222
 
@@ -242,9 +250,9 @@ OpenAI-совместимый API (`/v1/chat/completions`, `/v1/completions`, п
242
  和任何机器学习框架。该模型在 1536 维潜空间上从 512 个专家中选出 16 个,交替使用 30 个滑动窗口注意力层和 12 个
243
  稀疏注意力层,保持四条残差流,并在四个层上查询二元与三元哈希表(Engram)。
244
 
245
- - **A40(48 GB),CUDA:** 在 1000 token 的提示(显卡读取用时 14 秒)之后,`q2tp` 以 **10.1 tok/s**、`q4tp` 以 8.5 tok/s 生成。
246
- - **24 GB 显存以内:** 专家放在主机内存,显卡缓存常用专家:`q2tp` 13.6 tok/s,`q4tp` 10.1 tok/s,显存峰值 23.5 GB。
247
- - **Vulkan / DX12 / Metal:** 同样的文件通过 wgpu 在显卡上解码:A40 上 `q4tp` 11.9 tok/s(权重预算 24 GB)。
248
 
249
  ### 快速开始
250
 
@@ -269,51 +277,56 @@ CMF_GPU=cuda cortiq run hy4-flash-q4tp.cmf --prompt "用三句话介绍一下长
269
  |---|---|---|---:|---|
270
  | `hy4-flash-q4tp.cmf` | 4 位 · 4 位 | 8 位,Engram 保持发布时的 8 位 | 150.5 GB | **默认** |
271
  | `hy4-flash-q2tp.cmf` | 2 位 · 4 位 | 4 位,Engram 保持发布时的 8 位 | 122.8 GB | 更小更快:显卡可放下更多专家 |
 
272
 
273
  `q4tp` 与 `q2tp` 由 FP8 版本(e4m3,128×128 块缩放,精确解码)转换而来,注意力部分使用 `tencent/Hy4-flash` 的 bf16
274
- 分片。视觉塔保留在文件中;cortiq 目前只读取文本。
 
 
275
 
276
  ### 质量
277
 
278
  | 文件 | WikiText-2 | 中文文档 | Rust 源码 |
279
  |---|---:|---:|---:|
280
- | `q4tp` | 35.18 | 38.92 | 3.93 |
281
- | `q2tp` | 33.19 | 36.38 | 4.62 |
 
282
 
283
  困惑度,在显卡的提示图上按 512 token 窗口计算:WikiText-2 测试集(16 个窗口)、中文文档(8 个)、Rust 源码
284
- (8 个)。2 位专家对代码的影响大于对文本的影响。
285
 
286
- ### CUDA · A40
287
 
288
- 测试平台:NVIDIA A40(48 GB),CUDA 后端(`CMF_GPU=cuda`),cortiq 0.9.6,release 构建,RAM 层使用容器限制之外的
289
- 主机内存。`cortiq run --greedy --no-think`,WikiText-2 文本提示之后生成 256 token;用 `CMF_GPU_VRAM_MB` 限制显存。
 
290
 
291
- | 显存上限 | `q4tp` 解码 tok/s | 首 token 秒 | `q2tp` 解码 tok/s | 首 token 秒 | 实际显存峰值 `q4tp` / `q2tp` GB |
292
  |---:|---:|---:|---:|---:|---:|
293
- | 48 GB(整卡) | **8.5** | 57.5 | 10.1 | 58.1 | 42.0 / 42.1 |
294
- | 24 GB | **10.1** | 78.0 | 13.6 | 62.8 | 23.5 / 23.6 |
295
- | 16 GB | **7.5** | 80.3 | 11.3 | 64.0 | 16.5 / 16.6 |
296
- | 12 GB | **4.9** | 80.0 | 9.9 | 62.0 | 13.0 / 13.1 |
 
 
297
 
298
  ![按显存大小的解码速度](https://huggingface.co/infosave/Hy4-flash-cmf/resolve/main/assets/perf_cuda_zh.png)
299
 
300
- 首 token 从冷启动的进程��始计时:包括构建计划和填充 RAM 层(约 41 秒,每个进程一次);在整卡上读取 1000 token
301
- 的提示本身用时 14 秒。
302
- `CMF_GPU_VRAM_MB` 限制引擎放置的内容;在 16 GB 与 12 GB 上限下,进程峰值仍达到 16.5 GB 与 13.0 GB,
303
- 因此这些数字适用的最小显卡为 24 GB。
304
 
305
- ### Vulkan · A40
306
 
307
- 同一张显卡通过 Vulkan(`CMF_GPU=wgpu`),同样的 1000 token 提示与 256 个贪心 token,首 token 从冷启动的进程计时。提示通过
308
  批处理图按 16 token 分块读取。
309
 
310
- | 权重预算(`CMF_GPU_VRAM_MB`) | `q4tp` 解码 tok/s | 首 token 秒 | 实际显存峰值 GB |
311
- |---:|---:|---:|---:|
312
- | 24 GB | **11.9** | 200.3 | 33.3 |
313
- | 16 GB | **10.3** | 197.7 | 25.7 |
314
 
315
- 在 wgpu 上 `CMF_GPU_VRAM_MB` 是权重的预算;K/V、提示缓冲区与专家的中转区在其旁边占用显存(见峰值列)。不设预算时,
316
- A40 的专家缓存无法全部放下,部分层通过总线读取专家:48 GB 显卡请设置 `CMF_GPU_VRAM_MB=24576`。
317
 
318
  ### 服务器
319
 
 
31
  no ML framework. The model routes 16 of 512 experts on a 1536-wide latent, mixes 30 sliding-window and 12 sparse
32
  attention layers, keeps four residual streams, and looks up bigram and trigram tables (Engram) on four layers.
33
 
34
+ - **RTX PRO 6000 (96 GB), CUDA:** `q2tp` answers at **65.1 tok/s** and `q4tp` at 55.3 tok/s after a
35
+ 1 000-token prompt, which the card reads in 4 s.
36
  - **Within 24 GB of the card:** the experts live in host memory and the card keeps the hot ones: `q2tp`
37
+ 37.4 tok/s, `q4tp` 22.7 tok/s, 23.7 GB in use at the peak.
38
+ - **Vulkan / DX12 / Metal:** the same files decode on the card through wgpu: `q2tp` 45.1 tok/s, `q4tp`
39
+ 37.4 tok/s on the same card.
40
 
41
  [English](#quick-start) · [Русский](#документация-на-русском) · [中文](#中文说明)
42
 
 
64
  |---|---|---|---:|---|
65
  | `hy4-flash-q4tp.cmf` | 4-bit · 4-bit | 8-bit, Engram 8-bit as released | 150.5 GB | **default** |
66
  | `hy4-flash-q2tp.cmf` | 2-bit · 4-bit | 4-bit, Engram 8-bit as released | 122.8 GB | smaller and faster: more experts fit the card |
67
+ | `hy4-flash-q2tp-sfq.cmf` | 2-bit · 4-bit, SFq | 4-bit, Engram 8-bit as released | 122.8 GB | code: `q2tp` with the experts calibrated |
68
 
69
  `q4tp` and `q2tp` are converted from the FP8 release (e4m3 with 128×128 block scales, decoded exactly) with the bf16
70
  attention shards of `tencent/Hy4-flash` on top. The vision tower travels in the files; cortiq reads text only
71
+ for now. `hy4-flash-q2tp-sfq.cmf` is `q2tp` with SFq on its routed experts: a channel scale on the latent and
72
+ GPTQ with a code refinement, calibrated on 98 304 tokens of English, Chinese and Rust text (`cortiq hy4-sfq`). It
73
+ reads code better and prose worse than the plain `q2tp`.
74
 
75
  ## Quality
76
 
77
  | file | WikiText-2 | Chinese docs | Rust source |
78
  |---|---:|---:|---:|
79
+ | `q4tp` | 35.80 | 39.13 | 3.92 |
80
+ | `q2tp` | 32.98 | 36.08 | 4.64 |
81
+ | `q2tp-sfq` | 42.20 | 41.83 | 4.30 |
82
 
83
  Perplexity, windows of 512 tokens on the card's prompt graph: WikiText-2 test (16 windows), Chinese
84
+ documentation (8), Rust source (8). The 2-bit experts cost code more than prose; SFq gives code back.
85
 
86
+ ## CUDA · RTX PRO 6000
87
 
88
+ Stand: NVIDIA RTX PRO 6000 Blackwell Server Edition (96 GB), the CUDA backend (`CMF_GPU=cuda`), cortiq 0.9.6, a
89
+ release build. `cortiq run --greedy --no-think`, 256 tokens after a 1 000-token WikiText-2 prompt, the file already
90
+ in the page cache (a second run); `CMF_GPU_VRAM_MB` caps the card.
91
 
92
+ | limit (`CMF_GPU_VRAM_MB`) | `q2tp` decode, tok/s | first token, s | `q4tp` decode, tok/s | first token, s | peak in use `q2tp` / `q4tp`, GB |
93
  |---:|---:|---:|---:|---:|---:|
94
+ | 96 GB (whole) | **65.1** | 15.5 | 55.3 | 19.7 | 60.5 / 86.5 |
95
+ | 48 GB | **53.1** | 18.0 | 37.8 | 20.8 | 45.6 / 45.8 |
96
+ | 24 GB | **37.4** | 19.6 | 22.7 | 23.8 | 23.6 / 23.7 |
97
+ | 16 GB | **31.2** | 19.9 | 19.9 | 24.4 | 16.6 / 17.2 |
98
+ | 15 GB | **29.9** | 20.0 | 19.0 | 23.1 | 15.7 / 15.8 |
99
+ | 12 GB | **26.0** | 19.9 | — | — | 13.1 / — |
100
 
101
  ![Decode by card size](https://huggingface.co/infosave/Hy4-flash-cmf/resolve/main/assets/perf_cuda_en.png)
102
 
103
  The first token is timed from a cold process: it includes building the plan and filling the RAM tier (about
104
+ 15 s, once a process); reading the 1 000-token prompt itself takes 4 s on the whole card.
105
+ `CMF_GPU_VRAM_MB` caps what the engine places; the process peaks up to 1.2 GB above it (the peak column). On a 16 GB card set `CMF_GPU_VRAM_MB=15360`: both files then stay under 16 GB. Under a 12 GB limit `q4tp`'s expert slots do not fit (its prompt falls to the host) and `q2tp` peaks at 13.1 GB, so a 12 GB card is not covered yet.
 
 
106
 
107
+ ## Vulkan · RTX PRO 6000
108
 
109
+ The same card through Vulkan (`CMF_GPU=wgpu`), the same prompt and 256 greedy tokens, first token from a cold
110
+ process. The prompt goes through the batch graph in 16-token chunks.
111
 
112
+ | weights' budget | `q2tp` decode, tok/s | first token, s | `q4tp` decode, tok/s | first token, s | peak in use `q2tp` / `q4tp`, GB |
113
+ |---:|---:|---:|---:|---:|---:|
114
+ | none (the whole card) | **45.1** | 31.8 | 37.4 | 27.1 | 62.3 / 88.5 |
115
+ | 24 GB | **36.4** | 59.4 | 27.9 | 125.5 | 32.4 / 33.7 |
116
 
117
  On wgpu `CMF_GPU_VRAM_MB` budgets the weights; the K/V, the prompt's buffers and the experts' staging take the card
118
+ beside them (the peak column).
 
119
 
120
  ## Server
121
 
 
143
  скользящего окна и 12 разреженных слоёв внимания, держит четыре остаточных потока и на четырёх слоях читает
144
  таблицы биграмм и триграмм (Engram).
145
 
146
+ - **RTX PRO 6000 (96 ГБ), CUDA:** `q2tp` отвечает со скоростью **65,1 ток/с**, `q4tp` —
147
+ 55,3 ток/с после промпта в 1 000 токенов, который карта читает за 4 с.
148
+ - **В 24 ГБ карты:** эксперты живут в памяти хоста, карта держит горячие: `q2tp` 37,4 ток/с, `q4tp`
149
+ 22,7 ток/с, пик занятой памяти 23,7 ГБ.
150
+ - **Vulkan / DX12 / Metal:** те же файлы декодируются на карте через wgpu: `q2tp` 45,1 ток/с, `q4tp`
151
+ 37,4 ток/с на той же карте.
152
 
153
  ### Быстрый старт
154
 
 
174
  |---|---|---|---:|---|
175
  | `hy4-flash-q4tp.cmf` | 4 бита · 4 бита | 8 бит, Engram 8 бит как в релизе | 150,5 ГБ | **по умолчанию** |
176
  | `hy4-flash-q2tp.cmf` | 2 бита · 4 бита | 4 бита, Engram 8 бит как в релизе | 122,8 ГБ | меньше и быстрее: на карту помещается больше экспертов |
177
+ | `hy4-flash-q2tp-sfq.cmf` | 2 бита · 4 бита, SFq | 4 бита, Engram 8 бит как в релизе | 122,8 ГБ | код: `q2tp` с откалиброванными экспертами |
178
 
179
  `q4tp` и `q2tp` сконвертированы из FP8-релиза (e4m3 с масштабами блоков 128×128, декодируются точно) с bf16-шардами внимания
180
+ из `tencent/Hy4-flash` поверх. Визуальная башня лежит в файлах; cortiq пока читает только текст. `hy4-flash-q2tp-sfq.cmf` — это `q2tp` с SFq на маршрутизируемых экспертах:
181
+ масштаб каналов латента и GPTQ с доводкой кодов, откалиброванные на 98 304 токенах английского, китайского текста
182
+ и кода на Rust (`cortiq hy4-sfq`). Код он читает лучше, прозу хуже, чем обычный `q2tp`.
183
 
184
  ### Качество
185
 
186
  | файл | WikiText-2 | китайские доки | код на Rust |
187
  |---|---:|---:|---:|
188
+ | `q4tp` | 35,80 | 39,13 | 3,92 |
189
+ | `q2tp` | 32,98 | 36,08 | 4,64 |
190
+ | `q2tp-sfq` | 42,20 | 41,83 | 4,30 |
191
 
192
  Перплексия, окна по 512 токенов на prompt-графе карты: WikiText-2 test (16 окон), китайская документация
193
+ (8), код на Rust (8). 2-битные эксперты сильнее бьют по коду, чем по прозе; SFq возвращает код.
194
 
195
+ ### CUDA · RTX PRO 6000
196
 
197
+ Стенд: NVIDIA RTX PRO 6000 Blackwell Server Edition (96 ГБ), бэкенд CUDA (`CMF_GPU=cuda`), cortiq 0.9.6,
198
+ release-сборка. `cortiq run --greedy --no-think`, 256 токенов после промпта из 1 000 токенов WikiText-2, файл уже в
199
+ кэше страниц (второй запуск); `CMF_GPU_VRAM_MB` ограничивает карту.
200
 
201
+ | лимит (`CMF_GPU_VRAM_MB`) | `q2tp` декод, ток/с | первый токен, с | `q4tp` декод, ток/с | первый токен, с | пик занятой памяти `q2tp` / `q4tp`, ГБ |
202
  |---:|---:|---:|---:|---:|---:|
203
+ | 96 ГБ (вся) | **65,1** | 15,5 | 55,3 | 19,7 | 60,5 / 86,5 |
204
+ | 48 ГБ | **53,1** | 18,0 | 37,8 | 20,8 | 45,6 / 45,8 |
205
+ | 24 ГБ | **37,4** | 19,6 | 22,7 | 23,8 | 23,6 / 23,7 |
206
+ | 16 ГБ | **31,2** | 19,9 | 19,9 | 24,4 | 16,6 / 17,2 |
207
+ | 15 ГБ | **29,9** | 20,0 | 19,0 | 23,1 | 15,7 / 15,8 |
208
+ | 12 ГБ | **26,0** | 19,9 | — | — | 13,1 / — |
209
 
210
  ![Декод по размеру карты](https://huggingface.co/infosave/Hy4-flash-cmf/resolve/main/assets/perf_cuda_ru.png)
211
 
212
  Первый токен засекается от холодного процесса: в него входят построение плана и заполнение RAM-яруса (около
213
+ 15 с, один раз на процесс); само чтение промпта из 1 000 токенов на всей карте занимает 4 с.
214
+ `CMF_GPU_VRAM_MB` ограничивает то, что размещает движок; пик процесса бывает до 1,2 ГБ выше (столбец пика). На карте 16 ГБ задайте `CMF_GPU_VRAM_MB=15360`: тогда оба файла укладываются в 16 ГБ. Под лимитом 12 ГБ слоты экспертов `q4tp` не помещаются (его промпт уходит на хост), а `q2tp` доходит до 13,1 ГБ, так что карту на 12 ГБ эти файлы пока не покрывают.
 
 
215
 
216
+ ### Vulkan · RTX PRO 6000
217
 
218
+ Та же карта через Vulkan (`CMF_GPU=wgpu`), тот же промпт и 256 жадных токенов, первый токен от холодного
219
+ процесса. Промпт идёт через пакетный граф кусками по 16 токенов.
220
 
221
+ | бюджет весов | `q2tp` декод, ток/с | первый токен, с | `q4tp` декод, ток/с | первый токен, с | пик занятой памяти `q2tp` / `q4tp`, ГБ |
222
+ |---:|---:|---:|---:|---:|---:|
223
+ | нет (вся карта) | **45,1** | 31,8 | 37,4 | 27,1 | 62,3 / 88,5 |
224
+ | 24 ГБ | **36,4** | 59,4 | 27,9 | 125,5 | 32,4 / 33,7 |
225
 
226
  В wgpu `CMF_GPU_VRAM_MB` задаёт бюджет весов; K/V, буферы промпта и промежуточная загрузка экспертов занимают карту
227
+ рядом с ними (столбец пика).
 
228
 
229
  ### Сервер
230
 
 
250
  和任何机器学习框架。该模型在 1536 维潜空间上从 512 个专家中选出 16 个,交替使用 30 个滑动窗口注意力层和 12 个
251
  稀疏注意力层,保持四条残差流,并在四个层上查询二元与三元哈希表(Engram)。
252
 
253
+ - **RTX PRO 6000(96 GB),CUDA:** 在 1000 token 的提示(显卡读取用时 4 秒)之后,`q2tp` 以 **65.1 tok/s**、`q4tp` 以 55.3 tok/s 生成。
254
+ - **24 GB 显存以内:** 专家放在主机内存,显卡缓存常用专家:`q2tp` 37.4 tok/s,`q4tp` 22.7 tok/s,显存峰值 23.7 GB。
255
+ - **Vulkan / DX12 / Metal:** 同样的文件通过 wgpu 在同一张显卡上解码:`q2tp` 45.1 tok/s,`q4tp` 37.4 tok/s。
256
 
257
  ### 快速开始
258
 
 
277
  |---|---|---|---:|---|
278
  | `hy4-flash-q4tp.cmf` | 4 位 · 4 位 | 8 位,Engram 保持发布时的 8 位 | 150.5 GB | **默认** |
279
  | `hy4-flash-q2tp.cmf` | 2 位 · 4 位 | 4 位,Engram 保持发布时的 8 位 | 122.8 GB | 更小更快:显卡可放下更多专家 |
280
+ | `hy4-flash-q2tp-sfq.cmf` | 2 位 · 4 位,SFq | 4 位,Engram 保持发布时的 8 位 | 122.8 GB | 代码:专家经过校准的 `q2tp` |
281
 
282
  `q4tp` 与 `q2tp` 由 FP8 版本(e4m3,128×128 块缩放,精确解码)转换而来,注意力部分使用 `tencent/Hy4-flash` 的 bf16
283
+ 分片。视觉塔保留在文件中;cortiq 目前只读取文本。`hy4-flash-q2tp-sfq.cmf` 是对路由专家做了 SFq 的 `q2tp`:潜空间的通道缩放
284
+ 加带代码微调的 GPTQ,在 98 304 个英文、中文与 Rust 代码 token 上校准(`cortiq hy4-sfq`)。与普通 `q2tp` 相比,它读代码更好,
285
+ 读文本更差。
286
 
287
  ### 质量
288
 
289
  | 文件 | WikiText-2 | 中文文档 | Rust 源码 |
290
  |---|---:|---:|---:|
291
+ | `q4tp` | 35.80 | 39.13 | 3.92 |
292
+ | `q2tp` | 32.98 | 36.08 | 4.64 |
293
+ | `q2tp-sfq` | 42.20 | 41.83 | 4.30 |
294
 
295
  困惑度,在显卡的提示图上按 512 token 窗口计算:WikiText-2 测试集(16 个窗口)、中文文档(8 个)、Rust 源码
296
+ (8 个)。2 位专家对代码的影响大于对文本的影响;SFq 把代码的损失补了回来。
297
 
298
+ ### CUDA · RTX PRO 6000
299
 
300
+ 测试平台:NVIDIA RTX PRO 6000 Blackwell Server Edition(96 GB),CUDA 后端(`CMF_GPU=cuda`),cortiq 0.9.6,release 构建。
301
+ `cortiq run --greedy --no-think`,在 1000 token 的 WikiText-2 提示后生成 256 token,文件已在页缓存中(第二次运行);用
302
+ `CMF_GPU_VRAM_MB` 限制显存。
303
 
304
+ | 显存上限(`CMF_GPU_VRAM_MB`) | `q2tp` 解码 tok/s | 首 token 秒 | `q4tp` 解码 tok/s | 首 token 秒 | 实际显存峰值 `q2tp` / `q4tp` GB |
305
  |---:|---:|---:|---:|---:|---:|
306
+ | 96 GB(整卡) | **65.1** | 15.5 | 55.3 | 19.7 | 60.5 / 86.5 |
307
+ | 48 GB | **53.1** | 18.0 | 37.8 | 20.8 | 45.6 / 45.8 |
308
+ | 24 GB | **37.4** | 19.6 | 22.7 | 23.8 | 23.6 / 23.7 |
309
+ | 16 GB | **31.2** | 19.9 | 19.9 | 24.4 | 16.6 / 17.2 |
310
+ | 15 GB | **29.9** | 20.0 | 19.0 | 23.1 | 15.7 / 15.8 |
311
+ | 12 GB | **26.0** | 19.9 | — | — | 13.1 / — |
312
 
313
  ![按显存大小的解码速度](https://huggingface.co/infosave/Hy4-flash-cmf/resolve/main/assets/perf_cuda_zh.png)
314
 
315
+ 首 token 从冷启动的进程开始计时:包括构建计划和填充 RAM 层(约 15 秒,每个进程一次);在整卡上读取 1000 token
316
+ 的提示本身用时 4 秒。
317
+ `CMF_GPU_VRAM_MB` 限制引擎放置的内容;进程峰值最多比它高 1.2 GB(见峰值列)。16 GB 显卡请设置 `CMF_GPU_VRAM_MB=15360`:两个文件都能控制在 16 GB 以内。在 12 GB 上限下,`q4tp` 的专家槽放不下(提示退回主机),`q2tp` 峰值 13.1 GB,因此暂不支持 12 GB 显卡。
 
318
 
319
+ ### Vulkan · RTX PRO 6000
320
 
321
+ 同一张显卡通过 Vulkan(`CMF_GPU=wgpu`),同样的提示与 256 个贪心 token,首 token 从冷启动的进程计时。提示通过
322
  批处理图按 16 token 分块读取。
323
 
324
+ | 权重预算 | `q2tp` 解码 tok/s | 首 token 秒 | `q4tp` 解码 tok/s | 首 token 秒 | 实际显存峰值 `q2tp` / `q4tp` GB |
325
+ |---:|---:|---:|---:|---:|---:|
326
+ | 无(整卡) | **45.1** | 31.8 | 37.4 | 27.1 | 62.3 / 88.5 |
327
+ | 24 GB | **36.4** | 59.4 | 27.9 | 125.5 | 32.4 / 33.7 |
328
 
329
+ 在 wgpu 上 `CMF_GPU_VRAM_MB` 是权重的预算;K/V、提示缓冲区与专家的中转区在其旁边占用显存(见峰值列)。
 
330
 
331
  ### 服务器
332