Skip to content

feat(server): reject draft-only GGUF + support --model-draft (MTP speculative decoding) - #11

Open
mrDedchai wants to merge 7 commits into
mainfrom
feat/model-draft
Open

feat(server): reject draft-only GGUF + support --model-draft (MTP speculative decoding)#11
mrDedchai wants to merge 7 commits into
mainfrom
feat/model-draft

Conversation

@mrDedchai

Copy link
Copy Markdown
Contributor

Summary

Fixes the confusing "Network error" when loading an MTP-ONLY GGUF (e.g. Qwen3.8-27B-MTP-ONLY-Q8_0, 18 tensors = just the spec-draft head, no transformer) as the main chat model — it has no attention/FFN weights, so decode fails server-side and the UI shows a generic network error.

1. Draft-only rejection (clear error before spawn)

  • LlamaServerBackend.__init__ now rejects files with < 100 tensors as "draft-only/MTP GGUF" with a ModelError explaining: use a full chat model, or pass this as --model-draft (WS_MODEL_DRAFT).
  • Detected via GGUFParser.n_tensors (real file: MTP-ONLY = 18, full model = 1,202).

2. --model-draft support (MTP speculative decoding)

  • New ModelLoadRequest.model_draft (falls back to WS_MODEL_DRAFT env), forwarded through model_manager to the backend, which appends --model-draft <path> --spec-type draft-mtp to llama-server.
  • Enables the Method 1 usage from the a4lg MTP-ONLY repo: full model in model_path + draft head in model_draft.

Tests

6 new (tests/test_model_draft.py + tests/gguf_helper.py):

  • rejects 18-tensor file · accepts 500-tensor file · zero-tensor skip
  • draft flags present from arg / from env · absent without draft
  • 495 passed (2 pre-existing test_simulator_calibration failures belong to the other agent's commit baf4b72 — unrelated)

…culative decoding)

2026-08-16: loading an MTP-ONLY GGUF (18 tensors — just the draft head)
as the main model failed at decode with a confusing network/stream error.

- backend: reject files with < 100 tensors as 'draft-only' with a clear
  ModelError (use a full chat model, or pass as draft via WS_MODEL_DRAFT)
- backend: --model-draft <path> + --spec-type draft-mtp when a draft is
  configured (arg or WS_MODEL_DRAFT env) — enables MTP speculative
  decoding paired with a full Qwen3.8 model (Method 1 usage)
- schema: ModelLoadRequest.model_draft; model_manager forwards it
- 6 tests (reject 18 tensors / accept 500 / zero skip / draft flags from
  arg + env / no flag without draft); 495 passed
  (2 pre-existing simulator failures belong to the other agent's
  calibration commit baf4b72)
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