Skip to content

feat: enable lmcache for all preset models - #2543

Open
zhehli688 wants to merge 1 commit into
kaito-project:mainfrom
zhehli688:lmcache
Open

zhehli688 wants to merge 1 commit into
kaito-project:mainfrom
zhehli688:lmcache

Conversation

@zhehli688

@zhehli688 zhehli688 commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

Reason for Change:
KV cache offloading to CPU memory through LMCache was turned off for every DeepSeek V3.2/V4/V4.1, GLM Glm5Next, Qwen3.5/3.6/3.8, Qwen3-Next, Qwen3.8-Flash-Next and Nemotron-H preset, because those architectures had not been validated with LMCacheMPConnector. This PR enables LMCache for them, based on LMCache's model recipes (DeepSeek-V4.1-Flash, GLM-5.3, Qwen3.5/3.6/3.8, Qwen3.8-Flash-Next, hybrid models).

Changes:

  • Model gate: removes isLMCacheDisabled(). LMCache is now disabled only for MIG, data-parallel and multi-node pipeline-parallel deployments, as before.
  • LMCache server: starts with --separate-object-groups, so models with several KV cache layouts store each attention group as its own cache object.
  • LMCache 0.5.5 → 0.5.7: hybrid Mamba/linear-attention models use model-specific vLLM block sizes (528–2096 tokens). 0.5.6 only accepts a fixed chunk size that must be a multiple of the block size, so vLLM fails at startup. 0.5.7 negotiates the chunk size automatically. The base image goes to 0.7.2.
  • DeepSeek V4/V4.1: sets --kv-cache-dtype=fp8_ds_mla, which LMCache's recipe requires for their sparse-attention cache.
  • Hybrid Mamba/linear-attention models (Qwen3.5/3.6/3.8, Qwen3-Next, Qwen4Exp, Nemotron-H, GLM Glm5Next):
    • --enable-prefix-caching --mamba-cache-mode=align, required by LMCache's hybrid-model procedure.
    • --max-num-batched-tokens=4096 unless the preset sets one. LMCache requires every prefill step to cover at least one vLLM block, which can exceed vLLM's 2048-token default (for example 2096 for Nemotron-3-Nano-30B). The 8192-token default on large GPUs ran out of GPU memory during startup warmup.
    • --max-num-seqs capped at 512, applied only where vLLM's default would be higher (1024 on large non-A100 GPUs). vLLM's aligned-Mamba warmup runs one prefill per sequence slot, which its memory profiling doesn't account for, so Nemotron-3-Nano-4B ran out of GPU memory on H100 with 1024. The cap never raises a lower value from the estimator or the preset.
  • Refactor: moves vLLM's default max_num_seqs logic into sku.GPUConfig.VLLMDefaultMaxNumSeqs(), shared by the max-num-seqs estimator and the new cap.

Requirements

Issue Fixed:

Fixes #2363

Notes for Reviewers:

@zhehli688 zhehli688 changed the title feat: enable lmcache for more models feat: enable lmcache for all preset models Nov 21, 2026
@zhehli688
zhehli688 marked this pull request as ready for review November 21, 2026 18:36
Signed-off-by: zhehli688 <kevinlizh19@gmail.com>
@codecov

codecov Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.00000% with 16 lines in your changes missing coverage. Please review.

@@           Coverage Diff           @@
##             main    #2543   +/-   ##
=======================================
  Coverage   72.38%   72.38%           
=======================================
  Files         209      209           
  Lines       20077    20136   +59     
=======================================
+ Hits        14532    14575   +43     
- Misses       4890     4903   +13     
- Partials      655      658    +3     
Components Coverage Δ
workspace 68.93% <80.00%> (+0.02%) ⬆️
presets 93.06% <ø> (ø)
main ∅ <ø> (∅)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Unresolved permission handling, runtime propagation, and configuration/image compatibility issues can stall Workspace reconciliation or prevent LMCache-enabled Workspaces from starting.

