MTP draft head: --mtp-q4 (4-bit projections and draft head) and --mtp-draft-vocab FILE
Both opt-in; drafts only, the verify window decides every token (18/18 prompts identical on IQ3_XXS). - --mtp-q4: the draft layer's ten Q8_0 projections (fc_embedding/fc_hidden, q/k/v/o, the shared expert) and the draft head's subset rows are requantized to Q4_0 at load/bind with ggml's reference quantizer (native-experts builds). The prompt path's batched K/V pass keeps the Q8_0 originals. - --mtp-draft-vocab FILE: the draft head's token subset from FILE instead of <mtp>/draft_vocab.bin (data/draft_vocab_en.bin: 40,525 tokens instead of 106,299). RTX 5070, IQ3_XXS (head Q5_K), 18 prompts: draft ms per window 2.55 -> 2.23 (q4), 2.13 (en), 1.91 (both); tokens per step 2.64 -> 2.63 / 2.67 / 2.57.
This commit is contained in:
1 parent
2312c83bfd
commit
e35a061f1d
3 files changed
+125
-12
No files matched your search
@@ -419,6 +419,10 @@ struct Options {
|
||||
/// --mtp-hnorm stream (opt-in): the draft layer's pre_fc_norm_hidden normalizes each hyper-connection stream on
|
||||
/// its own (llama.cpp's qwen4exp MTP graph) instead of one RMS over all four (the default, tools/mtp_probe.py).
|
||||
bool mtp_hnorm_stream = false;
|
||||
/// --mtp-q4 (opt-in): the draft layer's projections and draft head from 4-bit copies (fewer bytes per draft step)
|
||||
bool mtp_q4 = false;
|
||||
/// --mtp-draft-vocab FILE (opt-in): the draft head's token subset from FILE instead of <mtp>/draft_vocab.bin
|
||||
std::string mtp_draft_vocab;
|
||||
/// A control vector on the residual stream (strata/kernels/cvec.hpp), with llama.cpp's flags: the
|
||||
/// `experimental-speed-projection` profile passes `--control-vector-scaled FILE:1.0 --control-vector-layer-range
|
||||
/// 4 44 --cvec-mode project --cvec-dir per-layer`. None by default; --serve switches a loaded one per request.
|
||||
@@ -522,6 +526,8 @@ void usage() {
|
||||
" --lookup-chain-min M the shortest context match --lookup-chain extends on (default 3)\n"
|
||||
" --mtp-hnorm pooled|stream the draft layer's hidden-input norm: one RMS over all four streams\n"
|
||||
" (default) or one per stream (llama.cpp's MTP graph)\n"
|
||||
" --mtp-q4 opt-in: the draft layer's projections and draft head as 4-bit copies\n"
|
||||
" --mtp-draft-vocab FILE opt-in: the draft head's token subset (default <mtp>/draft_vocab.bin)\n"
|
||||
" --control-vector-scaled FILE:SCALE[,...] a control vector GGUF on the residual stream (llama.cpp's\n"
|
||||
" format; --control-vector FILE = scale 1). --serve: requests switch it (cvec=0|1)\n"
|
||||
" --control-vector-layer-range A B the layers it follows (inclusive; default 1 .. the last)\n"
|
||||
@@ -1217,6 +1223,8 @@ int main(int argc, char** argv) {
|
||||
}
|
||||
o.mtp_hnorm_stream = v == "stream";
|
||||
}
|
||||
else if (a == "--mtp-q4") o.mtp_q4 = true;
|
||||
else if (a == "--mtp-draft-vocab") o.mtp_draft_vocab = next("--mtp-draft-vocab");
|
||||
else if (a == "--control-vector") o.cvec_files.push_back({next("--control-vector"), 1.0f});
|
||||
else if (a == "--control-vector-scaled") {
|
||||
// FILE:SCALE, comma-separated; the LAST colon splits, so a Windows path (C:\...) keeps its drive
|
||||
@@ -2567,6 +2575,8 @@ int main(int argc, char** argv) {
|
||||
}
|
||||
if (!o.mtp.empty()) mtp.set_prompt_len((int64_t) o.tokens.size());
|
||||
mtp.set_hnorm_per_stream(o.mtp_hnorm_stream); // --mtp-hnorm stream (opt-in), before any capture
|
||||
mtp.set_q4(o.mtp_q4); // --mtp-q4 (opt-in), before load
|
||||
if (!o.mtp_draft_vocab.empty()) mtp.set_draft_vocab(o.mtp_draft_vocab);
|
||||
// the draft layer is the canonical model's MTP head (512 experts) even when the target is pruned,
|
||||
// so it always sees the canonical geometry; `static` because MtpDrafter keeps a reference
|
||||
static const strata::core::ModelGeometry draft_geometry{};
|
||||
|
||||
Reference in new issue
Block a user