diff --git a/docs/GUIDE.md b/docs/GUIDE.md index a438b49e..61348f58 100644 --- a/docs/GUIDE.md +++ b/docs/GUIDE.md @@ -1123,6 +1123,38 @@ behind the packet processor's barrier bit, which saves most of the launch gap be kernels. The bytes are the same. Plain decode measured slower with them, so they stay off there and on every other model; the startup report's `chained launches` row says which and why. +**A shorter block under load: `--draft-short-from N`.** A block drafter's block is paid for by +every drafting sequence, whatever each one verifies. At one sequence a long block pays; at many, its +drafter rows and its weaker first positions cost more than the extra drafts bring. A drafter that also +serves a shorter block declares it (PLUGIN.md §11); DFlash2 declares a block of 4 (3 drafts) wherever its +own is longer, on `qwen35_fp8` and `gemma3`. With `--draft-short-from N` the engine runs that short block +once N sequences decoded in the step just run, and the drafter's own block again only once the count +falls two below N, so a load wavering at N does not change the pass shape every step. `0`, the default, +never switches. Startup names what it will run: + +``` +speculation: from 16 decoding sequences on, 'dflash2' runs its short block of 4 row(s), 3 token(s) +``` + +or warns that the drafter declares no shorter block, or is a serial head. Qwen3.8-27B MXFP4 + DFlash2 +on two R9700s, `--num-speculative-tokens 7` at the fixed window, greedy, tok/s: + +| streams | unset | `--draft-short-from 8` | +|---|---|---| +| 1 | 188.3 | 184.2 | +| 4 | 573.2 | 572.3 | +| 8 | 823.6 | 784.3 | +| 16 | 922.2 | 1089.1 | +| 32 | 1191.5 | 1252.7 | +| 64 | 1255.8 | 1541.0 | + +The block driver runs the short block on the card as it runs the drafter's own: the query pass is +the shorter batch, each row's proposals are the front of the drafter's proposal row, and the step +issued ahead verifies that many. Leave it unset for one to eight streams; for a server that +regularly decodes 16 or more sequences, set it around 16 and measure 8..32 for your load. The +drafts are verified as any others; as with `--num-speculative-tokens`, a different block is a +different verify shape, so greedy text can differ at a near-tie. + ### 4.7 Multiple cards ```sh @@ -1708,6 +1740,7 @@ by 0.002-0.003 nats. |---|---|---| | `--num-speculative-tokens N` | auto | speculative window; 0 disables. The ceiling under `--draft-window adaptive` | | `--draft-window MODE` | fixed | `fixed` drafts N every step; `adaptive` follows each sequence's acceptance and the measured step cost, serial draft heads only (§4.6) | +| `--draft-short-from N` | 0 | a block drafter that declares a shorter block runs it from N decoding sequences on, its own block again two below; 0 never (§4.6) | | `--draft-model PATH` | | not implemented: merge the drafter at convert time | **Server** diff --git a/docs/PLUGIN.md b/docs/PLUGIN.md index eb965db5..41607f65 100644 --- a/docs/PLUGIN.md +++ b/docs/PLUGIN.md @@ -361,6 +361,16 @@ says so with `RAD_ARCH_SERVES_IMPORTS(0)` (`qwen35_w8a8` does), and imports keep (`rad_op_resolved`) and is an error only if issued. The in-tree blocks do this for `qk_norm_rope_gate`. - **Read §8** if the model has a linear or recurrent block. +- **A block drafter may serve a shorter block.** `rad_drafter_short_block(b, block)`, called once + after `rad_declare_drafter`, says the plugin declared its query pass at `block` rows a sequence as + well as at `RadDrafterDecl::block`, with the same anchor convention, so the core may stage a step + at either; the short block proposes `block - (RadDrafterDecl::block - depth)` tokens. The builder + refuses it without a block drafter, at or above the drafter's own block, and where it would + propose nothing. The engine runs it under `--draft-short-from` (GUIDE §4.6) and reads row `s` of + the proposals at `s * proposal_pitch`; a block drafter's `proposal_pitch` now defaults to its + depth (a row holds the whole block's proposals and a short block fills its front) and is refused + below it. The pass's block is `n_tok / n_seq`; a block the plugin has no ops for should fail the + step (`rad_block_dflash2.h` does). Additive export; `RAD_ABI_VERSION` does not move. - **Media preprocessing is the core's** (`core/mm`): resizing, patching, placeholder-token expansion and positions, in five processor families (Qwen-VL, Gemma 4, LFM2-VL, Unlimited-OCR, GLM-5.3) chosen by the container's `vision_config.model_type` (Unlimited-OCR's by its