[Engine] drafting: gguf_facts stops at the first string array, so a renamed llama.cpp GGUF never "fits" and DFlash2 is refused

Open Beginner friendly
#6,695 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 6 days

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python

Research direction

Start with gguf_facts() in terminal/strata_control/drafting.py, around line 580, where the key/value loop stops at the first string array (break). Read the file_fit() caller and the existing header fixture tests/terminal/data/flash_next_iq3s_header.gguf in tests/terminal/test_drafting_file_fit.py. Done when gguf_facts() returns layers, hidden and vocab for a GGUF whose general.tags array precedes the sizes, and a fixture test covers that case.

Written by the indexing model from the issue text.

Description

Area

speed, kernels, models, the server and API

Desktop app, Terminal or source?

Source (START-HERE.bat, setup.sh or a build)

What happened

file_fit() (dd015b8c3, "drafting: decide DFlash2 by what the model file is when its name is not one setup writes") reads a GGUF's header to decide whether a run config with an unknown model_name is Qwen3.8-Flash-Next. gguf_facts() walks the key/value pairs and stops at the first array whose elements are strings (terminal/strata_control/drafting.py:580 in v0.2.19):

                else:
                    break                                   # an array of words before the tokens: not looked into

GGUFs written by llama.cpp's converter carry general.tags (and often general.languages) among the general.* keys, before <arch>.block_count and <arch>.embedding_length. For those files the reader returns no sizes, and file_fit() answers family for a file that is exactly the model. The start then logs Drafting: MTP (DFlash2 is for Qwen3.8-Flash-Next only) and runs the MTP, also when DFlash2 is chosen by name.

Every llama.cpp-written GGUF on this PC reads that way. general.tags is key 16 in Unsloth's Qwen3.8-27B UD-Q4_K_M and UD-Q4_K_XL, and key 17 in a Qwen3.8-Flash-Next ModelOpt NVFP4 file converted by tools/nvfp4_convert.py:

Qwen3.8-27B-UD-Q4_K_M.gguf   {'arch': 'qwen35',   'layers': None, 'hidden': None, 'vocab': None}
Qwen3.8-27B-UD-Q4_K_XL.gguf  {'arch': 'qwen35',   'layers': None, 'hidden': None, 'vocab': None}
gemma-4-31B-it-Q4_0.gguf     {'arch': 'gemma4',   'layers': None, 'hidden': None, 'vocab': None}
Flash-Next NVFP4 (ModelOpt)  {'arch': 'qwen4exp', 'layers': None, 'hidden': None, 'vocab': None}   -> file_fit: family

tests/terminal/data/flash_next_iq3s_header.gguf has no string array before tokenizer.ggml.tokens (its keys run general.architecture ... general.size_label, then qwen4exp.*), so test_drafting_file_fit.py passes.

Expected: the sizes are read past a string array, and a renamed Qwen3.8-Flash-Next GGUF fits.

A fix. Skip a string array (each element is a u64 length and its bytes) instead of stopping:

                elif etype == 8:
                    for _ in range(count):
                        (slen,) = struct.unpack_from("<Q", head, pos)
                        pos += 8 + slen
                else:
                    break

With it the NVFP4 file above reads {'arch': 'qwen4exp', 'layers': 48, 'hidden': 2560, 'vocab': 248320} and fits. A header fixture with general.tags before the sizes would cover it in test_drafting_file_fit.py.

Smallest steps or command that reproduce it
from strata_control import drafting as d
print(d.gguf_facts("<any llama.cpp-converted GGUF with general.tags>"))     # layers / hidden / vocab: None
print(d.file_fit(["--native", "<a Qwen3.8-Flash-Next GGUF with general.tags>"], "<its data folder>"))   # 'family'
Reproduction status

Reproduced locally

Strata version

Strata 0.2.15 through strata-nvfp4 0.2.15-nvfp4.7 (engine 0.1.61), where this was run. gguf_facts is byte-identical in v0.2.19, which was read, not run.

Graphics card, memory and system

RTX 5090 32 GB · 128 GB RAM · Windows 11

Model, size and settings

Unsloth Qwen3.8-27B UD-Q4_K_M and UD-Q4_K_XL, Gemma 4 31B Q4_0 (header read only); a Qwen3.8-Flash-Next ModelOpt NVFP4 checkpoint converted with tools/nvfp4_convert.py, served under its own model name

Logs
[strata] Drafting: MTP (DFlash2 is for Qwen3.8-Flash-Next only)
Dominant language
C++
Stars
11.6k
Forks
1k
Avg merge
17d 21h
Merged PRs (30d)
3

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Niko1221/Strata

All issues in Niko1221/Strata

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.