Skip to content

[serve][llm] Enable KV cache offloading & KV routing awareness of CPU KV caches - #65063

Draft
jeffreywang88 wants to merge 2 commits into
kv-atomic-reserve-v1from
kv-offload
Draft

[serve][llm] Enable KV cache offloading & KV routing awareness of CPU KV caches#65063
jeffreywang88 wants to merge 2 commits into
kv-atomic-reserve-v1from
kv-offload

Conversation

@jeffreywang88

@jeffreywang88 jeffreywang88 commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Description

  • Need to enable KB cache offloading generally for all routers
from ray.serve.config import RequestRouterConfig
from ray.serve.llm import LLMConfig
from ray.serve.llm.request_router import KVAwareRouter

llm_config = LLMConfig(
    model_loading_config={
        "model_id": "my-model",
        "model_source": "my-model",
    },
    deployment_config={
        "request_router_config": RequestRouterConfig(
            request_router_class=KVAwareRouter,
        ),
    },
    engine_kwargs={
        "enable_prefix_caching": True,
        "kv_offloading_backend": "native",
        "kv_offloading_size": 8,  # GiB of CPU cache per replica
    },
)

Observed KV cache offloading / reloading, and I'll add grafana dashboards for KV cache offloading observability in a follow-up.

  • Workload characteristic: A two-replica Ray Serve LLM workload on L4s using Qwen3-0.6B with native KV offload, capped GPU KV cache, sticky session routing, long repeated prompts, forced prefix-cache resets, and same-session follow-ups.
Screenshot 2026-07-28 at 11 33 43 PM

Related issues

Link related issues: "Fixes #1234", "Closes #1234", or "Related to #1234".

Additional information

Optional: Add implementation details, API changes, usage examples, screenshots, etc.

… KV caches

Signed-off-by: Jeffrey Wang <jeffreywang@anyscale.com>
Signed-off-by: Jeffrey Wang <jeffreywang@anyscale.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.

1 participant