Speculative decoding loses speed to repeated per-round work
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 5/5
- 預估耗時
- 一週以上
- 新手友好度
- 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 小時
- 30 天內合併 PR
- 644
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 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 於 22 天前認領。 未關閉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可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉bug module: quantization module: xnnpack
難度 4/5 3-5 天 新手友好度 43/100
pytorch/executorch#25854 ·
維護者通常 1 天內回覆
查看 pytorch/executorch 的全部 Issue
相似的 Issue
-
review-panel severity:low
難度 2/5 1-3 小時 新手友好度 72/100
kristovatlas/coin-accounting#576 ·
維護者通常 1 天內回覆
-
難度 1/5 1-3 小時 新手友好度 78/100
anthropics/skills#2328 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 88/100
維護者通常 1 天內回覆
-
repo-harnesses: the entrypoint-guard check greps a message `#13692` reworded, so it fails on main未關閉
難度 1/5 1 小時以內 新手友好度 88/100
daniel-ospina/tortoise#14947 ·
維護者通常 1 天內回覆
-
good first issue help wanted
難度 2/5 1-3 小時 新手友好度 82/100