Repository navigation
serve: --lanes N flag (default 1) and tools/bench_concurrency.py, with M3 Ultra measurements - #37
Closed
chadhurley25075-png wants to merge 1 commit into
Closed
chadhurley25075-png wants to merge 1 commit into
chadhurley25075-png wants to merge 1 commit into
Conversation
`serve` hardcoded lanes=1 for ChatApp. `--lanes N` plumbs the constructor's lanes through (default 1: as before). tools/bench_concurrency.py fires N simultaneous streaming requests at temperature 0 and reports aggregate and per-stream tok/s, time to first token, and whether every concurrent answer is byte-identical to the same prompt answered alone (standard library only). Measured on an M3 Ultra (256 GB, MLX 0.32.2, Flash Next 4-bit MTP, 0.3.4) with lanes 1 / 4 / 8 and 1 to 8 callers: aggregate stays ~100 tok/s at every lane count, but with 8 lanes eight callers get a first token in 0.3 s instead of 5.5 s and the last waits 0.9 s instead of 11.4 s; 24 of 24 answers identical to the serial ones. The README's Concurrency section carries the table and cites the author's M5 Max Nemotron numbers (265 -> 377 aggregate) as his.
Owner
|
Thanks @chadhurley25075-png for the proposal and the measurements. In 0.3.5, which ships tonight, |
This was referenced Oct 17, 2026
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.
Small one, on top of 0.3.4.1 (bb4b4a3), independent of the GLM work.
What
serve --lanes N(default 1):servehardcodedlanes=1forChatApp; this plumbs the constructor argument through. Nothing else changes, so a server started as before behaves as before.tools/bench_concurrency.py: fires N simultaneous streamingchat/completions(temperature 0, distinct prompts, 160 new tokens) and reports wall time, aggregate tok/s, per-stream decode tok/s, TTFT, and whether every concurrent answer is byte-identical to the same prompt answered alone. Standard library only;--tokenizer DIRcounts tokens exactly withtokenizerswhen the server streams several tokens per event (the CUDA server does).serveoptions table.Measured — M3 Ultra (Mac Studio, 256 GB, MLX 0.32.2),
Vontra/Qwen3.8-Flash-Next-MLX-4bit-MTP, 0.3.4 (2f8e514), context 32768, one client on the LANServer-side, rows a round stayed at a median of 2.4–2.8 at every lane count (max ~4), ~18 ms a round at 2–3 rows.
What we see on the M3 Ultra: lanes > 1 works and stays exact (24 of 24 answers identical, zero errors), and it buys latency fairness — eight callers get a first token in 0.3 s instead of 5.5 s, and the last one waits 0.9 s instead of 11.4 s — but not throughput: aggregate is pinned near 100 tok/s whatever the lane count, because the wide pass never got wider on this GPU. That is the difference from your M5 Max table (Nemotron 265 → 377 tok/s aggregate at 1 → 8 callers — your numbers, not ours), where the lane kernels' wide pass does the work. So on M1–M4 the flag is about fairness; on tensor-unit GPUs it should be about both. The default stays 1.
For what it is worth, our GLM-5.3-Flash family (PR #9) shows the same shape on the same Mac with
lanes=4: aggregate pinned at ~55 tok/s, TTFT at 8 callers 5.3 s median instead of 10.1 s, 15 of 15 identical. And the CUDA server on two DGX Sparks is a byte-exact FIFO under load (30/30 identical across two passes), ascuda/server.pysays.Tests:
pytest testson the Mac, 303 passed / 69 skipped (the CUDA and real-weights ones). Full bench output and the Spark tables are in the bench's--outJSON if you want them.Thanks for making concurrency a one-line change to expose — the engine already did all of this; the flag just lets a
serveuser reach it.— Chad