Back to directory

kvtc

The first open-source implementation of NVIDIA's KVTC algorithm, compressing LLM key-value caches 6 to 9x using PCA decorrelation, adaptive quantization and entropy coding, to fit longer context in the same GPU memory.

kvtc

kvtc compresses the key-value cache that grows with every token an LLM generates, which becomes the dominant memory bottleneck at long context lengths, often exceeding the model weights themselves. It applies techniques borrowed from media compression, such as those behind JPEG and H.264, in a three-stage pipeline: PCA decorrelates and reorders the KV vector dimensions by variance, undoing and later reapplying rotary position embeddings so the low-rank structure PCA needs is not obscured, followed by adaptive quantization and entropy coding.

On an RTX 5090 with Qwen2.5-7B, the authors report configurations from 8.8x compression with a 0.981 cosine similarity to 3.4x compression that is near-lossless. Combined with other techniques, it is used to extend a single 32 GB GPU's usable context length well beyond what an uncompressed FP16 cache allows.

The implementation targets NVIDIA GPUs and is written in Python.

More in Inference

See all 770
  • OpenDecision

    deepanwadhwa.github.io

    An open-source Python package that answers typed questions about application state or documents using a local natural-language-inference model, returning structured choice, score, yes/no or evidence-relation values instead of free text.

  • Lifeboat

    iterate.ai

    A local inference server that puts an OpenAI- and Anthropic-compatible API in front of open-weight language models running on hardware you control, from a laptop to a GPU cluster.

  • Claude S40

    github.com

    An unofficial Claude chat client for 2007-era Nokia Series 40 phones, built as a Java ME app plus a small Go relay server, with web search, reading mode and saved chats.