Skip to content

hyperloom custom: the result records whether the served decode drafted (#1062) - #1063

Merged
bong-water-water-bong merged 2 commits into
mainfrom
1bit/hyperloom-drafting-observed
Nov 5, 2026
Merged

bong-water-water-bong merged 2 commits into
mainfrom
1bit/hyperloom-drafting-observed

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

Closes #1062.

Root cause

drafting_identity() names the drafting files the workload passes (HL_DFLASH, HL_MTP_HEAD) and
returns {} when neither is set. On this pin {} is not "no drafting": the GGUF carries its own MTP head
and 1bit serve drafts with it unless --no-mtp/ONEBIT_NO_MTP=1. So unset (serve's recipe default,
draft length 3) and HL_MTP_MAX=0 (deliberately off) serialised identically, and neither said whether the
decode that produced the score drafted at all.

The measurement that exposed it

arm_74_longctx.json, 2026-11-04 22:39 on 7.4.0-rc1-1bit, Qwen3.8-27B UD-Q4_K_XL, HL_CTX=20480 HL_LONGCTX=18800, score 13.03 tok/s decode at 18,762 tokens, gate PASS (KLD 0, texts identical):

"drafting": {},                       # the whole record
"levers": {"HL_CTX": "20480", "HL_LONGCTX": "18800", "HL_LONGTOK": "128"}

the same run's serve.log:

1bit serve: …Qwen3.8-27B-UD-Q4_K_XL.gguf carries its own MTP head: drafting with it
            (--spec-type draft-mtp; --no-mtp or ONEBIT_NO_MTP=1 turns it off)
1bit serve: recipe qwen35-mtp-max-3: --spec-draft-n-max 3
… | task 532 | draft acceptance = 0.67460 (85 accepted / 126 generated), mean len = 3.02

The cap is not decorative: HL_MTP_MAX=6 costs ~18 % of 18.8k decode against the default on this box
(paired arm inside one claim, 2026-11-03 17:15), and HL_MTP_MAX=0 moves tg128 from 11.80 to 8.83
(2026-11-01). Two artifacts differing only in an unset default were therefore indistinguishable.

Fix

drafting_summary(serve_log) replaces the bare identity in bench_summary.drafting for a served
measurement and records both halves:

  • requested — null when no drafting lever was set (the pin's own default applied), otherwise the env
    that was set, so {"HL_MTP_MAX": "0"} is distinguishable from unset;
  • serve — parsed from the run's own log: spec_type, recipe/recipe_args, tasks_reporting,
    accept_rate_last, accepted_last/generated_last, mean_acc_len_last/_max.

It reports, it does not check (same posture as placement_summary): a log with no drafting stays None
rather than an object that reads as off, and drafting_identity() keeps its existing {} contract, so
the change only adds fields.

Before / after, same run, same log

BEFORE  drafting = {}
AFTER   drafting = {"requested": null,
                    "requested_note": "no drafting lever was set: the pin drafts with the model's own MTP head unless --no-mtp/ONEBIT_NO_MTP=1; see drafting.serve for what the server actually did",
                    "serve": {"spec_type": "draft-mtp", "recipe": "qwen35-mtp-max-3",
                              "recipe_args": "--spec-draft-n-max 3", "tasks_reporting": 12,
                              "accept_rate_last": 0.6746, "accepted_last": 85, "generated_last": 126,
                              "mean_acc_len_last": 3.02, "mean_acc_len_max": 3.81}}

Tests

$ python3 tests/hyperloom_benchmark_test.py
hyperloom_benchmark_test: OK        # rc=0
$ python3 tools/copyright.py --check
                                    # rc=0, no findings

The new block parses the four verbatim log lines above (including serve's mid-sentence flag, whose trailing
; is why the spec pattern is punctuation-bounded), asserts None for a log with no drafting and for a
missing log, and pins the unset-vs-HL_MTP_MAX=0 distinction. Existing assertions on
drafting_identity() are untouched and still pass.

 tests/hyperloom_benchmark_test.py   | 41 +++++++++++++++++++
 tools/hyperloom/custom/README.md    |  2 +-
 tools/hyperloom/custom/benchmark.py | 78 +++++++++++++++++++++++++++++++++++++
 3 files changed, 120 insertions(+), 1 deletion(-)

#1062)

`bench_summary.drafting` answered only "which drafter *file*" and returned `{}` when no
drafting lever was set. On this pin that is not "no drafting": the GGUF carries its own MTP
head and `1bit serve` drafts with it unless `--no-mtp`/`ONEBIT_NO_MTP=1`.

Measured, 2026-11-04 22:39 (Qwen3.8-27B UD-Q4_K_XL, 20_480 ctx, score 13.03 tok/s decode at
18_762 tokens): the artifact recorded `drafting: {}` while its own serve.log said
`--spec-type draft-mtp`, recipe `qwen35-mtp-max-3`, and the scored long leg drafted
`mean len 3.02` at `0.67460` acceptance (85 accepted / 126 generated).

That is worth recording because the cap moves the score: `HL_MTP_MAX=6` costs ~18 % of 18.8k
decode against the default here (paired arm in one claim, 2026-11-03 17:15) and
`HL_MTP_MAX=0` moves `tg128` from 11.80 to 8.83 (2026-11-01). Two rows differing only in the
unset default recorded identical `drafting`/`levers` and were silently incomparable -- the
same rule as `model`/`build`/`device_stack`/`placement` (#993/#1008/#996): the result names
the input it was measured with.

`drafting_summary()` now records both halves: `requested` (`null` = no lever set, pin default
applied; `{"HL_MTP_MAX": "0"}` = deliberately non-drafting) and `serve` (spec type, draft
recipe and args, accepted/generated counts, mean accepted length), parsed from the run's own
serve.log so it does not depend on reading the pin's defaults correctly. It reports, it does
not check: a log without drafting stays `None`. `drafting_identity()`'s existing contract is
unchanged, so this only adds fields.
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

1062 - Partially compliant

Compliant requirements:

  • The artifact now records whether the served decode drafted
  • The measurement distinguishes between "no drafting lever set" and "HL_MTP_MAX=0"
  • The result names the input it was measured with, including drafting details
  • The drafting summary includes both requested and served information

Non-compliant requirements:

  • None

Requires further human verification:

  • None
⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Drafting Summary Logic

The drafting_summary function introduces a new logic for distinguishing between unset drafting levers and explicitly set HL_MTP_MAX=0. While the change correctly handles the case where no drafting lever is set, it relies on drafting_identity() returning {} for no drafting, which was the original behavior. This could still be ambiguous if the original intent was to differentiate between "no drafting requested" and "drafting disabled by explicit setting". The new requested_note field helps clarify this, but the change in behavior should be carefully considered.

def drafting_summary(serve_log):
    """The drafting record for a served measurement: what the levers asked for, and what the serve says
    it actually did.

    `drafting_identity()` alone answers "which drafter file", and `{}` was its whole answer when no
    drafting lever was set -- which on this pin is not "no drafting": the GGUF carries its own MTP head
    and serve drafts with it unless told not to. Measured 2026-11-04 22:39 (27B UD-Q4_K_XL, 20,480 ctx):
    the artifact said `drafting: {}` while serve.log reported `--spec-type draft-mtp`, recipe
    `qwen35-mtp-max-3`, and the scored long leg drafted `mean len 3.02` at `0.67460` acceptance. The cap
    is worth ~18 % of 18.8k decode and ~25 % of `tg128` here, so an unrecorded default makes two rows
    incomparable -- the same rule as `model`/`build`/`placement`.

    `requested` is therefore explicit (`null` = no lever set, i.e. the pin's own default applied;
    `HL_MTP_MAX: "0"` = a deliberately non-drafting measurement), and `serve` is what the server itself
    reported, so the record does not depend on reading the pin's defaults correctly.
    """
    ident = drafting_identity()
    asked = {k: env(k) for k in ("HL_DFLASH", "HL_DFLASH_GGUF", "HL_MTP_MAX", "HL_MTP_HEAD") if env(k)}
    ident["requested"] = asked or None
    if not asked:
        ident["requested_note"] = ("no drafting lever was set: the pin drafts with the model's own MTP "
                                   "head unless --no-mtp/ONEBIT_NO_MTP=1; see drafting.serve for what the "
                                   "server actually did")
    ident["serve"] = drafting_observed(serve_log)
    return ident
Regex Pattern for Drafting

The regular expressions used for parsing drafting information from serve.log may not be robust enough to handle all possible log formats. Specifically, DRAFT_SPEC_RE stops at punctuation, which could lead to incorrect parsing if the log format changes. The regex patterns should be validated against various log outputs to ensure they correctly extract the intended information.

# the flag is quoted mid-sentence in serve's own line ("--spec-type draft-mtp; --no-mtp ... turns it off"),
# so the value stops at the punctuation rather than swallowing it.
DRAFT_SPEC_RE = re.compile(r"--spec-type ([A-Za-z0-9._-]+)")
DRAFT_RECIPE_RE = re.compile(r"1bit serve: recipe ([^:]+): (.*)$", re.M)
DRAFT_ACC_RE = re.compile(
    r"draft acceptance = ([0-9.]+) \(\s*(\d+) accepted /\s*(\d+) generated\), mean len =\s*([0-9.]+)")

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT: READY at b95ffd9e — the bug is real on the artifact it cites, and the new parser reproduces every value from the very log that exposed it.

The gap, on the artifact itself (~/hyperloom-ws/window-20261104/arm_74_longctx.json):

bench_summary.drafting         {}                                    <- the record
bench_summary.serve_tok_s      {"long": 13.03, "short": 17.70, …}    <- the score in the body
bench_summary.longctx          {"ctx_tokens_requested": 18800, "ctx_tokens_actual": 18762, "decode_tokens": 128, …}

so 13.03 tok/s at 18,762 tokens is exactly what the file says, and the drafting field says nothing while the same run's logs-arm_74_longctx/serve.log reports drafting.

The parser, run against that real log (not a fixture):

{"spec_type": "draft-mtp", "recipe": "qwen35-mtp-max-3", "recipe_args": "--spec-draft-n-max 3",
 "tasks_reporting": 12, "accept_rate_last": 0.6746, "accepted_last": 85, "generated_last": 126,
 "mean_acc_len_last": 3.02, "mean_acc_len_max": 3.81}

Every value the body quotes is there — draft-mtp, qwen35-mtp-max-3, --spec-draft-n-max 3, 0.67460, 85 / 126, mean len 3.02 — and the last acceptance line in the file (task 532) is the one it picks, which is the right one to pick.

Tests and the control. tests/hyperloom_benchmark_test.py → OK rc 0. With drafting_observed() forced back to its pre-#1063 behaviour (return None), the same test fails at assert got["spec_type"] == "draft-mtp"; restored, it passes again. The "unset is not off" half is pinned too: no lever set → requested: None and a requested_note, HL_MTP_MAX=0 → {"HL_MTP_MAX": "0"} with no note.

Placement of the change is right. It is assigned in the serve path only (benchmark.py:802, serve_measure), while the llama-bench path keeps drafting_identity() at :765 — correct, because llama-bench does not draft, so an empty record there is the truth rather than a gap. And drafting_identity()'s {} contract is untouched, so nothing that reads the old shape breaks.

Three small notes, none blocking:

  1. The negative control fails as TypeError: 'NoneType' object is not subscriptable rather than with the assertion's own message. assert got is not None and got["spec_type"] == "draft-mtp" would make a future regression print the sentence the test intends to print.
  2. tasks_reporting is 12 on the real log, not 2 as in the fixture — it counts every timing block that reported (all legs), which is honest but easy to read as "one per task". The *_last/*_max fields are the ones that carry meaning; a one-word rename (timing_blocks) or a comment would remove the ambiguity.
  3. For a reader of the JSON alone, bench_summary.kld is null on this arm, so the body's "gate PASS (KLD 0, texts identical)" cannot be confirmed from the artifact — it lives in the gate output. Not this PR's business, but the same argument as drafting applies one field over.

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT: READY at 1705799b (rebase-only; the review stands).

This PR's own files are byte-identical between the heads — the rebase brought other PRs' content with the new base:

git diff b95ffd9e…1705799b -- tools/hyperloom/custom/benchmark.py tests/hyperloom_benchmark_test.py   ->  0 changed lines

So everything in my verdict holds: drafting_observed() on the real arm_74_longctx serve.log returns draft-mtp / qwen35-mtp-max-3 / --spec-draft-n-max 3 / 0.6746 / 85 / 126 / mean len 3.02, the same run's artifact is the one that had drafting: {}, the test passes and bites when drafting_observed() is forced back to None, and the record is assigned on the serve leg only (benchmark.py:802) while llama-bench keeps drafting_identity() because it does not draft.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

hyperloom custom: a result that drafted says drafting: {} — the MTP default is worth ~18 % of long-context decode and is not recorded

1 participant