feat: wire MTP through SimpleEngine for native speculative decoding#170
Closed
Thump604 wants to merge 1 commit intowaybarrios:mainfrom
Closed
feat: wire MTP through SimpleEngine for native speculative decoding#170Thump604 wants to merge 1 commit intowaybarrios:mainfrom
Thump604 wants to merge 1 commit intowaybarrios:mainfrom
Conversation
Pass --enable-mtp flag through SimpleEngine → MLXLanguageModel → mlx_lm.stream_generate(mtp=True). Uses mlx-lm PR #990's native MTP speculative decoding for Qwen3.5 models. Requires model converted with MTP weights preserved (see mlx-lm PR #990). MTP only affects the streaming LLM path (SimpleEngine), not BatchedEngine (which has its own scheduler-based MTP). Tested on M2 Ultra: 35B-A3B-8bit 53→71.5 tok/s (1.35x) through the streaming API. Closes waybarrios#56 (partially — SimpleEngine path only)
Collaborator
Author
|
Closing — fully subsumed by #171 which adds per-request MLLM+MTP routing on top of the basic MTP wiring introduced here. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--enable-mtpflag throughSimpleEngine→MLXLanguageModel→mlx_lm.stream_generate(mtp=True)Currently
--enable-mtponly affectsBatchedEngine(scheduler-based MTP). This PR adds theSimpleEnginepath, which is the production path for single-user serving.Changes
cli.pymtp=args.enable_mtptoload_model(), log MTP status for SimpleEngineserver.pymtpparam inload_model(), forward toSimpleEngineengine/simple.pymtpin constructor, pass toMLXLanguageModel, log MTP statusmodels/llm.pymtpparam, passmtp=Truetomlx_lm.stream_generate()Benchmark (M2 Ultra, 35B-A3B-8bit, streaming API, greedy)
mlx-lm CLI benchmarks (all models, greedy):
Requirements
qwen3_5_moe.pyUsage
Test plan
mlx_lm.stream_generate(mtp=True)--enable-mtpwith--continuous-batchinguses existing scheduler MTP path (no conflict)Partially addresses #56