5 open issues
What changed in this PR

Extends KAITO’s multiprocess LMCache support to previously excluded preset architectures, advancing #2363.

Changes:

  • Enables hybrid-model caching with aligned blocks, prefill budgets, and sequence limits.
  • Updates LMCache to 0.5.7 and the base image to 0.7.2.
  • Adds NVIDIA RuntimeClass selection, tests, documentation, and regression-workflow updates.
File Description
website/​docs/​kv-cache-offloading.md Updates prerequisites and supported architectures.
presets/​workspace/​inference/​vllm/​tests/​test_lmcache_server.py Checks server cache-group arguments.
presets/​workspace/​inference/​vllm/​lmcache_server.py Enables separate cache object groups.
presets/​workspace/​dependencies/​requirements.txt Pins LMCache’s CUDA-compatible release.
pkg/​sku/​cloud_sku_handler.go Shares vLLM sequence-default logic.
pkg/​model/​interface.go Enables hybrid caching and bounds startup budgets.
pkg/​model/​interface_test.go Tests architecture support and budget limits.
pkg/​estimator/​maxnumseqestimator/​estimator.go Uses shared GPU sequence defaults.
pkg/​catalog/​vllm_model.go Passes attention-layout metadata to presets.
pkg/​catalog/​vllm_model_test.go Updates expected cache settings.
pkg/​catalog/​hfgen/​generator.go Generates hybrid settings and layout metadata.
pkg/​catalog/​hfgen/​generator_test.go Tests architecture-specific cache defaults.
pkg/​catalog/​base_images.yaml Advances the inference base image.
internal/​inference/​preset_inferences_test.go Tests RuntimeClass selection and fallback.
internal/​inference/​lmcache_sidecar.go Selects the shared-device runtime.
internal/​controller/​workspace/​benchmark_rollout_test.go Registers RuntimeClass in test schemes.
internal/​accelerator/​nvidia/​driver.go Specifies NVIDIA’s shared-device RuntimeClass.
internal/​accelerator/​driver.go Extends the accelerator runtime contract.
internal/​accelerator/​cpu/​driver.go Declares no RuntimeClass requirement.
charts/​kaito/​workspace/​templates/​clusterrole.yaml Grants RuntimeClass read permissions.
charts/​kaito/​workspace/​templates/​base-images-configmap.yaml Synchronizes the chart’s base-image tag.
.github/​workflows/​preset-model-regression-8xh100.yaml Broadens triggers and filters blocking node taints.

Review effort: Balanced

@@ -23,12 +23,6 @@ name: Preset Model Regression Test (8xH100)

on:
pull_request:
Comment on lines +85 to +86
if runtimeClassName != "" {
spec.RuntimeClassName = &runtimeClassName
if name == "" || spec.RuntimeClassName != nil || kubeClient == nil {
return "", nil
}
err := kubeClient.Get(ctx, client.ObjectKey{Name: name}, &nodev1.RuntimeClass{})
Comment thread pkg/model/interface.go
Comment on lines +615 to 618
// Disable LMCache KV cache CPU offloading on MIG partitions.
// TODO: support KV cache CPU offloading on MIG.
if rc.GPUConfig != nil && rc.GPUConfig.IsMIG {
p.VLLM.ModelRunParams["kaito-kv-cache-cpu-memory-utilization"] = "0"
Comment thread pkg/model/interface.go
Comment on lines +723 to +725
tp, err := strconv.Atoi(params["tensor-parallel-size"])
if err != nil || tp < 1 {
tp = 1

This branch is waiting to be deployed

1 inactive and 1 waiting deployments
e2e-test — 9937192a Waiting Dec 2, 2026 by zhehli688 via a100 (eastus) #1070
unit-tests — 9937192a Deployed Dec 2, 2026 by zhehli688 via unit-tests #5529
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Migrate LMCache from in-process mode to multi-process mode

2 participants