Speculative decoding loses speed to repeated per-round work
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 18/100
- issue の種類
- リファクタリング
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
調査の方向性
Start with speculate() and the uncommitted-token boundary in examples/models/muse-glimmer/runtime/mlx_executor.cpp, then drain() in the same file, which calls draft(..., verification=nullptr). Also look at exec_metal_kernel() in backends/mlx/runtime/MLXInterpreter.h and MLXDFlashAttention in examples/models/muse-glimmer/source_transformations/mlx.py. Done means attributed timings for target, draft, graph setup and context ingestion, plus end-to-end throughput on the stated benchmark, with greedy and non-greedy outputs unchanged.
索引モデルが issue の本文から書いたものです。
説明
Muse-Glimmer DFlash has runtime overhead beyond target verification. This issue tracks round-boundary execution, repeated draft/graph setup, and context ingestion, separately from quantized-kernel performance in #24812.
Measurements below use M2 Ultra, Q4_K_M target and draft weights, a 160-token code prompt, 512 generated tokens, temperature 0, seven draft tokens, FP16 KV, and one active request. Decode measurements exclude prefill/first-token work and the cold/JIT request; rates aggregate three warm requests. Findings are from the MLX serving path at 2ea9667, with local profiling/optimization experiments.
1. Separate target execution between speculative rounds
After verification, the correction/bonus token is returned but left uncommitted in target KV. The next round runs a single-token target forward to produce another token, then drafts from that token and runs target verification again. See speculate() and the uncommitted-token boundary.
The baseline performs 101 standalone target calls, costing about 3.7 seconds (~18% of decode time), in addition to 101 verification calls. This is a separate invocation that produces a useful token, not duplicate computation of the same token.
A local experiment eliminated those standalone calls. With faster verification kernels, throughput increased 32.4 → 40.1 tokens/s. With the original kernels, it regressed 23.1 → 21.5 tokens/s because more verification rounds were needed. Any change here needs end-to-end evaluation rather than assuming that removing a pass always helps.
2. Repeated execution setup for unchanged draft-block shapes
The MLX interpreter reconstructs execution graphs each invocation. For custom Metal operators, exec_metal_kernel() also constructs the kernel function from its source on each call, although MLX already caches compiled shaders.
In the raw-GGUF experiment, repeated host setup remained significant: reusing kernel function objects reduced verification graph construction 7.65 → 2.60 ms/call and draft graph construction 1.46 → 0.89 ms/call; throughput increased 40.1 → 42.2 tokens/s. Whole-draft graph reuse is a separate opportunity to evaluate; these numbers measure function-object reuse, not full draft-block compilation.
3. Context ingestion can execute unused draft predictions
Feature projection is already incremental: MLXDFlashAttention caches context K/V, and draft() consumes pending hidden rows. Full-history reprojection is not the demonstrated problem.
However, drain() calls draft(..., verification=nullptr) for context ingestion. That still executes draft_forward, including block predictions and the output head, although no proposals are consumed. This is a code-path finding; its cost needs separate measurement, especially for long/resumed prefills.
Validation
- Attribute target, draft, graph/setup, and context-ingestion time separately; report end-to-end throughput with unchanged weights and prompts.
- Exercise greedy and non-greedy sampling, accepted/rejected drafts, cached/resumed prompts, multiple sessions, and stop/context boundaries.
- Preserve token/cache correctness and bound retained execution state. Report regressions as well as wins; the short-code result does not establish a universal improvement.
- 主要言語
- Python
- スター
- 5.2k
- フォーク
- 1.3k
- 平均マージ
- 1日 7時間
- マージ済み PR(30日)
- 644
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
pytorch/executorch のほかの issue
-
to_edge_transform_and_lower ignores some ops_to_not_decompose requests: multi-output ops, and non-core ops without a decomposition対応中かも @Eureka-Zhang が 7 日前に担当しました。 オープンmodule: exir
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
pytorch/executorch#25620 ·
メンテナーはふだん 1 日以内に返信
-
Qualcomm AI Engine Direct - fp16a8w quantization crashes on layer_norm対応中かも @psiddh が 21 日前に担当しました。 オープンbug module: qnn partner: qualcomm
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
pytorch/executorch#24434 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
enhancement triaged
難易度 2/5 半日 初心者へのやさしさ 68/100
pytorch/executorch#21640 ·
メンテナーはふだん 1 日以内に返信
-
quantize_per_channel and dequantize_per_tensor.tensor abort the process on a float32 scale対応中かも @AxelNoun が今日担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
pytorch/executorch#25873 ·
メンテナーはふだん 1 日以内に返信
-
XNNPACK INT4 linear returns incorrect per-channel outputs and fails groupwise FP16 on Apple M4 Max対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンbug module: quantization module: xnnpack
難易度 4/5 3〜5日 初心者へのやさしさ 43/100
pytorch/executorch#25854 ·
メンテナーはふだん 1 日以内に返信
pytorch/executorch の issue をすべて見る
似ている issue
-
Container fails to start when GitHub Releases is unavailable: uv run re-downloads the tvl wheelオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
trezor/trezor-user-env#421 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
-
難易度 1/5 1〜3時間 初心者へのやさしさ 91/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
tangentcode/tangentswarm#167 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信