LPCompact for vLLM

KV cache compaction for vLLM.

Serve long histories with learned attention KV selection. LPCompact keeps selected positions, returns freed pages to vLLM’s allocator, and continues the request from the smaller cache.

Requires the patched vLLM 0.34.0 runtime. The container uses BF16 KV, eager text-only serving, and disables automatic prefix caching.

Serve a BF16 model.

On a Linux host with Docker, the NVIDIA Container Toolkit, and an NVIDIA GPU with enough memory for the model and cache, start the published image with Qwen3.8-27B. The first launch downloads the pinned model and selector.

From a checkout of the integration repository, run the smoke command in a second terminal. It sends a long prompt, checks continued generation, and reads the server log for reclaimed pages.

Launch vLLM · Shell
docker run --rm --gpus all --ipc=host \
  -p 127.0.0.1:8000:8000 \
  ghcr.io/latentport/latentport-vllm:0.2.0 \
  serve Qwen/Qwen3.8-27B \
  --lpcompact latentport/LPCompact-Qwen3.8-27B \
  --lpcompact-ratio 8 --max-num-batched-tokens 2048 2>&1 | tee vllm.log
Check compaction · Shell
python integrations/vllm/tests/gpu_smoke.py \
  --url http://127.0.0.1:8000 --rows 131091 \
  --log /path/to/vllm.log

The command binds to loopback for a local trial. Follow the integration guide for model limits and deployment settings.

Qwen3.8-27B · BF16 · RTX PRO 6000 Blackwell

Attention rows down. Pages reclaimed.

In the published GPU smoke run, one request compacted at 8× and generated 16 more tokens. The run confirms continuation and page reclamation for that configuration.

8×

Reduction in attention rows

131,072 attention rows became 16,384. The model continued on its original logical token timeline.

138

Pages returned to vLLM’s allocator

These pages became available for reuse inside the cache pool. Total GPU allocation also includes model weights, other state, and the cache pool.

Profiles and resident sessions.

Pick a pinned checkpoint

The integration guide lists the Qwen and Gemma profiles, compaction thresholds, and GPU validation by model. The optional NF4 and GGUF weight profiles are experimental and still use BF16 KV.

See model profiles

Keep a session on the GPU

Opt-in resident sessions retain KV pages and recurrent state between turns. Idle sessions keep their pages until deletion or expiry, and a server restart clears them. The client sends only the new suffix on later turns.

Read the session API guide