Skip to content

[DSv4.1][PCP] Compress ratio-2 groups rank-locally (proposal for vllm-project/vllm#59857) - #1

Draft
LucasWilkinson wants to merge 3 commits into
wangyicong52:feat/dsv4.1-flash-pcpfrom
LucasWilkinson:pcp-dsv41-local-compressor
Draft

LucasWilkinson wants to merge 3 commits into
wangyicong52:feat/dsv4.1-flash-pcpfrom
LucasWilkinson:pcp-dsv41-local-compressor

Conversation

@LucasWilkinson

@LucasWilkinson LucasWilkinson commented Oct 8, 2026 •

Copy link
Copy Markdown

Overview

Proposal against vllm-project#59857: keep the DeepSeek-V4.1 ratio-2 compressor rank-local under PCP, which removes the InputBatch.pcp_metadata / PCPBatchMetadata plumbing so vllm/v1/worker/gpu/ is unchanged relative to main.

Claims

  • No core changes: input_batch.py and pcp_manager.py match main; PCP chunking is untouched (arbitrary chunk boundaries still supported).
  • Each rank compresses only its own tokens. Ratio-2 pairs split across PCP chunks are closed with the predecessor row gathered from the owning rank.
  • Ratio-2 compressor communication drops from all-gathering kv_score (FP32 × 1024 per token) to the BF16 latent gather already used by ratio 1, plus one kv_score row per local request.
  • Ratio 1 and ratio 2 share a single PCP cache-insert path in attention.py.

Validation

Unit tests, B300, chg run -g 1:

.venv/bin/python -m pytest tests/kernels/test_compressor_kv_cache.py tests/v1/worker/test_gpu_pcp_manager.py -q

239 passed, 13 skipped (skips are ROCm/gfx950-only). ruff, ruff-format and mypy (3.10 / 3.12) pass.

test_v41_pcp_compressor_preserves_pairs_and_decode_state (PCP=2/4) simulates every rank with main's chunking, including prefills starting at odd positions (pairs split across ranks) and decodes whose owner rank changes each step. It asserts bit-exact latents against the non-PCP kernel and identical rings on all ranks. Removing the gathered predecessor rows makes it fail (33% / 99.8% mismatched elements).

Not yet done: end-to-end GSM8K / prefill benchmark on DeepSeek-V4.1-Flash. I don't have the checkpoint locally; the vllm-project#59857 GSM8K and vllm bench serve setup should be rerun on this branch before adopting it.

Details

  • CompressorMetadataBuilder (PCP only) all-gathers one int64 per local request: ring block << 32 | position of its last token. The ring block identifies a request on every rank. After sorting, each rank finds (a) the gathered row holding the token before each local chunk's first token, when that token closes a pair, and (b) each request's newest gathered row, which is written to the ring if it leaves a pair open.
  • DeepseekCompressor.forward gathers kv_score of those last tokens. fused_save_compress_norm takes optional prev_rows / prev_row_indices: the request program reads its predecessor from the gathered rows instead of the ring, and skips its own ring stores. save_ring_rows then writes the open rows so every rank keeps the same ring.
  • Under PCP the ring holds only the open row, which is all ratio 2 reads without speculative decoding; the builder asserts speculative_config is None (already rejected by the model for PCP).
  • The builder runs one small integer all-gather per step, like the existing positions all-gather in DeepseekV41SparseSWAMetadataBuilder. No host syncs were added.
  • The engram lookback fix and the doubled lookback buffer from [Feature][PCP] Add DeepSeek-V4.1-Flash support vllm-project/vllm#59857 are kept.

Pull Request Checklist
  • I used vLLM's /pr-checklist skill. (Mandatory for agents, optional for humans).

  • AI assistance was used during the creation of this PR.

  • Design Fit: Minimizes impact on core components, reuses existing functionality, and justifies added complexity.

  • Testing and Validation: Validates the change and ensures any added tests are meaningful and reliable, with CI coverage or documented CI resource constraints and validation performed outside CI.

  • Code Quality and Style: Keeps code and comments clear and concise, and updates relevant documentation and examples.

  • Pull Request Contents: Includes a brief summary and relevant links, supports claims with evidence, explains root causes and implementation trade-offs, and follows the contributing guide.

This is a suggestion PR into vllm-project#59857's branch, not a separate change to main. AI assistance (Claude Code) was used to write it.

🤖 Generated with Claude Code

wangyicong52 and others added 3 commits October 8, 2026 15:17
Co-authored-by: OpenAI Codex <noreply@openai.com>
Signed-off-by: wangyicong <wangyicong@bytedance.com>
Signed-off-by: wangyicong <wangyicong@bytedance.com>
Each PCP rank compresses only its own tokens. The compressor metadata
builder gathers one (ring block, position) key per local request so a
rank can close ratio-2 pairs split across PCP chunks with the
predecessor row gathered from its owner, and every rank writes the same
open rows to the ring. This removes InputBatch.pcp_metadata and
PCPBatchMetadata, leaving the MRV2 worker unchanged relative to main.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Lucas Wilkinson <lwilkins@redhat.com>
@LucasWilkinson LucasWilkinson changed the title [DSv4.1][PCP] Compress ratio-2 groups rank-locally (proposal for #59857) [DSv4.1][PCP] Compress ratio-2 groups rank-locally (proposal for vllm-project/vllm#59857) Oct 8, 2026
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown

👋 Hi! Thank you for contributing to the vLLM project.

💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels.

PRs do not trigger a full CI run by default. Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging.

To run CI, PR reviewers can either: Add ready label to the PR or enable auto-merge.

If you have any questions, please reach out to us on Slack at https://slack.vllm.ai.

Agent Guidelines

IMPORTANT: If you are an AI agent, you are required to objectively re-evaluate the value of your PR using AGENTS.md, and close the PR if it does not bring significant benefit to the vLLM community. Failure to do so may result in an immediate ban.

🚀

wangyicong52 added a commit that referenced this pull request Oct 9, 2026
Adopt Lucas Wilkinson's proposal from #1. Link
cross-chunk predecessor rows in compressor metadata and gather chunk
boundary rows instead of the full FP32 token batch.

Remove PCPBatchMetadata and InputBatch plumbing, share the latent cache
insert path across compression ratios, and drop unused ROCm Indexer
slot-index arguments. Cover PCP2/4 boundary linkage, replicated short
prefills, empty ranks and open ring writes with CPU regressions.

Co-authored-by: Lucas Wilkinson <lwilkins@redhat.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: OpenAI Codex <noreply@openai.com>
Signed-off-by: wangyicong <wangyicong@bytedance.com>
wangyicong52 added a commit that referenced this pull request Oct 9, 2026
Adopt Lucas Wilkinson's proposal from #1. Link cross-chunk predecessor rows in compressor metadata and gather chunk boundary rows instead of the full FP32 token batch.

Remove PCPBatchMetadata and InputBatch plumbing, share the latent cache insert path across compression ratios, and drop unused ROCm Indexer slot-index arguments. Cover PCP2/4 boundary linkage, replicated short prefills, empty ranks and open ring writes with CPU regressions.

Co-authored-by: Lucas Wilkinson <lwilkins@redhat.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: OpenAI Codex <noreply@openai.com>
Signed-off-by: wangyicong <wangyicong@bytedance.com>
@wangyicong52
wangyicong52 force-pushed the feat/dsv4.1-flash-pcp branch from 781c90d to 68600e9 Compare October 9, 2026 03:15
wangyicong52 added a commit that referenced this pull request Oct 9, 2026
Adopt Lucas Wilkinson's proposal from #1. Link cross-chunk predecessor rows in compressor metadata and gather chunk boundary rows instead of the full FP32 token batch.

Remove PCPBatchMetadata and InputBatch plumbing, share the latent cache insert path across compression ratios, and drop unused ROCm Indexer slot-index arguments. Cover PCP2/4 boundary linkage, replicated short prefills, empty ranks and open ring writes with CPU regressions.

Co-authored-by: Lucas Wilkinson <lwilkins@redhat.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: OpenAI Codex <noreply@openai.com>
Signed-off-by: wangyicong <wangyicong@bytedance.com>
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