Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,25 +148,28 @@ a fixed scale at startup. See the
| [Ouro-1.4B-Thinking](docs/recipes/ouro_thinking.md) | Reuses Ouro | [CUDA](docs/launching.md) | Bounded BF16, fixed-four-loop synchronous basic integration |
| [Ouro-2.6B-Thinking](docs/recipes/ouro_thinking.md) | Reuses Ouro | [CUDA](docs/launching.md) | Bounded BF16, fixed-four-loop synchronous basic integration |
| Nanbeige4.2-3B | Native Nanbeige | [CUDA](docs/launching.md) | Fixed two-loop inference. [CUDA PD validation](https://github.com/InferMatrixLab/vllm-rlt/pull/77) |
| Huginn-0125 | Native Huginn | [CUDA](docs/launching.md) | Synchronous fixed-depth, LAST_EXITED KV, CUDA Graph decode core and coda |
| [NVIDIA-Nemotron-Labs-Dory1.0-4B](docs/dory.md) | Native Dory | [CUDA](docs/launching.md) | Synchronous fixed-loop execution, boundary KV, per-loop and last-loop KV modes, Triton/Torch sliding-window masking, BF16 real-checkpoint agreement at 1/2/4 loops on A100; long context, Graphs/async and reclamation not qualified |
| Huginn-0125 | Native Huginn | [CUDA](docs/launching.md) | Synchronous fixed-depth, LAST_EXITED KV, eager mixed/WCPB prefill, CUDA Graph decode core and coda |
| [NVIDIA-Nemotron-Labs-Dory1.0-4B](docs/dory.md) | Native Dory | [CUDA](docs/launching.md) | Synchronous fixed-loop execution, per-loop and last-loop KV, eager staged prefill with per-loop KV, BF16 real-checkpoint checks on A100; long context, staged Graphs/async and reclamation not qualified |

The broader model roadmap is in [RFC #69](https://github.com/InferMatrixLab/vllm-rlt/issues/69).

Huginn uses native checkpoint loading and depth-aware KV for its recurrent
core, with separate prelude and coda KV. It supports synchronous fixed-depth
inference and CUDA Graphs for the recurrent core and decode coda.

Huginn does **not** currently support WCPB/mixed staged prefill, asynchronous
execution, self-speculation, or PD. Feature availability is not equivalent to
validation of every model/backend/workload combination.
Huginn supports synchronous eager WCPB and mixed staged prefill with per-loop KV.
Asynchronous staged execution, self-speculation, prefix reuse, and PD are not
supported. Feature availability is not equivalent to validation of every
model/backend/workload combination.

Dory runs the native normalized-GPT stack with attention-bearing input and
output stages, so its boundary stages own their own KV. Synchronous
fixed-loop execution is supported for both `per_loop` and `last_loop` KV
modes. Sliding-window masking exists only in the Torch reference attention
backend, and WCPB, CUDA Graphs, asynchronous execution, self-speculation,
prefix reuse and PD are rejected. See the
modes. Sliding-window masking is available in Torch and supported GPU attention
backends. Synchronous eager WCPB and mixed staged prefill support per-request
fixed loop counts with per-loop KV. Ordinary Graphs, asynchronous execution and
synchronous self-speculation have separate configuration restrictions; staged
Graphs/async, prefix reuse and PD are not supported. See the
[Dory baseline notes](docs/dory.md) for the exact qualified scope.

## Documentation
Expand Down
18 changes: 9 additions & 9 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ Supported models are Ouro-1.4B, Nanbeige4.2-3B, Huginn-0125 and
NVIDIA-Nemotron-Labs-Dory1.0-4B. See the
[checkpoint support matrix](../README.md#model-support) and the
[Thinking recipe](recipes/ouro_thinking.md) for model-specific coverage.
Huginn currently uses synchronous execution, LAST_EXITED KV, and fixed
recurrent depth; prefix caching, asynchronous execution, and speculative
decoding are rejected, as are mixed/WCPB staged prefill and PD. Its CUDA Graphs capture the recurrent decode core
and coda, including the LM head.
The [Dory baseline notes](dory.md) list the narrower scope qualified for Dory:
synchronous fixed-loop execution with boundary KV in both KV modes, sliding-window
masking on the Torch and Triton backends, and BF16 agreement with the pinned
checkpoint at 1/2/4 loops; Graphs, WCPB, async, speculation, prefix reuse and PD
remain out of scope.
Huginn supports synchronous fixed-depth execution, LAST_EXITED KV, and eager
mixed/WCPB staged prefill; prefix caching, asynchronous execution, speculative
decoding and PD are rejected. Its ordinary CUDA Graphs capture the recurrent
decode core and coda, including the LM head.
The [Dory notes](dory.md) describe the supported execution modes and their
validation scope. Eager staged prefill with per-request fixed depths is separate
from the already supported ordinary Graph, async and synchronous speculative
paths. Tiny-model CUDA regressions and a short real-checkpoint differential
check cover A100; broader staged qualification remains outstanding.
CPU execution provides a Torch reference backend. FlashAttention hardware validation is currently documented
for FA4 on B300; FA2/FA3 require validation on their target devices. Disaggregated
serving currently targets multiple GPUs on a single host.
Expand Down
29 changes: 25 additions & 4 deletions docs/dory.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@ layer id rather than their physical sublayer index.
`gate_up_proj` fails loudly instead of loading approximately.
- Synchronous eager execution: full-prompt prefill followed by ordinary token
decoding, with the configured fixed loop count.
- Synchronous eager staged prefill with per-loop KV, including WCPB and mixed
prelude/recurrent batching. Each request may select a fixed target from one
through `total_ut_steps`, with the full model depth as the default. Prompt
CODA is a separate causal stage; its final prompt row produces the first token.
Tiny-model CPU and A100 CUDA regressions cover float32, BF16 and multi-stream
execution. A short BF16 real-checkpoint differential check is recorded below;
long-context and broader backend qualification remain outstanding.
- `loops=` at load time to fix 1, 2 or 4 loops.
- Greedy and sampled decoding, request seeds, EOS (`2`, `11`) and length
stopping through the existing engine, covered by
Expand Down Expand Up @@ -134,14 +141,15 @@ even with per-query attention.

These fail fast rather than degrade silently:

- WCPB, mixed or staged prefill, and PD.
- Staged prefill with CUDA Graphs, asynchronous scheduling, preemption,
speculation, shared/last-loop KV, or PD.
- Prefix caching.
- Self-speculation combined with CUDA Graphs, asynchronous scheduling,
preemption or `last_loop` KV, and sampled token-pipeline speculation. The
synchronous eager form is supported; see below.
- Per-request loop counts other than the configured full depth: Dory has no
trained exit gate, so the runtime refuses to invent one, including via
`min_loops` with `exit_threshold=0`.
- Request loop counts below the configured full depth with ordinary atomic
prefill. Dory has no trained exit gate; its supported staged request target
is fixed rather than inferred from `exit_threshold`.

Preemption and snapshots are **not qualified** rather than enforced: the
generic KV snapshot mechanism copies every plane, so it may well work, but no
Expand Down Expand Up @@ -248,6 +256,19 @@ path.

### Real checkpoint

For the staged prefill change, a separate BF16 differential test compares the
local `Dory1.0-4B-BF16` checkpoint on an A100 80GB PCIe (PyTorch 2.13.0+cu130,
Triton 3.7.1) against independent atomic-prefill runs of the same weights. The
two five- and ten-token prompts run together with fixed request depths 1 and 2,
chunk size 2, and three greedy output tokens. Both mixed and WCPB scheduling
match the atomic token IDs and depths. First-token top-20 overlap is 20/20 for
the shallow request and 19/20 for the full-depth request; the largest top-20
logit deviation is 0.1500. This checks neither long contexts nor throughput,
and is a runtime-to-runtime differential, not an independent accuracy oracle.
The checkpoint's `model.safetensors` SHA-256 is
`207483664dfef54c4c4438863260d3ba423bf3d6009b43fe84264b281e9fda23`; its
revision was not independently verified for this run.

`tests/test_dory_real_checkpoint.py` runs the pinned snapshot
`f6c832e6963ddb74f62c75813a3e8c74b1af67b1` on one `A100-SXM4-80GB`
(torch 2.13.0+cu130, triton 3.7.1, Python 3.12.15) with the prompt
Expand Down
14 changes: 11 additions & 3 deletions docs/runtime.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,15 @@ if __name__ == "__main__":

The default exit mode remains `ouro`, with the original cumulative hazard policy. For random lookahead, sigmoid is a direct score for exiting after one more loop, not a hazard/CDF. `SamplingParams.exit_threshold` compares this score directly. Threshold 1 disables adaptive exit; `max_loops` always caps execution. Adaptive lookahead cannot exit before round 2, although an explicitly configured hard maximum of 1 is honored. All prompt tokens still run the model's full depth.

Fixed-loop models accept the request-level `SamplingParams.target_loops` field (offline CLI: `--request-target-loops`). An omitted target defaults to `total_ut_steps`; an explicit target must be between one and the model depth. If `max_loops` is provided, it must match the fixed target. For compatibility with the default, `min_loops=2` is accepted, as is `min_loops` equal to the target; the fixed target determines the exit depth. Targets below the model depth are rejected until per-request prompt prefill is enabled; they are never silently run at full prompt depth. Dynamic-exit models do not accept this field and retain their existing loop-bound and exit-threshold behavior.
Fixed-loop models accept the request-level `SamplingParams.target_loops` field (offline CLI: `--request-target-loops`). An omitted target defaults to `total_ut_steps`; an explicit target must be between one and the model depth. If `max_loops` is provided, it must match the fixed target. For compatibility with the default, `min_loops=2` is accepted, as is `min_loops` equal to the target; the fixed target determines the exit depth. Dory accepts shorter request targets for synchronous eager staged prefill with per-loop KV; ordinary atomic prefill still rejects shorter targets. Dynamic-exit models do not accept this field and retain their existing loop-bound and exit-threshold behavior.

Huginn initializes its recurrent state one token at a time using the request's
generator. This keeps seeded state independent of chunk sizes and batch grouping,
including when prelude work is mixed with decoding. Relative to earlier versions
that initialized a whole span at once, the same seed can produce different
outputs; GPU performance of this per-token initialization has not been measured.
Some PyTorch implementations of truncated-normal initialization synchronize
the device during rejection sampling, making that cost potentially significant.

For dynamic-exit models, ordinary asynchronous execution requires `ouro_delayed`, `random_lookahead` or `trace`; fixed-loop models do not need an exit signal. Speculative execution has the separate constraints below. Asynchronous execution automatically enables reusable static inputs to avoid blocking device metadata transfers. CPU supports the same scheduling state machine for tests, with immediately completed operations; it does not simulate GPU parallel execution. `multi_stream` is an independent CUDA execution feature: `False` uses one stream for core, boundary and copies; `True` separates those streams, with or without async scheduling.

Expand Down Expand Up @@ -383,8 +391,8 @@ because the runtime window includes the current token. Full-attention layers
keep their causal mask. Packed prompt chunks retain bottom-right alignment
against an existing prefix. Both `per_loop` and `last_loop` KV modes, using
their required layouts, support asynchronous scheduling and CUDA Graphs in
the input, recurrent and output stages. Dory's existing rejection of mixed
scheduling and boundary-KV prefix caching remains in effect.
the input, recurrent and output stages. Dory's staged path has separate
eager/per-loop restrictions, and boundary-KV prefix caching remains rejected.

Validation on B300 with FA4 4.0.0b39 covers 69 GPU cases across kernel,
end-to-end and regression checks: head dimensions 64/128/256, packed sliding
Expand Down
5 changes: 4 additions & 1 deletion docs/scheduler.md
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,10 @@ restrictions still apply. Speculative generation requires refill.
chunk runs its prelude and all recurrent depths locally in one submission.
Mixed mode inserts a boundary when ready decode work can join prompt recurrent
work, and it returns after every depth in such a mixed batch. With no ready
decode work, the prompt batch can run through its remaining depths. WCPB always
decode work, a prompt batch can run through its remaining depths. Models with
attention-bearing prompt CODA stage the prelude separately and run CODA after
the required recurrent depths; their final prompt row also produces the first
sampled token. WCPB always
returns after one depth to regroup ready chunks. Chunk size and loop submission
size are distinct choices; WCPB retains up to one staged chunk per model depth.
Ordinary prompt chunks already end at the scheduler's configured chunk boundary,
Expand Down
57 changes: 38 additions & 19 deletions docs/split-prefill-wavefront.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ uneven, without making chunks larger and reducing scheduling opportunities.

![Split prefill compared with wavefront chunked prefill](assets/Split-prefill-vs-wavefront-chunked-prefill.png)

The current runner requires one operation per batch: PRELUDE ranges and RECURRENT
ranges are submitted separately. Ordinary prefill can also execute its selected range
through all recurrent depths in one plan. Actual submission counts depend on scheduler
mode, token budget, and ready work; the numbered batches in the figure should not be
read as measured latency or a fixed runtime schedule.
The current runner requires one operation per batch: PRELUDE, RECURRENT and
CODA ranges are submitted separately. Ordinary prefill can also execute its
selected range through all recurrent depths in one plan. Actual submission
counts depend on scheduler mode, token budget, and ready work; the numbered batches
in the figure should not be read as measured latency or a fixed runtime schedule.

## Execution model

Expand All @@ -22,12 +22,24 @@ scheduler may choose a shorter execution boundary when ready decode work needs a
depth decision. `ExecutionBatch.loop_count` records the recurrent work in that
submission.

With `wavefront_chunked_prefill=True`, prompt work is scheduled in two phases:
With `wavefront_chunked_prefill=True`, prompt work uses these phases:

| Phase | Work | Recurrent loops in the submission |
| --- | --- | ---: |
| `PREFILLING_PRELUDE` | Embed staged prompt ranges and prepare inputs | 0 |
| `PREFILLING_RECURRENT` | Run ready prompt ranges at their selected recurrent depths | 1 |
| `PREFILLING_CODA` | Run attention-bearing output layers on ready prompt ranges, when required by the model | 0 |

Huginn and Dory require the CODA phase to populate their output-attention KV.
All prompt rows run the output layers; only the last prompt row projects logits
and samples the first output. This phase is currently scheduled separately from
ordinary decode CODA. Ouro does not require prompt CODA.

Staged CODA passes a row-aligned boolean `ForwardBatch.compute_logits` mask:
only a final prompt row or a mixed decode row is selected for projection and
sampling. Sparse samples are mapped back to their request spans. Uniform boolean
values remain supported for the existing atomic and CUDA Graph paths; automatic
mixing of prompt and decode CODA is a separate scheduling change.

The scheduler can include several ranges from different chunks, requests, and
depths in one recurrent batch. It obeys the shared token budget, request-owner
Expand All @@ -52,32 +64,35 @@ Progress belongs to the request rather than to a persistent task table:

- `num_preluded_tokens` tracks the prompt range whose prelude has been staged.
- `prefill_depth_ranges` tracks the ready range at each recurrent depth.
- `num_prefilled_tokens` tracks prompt progress at the final depth, including
progress within a chunk.
- For attention-bearing CODA, `num_recurrent_prefilled_tokens` tracks the final
recurrent frontier; `num_prefilled_tokens` tracks completed prompt CODA.
For other models, `num_prefilled_tokens` tracks the final recurrent frontier.
- `prefill_reclaimable_tokens` marks the oldest resident chunk boundary. It
advances only after that chunk completes its final depth and its ring slot
can be reused.
advances after the chunk's final required stage completes: CODA for Huginn and
Dory, otherwise the final recurrent depth.

This separation prevents a prelude or partial chunk from advancing the
reclaimable boundary. Prefix publication, prompt completion, and CODA follow
the completed final-depth frontier.
reclaimable boundary. For models with prompt CODA, the CODA frontier cannot
overtake the final recurrent frontier and each chunk remains resident until
CODA consumes it.

## Hidden-state ring

Each request reserves `prefill_chunk_size * total_ut_steps` rows for staged
prompt hidden states. A chunk uses a ring slot derived from its index relative
to the cached-prefix origin. For a chunk-local offset `j` and slot `s`, its row
offset is:
to the cached-prefix origin and the request's prefill loop count. For a
chunk-local offset `j` and slot `s`, its row offset is:

```text
prefill_hidden_row_offset = s * prefill_chunk_size + j
```

`ScheduledRequest` and `StateSpan` carry this row offset. When it is `None`, the
runner derives the row from `token_start - chunk_start`. Intermediate outputs
are scattered to the ring for later depths; after final-depth completion, the
chunk's intermediate state is no longer needed. Asynchronous submissions keep
the backing rows alive until dependent reads complete.
are scattered to the ring for later depths or prompt CODA. Batch-local gathered
hidden scratch rotates with the submission's input descriptors and is reused
only after its last device consumer. Request events also protect ring rows from
reuse before dependent reads finish.

## Scheduling and recovery

Expand All @@ -94,8 +109,12 @@ Preemption rewinds staged work to the request's completed prompt frontier and
recomputes unfinished work after resume. PD transfer progress is reported for
completed chunks, and imported prompt state initializes the same frontiers.
Speculative execution is supported with compatible refill scheduling; mixed
mode rejects speculative configuration. CUDA graph and asynchronous paths use
the existing runner machinery.
mode rejects speculative configuration. For Huginn and Dory, staged prefill
currently requires synchronous eager generation without preemption, speculation,
prefix reuse, or PD; the separate CUDA streams remain event-ordered. Tiny-model
CPU and A100 CUDA regressions cover these staged paths. A short real Dory
checkpoint check compares mixed and WCPB prefill with atomic prefill; longer
contexts and broader backend qualification remain outstanding.

`SHARED` KV is rejected for WCPB. Its position-major dependencies do not permit
the same cross-chunk/depth ordering as `LAST_EXITED` without a different
Expand Down
Loading
Loading