Skip to content

[Bugfix][KV Offload] Keep Mamba block span unscaled under DCP - #49964

Merged
orozery merged 3 commits into
vllm-project:mainfrom
jongukc:fix/native-offload-hybrid-dcp
Jul 28, 2026
Merged

orozery merged 3 commits into
vllm-project:mainfrom
jongukc:fix/native-offload-hybrid-dcp

Conversation

@jongukc

@jongukc jongukc commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Purpose

Native KV offloading currently multiplies every cache group's token span by the decode context parallelism world size. This is correct for attention KV, which is sharded across DCP ranks, but Mamba state is replicated and keeps its original block size.

With 16 token attention and Mamba blocks under DCP=2, the current configuration derives 32 tokens per block for both groups. The correct spans are 32 tokens for attention and 16 tokens for Mamba. For a 64 token prefix, the incorrect geometry associates offload keys with the wrong Mamba state blocks, so a later cache hit can restore recurrent state from an earlier boundary.

This change scales tokens_per_block by DCP only for AttentionSpec. Mamba and other non-attention groups retain their declared block size.

Duplicate-work check

I searched open and closed issues and PRs for native offloading, OffloadingConnector, DCP, Mamba, hybrid KV cache, and block size mismatches.
I found no matching report or fix.

Test plan

tests/v1/kv_connector/unit/offloading_connector/test_config.py

Test results

  • Before the fix, 16 token attention and Mamba groups under DCP=2 both derive a 32 token offload span.
  • After the fix, the groups derive the expected 32 token attention span and 16 token Mamba span.
  • The corrected alignment selects Mamba state blocks at the 32 token and 64 token boundaries.
  • tests/v1/kv_connector/unit/offloading_connector/test_config.py: 39 passed.

AI Assistance

OpenAI Codex was used to assist with investigation, implementation, testing, and PR preparation. The human submitter must review every changed line and be prepared to explain and defend the change end-to-end.


Essential Elements of an Effective PR Description Checklist
  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.

Co-authored-by: OpenAI Codex <codex@openai.com>
Signed-off-by: Jonguk Cheong <jdal3031@snu.ac.kr>

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@mergify mergify Bot added v1 bug Something isn't working kv-connector labels Jul 27, 2026
@orozery orozery added the ready ONLY add when PR is ready to merge/full CI is needed label Jul 27, 2026

@orozery orozery left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @jongukc !

@orozery
orozery merged commit 1e81853 into vllm-project:main Jul 28, 2026
92 checks passed
@jongukc
jongukc deleted the fix/native-offload-hybrid-dcp branch July 30, 2026 04:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working kv-connector ready ONLY add when PR is ready to merge/full CI is needed v1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants