Skip to content

Append DeepSeek V4.1 window snapshots during cache writes - #108

Merged
lukealonso merged 3 commits into
mainfrom
astra/ds41-window-snapshot-main
Oct 29, 2026
Merged

lukealonso merged 3 commits into
mainfrom
astra/ds41-window-snapshot-main

Conversation

@voipmonitor

@voipmonitor voipmonitor commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

DeepSeek V4.1 draft and verification passes need the saved 128-token window history alongside the KV rows they have just computed. They currently prepare these in two operations: copy the history into a working buffer, then append the KV rows.

This PR makes the b12x cache writer do both in one operation. It removes one graph node while producing exactly the same cache bytes. The recipe supplies the history buffer and request row IDs explicitly, so the copy remains safe when request slots are reused and graphs are replayed natively. Prefill and the commit of accepted tokens keep their existing behavior.

The change is implemented and qualified for the tested cache layouts. Using it requires re-exporting the model; the package ABI and serving API stay the same. Unsupported history lengths or destination page layouts are rejected during preparation.

The required writer API is already in FlashInfer main through FI #57. This branch pins the published revision used for its tests. When resolving the dependency conflict with main, retain a revision containing that API rather than downgrading FlashInfer.

Validation passed:

  • Five CPU tests for the preparation interface and geometry checks.
  • Four SM120 GPU cases using compiled native replay: verification width 8 and draft width 7, with one and three request rows. The tests compare staged and committed cache bytes exactly, overwrite reusable inputs to catch stale reads, check allocation stability, and confirm one fewer graph node.
  • Native TP4 serving in the combined build described in Flare #135, including text, logprobs, JSON output, long prefill and vision checks.

That combined build averaged 130.47 steps/s across three Tetris requests. Several changes are included in that number; the end-to-end speedup of this cache-writer change has not been measured separately.

Prepare the verification and draft sliding-window history copy with the cache append, using caller-owned history and continuation row IDs. Preserve the existing prefill copy and ring-commit behavior. Pin the published FlashInfer snapshot-writer revision so this main-based branch builds independently.

Validation: 5 CPU tests and 4 SM120 compiled native GPU cases passed with the pinned FI revision. The GPU cases cover verification width eight and draft width seven at one and three rows, exact staging and persistent cache bytes, poisoned reusable storage, allocation stability, and one fewer graph node. The combined feature set native throughput is not attributed to this isolated writer.

Design-Signed-Off-By: Codex GPT-6.1; design-review=2d93
Keep the existing CUDA toolkit platform markers byte-for-byte while updating only the three immutable FlashInfer revision references. This avoids unrelated Windows and non-Linux dependency-resolution changes in the window snapshot consumer PR.

Validation: uv lock --check --offline and uv lock --locked --offline pass; the source and tested FI revision are unchanged, so no GPU replay test was repeated.

Design-Signed-Off-By: Codex GPT-6.1; design-review=2d93
lukealonso added a commit that referenced this pull request Oct 29, 2026
Combine immutable window-prefix copies with appended KV encoding during verify and draft preparation. Preserve lockfile platform markers.

Cherry-picked from cb5b34e and 02d7328 (PR #108), with dependency conflicts resolved against local main. Validation: 5 Ignition snapshot preparation tests and 27 FlashInfer snapshot/word-exchange contract tests passed. CUDA and full-model export checks were not run; target GPUs are occupied.

Design-Signed-Off-By: Codex GPT-6; design-review=1c01
@lukealonso
lukealonso merged commit 921afd5 into main Oct 29, 2026
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants