Skip to content

serve --help: --npu-streams' default back under it; --flash says a short system turn is not pinned (Refs #1785) - #2152

Merged
bong-water-water-bong merged 1 commit into
mainfrom
cl1077/1785-flash-help
Nov 11, 2026
Merged

bong-water-water-bong merged 1 commit into
mainfrom
cl1077/1785-flash-help

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

Refs #1785. This is a help text and docs change only, distinct from the speed work on #1785.

What changes

  1. serve --help: the line (default 1, the device exclusive; docs/npu.md) is the second half of --npu-streams. Commit 880d646 inserted the prefix-cache lines between the two halves, so the help has been showing that default under --flash. It is now back under --npu-streams. The line under --flash now says that a system turn shorter than --prefix-min-gain (128 by default) is not pinned.
  2. docs/npu.md, the --flash paragraph: says that the pin obeys --prefix-min-gain like every other slot. A short system turn is therefore prefilled on every request, even under --flash. To pin one, pass the threshold together with the profile, for example --flash --prefix-min-gain 32 for a 40-token turn. This matches the 11-11 03:04Z conclusion on npu: F5 — a single-turn flash serving mode (fixed 1k ctx, clean state per request, system prompt reused), measured against 0.49 s TTFT / 33 tok/s #1785: the threshold is the cache's tested policy (pin_at(q1, 127) == 0), so this is a configuration choice and not a code change.

Checked

  • --prefix-min-gain reaches forward-serve whether --flash is set or not (app/serve.cpp:3480, after the --flash block), so the documented command does what it says.
  • serve.cpp compiles with -fsyntax-only, using the existing build's own compile command, rc 0.
  • No test matches either help line (grep -rl over tests/).

🤖 Generated with Claude Code

…ort system turn is not pinned (Refs #1785)

880d646 put the prefix-cache lines between --npu-streams and its continuation,
so '(default 1, the device exclusive)' read as --flash's default. docs/npu.md's
--flash paragraph now says the pin obeys --prefix-min-gain (128) and how to pin
a shorter system turn, as the #1785 thread concluded (a policy, not a change).

Co-authored-by: bong-water-water-bong <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

ready for review at 2c6ea21

@github-actions

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

1785 - Partially compliant

Compliant requirements:

  • The PR updates the help text and documentation to clarify that --flash mode uses the same prefix pinning behavior as other modes, with --prefix-min-gain controlling pinning
  • The PR ensures that system prompts shorter than --prefix-min-gain (default 128) are not pinned under --flash, matching the documented behavior

Non-compliant requirements:

  • The PR does not implement the actual --flash mode functionality or measure performance against the specified bar
  • The PR does not verify that the state-reset is complete (KV + recurrent state + scratch) for the flash mode
  • The PR does not actually implement the single-turn flash serving mode with fixed 1k context and clean state per request

Requires further human verification:

  • The actual performance measurement and verification of the flash mode against the FLM 1.0.12 bar
  • The verification of complete state reset in the flash mode
  • Confirmation that the qwen3.5-flash:2b pack is available and working with the new flash mode
⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Help Text Placement

The help text for --npu-streams was moved from under the --flash flag to under --npu-streams itself. This change may cause confusion for users who expect to see the default value for --npu-streams when they look at the help for --flash, as it was previously positioned there.

"                  [--npu-streams N]   with --device npu: this serve is one of N sharing the NPU\n"
"                  (default 1, the device exclusive; docs/npu.md)\n"
Documentation Clarity

The documentation change clarifies that --flash mode respects --prefix-min-gain for pinning behavior, which is good for consistency. However, it does not address whether the actual flash mode implementation has been fully implemented or tested for performance against the specified bar.

The pin obeys `--prefix-min-gain` like every other slot (128 tokens by default): a system turn shorter than
that is not pinned, under `--flash` too, and each request prefills it again. That is the cache's policy, not
something `--flash` changes, so to pin a short system turn give the threshold with the profile, for example
`--flash --prefix-min-gain 32` for a 40-token one. A lower threshold also lets shorter whole prompts take a slot.

@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 at 2c6ea21: READY

Reviewed head 2c6ea21 (refs #1785). Help text and docs only: app/serve.cpp +2/−1, docs/npu.md +5. This is the first verdict.

  • The misplaced line is back where it belongs. In usage(), (default 1, the device exclusive; docs/npu.md) now sits directly under [--npu-streams N] again, rather than under [--flash]. The --flash line gains "(a system turn shorter than --prefix-min-gain, 128 by default, is not pinned)".
  • The 128 is the real default. app/npu_prefix_cache.h:61 has int min_gain = 128;, and the existing help line two above already says "Unset keeps the forward's defaults: 8 / 4096 / 128".
  • The documented command does what it says. serve forwards --prefix-min-gain to forward-serve whenever it was set (app/serve.cpp:3480), in the per-op route's argument list next to --prefix-pin, and not inside any --flash-only branch. forward-serve parses it into prefix_opts.min_gain (app/forward_serve.cpp:1077). So --flash --prefix-min-gain 32 reaches the cache.
  • git merge-tree onto main: no conflicts. CI build, hrx_build and CodeQL green.

@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 at 2c6ea21: READY

Putting --npu-streams' default back under the option in --help is the kind of fix only a reader of the help output would ask for, and it matters more than it looks: a flag whose default is not shown is a flag every operator guesses, and the guesses become benchmark variance that looks like noise. Same argument as naming the term that decided a refusal (#296/#300) — the interface should state the value it will use.

@bong-water-water-bong
bong-water-water-bong merged commit b8b69cb into main Nov 11, 2026
10 checks passed
@bong-water-water-bong
bong-water-water-bong deleted the cl1077/1785-flash-help branch November 11, 2026 09:06
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.

1 participant