onw 2.0.2: dense 64-token prompt blocks on all NPUs again - NPUW_DQ_FULL=NO on NPU 5000+ (the cause of the Panther Lake errors); Panther Lake Qwen3.5-9B 44 -> ~157 tok/s
Browse files- CHANGELOG.md +8 -1
- CHANGELOG_en.md +8 -1
- MANUAL.md +1 -1
- MANUAL_en.md +1 -1
- README.md +3 -3
- README_en.md +3 -3
- TECHNICAL.md +3 -3
- TECHNICAL_en.md +13 -5
- onw/__init__.py +1 -1
- onw/app.py +3 -7
- onw/chat.py +9 -21
- onw/i18n.json +2 -2
- onw/runtime.py +12 -3
- onw/web/manage.html +1 -1
CHANGELOG.md
CHANGED
|
@@ -5,6 +5,13 @@
|
|
| 5 |
日付は日本時間です。各版は Hugging Face の `ryugyosoft/onw` にタグ(`v0.4.2` 以降)付きで残っています。
|
| 6 |
onw ウィンドウは、新しい版があるとこのファイルから変更点を表示します(`## v…` の見出しで区切っています)。
|
| 7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
## v2.0.1 (2026-10-17)
|
| 9 |
- **Panther Lake・Lunar Lake で、dense モデルの 64 トークン処理(2.0.0 で追加)を使わないように戻しました**:Panther Lake(NPU 5010)で、2.0.0 で加えた 64 トークンのグラフの計算結果が正しくなく、Qwen3.5-9B などで意味のない文字が出ることがありました(16 トークンでは正しく計算されます)。NPU 4000 以降では 1.4.13 と同じブロックの選び方に戻します。NPU 3720 では正しく計算できているので、2.0.0 のまま 64 トークンずつ処理します(約 2〜2.5 倍)。モデルの更新はそのままで構いません。
|
| 10 |
- Qwen3.6 系のプロンプト処理(2.0.0)は Panther Lake でも正しく動いているので、変わりません。
|
|
@@ -18,7 +25,7 @@ onw ウィンドウは、新しい版があるとこのファイルから変更
|
|
| 18 |
- **モデルの更新が必要です**(カードに「更新あり」と出ます。差し替えは区間ファイルの約 0.9 GB だけです)。更新すると初回のロードで新しいグラフをコンパイルし直します。古い onw でも更新後のモデルはそのまま動きます。
|
| 19 |
- メモリ 24 GB 未満の PC(16 GB の Lunar Lake など)では、新しいグラフのコンパイル中にメモリが足りなくなるため、今までどおりの処理のままです(`ONW_GROUPED=1` で強制、`0` で無効)。
|
| 20 |
- **Qwen3.6 系の生成が少し速く**:1 トークンの処理で、区間どうしの入出力を最初に一度だけつないでおき、毎回の受け渡しをなくしました。Panther Lake で 8.9 → 10.3 tok/s、NPU 3720 で 6.0 → 6.5 tok/s(出力は同じ)。
|
| 21 |
-
- **dense モデルのプロンプト処理が約 2〜2.5 倍に**(2.0.1
|
| 22 |
- Core Ultra 9 285HX(NPU 3720):Qwen3.5-9B 約 31〜43 → 約 80〜87 tok/s、llm-jp-4.1-8B 約 46 → 約 111、NeoHorse-1-4B 約 67 → 約 132、Granite 4.2 3B 約 69 → 約 139 tok/s。
|
| 23 |
- 出力はほぼ同じです(16 トークンのブロックとの差は KL 0.00005〜0.0015、最初のトークンは一致)。
|
| 24 |
- 使用メモリはほぼ変わりません(+0.35〜0.5 GB)。16 トークン用のグラフの代わりに 64 トークン用を読み込むので、重みの写しは増えません。そのぶん、短い入力や先読み検証は少し割高になります(NPU 3720 では先読み検証が自動でオ��になります)。設定の「64 トークン処理」を off にすると今までどおりです。
|
|
|
|
| 5 |
日付は日本時間です。各版は Hugging Face の `ryugyosoft/onw` にタグ(`v0.4.2` 以降)付きで残っています。
|
| 6 |
onw ウィンドウは、新しい版があるとこのファイルから変更点を表示します(`## v…` の見出しで区切っています)。
|
| 7 |
|
| 8 |
+
## v2.0.2 (2026-10-17)
|
| 9 |
+
- **Panther Lake・Lunar Lake でも、dense モデルのプロンプトをまた 64 トークンずつ処理するようにしました**(2.0.1 で止めた原因を突き止めて直しました)。Panther Lake で計算がずれていたのは、重みを共有する仕組み(NPUW)の設定の一つ(`NPUW_DQ_FULL`)が原因でした。OpenVINO 自身や llama.cpp と同じ設定にしたところ、正しく計算できるうえに速くなりました。
|
| 10 |
+
- Panther Lake(Qwen3.5-9B INT4、1024 トークン):約 44 → 約 157 tok/s(2.0.0 の約 105 tok/s より速く、計算も正しい)。16 トークンずつの処理も約 44 → 約 51 tok/s。
|
| 11 |
+
- 初回のコンパイルも短くなり(Qwen3.5-9B で約 23 → 約 14 分)、使用メモリも少し減ります。
|
| 12 |
+
- Panther Lake では、更新後の最初のロードでコンパイルし直します。Lunar Lake と NPU 3720(Meteor Lake・Arrow Lake)は今のキャッシュのまま使えます(Lunar Lake の 64 トークンのグラフは、もともと正しく計算できていることを確かめました)。
|
| 13 |
+
- Qwen3.6 系(2.0.0 の高速化)は、この設定を使わないので変わりません。
|
| 14 |
+
|
| 15 |
## v2.0.1 (2026-10-17)
|
| 16 |
- **Panther Lake・Lunar Lake で、dense モデルの 64 トークン処理(2.0.0 で追加)を使わないように戻しました**:Panther Lake(NPU 5010)で、2.0.0 で加えた 64 トークンのグラフの計算結果が正しくなく、Qwen3.5-9B などで意味のない文字が出ることがありました(16 トークンでは正しく計算されます)。NPU 4000 以降では 1.4.13 と同じブロックの選び方に戻します。NPU 3720 では正しく計算できているので、2.0.0 のまま 64 トークンずつ処理します(約 2〜2.5 倍)。モデルの更新はそのままで構いません。
|
| 17 |
- Qwen3.6 系のプロンプト処理(2.0.0)は Panther Lake でも正しく動いているので、変わりません。
|
|
|
|
| 25 |
- **モデルの更新が必要です**(カードに「更新あり」と出ます。差し替えは区間ファイルの約 0.9 GB だけです)。更新すると初回のロードで新しいグラフをコンパイルし直します。古い onw でも更新後のモデルはそのまま動きます。
|
| 26 |
- メモリ 24 GB 未満の PC(16 GB の Lunar Lake など)では、新しいグラフのコンパイル中にメモリが足りなくなるため、今までどおりの処理のままです(`ONW_GROUPED=1` で強制、`0` で無効)。
|
| 27 |
- **Qwen3.6 系の生成が少し速く**:1 トークンの処理で、区間どうしの入出力を最初に一度だけつないでおき、毎回の受け渡しをなくしました。Panther Lake で 8.9 → 10.3 tok/s、NPU 3720 で 6.0 → 6.5 tok/s(出力は同じ)。
|
| 28 |
+
- **dense モデルのプロンプト処理が約 2〜2.5 倍に**(2.0.1 では NPU 3720 のみ、2.0.2 で全機種に戻しました):Qwen3.5-9B、Ornith-1.5-9B、NeoHorse-1-4B、Granite 4.2 3B / 8B、llm-jp-4.1-8B-thinking(INT4 / INT8)に 64 トークンのブロックを加え、プロンプトを 16 トークンずつではなく 64 トークンずつ処理します。Gemma 4 E4B と NF4 版は、今まで 64 トークンのブロックを使えなかった PC(NPU 3720 のメモリ 24 GB 未満、NPUW が使えない設定など)でも使うようになります。
|
| 29 |
- Core Ultra 9 285HX(NPU 3720):Qwen3.5-9B 約 31〜43 → 約 80〜87 tok/s、llm-jp-4.1-8B 約 46 → 約 111、NeoHorse-1-4B 約 67 → 約 132、Granite 4.2 3B 約 69 → 約 139 tok/s。
|
| 30 |
- 出力はほぼ同じです(16 トークンのブロックとの差は KL 0.00005〜0.0015、最初のトークンは一致)。
|
| 31 |
- 使用メモリはほぼ変わりません(+0.35〜0.5 GB)。16 トークン用のグラフの代わりに 64 トークン用を読み込むので、重みの写しは増えません。そのぶん、短い入力や先読み検証は少し割高になります(NPU 3720 では先読み検証が自動でオ��になります)。設定の「64 トークン処理」を off にすると今までどおりです。
|
CHANGELOG_en.md
CHANGED
|
@@ -4,6 +4,13 @@
|
|
| 4 |
|
| 5 |
Dates are JST. Every version is on Hugging Face `ryugyosoft/onw`, tagged from `v0.4.2` on.
|
| 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
## v2.0.1 (2026-10-17)
|
| 8 |
- **On Panther Lake and Lunar Lake the dense models' 64-token blocks (new in 2.0.0) are off again**: on Panther Lake (NPU 5010) the 64-token graphs added in 2.0.0 computed wrong, and Qwen3.5-9B and others could write gibberish (the 16-token blocks compute right). NPU 4000 and later pick their blocks as in 1.4.13 again. On the NPU 3720 they compute right, so it keeps reading prompts 64 tokens at a time (~2-2.5x). The updated models can stay as they are.
|
| 9 |
- The Qwen3.6 prompt path (2.0.0) works right on Panther Lake too and is unchanged.
|
|
@@ -17,7 +24,7 @@ Dates are JST. Every version is on Hugging Face `ryugyosoft/onw`, tagged from `v
|
|
| 17 |
- **The models need an update** (their card shows "update available"; only the segment files, ~0.9 GB, are replaced). The first load after it compiles the new graphs. Older onw versions keep working with the updated models.
|
| 18 |
- On PCs below 24 GB (a 16 GB Lunar Lake, for example) compiling the new graphs runs out of memory, so they keep the old prompt path (`ONW_GROUPED=1` forces it, `0` turns it off).
|
| 19 |
- **Qwen3.6 models generate a little faster**: for single tokens the segments' inputs and outputs are wired to each other once, with no hand-over at every token. Panther Lake 8.9 -> 10.3 tok/s, NPU 3720 6.0 -> 6.5 tok/s (same output).
|
| 20 |
-
- **Prompts of the dense models about 2-2.5x faster** (
|
| 21 |
- Core Ultra 9 285HX (NPU 3720): Qwen3.5-9B ~31-43 -> ~80-87 tok/s, llm-jp-4.1-8B ~46 -> ~111, NeoHorse-1-4B ~67 -> ~132, Granite 4.2 3B ~69 -> ~139 tok/s.
|
| 22 |
- Practically the same output (KL 0.00005-0.0015 against the 16-token blocks, the first token equal).
|
| 23 |
- Practically no extra memory (+0.35-0.5 GB): the 64-token graphs are loaded in place of the 16-token ones, so there is no extra copy of the weights. Short inputs and draft checks cost a little more on them (on the NPU 3720 prompt lookup decoding turns itself off). The setting "64-token blocks" = off keeps the old way.
|
|
|
|
| 4 |
|
| 5 |
Dates are JST. Every version is on Hugging Face `ryugyosoft/onw`, tagged from `v0.4.2` on.
|
| 6 |
|
| 7 |
+
## v2.0.2 (2026-10-17)
|
| 8 |
+
- **Dense models read prompts 64 tokens at a time on Panther Lake and Lunar Lake again** (the cause behind 2.0.1 is found and fixed). The wrong results on Panther Lake came from one setting of the weight-sharing layer (NPUW, `NPUW_DQ_FULL`). With the setting OpenVINO itself and llama.cpp use, the results are right and faster too.
|
| 9 |
+
- Panther Lake (Qwen3.5-9B INT4, 1,024 tokens): ~44 -> ~157 tok/s (faster than 2.0.0's ~105 tok/s, and right). 16 tokens at a time ~44 -> ~51 tok/s.
|
| 10 |
+
- The first compile is shorter as well (Qwen3.5-9B ~23 -> ~14 min), and memory use slightly lower.
|
| 11 |
+
- Panther Lake compiles again on the first load after the update. Lunar Lake and the NPU 3720 (Meteor Lake, Arrow Lake) keep their caches (Lunar Lake's 64-token graphs were checked to compute right all along).
|
| 12 |
+
- The Qwen3.6 models (sped up in 2.0.0) do not use this setting and are unchanged.
|
| 13 |
+
|
| 14 |
## v2.0.1 (2026-10-17)
|
| 15 |
- **On Panther Lake and Lunar Lake the dense models' 64-token blocks (new in 2.0.0) are off again**: on Panther Lake (NPU 5010) the 64-token graphs added in 2.0.0 computed wrong, and Qwen3.5-9B and others could write gibberish (the 16-token blocks compute right). NPU 4000 and later pick their blocks as in 1.4.13 again. On the NPU 3720 they compute right, so it keeps reading prompts 64 tokens at a time (~2-2.5x). The updated models can stay as they are.
|
| 16 |
- The Qwen3.6 prompt path (2.0.0) works right on Panther Lake too and is unchanged.
|
|
|
|
| 24 |
- **The models need an update** (their card shows "update available"; only the segment files, ~0.9 GB, are replaced). The first load after it compiles the new graphs. Older onw versions keep working with the updated models.
|
| 25 |
- On PCs below 24 GB (a 16 GB Lunar Lake, for example) compiling the new graphs runs out of memory, so they keep the old prompt path (`ONW_GROUPED=1` forces it, `0` turns it off).
|
| 26 |
- **Qwen3.6 models generate a little faster**: for single tokens the segments' inputs and outputs are wired to each other once, with no hand-over at every token. Panther Lake 8.9 -> 10.3 tok/s, NPU 3720 6.0 -> 6.5 tok/s (same output).
|
| 27 |
+
- **Prompts of the dense models about 2-2.5x faster** (NPU 3720 only in 2.0.1, all machines again in 2.0.2): Qwen3.5-9B, Ornith-1.5-9B, NeoHorse-1-4B, Granite 4.2 3B / 8B and llm-jp-4.1-8B-thinking (INT4 / INT8) get 64-token blocks, so prompts run 64 tokens at a time instead of 16. Gemma 4 E4B and the NF4 models now use their 64-token blocks on PCs that could not before too (NPU 3720 with less than 24 GB, NPUW off, ...).
|
| 28 |
- Core Ultra 9 285HX (NPU 3720): Qwen3.5-9B ~31-43 -> ~80-87 tok/s, llm-jp-4.1-8B ~46 -> ~111, NeoHorse-1-4B ~67 -> ~132, Granite 4.2 3B ~69 -> ~139 tok/s.
|
| 29 |
- Practically the same output (KL 0.00005-0.0015 against the 16-token blocks, the first token equal).
|
| 30 |
- Practically no extra memory (+0.35-0.5 GB): the 64-token graphs are loaded in place of the 16-token ones, so there is no extra copy of the weights. Short inputs and draft checks cost a little more on them (on the NPU 3720 prompt lookup decoding turns itself off). The setting "64-token blocks" = off keeps the old way.
|
MANUAL.md
CHANGED
|
@@ -167,7 +167,7 @@
|
|
| 167 |
| メモリ節約モード | 1 トークン用と 16 トークン用のグラフを入れ替えて、片方だけを持ちます。待機中のメモリが約 4 割減る代わりに、回答の出だし数秒は遅めで、先読み検証は使いません。初回のコンパイルも並列にせず 1 つずつ行います(コンパイル中のメモリを抑えるため)。効くモデルがあるときだけ表示され、この PC で効くモデルの名前が出ます |
|
| 168 |
| 厳格 | メモリ節約モードの追加。2 種類のグラフを同時に持たないので、メモリは最小になりますが、回答のたびに書き始めるまで数秒待ちます |
|
| 169 |
| エキスパートのメモリ | Qwen3.6 系の MoE 用。上限を超えるエキスパートは SSD に置いたまま、必要なときだけ読みます(メモリが少なくても動きますが、遅くなります) |
|
| 170 |
-
| 64 トークン処理 | 長いプロンプトの処理が約 2〜2.5 倍速くなります
|
| 171 |
|
| 172 |
### 詳細
|
| 173 |
|
|
|
|
| 167 |
| メモリ節約モード | 1 トークン用と 16 トークン用のグラフを入れ替えて、片方だけを持ちます。待機中のメモリが約 4 割減る代わりに、回答の出だし数秒は遅めで、先読み検証は使いません。初回のコンパイルも並列にせず 1 つずつ行います(コンパイル中のメモリを抑えるため)。効くモデルがあるときだけ表示され、この PC で効くモデルの名前が出ます |
|
| 168 |
| 厳格 | メモリ節約モードの追加。2 種類のグラフを同時に持たないので、メモリは最小になりますが、回答のたびに書き始めるまで数秒待ちます |
|
| 169 |
| エキスパートのメモリ | Qwen3.6 系の MoE 用。上限を超えるエキスパートは SSD に置いたまま、必要なときだけ読みます(メモリが少なくても動きますが、遅くなります) |
|
| 170 |
+
| 64 トークン処理 | 長いプロンプトの処理が約 2〜2.5 倍速くなります(dense モデル。Qwen3.6 系は別の方法で速くしています)。16 トークン用のグラフの代わりに読み込むので、メモリはほぼ増えません(+0.3〜0.5 GB)。auto はオン。off にすると今までどおり 16 トークンずつ(短い入力の多い使い方や、NPU 3720 で先読み検証を使いたいとき) |
|
| 171 |
|
| 172 |
### 詳細
|
| 173 |
|
MANUAL_en.md
CHANGED
|
@@ -178,7 +178,7 @@ applies them ("Discard" throws them away). For settings that need a server resta
|
|
| 178 |
| Memory-saving mode | Swaps the 1-token and 16-token graphs so only one set is held: about 40% less memory when idle, but the first seconds of an answer are slower and prompt lookup is not used. The first compile also runs one graph at a time instead of in parallel (less memory while compiling). Shown only when it applies, with the models it works for on this PC |
|
| 179 |
| Strict | An addition to the memory-saving mode: never holds both sets of graphs, for the least memory, but every answer waits a few seconds before it starts |
|
| 180 |
| Expert memory | For the Qwen3.6 MoE models: experts beyond the limit stay on the SSD and are read when needed (works with less memory, but slower) |
|
| 181 |
-
| 64-token blocks | Long prompts are processed ~2-2.5x faster
|
| 182 |
|
| 183 |
### Advanced
|
| 184 |
|
|
|
|
| 178 |
| Memory-saving mode | Swaps the 1-token and 16-token graphs so only one set is held: about 40% less memory when idle, but the first seconds of an answer are slower and prompt lookup is not used. The first compile also runs one graph at a time instead of in parallel (less memory while compiling). Shown only when it applies, with the models it works for on this PC |
|
| 179 |
| Strict | An addition to the memory-saving mode: never holds both sets of graphs, for the least memory, but every answer waits a few seconds before it starts |
|
| 180 |
| Expert memory | For the Qwen3.6 MoE models: experts beyond the limit stay on the SSD and are read when needed (works with less memory, but slower) |
|
| 181 |
+
| 64-token blocks | Long prompts are processed ~2-2.5x faster (dense models; the Qwen3.6 models are sped up another way). Loaded in place of the 16-token graphs, so memory hardly grows (+0.3-0.5 GB). auto = on. off = 16 tokens at a time as before (for mostly short inputs, or to keep prompt lookup decoding on the NPU 3720) |
|
| 182 |
|
| 183 |
### Advanced
|
| 184 |
|
README.md
CHANGED
|
@@ -129,9 +129,9 @@ NPU は数トークンを 1 トークンとほぼ同じ時間で計算できる
|
|
| 129 |
(コンテキスト長、64 トークン処理、エキスパートのメモリ)を反映した目安です。メモリが足りない PC では、Qwen3.6 系の
|
| 130 |
エキスパートを SSD に置いたまま動かせます(設定の「エキスパートのメモリ」。仕組みは[技術解説](TECHNICAL.md))。
|
| 131 |
|
| 132 |
-
プロンプト(入力した文章)の読み込みは、dense モデルは
|
| 133 |
処理します(onw 2.0)。NPU 3720 で Qwen3.5-9B 約 80〜87 tok/s、llm-jp-4.1-8B 約 110、Granite 4.2 3B 約 140、Qwen3.6-35B-A3B
|
| 134 |
-
約 100 tok/s(メモリ 24 GB 以上)、Panther Lake で Qwen3.6-35B-A3B 約 147 tok/s です。
|
| 135 |
|
| 136 |
先読み検証は、検証ブロックが十分安く済むモデル(LFM 系、Lunar Lake 以降の Qwen3.5-9B・Gemma など)で自動的に使われます。
|
| 137 |
「思考」の列の「切替」のモデル(Qwen、LFM2.5、Gemma 4、Granite 4.2 など)は、既定では考えずに答えます(チャット画面の「思考モード」、API の
|
|
@@ -194,7 +194,7 @@ onw list # 対応アーキ
|
|
| 194 |
| temperature、top_p、top_k、繰り返し抑制(repetition / presence / frequency penalty)、max_tokens、stop、seed、思考モード | リクエストごと(API またはチャット画面) | 不要 |
|
| 195 |
| ポート、待ち受けアドレス、モデル、デバイス、先読み検証のオン/オフ | サーバーのオプション/設定画面、再起動(約 20 秒) | 不要 |
|
| 196 |
| **コンテキスト長**(`--context`、既定 32K、モデルの最大まで) | サーバーのオプション/設定画面 | 不要(KV キャッシュの上限が変わるだけ) |
|
| 197 |
-
| 64 トークン処理(dense モデルのプロンプトを 64 トークンずつ。auto は
|
| 198 |
| MTP 先読み(Qwen3.5 系 NF4 版。auto は Lunar Lake 以降でオン) | `ONW_MTP=1/0` | 初回のみ |
|
| 199 |
| エキスパートのメモリ(Qwen3.6 系。上限を超える分は SSD から読む) | `ONW_EXPERT_GB=5`/設定画面 | 不要 |
|
| 200 |
| NPUW 重み共有(試験的。auto は Lunar Lake 以降でオン、MoE モデル(LFM2・Qwen3.6)と区間の多いモデル(Granite・llm-jp)は対象外:重みを 1 コピーにしてメモリとコンパイル時間を削減) | `ONW_NPUW=1/0`/設定画面 | 初回のみ |
|
|
|
|
| 129 |
(コンテキスト長、64 トークン処理、エキスパートのメモリ)を反映した目安です。メモリが足りない PC では、Qwen3.6 系の
|
| 130 |
エキスパートを SSD に置いたまま動かせます(設定の「エキスパートのメモリ」。仕組みは[技術解説](TECHNICAL.md))。
|
| 131 |
|
| 132 |
+
プロンプト(入力した文章)の読み込みは、dense モデルは 64 トークンずつ、Qwen3.6 系はプロンプト全体を層ごとにまとめて
|
| 133 |
処理します(onw 2.0)。NPU 3720 で Qwen3.5-9B 約 80〜87 tok/s、llm-jp-4.1-8B 約 110、Granite 4.2 3B 約 140、Qwen3.6-35B-A3B
|
| 134 |
+
約 100 tok/s(メモリ 24 GB 以上)、Panther Lake で Qwen3.5-9B 約 157、Qwen3.6-35B-A3B 約 147 tok/s です。
|
| 135 |
|
| 136 |
先読み検証は、検証ブロックが十分安く済むモデル(LFM 系、Lunar Lake 以降の Qwen3.5-9B・Gemma など)で自動的に使われます。
|
| 137 |
「思考」の列の「切替」のモデル(Qwen、LFM2.5、Gemma 4、Granite 4.2 など)は、既定では考えずに答えます(チャット画面の「思考モード」、API の
|
|
|
|
| 194 |
| temperature、top_p、top_k、繰り返し抑制(repetition / presence / frequency penalty)、max_tokens、stop、seed、思考モード | リクエストごと(API またはチャット画面) | 不要 |
|
| 195 |
| ポート、待ち受けアドレス、モデル、デバイス、先読み検証のオン/オフ | サーバーのオプション/設定画面、再起動(約 20 秒) | 不要 |
|
| 196 |
| **コンテキスト長**(`--context`、既定 32K、モデルの最大まで) | サーバーのオプション/設定画面 | 不要(KV キャッシュの上限が変わるだけ) |
|
| 197 |
+
| 64 トークン処理(dense モデルのプロンプトを 64 トークンずつ。auto はオンで、16 トークン用のグラフの代わりに読み込む。off で 16 トークンずつ、`ONW_S64=1` で両方) | `ONW_S64=1/0`/設定画面 | 初回のみ |
|
| 198 |
| MTP 先読み(Qwen3.5 系 NF4 版。auto は Lunar Lake 以降でオン) | `ONW_MTP=1/0` | 初回のみ |
|
| 199 |
| エキスパートのメモリ(Qwen3.6 系。上限を超える分は SSD から読む) | `ONW_EXPERT_GB=5`/設定画面 | 不要 |
|
| 200 |
| NPUW 重み共有(試験的。auto は Lunar Lake 以降でオン、MoE モデル(LFM2・Qwen3.6)と区間の多いモデル(Granite・llm-jp)は対象外:重みを 1 コピーにしてメモリとコンパイル時間を削減) | `ONW_NPUW=1/0`/設定画面 | 初回のみ |
|
README_en.md
CHANGED
|
@@ -118,9 +118,9 @@ vision encoder freed after each image (the default below 24 GB of RAM). The "Mem
|
|
| 118 |
window applies that PC's settings (context length, 64-token blocks, expert memory). On a PC short of memory the
|
| 119 |
Qwen3.6 models can keep their experts on the SSD (Settings → "Expert memory"; how it works: [Technical notes](TECHNICAL_en.md)).
|
| 120 |
|
| 121 |
-
Prompts (the text you send) are read 64 tokens at a time on the dense models
|
| 122 |
on the Qwen3.6 models (onw 2.0): on the NPU 3720 Qwen3.5-9B ~80-87 tok/s, llm-jp-4.1-8B ~110, Granite 4.2 3B ~140,
|
| 123 |
-
Qwen3.6-35B-A3B ~100 tok/s (24 GB of RAM or more); on Panther Lake Qwen3.6-35B-A3B ~147 tok/s.
|
| 124 |
|
| 125 |
Prompt lookup decoding is used automatically where a verification block is cheap enough (the LFM models, Qwen3.5-9B
|
| 126 |
and Gemma from Lunar Lake on, ...), and every model keeps the conversation state between turns (a follow-up with an image
|
|
@@ -182,7 +182,7 @@ What needs what:
|
|
| 182 |
| temperature, top_p, top_k, repetition / presence / frequency penalty, max_tokens, stop, seed, thinking | per request (API or chat UI) | no |
|
| 183 |
| port, address, model, device, prompt lookup on/off | server option / settings, restart (~20 s) | no |
|
| 184 |
| **context length** (`--context`, 32K by default, up to the model's maximum) | server option / settings | no (it only bounds the KV cache) |
|
| 185 |
-
| 64-token prompt blocks (dense models read prompts 64 tokens at a time; auto = on
|
| 186 |
| MTP draft tokens (the NF4 Qwen3.5-family builds; auto = on from Lunar Lake) | `ONW_MTP=1/0` | once, the first time |
|
| 187 |
| expert memory (Qwen3.6 models; the rest streams from the SSD) | `ONW_EXPERT_GB=5` / settings | no |
|
| 188 |
| NPUW weight sharing (experimental; auto = on from Lunar Lake, not for the MoE models LFM2 / Qwen3.6 or models with many parts (Granite, llm-jp): one copy of the weights, less memory, much faster compile) | `ONW_NPUW=1/0` / settings | once, the first time |
|
|
|
|
| 118 |
window applies that PC's settings (context length, 64-token blocks, expert memory). On a PC short of memory the
|
| 119 |
Qwen3.6 models can keep their experts on the SSD (Settings → "Expert memory"; how it works: [Technical notes](TECHNICAL_en.md)).
|
| 120 |
|
| 121 |
+
Prompts (the text you send) are read 64 tokens at a time on the dense models, and layer by layer over the whole prompt
|
| 122 |
on the Qwen3.6 models (onw 2.0): on the NPU 3720 Qwen3.5-9B ~80-87 tok/s, llm-jp-4.1-8B ~110, Granite 4.2 3B ~140,
|
| 123 |
+
Qwen3.6-35B-A3B ~100 tok/s (24 GB of RAM or more); on Panther Lake Qwen3.5-9B ~157, Qwen3.6-35B-A3B ~147 tok/s.
|
| 124 |
|
| 125 |
Prompt lookup decoding is used automatically where a verification block is cheap enough (the LFM models, Qwen3.5-9B
|
| 126 |
and Gemma from Lunar Lake on, ...), and every model keeps the conversation state between turns (a follow-up with an image
|
|
|
|
| 182 |
| temperature, top_p, top_k, repetition / presence / frequency penalty, max_tokens, stop, seed, thinking | per request (API or chat UI) | no |
|
| 183 |
| port, address, model, device, prompt lookup on/off | server option / settings, restart (~20 s) | no |
|
| 184 |
| **context length** (`--context`, 32K by default, up to the model's maximum) | server option / settings | no (it only bounds the KV cache) |
|
| 185 |
+
| 64-token prompt blocks (dense models read prompts 64 tokens at a time; auto = on, loaded in place of the 16-token graphs; off = 16 at a time, `ONW_S64=1` = both) | `ONW_S64=1/0` / settings | once, the first time |
|
| 186 |
| MTP draft tokens (the NF4 Qwen3.5-family builds; auto = on from Lunar Lake) | `ONW_MTP=1/0` | once, the first time |
|
| 187 |
| expert memory (Qwen3.6 models; the rest streams from the SSD) | `ONW_EXPERT_GB=5` / settings | no |
|
| 188 |
| NPUW weight sharing (experimental; auto = on from Lunar Lake, not for the MoE models LFM2 / Qwen3.6 or models with many parts (Granite, llm-jp): one copy of the weights, less memory, much faster compile) | `ONW_NPUW=1/0` / settings | once, the first time |
|
TECHNICAL.md
CHANGED
|
@@ -377,9 +377,9 @@ dense モデルのプロンプトは 16 トークンのブロックで処理し
|
|
| 377 |
- **やったこと**:64 トークンのグラフを加え、16 トークン用の代わりに読み込みます(1 トークン用+プロンプト用の 2 種類のまま)。NPU 3720 は重みを共有できないので、サイズを足すと重みの写しが増えますが、入れ替えなら増えません。Lunar Lake 以降も、サイズごとに NPU の作業領域(約 0.6 GB)を取るので入れ替えにしました。
|
| 378 |
- **DeltaNet の計算は 16 トークンのチャンクのまま**(`ir.deltanet_chunks`)。64 トークンを 1 チャンクにする式(減衰をチャンク内の累積とチャンクの合計の積で作り、fp16 の桁落ちを避ける)も試しました。NPU 3720 では状態の読み書きが減って DeltaNet が 1.5 倍速くなりましたが、Panther Lake のコンパイラーでは答えが大きくずれたので採用していません。
|
| 379 |
- **配布**:公開済みのモデルの重みファイル(`seg*.bin`)は変えていません。同じ変換器で作り直した 64 トークンのグラフの定数は、ほとんどが既存の `seg*.bin` の中に同じものがあり、そこを指します。足りない分(大きなブロックの形を表す整数、区間あたり数百バイト)だけを `seg*x.bin` に置き、読み込み時に入力として読んでから定数に置き換えます(`compact.graft_sizes`、`runtime._xbin_model`)。`engine.json` の `prompt_sizes` に書くので、2.0 より前の onw はこれらを読まず、今までどおり動きます。更新のダウンロードは数 MB です。
|
| 380 |
-
- **Panther Lake で
|
| 381 |
-
- **128 トークンは見送り**:Panther Lake では 139 tok/s とさらに速くなりますが、使用メモリが 16 トークンより約 1.1 GB 増え、初回のコンパイルが 9B で約 1 時間 40 分かかります(64 トークンで約 50 分)。NPU 3720 では 64 より遅くなります。
|
| 382 |
-
- **結果**(1024 トークン):Panther Lake の Qwen3.5-9B INT4 44 →
|
| 383 |
|
| 384 |
## 1 ステップのホスト側の処理(onw 1.4)
|
| 385 |
|
|
|
|
| 377 |
- **やったこと**:64 トークンのグラフを加え、16 トークン用の代わりに読み込みます(1 トークン用+プロンプト用の 2 種類のまま)。NPU 3720 は重みを共有できないので、サイズを足すと重みの写しが増えますが、入れ替えなら増えません。Lunar Lake 以降も、サイズごとに NPU の作業領域(約 0.6 GB)を取るので入れ替えにしました。
|
| 378 |
- **DeltaNet の計算は 16 トークンのチャンクのまま**(`ir.deltanet_chunks`)。64 トークンを 1 チャンクにする式(減衰をチャンク内の累積とチャンクの合計の積で作り、fp16 の桁落ちを避ける)も試しました。NPU 3720 では状態の読み書きが減って DeltaNet が 1.5 倍速くなりましたが、Panther Lake のコンパイラーでは答えが大きくずれたので採用していません。
|
| 379 |
- **配布**:公開済みのモデルの重みファイル(`seg*.bin`)は変えていません。同じ変換器で作り直した 64 トークンのグラフの定数は、ほとんどが既存の `seg*.bin` の中に同じものがあり、そこを指します。足りない分(大きなブロックの形を表す整数、区間あたり数百バイト)だけを `seg*x.bin` に置き、読み込み時に入力として読んでから定数に置き換えます(`compact.graft_sizes`、`runtime._xbin_model`)。`engine.json` の `prompt_sizes` に書くので、2.0 より前の onw はこれらを読まず、今までどおり動きます。更新のダウンロードは数 MB です。
|
| 380 |
+
- **Panther Lake で計算がずれた件(2.0.1 で止め、2.0.2 で直した)**:Panther Lake(NPU 5010)では、2.0.0 の 64 トークンのグラフの計算結果が正しくありませんでした(Qwen3.5-9B INT4 のロジットの KL が 14)。原因は NPUW の `NPUW_DQ_FULL`(既定 YES)です。グループ量子化された INT4 の行列積を、重みのグループごとの行列積と足し算の連鎖に書き換える処理で、この NPU のコンパイラーが、ちょうど 64 行のときに、出力 4096 の行列積の後に足し算が続く形(各層の出力の射影と残差)を誤ってコンパイルしていました(16・32・48・80・96・128 行は正しい)。OpenVINO 自身の NPUW の LLM モードと llama.cpp は `NPUW_DQ_FULL=NO`(重みを転置するだけ)を使っています。2.0.2 では NPU 5000 番台でこれに合わせました。計算が正しくなったうえに、Qwen3.5-9B の 64 トークンは初回コンパイル 50 → 14 分、1024 トークン 105(誤り)→ 157 tok/s、16 トークンも 44 → 51 tok/s になり、メモリも少し減りました。NPU 4000(Lunar Lake)は YES のまま正しく計算でき、NO では約 2 割遅かったので変えていません。NPU 3720 は NPUW を使いません(使うと INT4 の重みを f16 に展開して持つので、9B でメモリが 9.8 → 34.7 GB になり、生成も半分になります)。
|
| 381 |
+
- **128 トークンは見送り**:Panther Lake では 139 tok/s とさらに速くなりますが、使用メモリが 16 トークンより約 1.1 GB 増え、初回のコンパイルが 9B で約 1 時間 40 分かかります(64 トークンで約 50 分。どちらも `NPUW_DQ_FULL` が YES のときの値)。NPU 3720 では 64 より遅くなります。
|
| 382 |
+
- **結果**(1024 トークン):Panther Lake の Qwen3.5-9B INT4 44 → 157 tok/s(2.0.2)、NPU 3720 の Qwen3.5-9B 31〜43 → 80〜87、llm-jp-4.1-8B 46 → 111、NeoHorse-1-4B 67 → 132、Granite 4.2 3B 69 → 139 tok/s。16 トークンのブロックとの差は KL 0.00005〜0.0015。
|
| 383 |
|
| 384 |
## 1 ステップのホスト側の処理(onw 1.4)
|
| 385 |
|
TECHNICAL_en.md
CHANGED
|
@@ -387,12 +387,20 @@ Dense models read prompts in 16-token blocks. Every NPU run has a fixed cost tha
|
|
| 387 |
inputs and turned into constants at load (`compact.graft_sizes`, `runtime._xbin_model`). They are listed under
|
| 388 |
`prompt_sizes` in `engine.json`, which onw before 2.0 does not read, so it keeps working as before. An update
|
| 389 |
downloads a few MB.
|
| 390 |
-
- **
|
| 391 |
-
|
| 392 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 393 |
- **No 128-token blocks**: on Panther Lake they reach 139 tok/s, but take ~1.1 GB more memory than the 16-token
|
| 394 |
-
blocks and ~1 h 40 min to compile for a 9B the first time (64 tokens: ~50 min
|
| 395 |
-
|
|
|
|
| 396 |
llm-jp-4.1-8B 46 -> 111, NeoHorse-1-4B 67 -> 132, Granite 4.2 3B 69 -> 139 tok/s. KL 0.00005-0.0015 against the
|
| 397 |
16-token blocks.
|
| 398 |
|
|
|
|
| 387 |
inputs and turned into constants at load (`compact.graft_sizes`, `runtime._xbin_model`). They are listed under
|
| 388 |
`prompt_sizes` in `engine.json`, which onw before 2.0 does not read, so it keeps working as before. An update
|
| 389 |
downloads a few MB.
|
| 390 |
+
- **Wrong on Panther Lake (off in 2.0.1, fixed in 2.0.2)**: on Panther Lake (NPU 5010) the 2.0.0 64-token graphs
|
| 391 |
+
computed wrong (Qwen3.5-9B INT4 logits KL 14). The cause is NPUW's `NPUW_DQ_FULL` (default YES): it rewrites every
|
| 392 |
+
group-quantized INT4 MatMul into a MatMul per weight group plus an Add chain, and this NPU's compiler gets one shape
|
| 393 |
+
wrong at exactly 64 rows - a MatMul with 4096 outputs followed by an Add (every layer's out_proj + residual; 16, 32,
|
| 394 |
+
48, 80, 96 and 128 rows are right). OpenVINO's own NPUW LLM mode and llama.cpp use `NPUW_DQ_FULL=NO` (the weights are
|
| 395 |
+
only transposed); 2.0.2 does the same on NPU 5000+. Besides right results, Qwen3.5-9B's 64-token blocks now compile in
|
| 396 |
+
14 instead of 50 min and read 1,024 tokens at 157 instead of 105 (wrong) tok/s; the 16-token blocks go 44 -> 51 tok/s,
|
| 397 |
+
and memory is slightly lower. NPU 4000 (Lunar Lake) computes right with YES and runs ~20% slower with NO, so it keeps
|
| 398 |
+
YES. The NPU 3720 does not use NPUW (it would hold the INT4 weights expanded to f16: 9.8 -> 34.7 GB for a 9B, decode
|
| 399 |
+
halved).
|
| 400 |
- **No 128-token blocks**: on Panther Lake they reach 139 tok/s, but take ~1.1 GB more memory than the 16-token
|
| 401 |
+
blocks and ~1 h 40 min to compile for a 9B the first time (64 tokens: ~50 min; both with
|
| 402 |
+
`NPUW_DQ_FULL` YES); on the NPU 3720 they are slower than 64.
|
| 403 |
+
- **Result** (1,024 tokens): Panther Lake Qwen3.5-9B INT4 44 -> 157 tok/s (2.0.2); NPU 3720 Qwen3.5-9B 31-43 -> 80-87,
|
| 404 |
llm-jp-4.1-8B 46 -> 111, NeoHorse-1-4B 67 -> 132, Granite 4.2 3B 69 -> 139 tok/s. KL 0.00005-0.0015 against the
|
| 405 |
16-token blocks.
|
| 406 |
|
onw/__init__.py
CHANGED
|
@@ -2,4 +2,4 @@
|
|
| 2 |
|
| 3 |
A small engine that runs LLMs entirely on the Intel NPU: static segment graphs + host-managed state.
|
| 4 |
"""
|
| 5 |
-
__version__ = "2.0.
|
|
|
|
| 2 |
|
| 3 |
A small engine that runs LLMs entirely on the Intel NPU: static segment graphs + host-managed state.
|
| 4 |
"""
|
| 5 |
+
__version__ = "2.0.2"
|
onw/app.py
CHANGED
|
@@ -301,13 +301,9 @@ def raise_window():
|
|
| 301 |
|
| 302 |
|
| 303 |
def big_blocks_on(cfg, ram):
|
| 304 |
-
"""
|
| 305 |
-
|
| 306 |
-
|
| 307 |
-
b = cfg.get("big_blocks", "auto")
|
| 308 |
-
if b in ("on", "off"):
|
| 309 |
-
return b == "on"
|
| 310 |
-
return npu_arch() >= 4000 and ram is not None and ram >= 24
|
| 311 |
|
| 312 |
|
| 313 |
def usable_ram(ram):
|
|
|
|
| 301 |
|
| 302 |
|
| 303 |
def big_blocks_on(cfg, ram):
|
| 304 |
+
"""A second copy of the weights for the 64-token blocks (memory estimate): only when forced on in the settings -
|
| 305 |
+
since 2.0 "auto" (chat.block_sizes) loads them in the 16-token graphs' place where the sizes cannot share weights."""
|
| 306 |
+
return cfg.get("big_blocks", "auto") == "on"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 307 |
|
| 308 |
|
| 309 |
def usable_ram(ram):
|
onw/chat.py
CHANGED
|
@@ -65,10 +65,6 @@ def block_sizes(meta, shared=False, mtp=False, arch=None):
|
|
| 65 |
return [1]
|
| 66 |
if only:
|
| 67 |
return [S for S in sizes if str(S) in only.split(",")] or sizes
|
| 68 |
-
if arch is None or arch >= 4000:
|
| 69 |
-
# [2.0.1] NPU 4000+: as in 1.4 - the 64-token graphs added in 2.0 ("prompt_sizes") compute wrong on Panther
|
| 70 |
-
# Lake (NPU 5010, Qwen3.5-9B INT4: logits KL 14 against the 16-token blocks; 16 and 128 tokens are right)
|
| 71 |
-
return _block_sizes_14(meta, shared, mtp)
|
| 72 |
cap = int(os.environ.get("ONW_PROMPT_MAX", "0")) or (64 if arch is not None and arch < 4000 else 0)
|
| 73 |
if cap:
|
| 74 |
sizes = [S for S in sizes if S <= cap]
|
|
@@ -93,23 +89,6 @@ def block_sizes(meta, shared=False, mtp=False, arch=None):
|
|
| 93 |
return [S for S in sizes if S in keep or (S > 16 and (env == "1" or S == max(big)))]
|
| 94 |
|
| 95 |
|
| 96 |
-
def _block_sizes_14(meta, shared, mtp):
|
| 97 |
-
"""onw 1.4's choice (NPU 4000+): the 1- and 16-token graphs, larger blocks of "sizes" with NPUW or >= 24 GB RAM
|
| 98 |
-
(ONW_S64=1 / 0 forces them on / off), the smallest checking size instead of the 1-token graphs with MTP drafts."""
|
| 99 |
-
sizes = meta["sizes"]
|
| 100 |
-
env = os.environ.get("ONW_S64")
|
| 101 |
-
ram = total_ram_gb()
|
| 102 |
-
big = env == "1" if env in ("0", "1") else (shared or (ram is not None and ram >= 24))
|
| 103 |
-
sizes = [S for S in sizes if S <= 16 or big]
|
| 104 |
-
small = [S for S in sizes if S <= 16]
|
| 105 |
-
verify = [S for S in small if S >= 4]
|
| 106 |
-
if shared and mtp and verify:
|
| 107 |
-
keep = {min(verify)}
|
| 108 |
-
else:
|
| 109 |
-
keep = {S for S in small if S in (1, 16)} or set(small)
|
| 110 |
-
return [S for S in sizes if S > 16 or S in keep]
|
| 111 |
-
|
| 112 |
-
|
| 113 |
# Thinking levels ("low" / "medium" / "high", the API's reasoning_effort): harmony models (gpt-oss, llm-jp) were trained
|
| 114 |
# for them; models that only switch thinking on or off (Qwen, Gemma, Granite) get a budget of thinking tokens, after
|
| 115 |
# which onw closes the thought and the answer follows (None: no limit)
|
|
@@ -138,6 +117,15 @@ class ChatEngine:
|
|
| 138 |
arch = npu_arch(core) if device == "NPU" else None
|
| 139 |
sizes = block_sizes(meta, shared, mtp, arch)
|
| 140 |
from . import parts
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 141 |
if shared and parts.estimate(meta, sizes) > parts.MANY: # (NPUW goes off for so many parts: no sharing)
|
| 142 |
shared = False
|
| 143 |
mtp = use_mtp(meta, shared)
|
|
|
|
| 65 |
return [1]
|
| 66 |
if only:
|
| 67 |
return [S for S in sizes if str(S) in only.split(",")] or sizes
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
cap = int(os.environ.get("ONW_PROMPT_MAX", "0")) or (64 if arch is not None and arch < 4000 else 0)
|
| 69 |
if cap:
|
| 70 |
sizes = [S for S in sizes if S <= cap]
|
|
|
|
| 89 |
return [S for S in sizes if S in keep or (S > 16 and (env == "1" or S == max(big)))]
|
| 90 |
|
| 91 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
# Thinking levels ("low" / "medium" / "high", the API's reasoning_effort): harmony models (gpt-oss, llm-jp) were trained
|
| 93 |
# for them; models that only switch thinking on or off (Qwen, Gemma, Granite) get a budget of thinking tokens, after
|
| 94 |
# which onw closes the thought and the answer follows (None: no limit)
|
|
|
|
| 117 |
arch = npu_arch(core) if device == "NPU" else None
|
| 118 |
sizes = block_sizes(meta, shared, mtp, arch)
|
| 119 |
from . import parts
|
| 120 |
+
while shared and parts.estimate(meta, sizes) > parts.MANY and len([S for S in sizes if S > 1]) > 1:
|
| 121 |
+
# [2.0] rather fewer block sizes than no sharing (a second copy of the weights): the 16-token graphs go
|
| 122 |
+
# first when larger prompt blocks are there, then the smallest of those
|
| 123 |
+
big = [S for S in sizes if S > 16]
|
| 124 |
+
if 16 in sizes and big:
|
| 125 |
+
drop = 16
|
| 126 |
+
else:
|
| 127 |
+
drop = min(big or [S for S in sizes if S > 1])
|
| 128 |
+
sizes = [S for S in sizes if S != drop]
|
| 129 |
if shared and parts.estimate(meta, sizes) > parts.MANY: # (NPUW goes off for so many parts: no sharing)
|
| 130 |
shared = False
|
| 131 |
mtp = use_mtp(meta, shared)
|
onw/i18n.json
CHANGED
|
@@ -39,7 +39,7 @@
|
|
| 39 |
"URL をコピーしました": "URL copied",
|
| 40 |
"auto(Lunar Lake 以降でオン)": "auto (on for Lunar Lake+)",
|
| 41 |
"auto(OS に合わせる)": "auto (follow the OS)",
|
| 42 |
-
"auto(NPU 3720
|
| 43 |
"auto(足りないときだけ SSD から)": "auto (SSD when RAM is short)",
|
| 44 |
"gpt-oss-20b の高精度版": "The higher-precision gpt-oss-20b",
|
| 45 |
"gpt-oss-20b の高精度版(エキスパート INT8。メモリ 24 GB 以上向け)": "The higher-precision gpt-oss-20b (INT8 experts; for 24 GB+ of RAM)",
|
|
@@ -397,7 +397,7 @@
|
|
| 397 |
"URL をコピーしました": "已复制 URL",
|
| 398 |
"auto(Lunar Lake 以降でオン)": "auto(Lunar Lake 起开启)",
|
| 399 |
"auto(OS に合わせる)": "auto(跟随系统)",
|
| 400 |
-
"auto(NPU 3720
|
| 401 |
"auto(足りないときだけ SSD から)": "auto(内存不足时用 SSD)",
|
| 402 |
"gpt-oss-20b の高精度版": "gpt-oss-20b 的高精度版",
|
| 403 |
"gpt-oss-20b の高精度版(エキスパート INT8。メモリ 24 GB 以上向け)": "gpt-oss-20b 的高精度版(INT8 专家;面向 24 GB 以上内存)",
|
|
|
|
| 39 |
"URL をコピーしました": "URL copied",
|
| 40 |
"auto(Lunar Lake 以降でオン)": "auto (on for Lunar Lake+)",
|
| 41 |
"auto(OS に合わせる)": "auto (follow the OS)",
|
| 42 |
+
"auto(オン。NPU 3720 などでは 16 トークン処理と入れ替え)": "auto (on; on NPU 3720 and the like in place of the 16-token blocks)",
|
| 43 |
"auto(足りないときだけ SSD から)": "auto (SSD when RAM is short)",
|
| 44 |
"gpt-oss-20b の高精度版": "The higher-precision gpt-oss-20b",
|
| 45 |
"gpt-oss-20b の高精度版(エキスパート INT8。メモリ 24 GB 以上向け)": "The higher-precision gpt-oss-20b (INT8 experts; for 24 GB+ of RAM)",
|
|
|
|
| 397 |
"URL をコピーしました": "已复制 URL",
|
| 398 |
"auto(Lunar Lake 以降でオン)": "auto(Lunar Lake 起开启)",
|
| 399 |
"auto(OS に合わせる)": "auto(跟随系统)",
|
| 400 |
+
"auto(オン。NPU 3720 などでは 16 トークン処理と入れ替え)": "auto(开启;在 NPU 3720 等机型上替换 16 token 分块)",
|
| 401 |
"auto(足りないときだけ SSD から)": "auto(内存不足时用 SSD)",
|
| 402 |
"gpt-oss-20b の高精度版": "gpt-oss-20b 的高精度版",
|
| 403 |
"gpt-oss-20b の高精度版(エキスパート INT8。メモリ 24 GB 以上向け)": "gpt-oss-20b 的高精度版(INT8 专家;面向 24 GB 以上内存)",
|
onw/runtime.py
CHANGED
|
@@ -54,7 +54,9 @@ def npu_info(core):
|
|
| 54 |
|
| 55 |
def use_npuw(core):
|
| 56 |
"""NPUW weight sharing (one copy of the weights for all block sizes, much faster compile): on by default from
|
| 57 |
-
NPU 4000 (Lunar Lake) on; ONW_NPUW=1 / 0 forces it.
|
|
|
|
|
|
|
| 58 |
env = os.environ.get("ONW_NPUW", "auto")
|
| 59 |
return env == "1" if env in ("0", "1") else npu_arch(core) >= 4000
|
| 60 |
|
|
@@ -1022,8 +1024,15 @@ class SegmentedModel:
|
|
| 1022 |
# by data pointer, so every block size reads its IR against the same in-memory copy of the .bin
|
| 1023 |
# same baseline as OpenVINO's NPUW LLM mode: NPU 4000+ compilers dequantize themselves (compiler DQ),
|
| 1024 |
# older ones get the weights decompressed by NPUW (DCOFF)
|
| 1025 |
-
dq = {"NPUW_DQ": "YES", "NPU_COMPILER_DYNAMIC_QUANTIZATION": "YES"}
|
| 1026 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1027 |
# The same set as the standalone Qwen3.5 / Gemma ports that run on Lunar Lake, plus the shared weights bank.
|
| 1028 |
# Not NPUW_SLICE_OUT (cuts outputs to the last token; breaks multi-token blocks) and not the LLM mode's
|
| 1029 |
# "compute-layers-with-higher-precision" (its f32 -> f16 converts fail to compile on NPU 4000; our graphs
|
|
|
|
| 54 |
|
| 55 |
def use_npuw(core):
|
| 56 |
"""NPUW weight sharing (one copy of the weights for all block sizes, much faster compile): on by default from
|
| 57 |
+
NPU 4000 (Lunar Lake) on; ONW_NPUW=1 / 0 forces it. Not on the NPU 3720: its compiler has no dynamic quantization, so
|
| 58 |
+
NPUW keeps the INT4 weights expanded to f16 (DCOFF) - [2.0.2] Qwen3.5-9B [1, 64] on Arrow Lake: 9.8 -> 34.7 GB, decode
|
| 59 |
+
5.1 -> 2.3 tok/s (right results with OpenVINO 2026.5)."""
|
| 60 |
env = os.environ.get("ONW_NPUW", "auto")
|
| 61 |
return env == "1" if env in ("0", "1") else npu_arch(core) >= 4000
|
| 62 |
|
|
|
|
| 1024 |
# by data pointer, so every block size reads its IR against the same in-memory copy of the .bin
|
| 1025 |
# same baseline as OpenVINO's NPUW LLM mode: NPU 4000+ compilers dequantize themselves (compiler DQ),
|
| 1026 |
# older ones get the weights decompressed by NPUW (DCOFF)
|
| 1027 |
+
dq = ({"NPUW_DQ": "YES", "NPU_COMPILER_DYNAMIC_QUANTIZATION": "YES"}
|
| 1028 |
+
if npu_arch(core) >= 4000 else {"NPUW_DCOFF_TYPE": "f16", "NPUW_DCOFF_SCALE": "YES"})
|
| 1029 |
+
if npu_arch(core) >= 5000:
|
| 1030 |
+
# [2.0.2] NPU 5010 (Panther Lake): NPUW_DQ_FULL=NO, as OpenVINO's own NPUW LLM mode (and llama.cpp) set
|
| 1031 |
+
# it. The default (YES) rewrites every group-quantized multi-row MatMul into a MatMul per weight group +
|
| 1032 |
+
# an Add chain, which this NPU's compiler gets wrong at 64 rows (Qwen3.5-9B INT4: logits KL 14) and
|
| 1033 |
+
# compiles 3-4x slower; NO only transposes the weights (a 64-token part: 274 -> 74 s compile, 47.8 ->
|
| 1034 |
+
# 29.5 ms, right results). NPU 4000 (Lunar Lake) keeps YES: right there, and NO runs ~20% slower
|
| 1035 |
+
dq["NPUW_DQ_FULL"] = "NO"
|
| 1036 |
# The same set as the standalone Qwen3.5 / Gemma ports that run on Lunar Lake, plus the shared weights bank.
|
| 1037 |
# Not NPUW_SLICE_OUT (cuts outputs to the last token; breaks multi-token blocks) and not the LLM mode's
|
| 1038 |
# "compute-layers-with-higher-precision" (its f32 -> f16 converts fail to compile on NPU 4000; our graphs
|
onw/web/manage.html
CHANGED
|
@@ -256,7 +256,7 @@
|
|
| 256 |
</div>
|
| 257 |
<div class="opt"><span class="k">エキスパートのメモリ</span><select id="f-expert_gb" style="width:220px"><option value="auto">auto(足りないときだけ SSD から)</option><option value="off">すべてメモリに置く</option><option value="2">2 GB</option><option value="3">3 GB</option><option value="4">4 GB</option><option value="5">5 GB</option><option value="6">6 GB</option><option value="8">8 GB</option></select>
|
| 258 |
<span class="desc">Qwen3.6 系の MoE 用。上限を超えるエキスパートは SSD に置いたまま必要なときだけ読みます(動きますが遅くなります)。</span></div>
|
| 259 |
-
<div class="opt"><span class="k">64 トークン処理<span class="rc" title="変えるとコンパイルし直します">※</span></span><select id="f-big_blocks" style="width:300px"><option value="auto">auto(NPU 3720
|
| 260 |
<span class="desc">長いプロンプトの処理が速くなる代わりに、そのぶんメモリを使います(Gemma)。</span>
|
| 261 |
<span class="desc">※ 64 トークン処理は on にしたときだけ(off にするのはすぐです)。</span></div>
|
| 262 |
</div>
|
|
|
|
| 256 |
</div>
|
| 257 |
<div class="opt"><span class="k">エキスパートのメモリ</span><select id="f-expert_gb" style="width:220px"><option value="auto">auto(足りないときだけ SSD から)</option><option value="off">すべてメモリに置く</option><option value="2">2 GB</option><option value="3">3 GB</option><option value="4">4 GB</option><option value="5">5 GB</option><option value="6">6 GB</option><option value="8">8 GB</option></select>
|
| 258 |
<span class="desc">Qwen3.6 系の MoE 用。上限を超えるエキスパートは SSD に置いたまま必要なときだけ読みます(動きますが遅くなります)。</span></div>
|
| 259 |
+
<div class="opt"><span class="k">64 トークン処理<span class="rc" title="変えるとコンパイルし直します">※</span></span><select id="f-big_blocks" style="width:300px"><option value="auto">auto(オン。NPU 3720 などでは 16 トークン処理と入れ替え)</option><option value="on">on</option><option value="off">off</option></select>
|
| 260 |
<span class="desc">長いプロンプトの処理が速くなる代わりに、そのぶんメモリを使います(Gemma)。</span>
|
| 261 |
<span class="desc">※ 64 トークン処理は on にしたときだけ(off にするのはすぐです)。</span></div>
|
| 262 |
</div>
|