跳到正文
DEV Community· InferenceKey·· 1 小時前AI 評分60

Mellum2.1 的 MTP head 在 vLLM 上實測:87% 猜測獲接受、速度達 1.11x,並比較調校與測量

Mellum2.1's MTP head on vLLM: 87% of guesses accepted, 1.11x faster. What to tune and measure

AI 導讀

InferenceKey 在 vLLM 0.33 和 48 GB RTX A6000 上測試 Mellum2.1 的 MTP head,單一請求吞吐量由 106.8 升至 118.9 tokens per second(1.11x),猜測接受率為 87.2%,低於 JetBrains 模型頁列出的 1.4 至 1.8x 提升幅度。

正文

If you watch only one number when you turn on speculative decoding, you will probably watch the wrong one.

A model writes text one token (a piece of a word) at a time, and each token costs one full pass through the network. Speculative decoding adds a cheap guesser that proposes the next token, and the full model then checks the guess. When the guess is right, you get two tokens for roughly the price of one pass.

JetBrains ships Mellum2.1, its open coding model, with a guesser of this kind built in, which it calls the MTP head. We enabled it in vLLM 0.33, an open-source inference server, on a 48 GB RTX A6000 on our cloud. vLLM counted 87.2% of guesses accepted, near JetBrains' roughly 90%. A single request moved from 106.8 to 118.9 tokens per second. That is 1.11x, below the 1.4 to 1.8x JetBrains' model page promises.

The guesser worked. The checking took the gain back. The full Mellum2.1 MTP benchmark with every table and command has the rest.

Acceptance rate is not throughput

Mellum2.1 is a mixture of experts (MoE): only 2.5B of its 12B parameters work on each token. Plain decoding is already quick, so a verify pass can cost nearly what it saves. Another likely factor, not measured: vLLM 0.33 runs Mellum through the generic Transformers modeling backend, not code written for this model, and logs that it uses a default MoE config.

Benchmark tokens per second with the head off and on, on your own prompts. The acceptance counter says the guesser works, not that you got faster.

The setting worth changing: draft depth

One flag enables the head, and the number of tokens it guesses per step sits inside it:

--speculative-config '{"method": "mtp", "num_speculative_tokens": 1}'

JetBrains and the vLLM docs both say start at 1. For a single request, 2 was faster:

Draft tokens Accepted 1 request (tok/s) 8 at once (tok/s)
none 106.8 418.4
1 87.2% 118.9 (1.11x) 607.3 (1.45x)
2 66.6% 140.2 (1.31x) 581.8 (1.39x)
3 48.6% 124.8 (1.17x) 663.5 (1.59x)

At depth 2 fewer guesses survived, but each success skipped two passes. At depth 3 the misses outweighed the hits. Each setting ran once on short answers, so small differences are noise. Benchmark depths 1 and 2 against your real requests.

Concurrency changed the picture

With eight requests at once, measured straight against vLLM, depth 1 reached 1.45x, which is inside JetBrains' range. Over depths 1 to 3 the gain ranged from 1.39x to 1.66x, with no consistent winner between 2 and 3. Speculative decoding normally helps less as load grows. This is one run, the article has no explanation for it, and nothing above eight was tested.

A caveat from our side: the InferenceKey platform currently hands each model one request at a time, so our endpoint today gives the single-request 1.11x. Still open.

On a small GPU the head is paid in KV cache

The KV cache is where the server keeps the state of each conversation in progress, so it does not reread the text at every token. The head adds under a gigabyte of weights (0.80 GiB in BF16, the published full size). vLLM holds total GPU memory at a fixed share set by --gpu-memory-utilization, so the head shrinks the KV cache instead of raising peak memory.

On the A6000 that barely matters: the cache dropped from 1,122,580 tokens to 1,027,634, about 8.5%. On a real 16 GB RTX 5080, running vLLM's online FP8 (weights converted to 8 bits at load, half the size) with a 16,384-token context, it dropped from 52,400 to 29,019 tokens. Space for three full 16K conversations became space for one. The VRAM ladder for Mellum2.1 from 48 GB down to 16 GB has the full memory accounting.

Tokens per second for one request with the MTP head on: RTX A6000 48 GB 119, 32 GB emulated cap 141, 24 GB cap at full size does not start, 24 GB cap in 8-bit 211, real RTX 5080 16 GB in 8-bit 289

The RTX 5080 still beat the A6000: 217.2 tokens per second plain and 288.7 with one draft token (1.33x), peaking at 97% of its memory, with correct answers. A 24 GB cap at full size never started: the weights alone are 23.47 GiB. The 24 GB and 32 GB rows are caps on the A6000, not real cards. FP8 on a real 16 GB Ampere card is untested and may fail at load.

Do not diff outputs byte for byte

JetBrains' card says the output is unchanged. In quality it was: the bug was found on every run, the interval-merging function passed its checks in all 13 outputs, the math answer was 400 each time. In exact text it was not. With greedy decoding (always taking the most likely token), two runs of one prompt produced 369 and 810 tokens with the head, and 380 and 829 without it. The vLLM docs say hardware numerics and batch size can shift the exact words. Tests that assert on raw model text will be flaky either way. Assert on what the answer does.

Tool calls varied too (one city per turn with MTP on the A6000, two parallel calls without), so your client needs a real agent loop.

Credit

JetBrains built the model and its head and released them under Apache-2.0 on the Mellum2.1 MTP model card. The vLLM project provides the MTP speculative decoding, the spec-decode metrics and online FP8, and Hugging Face Transformers provides the modeling code vLLM runs. We found the release through a post by pmttyji on r/LocalLLaMA. Our part was the deployment, the sweeps and the memory accounting.

Before you pick your draft depth, read the Mellum2.1 MTP speculative decoding research post.

來源:DEV Community · dev.to