Skip to content
Back to skills

Kvcache Format

ASecurity

Paged KV cache page-out / page-in format used by pf-cache. Reference for vLLM and SGLang adapter authors.

  • 4 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 12, 2026
documentationgit

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned September 12, 2026

npx -y skills add aibot88/sec_skill_store --skill kvcache-format --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Kvcache Format?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Kvcache Format
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/aibot88-kvcache-format/badge)](https://www.skillsdirectory.com/skills/aibot88-kvcache-format)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: kvcache-format
description: Paged KV cache page-out / page-in format used by pf-cache. Reference for vLLM and SGLang adapter authors.
---

# KV-cache page format

See `agent_docs/cache-layer.md` for the full spec. Cheat sheet:

## On-GPU page

A page is a contiguous `[n_layers, page_size_tokens, n_heads, head_dim]`
tensor for K, plus the same shape for V. Stored in vLLM's `gpu_cache` as a
list of `(K_page, V_page)` pairs indexed by physical-page id.

## Page-out

```
for phys_pid in occupied_pages:
    K, V = read_page(phys_pid)              # GPU → pinned host buffer
    digest = sha256(K.bytes() ‖ V.bytes())  # one digest per (K,V) pair
    if not blob_store.contains(digest):
        compressed = zstd_19(K.bytes() ‖ V.bytes())
        blob_store.put_with_digest(compressed, digest)
    page_table[phys_pid] = digest
emit_manifest({page_size_tokens, n_layers, n_heads, head_dim, dtype, pages: page_table})
```

## Page-in

```
manifest = read_manifest(cid)
for phys_pid, digest in zip(allocate_pages(len(manifest.pages)), manifest.pages):
    compressed = blob_store.get(digest)
    K_bytes, V_bytes = split(zstd_decompress(compressed))
    write_page(phys_pid, K_bytes, V_bytes)  # pinned → GPU
patch_logical_seq_table(manifest.logical_seqs)
```

## Logical sequences

vLLM tracks per-request logical-seq → physical-page mappings. We serialize
that mapping into `logical_seqs[]` so restore can rebuild request-level
prefix-sharing exactly.

## Bit-exactness

Requires the engine started with batch-invariant kernels (vLLM
`--enforce-deterministic`, SGLang `--deterministic-mode`). Otherwise restore
will produce numerically equivalent but not bit-equal logits.

Files in this skill

  • SKILL.md1.7 KB
  • source.json614 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.