Archived
core/sched: a prefix hit resumes on the cold run's chunk grid, so it recomputes the cold run's own chunks
A hit recomputes the tokens past where it resumes. Kernels may round a row differently at another chunk length (spec §17: the fp8 GEMM's split-K count is chosen from M), so a hit that recomputes its tail in other chunks than a cold prefill of the same prompt can flip a near-tie in greedy text. On the DeepSeek-V4.1 daily (TP4) a 24k-token prompt that hit a 16k one's tail snapshot resumed at 15856, ran a 528-token chunk to the next boundary and answered differently from its cold run. --prefix-resume exact, the default: - ChunkGeometry carries the grid an idle server's cold prefill chunks on: --max-num-batched-tokens rounded down to the quantum, or the checkpoint interval where chunks split at it and it is the smaller, times the span from the second interval on. - plan_chunk writes checkpoints only on that grid. A prompt's tail snapshot is taken where its last chunk starts (sliding-window snapshots keep their one-block margin) instead of at its last quantum boundary. The chunk already ends there, so a long cold prompt no longer runs a short extra step at its end. - A checkpoint interval past the chunk must be a multiple of it; otherwise it is rounded up, and startup says so. - admit_one steps a hit with no snapshot to resume from (full attention) back to the grid. A request's own checkpoint (Request::checkpoint_at, /v1/systemone's shared head) is honored where it falls. --prefix-resume nearest keeps the previous rule. The cost is re-prefill: an exact repeat runs the cold run's last chunk again, and an agent's next turn resumes where the previous prompt's last chunk started, about half a chunk more than nearest (2048 tokens at a 4096-token budget). The property holds on an idle server; a prefill that shares its steps with decode rows or other requests (--busy-prefill-chunk, --prefill-interleave) is cut differently, as batching already changes greedy text. Tests: sched_test covers the grid for six geometries (GDN hybrid, interval past the budget, span, periodic and tip-only window snapshots, full attention), the interval rounding, the tail snapshot at the last chunk start, admission stepping back to the grid, and a property over prompt lengths: every checkpoint is a chunk start of the cold run of its prompt and of any longer prompt it prefixes, and a hit from it cuts the cold run's chunks. config_test covers the flag.
This commit is contained in:
1 parent
f43929ccb8
commit
662b7720b5
9 files changed
+449
-4
No files matched your search
@@ -1193,6 +1193,31 @@ snapshot lets it skip at least 256 tokens of that head, the request takes one wh
|
||||
ends, at the cost of one chunk split, and the requests after it resume there. A conversation's
|
||||
next turn has only its own earlier turn past that point, so it splits nothing extra.
|
||||
|
||||
A prefix hit answers exactly as the same prompt prefilled cold, by default
|
||||
(`--prefix-resume exact`). A kernel can round a row differently at another chunk
|
||||
length (the fp8 GEMM's split-K count is chosen from `M`, spec §17), so a hit that
|
||||
recomputes its tail in other chunks than a cold prefill can flip a near-tie in
|
||||
greedy text. The hit therefore resumes only where an idle server's cold prefill of
|
||||
that prompt starts a chunk: every `--max-num-batched-tokens` tokens (rounded down
|
||||
to the chunk quantum), or every `--checkpoint-interval` when that is smaller. A
|
||||
prompt's tail snapshot is taken where its last chunk starts, a boundary the chunk
|
||||
already ends on, so it costs a copy and no step. An exact repeat re-prefills the
|
||||
cold run's last chunk; an appended turn, that chunk and what the turn added: up to
|
||||
one chunk more than `--prefix-resume nearest`, which resumes at the deepest
|
||||
snapshot or block and splits a prompt's last chunk at its last quantum boundary.
|
||||
The interval must be a multiple of the chunk when it is larger; otherwise it is
|
||||
rounded up, and startup says so:
|
||||
|
||||
```
|
||||
--checkpoint-interval 6144 resolves to 8192: --prefix-resume exact needs it a multiple of the
|
||||
4096-token prefill chunk (--max-num-batched-tokens 4096) ...
|
||||
```
|
||||
|
||||
It is an idle-server property, as greedy batching is: a prefill that shares its
|
||||
steps with other requests or decode rows (`--busy-prefill-chunk`,
|
||||
`--prefill-interleave`) is cut differently, and a request's own checkpoint
|
||||
(`/v1/systemone`'s shared head) resumes where it was asked.
|
||||
|
||||
**One prefill sequence in two pieces.** At two ranks, on `qwen35_fp8` (and `qwen35_w8a8`, built
|
||||
from it, where its norms do not write rotated int8 codes) and on `gemma3`'s MXFP4 trunk with the
|
||||
fused fp8 junctions, a step of at least 1024 tokens that carries one prefill sequence and nothing
|
||||
@@ -1947,6 +1972,7 @@ by 0.002-0.003 nats.
|
||||
| `--prefill-span N` | 1 | checkpoint intervals one step may carry of a prefill alone in its step, from the prompt's second interval on; needs `--max-num-batched-tokens` of N intervals. Every other step is planned at the budget less the extra intervals, and the checkpoints inside a span are not written (§4.5) |
|
||||
| `--checkpoint-slots N` | auto | linear-state (hybrid) or sliding-window snapshots the server may hold at once, in total, not per sequence. They live in pinned host memory, allocated at startup: one slot is a snapshot of every rank's shard (113 MB on Flash-Next at `--tp 2`, 144 MiB on Qwen3.8-27B; on Gemma 4 31B the 1024-token window of every sliding layer, 406 MiB at `--tp 2`). `auto` gives each of `--max-num-seqs` what `--checkpoint-policy` keeps for a `--max-model-len` session plus one (10 at 200K tokens under geometric backoff), within an eighth of host memory and what the host can pin; the startup line and the report say what it chose and why (§4.8). A full store retires its least recently used snapshot. A count is taken as given: a store the host memory cannot hold or pin stops the start, and a table placed in host memory leaves room for it; `0` serves with none, every prefix hit then prefilling from the start |
|
||||
| `--checkpoint-policy NAME` | geometric-backoff | also `tip-only`, `keep-all` |
|
||||
| `--prefix-resume MODE` | exact | `exact`: a prefix hit resumes only where an idle server's cold prefill of the prompt starts a chunk, and a prompt's tail snapshot is taken where its last chunk starts, so a hit answers bit-identically to a cold run; an interval past the chunk is rounded up to a multiple of it. `nearest`: the deepest snapshot or block, up to a chunk less re-prefilled a turn |
|
||||
| `--no-prefix-cache` | prefix cache on | disable prefix caching |
|
||||
|
||||
**Parallel**
|
||||
|
||||
Reference in new issue
Block a user