Speculative decoding loses speed to repeated per-round work
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Anfängerfreundlichkeit
- 18/100
- Issue-Typ
- Refactoring
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Aktiv
- Bereich
- machine-learning, performance
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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.
- Vorherrschende Sprache
- Python
- Sterne
- 5.2k
- Forks
- 1.3k
- Ø Merge
- 1 T. 7 Std.
- Gemergte PRs (30 T.)
- 644
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus pytorch/executorch
-
to_edge_transform_and_lower ignores some ops_to_not_decompose requests: multi-output ops, and non-core ops without a decompositionEvtl. vergeben @Eureka-Zhang hat das vor 7 Tagen übernommen. Offenmodule: exir
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 66/100
pytorch/executorch#25620 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Qualcomm AI Engine Direct - fp16a8w quantization crashes on layer_normEvtl. vergeben @psiddh hat das vor 21 Tagen übernommen. Offenbug module: qnn partner: qualcomm
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
pytorch/executorch#24434 · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
enhancement triaged
Schwierigkeit 2/5 Ein halber Tag Anfängerfreundlichkeit 68/100
pytorch/executorch#21640 ·
Maintainer antworten meist innerhalb von 1 Tag
-
quantize_per_channel and dequantize_per_tensor.tensor abort the process on a float32 scaleEvtl. vergeben @AxelNoun hat das heute übernommen. Offen
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 35/100
pytorch/executorch#25873 ·
Maintainer antworten meist innerhalb von 1 Tag
-
XNNPACK INT4 linear returns incorrect per-channel outputs and fails groupwise FP16 on Apple M4 MaxEvtl. vergeben Ein verknüpfter Pull Request ist offen oder bereits gemergt. Offenbug module: quantization module: xnnpack
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 43/100
pytorch/executorch#25854 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in pytorch/executorch
Ähnliche Issues
-
Container fails to start when GitHub Releases is unavailable: uv run re-downloads the tvl wheelOffen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
trezor/trezor-user-env#421 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
-
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 91/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
tangentcode/tangentswarm#167 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
Maintainer antworten meist innerhalb von 1 Tag