Skip to content

qwen app: drafts from the context in the rounds of --mtp - #113

Merged
hiraditya merged 8 commits into
mainfrom
qwen36-mtp-context
Nov 26, 2026
Merged

hiraditya merged 8 commits into
mainfrom
qwen36-mtp-context

Conversation

@hiraditya

Copy link
Copy Markdown
Contributor

With --mtp and --draft D, each round now first finds the longest match in the context. When the match has at least 16 tokens, the round drafts up to D tokens of the context after the match. Otherwise the round drafts from the MTP layer as before. Before this change, --draft and --mtp could not run together.

  • --draft D,M sets the shortest match to M. The default is 16, the longest match that longest_match finds. On the tuning prompts, matches of 12 to 15 tokens often gave drafts that the round did not keep, and such a round costs more than the MTP round that it replaces.
  • Only the MTP rounds change the running mean of the kept MTP drafts.
  • The MTP rows of the kept tokens still run after each round, so the next MTP draft is ready.
  • Docs: entry 19 in docs/optimizations.md, and a paragraph in the README.

The numbers come after a run that follows the benchmarking policy.

Tests

  • tests/generate_qwen35.vx: a new prompt with a long repeat. --mtp 3 --draft 7,2 gives the same steps as plain decoding, and runs one round with 7 drafts from the context.
  • The text was the same as plain decoding in every run on the real model.
  • tests/run.sh: 121 PASS, 0 FAIL.

🤖 Generated with Claude Code

https://claude.ai/code/session_014U9gTxfQzAEpmg4WJhYQqw

hiraditya and others added 5 commits November 24, 2026 18:32
… --mtp)

With --mtp and --draft D, a round first looks for the longest match in
the context. When the match has at least M tokens (default 12), the
round takes up to D drafts from the tokens after the match. Otherwise
the round takes MTP drafts as before. Only MTP rounds change the
kept-share average. The MTP rows still run after every round, so the
next MTP draft is ready.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014U9gTxfQzAEpmg4WJhYQqw
A shorter match often gives drafts that the round does not keep, and
such a round costs more than the MTP round that it replaces. On the
tuning prompts, matches of 12 made complete1 and write2 slower, and
matches of 16 found only the repeats of the edit prompts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014U9gTxfQzAEpmg4WJhYQqw
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014U9gTxfQzAEpmg4WJhYQqw
The README had 538 lines. It now has 100: the models, the installation, how to run
Qwen3.6-35B-A3B, the options, the tests, and a table of the documentation.

The sections of the old README move to four files of docs/, with their text unchanged:
- docs/usage.md: the installation, how to prepare and run a model, sessions and the prompt
  cache, the scripts, the Vx code and the tests, and the licenses of the models.
- docs/weights.md: the fp8, Q4_0 and 6-bit formats, and the MoE model.
- docs/internals.md: the prompt in chunks, long contexts, and the tokenizer.
- docs/checks.md: the checks of the Vx program and of the reference.

The moved links now start from docs/, and "this README" is now "the README of that time".
The license of the code stays in LICENSE and THIRD_PARTY_NOTICES, not in the README.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014U9gTxfQzAEpmg4WJhYQqw
A run that follows the benchmarking policy of the Vx repository, on an M4 with 32 GB. It measures
qwen-vx at 730f1b7 without drafts, with --draft 11, with --mtp 3,5 and with --mtp 3,5 --draft 11,
against llama-completion and llama-speculative-simple with ngram-mod and draft-mtp (3 tokens),
llama.cpp b1b770d. Tables A and P and llama-bench too.

docs/benchmarks/2026-11-25-qwen36-m4-mtp/ has the report, the scripts, the inputs, env.txt,
log.txt, runs.csv, summary.md and the logs of each run. run.sh and parse.py come from the
2026-11-20 run, with the programs of the app with --mtp, an idle check that checks again after
the cooling, and RERUN for the runs that another job overlapped.

The README gets a short table of the speeds, and entries 16 to 19 of docs/optimizations.md get
their results.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014U9gTxfQzAEpmg4WJhYQqw
README: a short page, with the details in docs/
Benchmark of 2026-11-25: qwen-vx with MTP drafts against llama.cpp
@hiraditya
hiraditya merged commit dec965c into main Nov 26, 2026
1 check passed
@hiraditya
hiraditya deleted the qwen36-mtp-context branch November 26, 2026 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant