Repository navigation
bench_niah_cpp: expose ddtree/fa/kv params and auto-max-ctx as CLI flags - #90
Merged
Merged
Conversation
Adds --ddtree-budget, --ddtree-temp, --no-chain-seed, --fa-window, --kv-tq3, and --auto-max-ctx CLI flags to bench_niah_cpp.py. Each maps 1:1 to existing daemon CLI flags via DflashClient kwargs. Pure ergonomics change. Defaults preserve current behavior: - ddtree_budget=16 (matches existing DflashClient default) - kv_tq3=1 (matches existing default) - fa_window=0 (full attention, matches existing default) - chain_seed=True (matches existing daemon default) DflashClient gains two new optional kwargs (ddtree_temp, chain_seed) with backward-compatible defaults; they are translated to the daemon's --ddtree-temp / --ddtree-no-chain-seed flags only when set. Existing callers that don't pass the new kwargs are unaffected. --auto-max-ctx computes max_ctx from src_tokens, keep_ratio, and n_gen, then aligns up to 1024. Treats --max-ctx as a floor (max(max_ctx, computed)) so existing scripts setting --max-ctx explicitly continue to work. Motivation: parameter sweeps for tuning configs on different GPUs (e.g. Blackwell sm_120) previously required editing Python source between runs. This makes such sweeps reproducible from the CLI. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds additional CLI ergonomics to the bench_niah_cpp.py harness by exposing daemon tuning parameters as flags and introducing an --auto-max-ctx helper, with corresponding support in DflashClient for mapping new options to daemon flags.
Changes:
- Expose daemon tuning params (
ddtree_budget,ddtree_temp,chain_seed,fa_window,kv_tq3) asbench_niah_cpp.pyCLI flags and wire them intoDflashClient. - Add
--auto-max-ctxlogic to compute and roundmax_ctxbased on the first case’s prompt token estimate. - Extend
DflashClientto optionally append--ddtree-tempand--ddtree-no-chain-seedto the daemon command line.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
pflash/tests/bench_niah_cpp.py |
Adds CLI flags for daemon knobs and implements --auto-max-ctx sizing logic. |
pflash/pflash/dflash_client.py |
Adds optional kwargs to emit new daemon flags during subprocess spawn. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Insert `*` before the optional tuning kwargs in DflashClient.__init__ (ddtree_temp, chain_seed, fa_window, kv_tq3, lm_head_fix, boot_*) so they cannot be bound positionally. The previous diff introduced ddtree_temp and chain_seed in the middle of the positional list, which would silently rebind any caller passing fa_window positionally. The keyword-only marker prevents this class of bug for all future tuning-knob additions; the only in-tree caller already uses kwargs. Addresses the dflash_client.py:19-20 review finding. The companion bench_niah_cpp.py auto-max-ctx finding is already addressed by 8a2e24b (Copilot Autofix). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Contributor
|
@ppsx thanks for your first contribution. This cleaning is very welcomed |
Contributor
Author
|
Thank you, @davide221. I hope it will be useful. |
This was referenced May 4, 2026
smpurkis
pushed a commit
to smpurkis/lucebox-hub
that referenced
this pull request
May 10, 2026
…ance
Six review-feedback fixes on the new RTX 5090 long-context section:
1-3. Throughput unit consistency: rename Decode t/s → Decode tok/s in all
three throughput tables (headline, budget sweep, alpha sweep) to
match the rest of dflash/RESULTS.md and the short-context section.
4. Runtime config interface ambiguity: replace shorthand names
(keep_ratio=, alpha=, ddtree_budget=, ...) with the actual
reproducible interfaces — bench_niah_cpp.py CLI flags added in Luce-Org#90
(--keep-ratio=, --alpha=, --ddtree-budget=, --fa-window=, --kv-tq3=,
--n-gen=) and daemon env vars (DFLASH_FP_USE_BSA=, optional
DFLASH27B_FA_WINDOW=). One concrete way to reproduce, not three
shorthand aliases.
5. niah_gen.py path: reference becomes a relative markdown link to
../pflash/tests/niah_gen.py.
6. P2 — sweep provenance and apparent headline-vs-table mismatch:
the headline 210.7 tok/s comes from Phase 4 (n=20 reliability run at
the V4 config: keep=0.05/alpha=0.70/budget=22), but the budget table
was at keep=0.08/budget=varying and the alpha table was at
keep=0.08/budget=28/alpha=varying. A reader who notices both
"budget=22 → 217.4" (sweep) and "budget=22 → 210.7" (headline)
would correctly conclude the section is mixing configs.
Fix: each sweep table now declares its held-fixed parameters in the
subsection title (Phase 1 / 2 / 3, with "held: ..."). Added the
missing keep-ratio sweep (Phase 3) so the reader can see why
keep=0.05 was chosen over the per-token-faster keep=0.08 (TTFT and
compression-ratio tradeoff). New paragraph between the headline and
the sweeps spells out the methodology so the cross-table comparison
is grounded.
oliveagle
pushed a commit
to oliveagle/lucebox-hub
that referenced
this pull request
May 22, 2026
bench_niah_cpp: expose ddtree/fa/kv params and auto-max-ctx as CLI flags
oliveagle
pushed a commit
to oliveagle/lucebox-hub
that referenced
this pull request
May 22, 2026
…ance
Six review-feedback fixes on the new RTX 5090 long-context section:
1-3. Throughput unit consistency: rename Decode t/s → Decode tok/s in all
three throughput tables (headline, budget sweep, alpha sweep) to
match the rest of dflash/RESULTS.md and the short-context section.
4. Runtime config interface ambiguity: replace shorthand names
(keep_ratio=, alpha=, ddtree_budget=, ...) with the actual
reproducible interfaces — bench_niah_cpp.py CLI flags added in Luce-Org#90
(--keep-ratio=, --alpha=, --ddtree-budget=, --fa-window=, --kv-tq3=,
--n-gen=) and daemon env vars (DFLASH_FP_USE_BSA=, optional
DFLASH27B_FA_WINDOW=). One concrete way to reproduce, not three
shorthand aliases.
5. niah_gen.py path: reference becomes a relative markdown link to
../pflash/tests/niah_gen.py.
6. P2 — sweep provenance and apparent headline-vs-table mismatch:
the headline 210.7 tok/s comes from Phase 4 (n=20 reliability run at
the V4 config: keep=0.05/alpha=0.70/budget=22), but the budget table
was at keep=0.08/budget=varying and the alpha table was at
keep=0.08/budget=28/alpha=varying. A reader who notices both
"budget=22 → 217.4" (sweep) and "budget=22 → 210.7" (headline)
would correctly conclude the section is mixing configs.
Fix: each sweep table now declares its held-fixed parameters in the
subsection title (Phase 1 / 2 / 3, with "held: ..."). Added the
missing keep-ratio sweep (Phase 3) so the reader can see why
keep=0.05 was chosen over the per-token-faster keep=0.08 (TTFT and
compression-ratio tradeoff). New paragraph between the headline and
the sweeps spells out the methodology so the cross-table comparison
is grounded.
oliveagle
pushed a commit
to oliveagle/lucebox-hub
that referenced
this pull request
May 22, 2026
…ance
Six review-feedback fixes on the new RTX 5090 long-context section:
1-3. Throughput unit consistency: rename Decode t/s → Decode tok/s in all
three throughput tables (headline, budget sweep, alpha sweep) to
match the rest of dflash/RESULTS.md and the short-context section.
4. Runtime config interface ambiguity: replace shorthand names
(keep_ratio=, alpha=, ddtree_budget=, ...) with the actual
reproducible interfaces — bench_niah_cpp.py CLI flags added in Luce-Org#90
(--keep-ratio=, --alpha=, --ddtree-budget=, --fa-window=, --kv-tq3=,
--n-gen=) and daemon env vars (DFLASH_FP_USE_BSA=, optional
DFLASH27B_FA_WINDOW=). One concrete way to reproduce, not three
shorthand aliases.
5. niah_gen.py path: reference becomes a relative markdown link to
../pflash/tests/niah_gen.py.
6. P2 — sweep provenance and apparent headline-vs-table mismatch:
the headline 210.7 tok/s comes from Phase 4 (n=20 reliability run at
the V4 config: keep=0.05/alpha=0.70/budget=22), but the budget table
was at keep=0.08/budget=varying and the alpha table was at
keep=0.08/budget=28/alpha=varying. A reader who notices both
"budget=22 → 217.4" (sweep) and "budget=22 → 210.7" (headline)
would correctly conclude the section is mixing configs.
Fix: each sweep table now declares its held-fixed parameters in the
subsection title (Phase 1 / 2 / 3, with "held: ..."). Added the
missing keep-ratio sweep (Phase 3) so the reader can see why
keep=0.05 was chosen over the per-token-faster keep=0.08 (TTFT and
compression-ratio tradeoff). New paragraph between the headline and
the sweeps spells out the methodology so the cross-table comparison
is grounded.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pure ergonomics change to
pflash/tests/bench_niah_cpp.pyand the underlyingDflashClient. Six existing daemon knobs and one new helper become reachable from the CLI:--ddtree-budget(default 16, matches existingDflashClientdefault)--ddtree-temp(default unset → daemon default)--no-chain-seed(default off → chain seeding stays on)--fa-window(default 0, full attention)--kv-tq3 {0,1}(default 1, matches existing default)--auto-max-ctx(off by default; when on, sizesmax_ctxfromsrc_tokens x keep_ratio x 1.15 + n_gen + 512, aligned up to 1024, and treats--max-ctxas a floor)DflashClient.__init__gains two new optional kwargs (ddtree_temp,chain_seed) that are forwarded to the daemon as--ddtree-temp=...and--ddtree-no-chain-seedonly when set. The other knobs already hadDflashClientkwargs; this PR just plumbs them through the bench.Motivation
Parameter sweeps for tuning configs on different GPUs (in my case Blackwell
sm_120, RTX 5090 32 GB at 117K NIAH) previously required editing the Python
source between runs. With these flags every sweep step is a single CLI
invocation, so configs can be captured in shell scripts and reproduced.
No upstream defaults change — anyone running the existing bench command unchanged sees the same
ddtree_budget=16 / kv_tq3=1 / fa_window=0 / chain_seed=Truebehavior they have today.