Skip to content

hostgap hold 4: full series validated; tuned MTP served +7.5-9.6% per user, token-identical outputs - #163

Merged
SamMausberg merged 7 commits into
mainfrom
hostgap/hold-results
Oct 1, 2026
Merged

SamMausberg merged 7 commits into
mainfrom
hostgap/hold-results

Conversation

@SamMausberg

@SamMausberg SamMausberg commented Oct 1, 2026 •

Copy link
Copy Markdown
Owner

Follow-up to #120 with the results of the queued MTP hold (hold 4). The whole hostgap series, patches 0001-0005, passes the GPU tests and the GPU plan check against stock SGLang, and on bench's tuned MTP arm its in-engine validation and token-identical greedy outputs. On that arm it raises served per-user output rate by 9.4-9.6% at c = 1-8, 8.9% at c = 16 and 7.5% at c = 32, in an interleaved stock / hostgap / hostgap / stock comparison where all twelve pairs fall between 1.067 and 1.101. Evidence: evidence/hostgap/hold4/ and the new "Full series 0001-0005 (hold 4)" section of evidence/hostgap/README.md.

Hold 4

One exclusive hold, 2026-10-01 19:49-20:28 UTC, repository 02a9803, engine 6b1d344887 (0001-0005), tuned MTP arm (s3, replayssm-spec, radix off; bench's mtp-tuned flags).

Exactness (measured):

  • tests/test_hostgap_plan.py: 8 passed. This is its first GPU run, which Remove blocking reads from FlashInfer planning in the speculative cycle (hostgap) #120 listed as pending.
  • GPU plan check: 0 plan-state and 0 attention-output-bit differences for the EAGLE verify and the DFlash draft block at B = 1-128, and 0 for segment_packbits and the draft kv_indptr.
  • Greedy outputs against Remove blocking reads from FlashInfer planning in the speculative cycle (hostgap) #120's stock run (64 prompts at c = 1, 8 and 32, pinned pools, radix off): hostgap and hostgap + validate are token-identical on 192/192 requests, with equal verify counts and correct-draft histograms and equal pools. Logprobs were not compared. This covers the MTP arm; DFlash on the full series is pending. In-engine validation matched 8,192 verify plans and 8,192 draft index sets.
  • 0005 changes nothing with this BF16 KV cache; its NVFP4 path is untested.

Held-batch decode cycle, untraced (measured; patched server first, the reverse of hold 2):

B 1 8 32 64 128
Stock cycle (ms) 6.880 7.689 10.001 13.088 20.104
0001-0005 6.378 (-7.3%) 7.060 (-8.2%) 9.148 (-8.5%) 11.937 (-8.8%) 18.908 (-5.9%)
Stock idle, derived from its own trace 1.39 ms (20%) 1.47 (19%) 1.55 (16%) 1.62 (12%) 1.81 (9%)
Share of that idle removed 36% 43% 55% 71% 66%
  • Every change is at least five times the larger window standard deviation.
  • Stock and patched traces from the same driver agree on GPU busy time within 0.02 ms per cycle at B ≤ 64. That confirms the assumption behind Remove blocking reads from FlashInfer planning in the speculative cycle (hostgap) #120's estimate (1.44-1.79 ms), which this direct measurement agrees with. At B = 128 the two busy times differ by 0.48 ms, so the idle split there is less certain than the cycle change.
  • 0001-0003 alone gave -2.7% to -4.8% in hold 2. The full series adds 1.1-5.1 points (derived across the two holds, which ran in opposite order). 0004 is the only change on this BF16 path.

Where the gain is (traced, attribution only): the GPU's wait between the draft and the verify fell from 1.54-2.18 ms to 0.52-0.97 ms, and verify planning is exposed for 0.13-0.58 ms instead of 1.09-1.75. No blocking synchronization remains on the verify or draft planning paths. That includes the last one 0001-0003 left, which the #120 reviewer asked about: FlashInfer's _compute_page_mask_indptr runs mask_indptr[0] = 0 on a CUDA tensor, which PyTorch performs as a blocking 4-byte copy from pageable host memory. 0004 uploads those offsets from pinned memory and no longer calls the helper. The wait before the draft did not shrink (0.89-1.14 ms traced, against 0.81-1.07 in stock): the host still needs 1.67-1.82 ms after the previous verify before it launches the draft. That is what is left.

Served A/B (measured, hold4/ab_mtp.json): bench.sweep with one server per sweep, identical flags except the patched worktree and its flags, c = 1-32. Every point is valid, and the mean CPU load of other processes during each point was at most 0.81 cores.

c 1 2 4 8 16 32
Per-user tok/s, stock → hostgap 461.2 → 505.6 436.8 → 478.6 406.8 → 445.0 360.4 → 394.5 293.6 → 319.7 222.8 → 239.6
Pair ratios 1.101, 1.091 1.096, 1.096 1.090, 1.098 1.092, 1.097 1.090, 1.089 1.067, 1.084
TTFT p50 (ms) 42.8 → 40.2 46.1 → 43.0 46.4 → 43.4 47.4 → 43.9 48.8 → 45.5 51.4 → 48.6
  • Output throughput moves by the same ratios (within 0.006).
  • Accept length is identical at c = 1-16. At c = 32 it is 3.263 against 3.258, where arrival timing changes batch composition.
  • Two runs per side do not make a distribution. Concurrencies above 32 and the Triton reference were not swept: the hold used 2,319 s, past the 2,100 s budget it allows before the Triton sweep.

Other changes

  • The engine README's default apply command is now the whole series (*.patch); 0004 and 0005 are no longer marked unvalidated.
  • hold_mtp.sh exported OUT for its equality step, and ab_sweep.sh reads OUT, so hold 4's sweeps landed in ~/vp-data/hostgap/equality_x/ instead of ab/. The data is intact and the README's reproduction row says where it is. The script no longer exports OUT and passes the sweep directory explicitly.
  • hold_mtp.sh and hold_dflash.sh now exit non-zero when their GPU tests (MTP), plan check, equality or validation fail; before, they always exited 0. A failed GPU test also skips the patched steps.
  • A rerun can no longer mix into an earlier hold's outputs. A profile step refuses a label that already holds windows, since cycle_profile.py appends. Each hold writes its sweeps to ab-<TAG>/, since ab_summary.py pairs every run under a label.
  • The hold-2 sections are relabelled "(hold 2, patches 0001-0003)", and their pending notes point to hold 4.
  • Merged origin/main (5567ce5, no conflicts).

Review and Codex on aa355b6

  • Reviewer 1: "bitwise equal" outputs now read token-identical (tokens, verify counts, histograms; logprobs were not compared), in the README and here. Plan state and attention output bits are still described as bitwise identical, which the plan check tests.
  • Reviewer 2: B = 128 is -5.9% (fraction -0.0595), so the gain over hold 2 is 1.1-5.1 points. The ITL medians are 2.09 at c = 4 and 4.45 / 4.15 at c = 32. The c = 1-8 range is 9.4-9.6%. All recomputed from hold4/*.json.
  • Codex P1 (hold_mtp.sh): the pytest exit code now folds into the gate ([ "$RC" = 0 ] || OK=0 before the gate is used). Hold 4's own run passed (8 passed), so no evidence changes.
  • Codex P2 (engine README): the claim is now scoped. The GPU tests and plan check cover the EAGLE verify and the DFlash draft block. In-engine validation and token-identical outputs were checked on tuned MTP. DFlash serving equality has only run on 0001-0003 with an unpinned pool, and the full-series check is pending.

Pending

hold_dflash.sh is queued with the full series. It runs the DFlash block-8 pinned-KV equality (binding 240K cap), patched-first cycle profiles with same-driver stock traces, and the interleaved served A/B. The DFlash gain from #120 (0.7-1.7%, sequential) stays unconfirmed until it reports. I will add the results to this PR, or open a third one if this merges first.

Checks

Pre-commit passes on every changed file, including the host-identity hook. The commits are by the configured identity, with no AI attribution lines. Every number above was recomputed from the committed JSON. No new dependencies were installed.

hold_mtp.sh exported OUT for the equality step, and ab_sweep.sh reads OUT
as its output directory, so hold 4's sweeps landed in equality_x/ instead
of ab/. OUT is no longer exported, and the sweeps get theirs explicitly.
…ed A/B

Patches 0001-0005 on the tuned MTP arm, one exclusive hold: the GPU tests
and plan check pass, greedy outputs match stock on 192/192 requests with
equal pools, and in-engine validation matched every plan. The held decode
cycle is 6.0-8.8% shorter (patched run first, the reverse of hold 2), the
stock idle measured with its own trace is 1.39-1.81 ms (hold 2's estimate
agrees), and the interleaved served A/B raises per-user output rate by
7.5-9.6% at c = 1-32, every pair between 1.067 and 1.101. The remaining
synchronization of 0001-0003 is FlashInfer's mask_indptr[0] = 0, which 0004
removes. The engine README's default apply command is now the whole series.
@SamMausberg

Copy link
Copy Markdown
Owner Author

Verdict: REQUEST CHANGES (aa355b6; 2 blocking, both small)

Blocking

  1. "Outputs are bitwise equal to stock: 192/192 greedy requests" (the new top summary bullet) claims more than was checked. compare_stock_vs_hostgap*.json compares token sequences, verify-step counts and correct-draft histograms, not logprobs. The section below says this correctly ("match on 192/192 token sequences, verify-step counts and correct-draft histograms"). Say "token-identical" in the summary too. "Identical plan state and attention output bits" for the GPU plan check is right as written.
  2. A few figures are off by one in the last digit.
    • B = 128: cycle_change_fraction is -0.05950, so the change is -5.9%, not -6.0% (table and summary). The full series' extra gain over hold 2 is then 1.1-5.1 percentage points (5.95 - 4.83 = 1.12 at B = 128), not 1.2-5.1.
    • ITL p50 in ab_mtp.json: c = 4 hostgap is 2.095, so 2.09 (the table says 2.10); c = 32 is 4.455 and 4.155, so 4.45 / 4.15 (the table says 4.46 / 4.16).
    • The summary's "rises by 9.6% at c = 1-8" should be "9.4-9.6%". The ratios of means are 1.096, 1.096, 1.094 and 1.095.

Checked

  • Engine. git am of patches/hostgap/0001-0005 at bd66ce343e gives tree 47e10025, which is the tree of engine 6b1d344887. That is the commit plan_equivalence.json records.
  • Exactness.
    • pytest_hostgap_plan.log: 8 passed.
    • Plan check: 0 state and output mismatches at every B, and packbits 0/40.
    • Equality, both hostgap and hostgap-validate: 64/64 at c = 1, 8 and 32 in token sequences, verify steps and histograms, with equal pools (1,000,000 KV tokens, 128 slots, limit 128).
    • Validation: 8,192 verify plans and 8,192 draft index sets matched, and the guard waited 0 of 32,711 times.
  • Held cycle.
    • Stock and patched means and sds, idle 1.39-1.81 ms (20% to 9%), removed 0.50-1.20 ms (36-71%) and GPU busy agreement within 0.02 ms at B <= 64 all match cycle_profiles.json.
    • The smallest change-to-sd ratio is 5.9 (B = 128).
    • Holds 2 and 4 differ in stock cycle by 0.5-1.0%, and hold 2's 0001-0003 changes are 2.7-4.8%.
  • Served A/B.
    • The order is stock 20:07, hostgap 20:12 and 20:17, stock 20:22.
    • Every ratio of means and pair ratio in the table matches, all twelve pairs fall in 1.067-1.101, there are no invalid points, and foreign CPU peaks at 0.812 cores.
    • Accept length is identical at c = 1-16, and 3.263 against 3.258 at c = 32.
    • The y ratios are within 0.004 of the x ratios.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: aa355b683c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread experiments/hostgap/hold_mtp.sh Outdated
nvidia-smi --query-compute-apps=pid,used_memory --format=csv,noheader
# A failed plan check, equality or validation check fails the hold (the stock
# profiles above still ran, so the hold's output is usable for the stock side).
[ "$OK" = 1 ] || { echo "=== hold failed: plan check, MTP equality or validation did not pass"; exit 1; }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Gate success on pytest's exit status

When tests/test_hostgap_plan.py fails but plan_equivalence.py succeeds, $RC is only printed and $OK is subsequently set to 1 from the equivalence check. This final guard therefore runs the remaining patched experiments and exits successfully despite a failed required GPU test, allowing an invalid hold to be treated as validated; incorporate $RC into the gate before setting or testing $OK.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Fixed in aff0c0f: after the plan check, [ "$RC" = 0 ] || OK=0 folds the pytest exit code into the gate, so a failed GPU test skips the patched steps and fails the hold (the final guard now exits 1). Hold 4 itself passed its tests (8 passed, evidence/hostgap/hold4/pytest_hostgap_plan.log), so no evidence changes.

Comment thread engine/sglang/README.md Outdated
Comment on lines +199 to +200
`6b1d344887`) passed the GPU plan check, the GPU tests, in-engine validation and greedy output
equality with stock (`evidence/hostgap/README.md`, hold 4):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Scope the equality claim to the tested MTP arm

For readers evaluating the DFlash path, this states that the whole series passed in-engine validation and greedy output equality, but the committed evidence explicitly says the full-series DFlash pinned-KV equality is still pending (evidence/hostgap/README.md, lines 53-57); hold 4 only ran serving equality for MTP. Qualify this claim as MTP-specific so patch 0003's DFlash integration is not presented as fully validated.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Fixed in aff0c0f. The engine README now says the GPU tests and the plan check cover the EAGLE verify and the DFlash draft block, while in-engine validation and token-identical greedy outputs were checked on the tuned MTP arm only. DFlash serving equality has run only on 0001-0003 with an unpinned KV pool, and the full-series DFlash check is pending (queued hold_dflash.sh).

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-01T20:42:12.822669Z 53317ad Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

…igits

Codex on #163: the pytest exit code was printed but not part of the hold's
gate, so a failed GPU test could still run the patched steps and pass; and
the engine README presented serving equality on the full series as covering
DFlash, which has only run on 0001-0003. Review on #163: outputs are
token-identical (tokens, verify counts, histograms), and B = 128 is -5.9%,
c = 1-8 is 9.4-9.6%, two ITL medians rounded the wrong way.
@SamMausberg

Copy link
Copy Markdown
Owner Author

Update to my verdict on aa355b6 (still REQUEST CHANGES): Codex's two comments on this head are valid. Add them to my two items.

  1. r4160223880 (P1, hold_mtp.sh). The pytest exit status RC (line 29) is printed but never folds into OK, which comes only from the equivalence check (line 31-33). A failed GPU test would therefore not stop the patched arms and would not fail the hold. Set OK=0 when RC != 0, before the equivalence result is tested. Hold 4's own run is unaffected (8 passed), so no evidence changes.
  2. r4160223888 (P2, engine/sglang/README.md:200). "The whole series ... passed the GPU plan check, the GPU tests, in-engine validation and greedy output equality with stock" reads as covering DFlash, but hold 4 ran in-engine validation and greedy equality for MTP only. The evidence README lists DFlash's full-series pinned-KV equality and A/B as pending. Say "for tuned MTP; DFlash's in-engine equality on the full series is pending". The plan check and GPU tests do cover the DFlash draft block.

cycle_profile.py appends windows to a label's windows.jsonl and
ab_summary.py pairs every run under a label, so rerunning a hold with the
same TAG would have folded old runs into new summaries without an error.
A profile step now refuses a label that already holds windows, and each
hold writes its sweeps to ab-<TAG>/.
@SamMausberg

Copy link
Copy Markdown
Owner Author

Verdict: APPROVE (provisional, on aff0c0f: Codex has not reviewed this head yet. I will confirm once it does.)

aff0c0f resolves all four items.

  1. Wording. The summary says outputs are token-identical on 192/192 (tokens, verify-step counts and correct-draft histograms), and keeps the identical plan state and attention bits for the random-batch check.
  2. Figures.
    • B = 128 is now -5.9% in the table and the summary, and the extra gain over hold 2 is 1.1-5.1 points.
    • ITL is 2.09 at c = 4 and 4.45 / 4.15 at c = 32.
    • The served rise is 9.4-9.6% at c = 1-8.
  3. r4160223880. [ "$RC" = 0 ] || OK=0 now runs after the plan check and before any patched step, so a failed GPU test skips the patched arms and fails the hold. The final message names the GPU tests.
  4. r4160223888. engine/sglang/README.md scopes in-engine validation and token-identical outputs to the tuned MTP arm. It says the plan check covers the EAGLE verify and the DFlash draft block, and that DFlash serving equality has run only on 0001-0003, with KV pools that differ by 31-155 tokens, with the full-series check pending. This matches evidence/hostgap/README.md.

Pre-commit from main is clean, and the commit has no hostname or AI attribution.

@SamMausberg SamMausberg changed the title hostgap hold 4: full series validated; tuned MTP served +7.5-9.6% per user, bitwise equal hostgap hold 4: full series validated; tuned MTP served +7.5-9.6% per user, token-identical outputs Oct 1, 2026
@SamMausberg

Copy link
Copy Markdown
Owner Author

@codex review

@SamMausberg

Copy link
Copy Markdown
Owner Author

Verdict: APPROVE (provisional, on 53317ad: Codex has not reviewed this head yet. I will confirm once it does.)

53317ad is a self-review commit on top of aff0c0f, whose four fixes I checked in my previous comment.

  • Profiles. profile_arms.sh skips, and logs with !!!, a step whose label already holds windows.jsonl, because cycle_profile.py appends. A failed or skipped step is logged and the next step runs, consistent with the script's stated design.
  • Sweeps. Both holds write their sweeps to ab-$TAG, so ab_summary.py, which pairs every run under a label, cannot mix holds. The README's hold4/ row records where hold 4's sweeps actually landed.
  • Checks. Pre-commit from main is clean, including shellcheck, and the commit has no AI attribution.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: 53317ad0ac

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@SamMausberg

Copy link
Copy Markdown
Owner Author

Verdict: APPROVE (confirmed on 53317ad)

This confirms my provisional approval. Codex found no issues on this head.

@SamMausberg
SamMausberg merged commit 6f70a23 into main Oct 1, 2026
SamMausberg added a commit that referenced this pull request Oct 1, 2026
…ved A/B (#163)

The host-gap paragraph, the levers-table row, the H6 status row, the hostgap
register entry and the hostgap-served pending item now carry #163's results for
the tuned MTP arm: all five patches validated and token-identical, the held cycle
5.9-8.8% shorter, and served per-request rate 1.067-1.101x in interleaved pairs at
concurrency 1-32 (one session). DFlash with FlashInfer draft attention stays
pending. Text from the host-gap agent, checked against evidence/hostgap/README.md.
SamMausberg added a commit that referenced this pull request Oct 1, 2026
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