Repository navigation
bench: the long-context score names and pins its own denominator (#1337) - #1338
Conversation
…se that is the score's denominator `throughput_unit` for a long-context result was `tok/s (decode at <ctx>-token ctx)` -- it named the context the server prefilled and not the number of tokens the decode actually produced, which is the score's own denominator and which is not the number the caller asked for (the model can stop at EOS first). Measured on this box 2026-11-07, two arms with the same model, ctx, levers and default draft cap: HL_LONGTOK=128 -> 128 decoded, 13.0592 tok/s, "tok/s (decode at 18762-token ctx)" HL_LONGTOK=512 -> 278 decoded, 14.1784 tok/s, "tok/s (decode at 18762-token ctx)" HL_LONGTOK=512 produced 278 because the server stopped at EOS (`stop processing: n_tokens = 19039`, `truncated = 0`), not because the harness cut it. So the artifact's `longctx.decode_tokens` and `levers.HL_LONGTOK` both told the truth; the two rows carry a byte-identical UNIT while their denominators differ by more than 2x, and the unit is the part that travels with the number. This lane nearly compared 14.18 against 13.40 as if the decode length were constant. Both places that build the unit now go through one `decode_unit()` (the pre-measurement placeholder that uses the requested context, and the measured one that uses the context and count the server reported), so they cannot drift apart the way the README and the gate did in #769. After: `tok/s (decode at 18762-token ctx, 278 decoded)`. The test asserts the two dimensions separately, that an unknown decode count falls back instead of fabricating "0 decoded", and -- the regression -- that rows differing only in the decoded count do not serialise to the same unit. It fails on the unfixed file (`AttributeError: decode_unit`) and passes here. Device-free: no GPU claim, no measurement, no lever touched. Closes #1337
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY at 5b6da279d46bfd9ee7ee3942b45584cf62725397. The unit now carries the score's denominator, from one definition used by both writers.
python3 tests/hyperloom_benchmark_test.py→hyperloom_benchmark_test: OK.copyright.py --checkrc 0. 3 files, +38/−4.decode_unit()(benchmark.py:242) is the only constructor. The placeholder (:844, requested ctx) and the measured result (:903,ctx_tokens_actualpluslong_info.get("decode_tokens")) both call it.- Probed directly:
decode_unit(18762, None)→tok/s (decode at 18762-token ctx)(no fabricated count);278and'278'→…, 278 decoded). So the body's two arms (128 and 278 decoded) can no longer serialise to the same unit, which is the regression the new test pins.
Nits: if decoded is truthiness, so a reported 0 decoded falls back to the count-less unit. That is harmless, because a 0-token decode has no rate, but is not None would say what is meant. And the comment at :900 cites engine#1268, while this PR closes #1337.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY at 5b6da279d46bfd9ee7ee3942b45584cf62725397
The unit now names both dimensions that set the score, and I checked the function directly as well as through the suite:
decode_unit(18762) -> 'tok/s (decode at 18762-token ctx)'
decode_unit(18762, 278) -> 'tok/s (decode at 18762-token ctx, 278 decoded)'
decode_unit(18762, 0) -> 'tok/s (decode at 18762-token ctx)' # 0/None is "unknown", not "0 decoded"
python3 tests/hyperloom_benchmark_test.py → hyperloom_benchmark_test: OK, and the arms it grew are the right ones: the two spellings, the regression itself (decode_unit(18762, 128) != decode_unit(18762, 278), i.e. two rows whose denominators differ by >2x can no longer serialise to the same unit), and the unknown count not fabricating a 0 decoded.
The reason is stated with its measurement (13.3986 tok/s over 128 decoded vs 14.1784 over 278, identical unit strings before this), which is what makes the change reviewable rather than cosmetic: HL_LONGTOK is what the caller asks for, EOS decides what was actually decoded, and only the latter is the rate's denominator. Using the same helper for the pre-measurement placeholder and the measured result is the part that stops the two drifting apart later — the failure mode this project has hit before when a doc and a gate spelled the same thing twice.
One line of prose moved with it (tools/hyperloom/custom/README.md), so the flag table and the code agree. Nothing else in the diff; no device path, no gate logic.
… it did not get it The score is a decode rate, so the number it divides by is part of the measurement. Two things were wrong: 1. `throughput_unit` named the context and not the decoded-token count, so two rows whose denominators differed by more than 2x carried byte-identical units (13.0592 over 128 tokens and 14.1784 over 278, measured here 2026-11-07). A scoreboard carries the unit and not `bench_summary.longctx`, so those two landed as the same measurement. 2. `max_tokens` was only a ceiling. The long leg asked for 512 tokens and the model stopped at EOS after 278 (serve: `stop processing: n_tokens = 19039, truncated = 0`), so the denominator varied between runs of the *same* configuration -- and nothing in the result distinguished that from a complete decode. Fix. The long leg now sends `ignore_eos`, so the decode runs the requested length and the denominator is the one we asked for. `ignore_eos` is set for that leg only: the short legs' replies are the greedy-text gate's inputs and are compared against a stored reference, so changing how long they may run would change the gate's own evidence. The long reply was already outside that gate (it depends on the context, not on the lever), which is what makes pinning its length safe. Because the flag is a request to the backend and not a guarantee from it, the result records both sides: `longctx.decode_tokens_requested`, `longctx.decode_tokens` (what actually came back) and `longctx.decode_complete`. `decode_unit()` names the count the score was divided by and says which case it is in: tok/s (decode at 18762-token ctx, 512 decoded) -- complete tok/s (decode at 18762-token ctx, 278 of 512 requested) -- stopped short Tests assert the two dimensions separately, the stopped-short form, the unknown-count fallback (no fabricated "0 decoded"), that the short legs never carry `ignore_eos`, and that completeness treats a missing count as False rather than True. They fail on the unfixed file (`decode_unit() takes from 1 to 2 positional arguments but 3 were given`) and pass here. Device-free in itself; the backend's honouring of `ignore_eos` is verified by an arm on the box. Refs #1337
|
#1338 ready for review at 42278c9 (2 commits, same PR) — the unit now names the denominator and the score pins it with |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY at 42278c91e6ec.
Re-verdicted at the new head (the READY it carried was at 5b6da279; this head adds +91/−23 of real content, not a merge), and
the three properties that make the fix safe all check out:
tests/hyperloom_benchmark_test.py hyperloom_benchmark_test: OK rc 0
ignore_eos call sites
684 ask(port, "hi", 4, timeout) warm-up no ignore_eos
688 ask(port, prompt, tokens, timeout) the short legs no ignore_eos
699 ask(port, long_prompt(longctx), longtok, timeout, ignore_eos=True) the long leg pinned
decode_unit(ctx, decoded, requested)
no decoded -> base
decoded < requested -> "…, 278 of 512 requested)"
otherwise -> "…, 512 decoded)"
So the denominator is pinned only where it is safe to pin it: the long leg's reply is the score's numerator/denominator pair and
was already outside the greedy-text gate (it depends on the context, not the lever), while the short legs keep their natural EOS and
the gate's stored reference keeps meaning what it meant. And it is still reported rather than promised — decode_tokens_requested /
decode_tokens / decode_complete say whether the flag took effect, and the unit carries the two cases apart
(512 decoded versus 278 of 512 requested), which is exactly what was missing when two rows 2.17× apart in denominator carried
byte-identical units.
One decode_unit() serving both the placeholder and the measured result is the right shape for this class — the drift between the
README and the gate in #769 was two places computing the same string.
Fixes #1337, and the root cause it names is worth keeping visible: max_tokens is a ceiling, not a length, and a scoreboard that
records the unit without bench_summary.longctx cannot tell a complete decode from a truncated one.
Device proof: the chat endpoint does honour
|
| prefill | tg at n_decoded≈102 |
final score | |
|---|---|---|---|
default_tok512 (natural stop, no flag) |
294.55 (3.39 ms/tok) | 23.06 t/s | 14.1784 |
ignoreeos_proof (flag) |
186.49 (5.36 ms/tok) | 11.90 t/s | 6.3580 |
ignore_eos cannot affect prefill — it is a sampling flag on the decode, and the prompt and its path are identical — yet prefill was 1.58× slower too, with draft acceptance unchanged (0.665 / mean len 2.99, i.e. the same as the 128-token rows). The parsimonious reading is that the window was slow (box contention: die 66.4–67.9 C, 51.6 GiB of GTT held by other lanes), and the decode was slowed by the same factor.
One sample cannot prove the flag is speed-neutral, though, so I am not asserting it. There is a clean way to settle it, and it is running now: HL_LONGTOK=128 from this branch. At 128 tokens the model's natural stop (~278) is never reached, so the flag cannot change how many tokens are decoded — if that row reproduces the 13.06–13.40 of the flag-less 128-token rows, the flag is speed-neutral and only the denominator changed; if it reads ~6, then ignore_eos itself slows this pin's decode and this PR must say so loudly, because every post-merge row would then be measured differently from the historical ladder.
Either result gets posted here. The plumbing claim (flag honoured, decode_complete correct, unit correct) stands regardless.
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
Device answer, both questions — and one correction to what I posted 40 minutes ago1. Does the chat endpoint honour 2. Does pinning cost speed? No — and my earlier "6.358 tok/s" scare was the box, not the flag. I nearly concluded the opposite, so here is the whole trail. Sequential arms could not answer it. Across three arms on 2026-11-07 with identical config, prefill and decode moved together:
So I ran the pair that does control for it — one claim, one
The first pair's 25 % gap was the window, not the body: inverting the order made it vanish (+0.5 %). A single-order probe would have produced a false "25 % cost", an unnecessary opt-in, and a wrong line in the docs. Both requests decoded exactly 128 tokens in each pair, so this was never about the count — only the rate. Net: the pin ships as the default, and this measurement is recorded in Branch is at |
Fixes #1337.
The long-context score is a decode rate, so the number it divides by is part of the measurement. Two things were wrong, and this PR fixes both in one place.
Root cause
throughput_unitwastok/s (decode at <ctx>-token ctx)— the context, not the decoded-token count. That count is the score's denominator, so two rows whose denominators differed by more than 2× carried byte-identical units. A scoreboard carries the unit and notbench_summary.longctx, so the two landed as the same measurement.max_tokenswas only a ceiling. The long leg asked for 512 tokens; the model stopped at EOS after 278 (slot release: task 528 | stop processing: n_tokens = 19039, truncated = 0). So the denominator varied between runs of the same configuration, and nothing in the result distinguished that from a complete decode.Measured on this box, 2026-11-07
Two arms, same model, ctx, levers and default draft cap, both
drafting.serve.status: drafted, both gate PASS:HL_LONGTOKarm_74_longctx_default_post1238.jsontok/s (decode at 18762-token ctx)arm_74_longctx_default_tok512.jsontok/s (decode at 18762-token ctx)Identical unit strings, denominators 2.17× apart. This lane nearly compared 14.18 against 13.40 as though the decode length were constant.
Fix
ignore_eos, so the decode runs the requestedHL_LONGTOK. Set for that leg only — the short legs' replies are the greedy-text gate's inputs, compared against a stored reference, so changing how long they may run would change the gate's own evidence. The long reply was already outside that gate (it depends on the context, not the lever), which is what makes pinning its length safe.longctxgainsdecode_tokens_requested,decode_tokens(what actually came back) anddecode_complete.tok/s (decode at 18762-token ctx, 512 decoded)when complete,tok/s (decode at 18762-token ctx, 278 of 512 requested)when the decode stopped short.decode_unit()definition serves both the pre-measurement placeholder and the measured result, so they cannot drift apart the way the README and the gate did in hyperloom custom: document HL_CTX and the long-context leg in the README #769.Verification
python3 tests/hyperloom_benchmark_test.py→hyperloom_benchmark_test: OK, rc=0.TypeError: decode_unit() takes from 1 to 2 positional arguments but 3 were given(line 66) — checked by stashingbenchmark.py.0 decoded), that the short legs never carryignore_eos, and thatdecode_completetreats a missing count as False, not True.python3 tools/copyright.py --check→ rc=0.ignore_eoson/v1/chat/completionsis verified on the box by an arm withHL_LONGTOK=512run from this branch (result recorded in the PR thread once it lands) —/v1/completionssupport is already documented in this repo (tools/e2e_bench.py, "ignore_eos (exactly N tokens)"), but the chat endpoint was not verifiable from source here, which is exactly why the completeness flag exists rather than being assumed.Not in scope
The rate itself is not re-normalised: a decode rate is a decode rate. The fix is that its denominator is now pinned where the backend allows it, and always named where it is not.