IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).

Python module

max.pipelines.kv_cache

KV cache management for MAX pipelines.

Submodules​

max.pipelines.kv_cache.paged_kv_cache.kv_group_coordinatorCache group coordinators: one per set of leaves written in lockstep.
max.pipelines.kv_cache.paged_kv_cache.recurrent_coordinatorThe cache group whose entry is a recurrent state rather than a span.

Memory planning​

MemoryPlannerBase class for pipeline model memory planning.
ModelConfigStructural protocol for model configuration consumed by MemoryPlanner.
ModelConfigWithKVCacheExtension of ModelConfig for models with a KV cache.
PagedMemoryPlannerMemory planner for models that use a paged KV cache.

Configuration​

KVCacheConfigConfiguration for the paged KV cache.
KVConnectorConfigKV cache connector configuration: the connector type and its settings.

Cache manager​

ByteCountA point-in-time snapshot of an external cache tier's occupancy, in bytes.
DummyKVCacheNo-op KV cache implementation for testing or when cache is disabled.
InsufficientBlocksErrorException raised when there are insufficient free blocks to satisfy an allocation.
PagedKVCacheManagerPaged KVCache manager with data and tensor parallelism support.

Transfer engine​

KVTransferEngineKVCache Transfer Engine with support for Data Parallelism (DP) and Tensor Parallelism (TP).
KVTransferEngineMetadataMetadata associated with a KV cache transfer engine.
TransferReqDataMetadata associated with a transfer request.

Factory functions​

available_portFinds an available TCP port in the given range.
kv_cache_memory_sizeReturns the KV bytes the manager for this cache needs for a full batch.
load_kv_managerLoads a KV cache manager from the given params.
max_seq_len_fitting_in_cacheReturns the longest request the manager for this cache holds.

Utilities​

cache_dtype_for_encodingReturns the KV-cache dtype for a quantization encoding.
is_fp4_kv_cache_formatReturns whether kv_cache_format names the NVFP4 KV cache format.