Running KVBM in TensorRT-LLM
Running KVBM in TensorRT-LLM
Running KVBM in TensorRT-LLM
This guide explains how to leverage KVBM (KV Block Manager) to manage KV cache and do KV offloading in TensorRT-LLM (trtllm).
To learn what KVBM is, please check here
[!Note]
- Ensure that
etcdandnatsare running before starting.- KVBM only supports TensorRT-LLM’s PyTorch backend.
- Disable partial reuse
enable_partial_reuse: falsein the LLM API config’skv_connector_configto increase offloading cache hits.- KVBM requires TensorRT-LLM v1.1.0rc5 or newer.
- Enabling KVBM metrics with TensorRT-LLM is still a work in progress.
To use KVBM in TensorRT-LLM, you can follow the steps below:
When disk offloading is enabled, to extend SSD lifespan, disk offload filtering would be enabled by default. The current policy is only offloading KV blocks from CPU to disk if the blocks have frequency equal or more than 2. Frequency is determined via doubling on cache hit (init with 1) and decrement by 1 on each time decay step.
To disable disk offload filtering, set DYN_KVBM_DISABLE_DISK_OFFLOAD_FILTER to true or 1.
Alternatively, can use “trtllm-serve” with KVBM by replacing the above two [DYNAMO] cmds with below:
Follow below steps to enable metrics collection and view via Grafana dashboard:
View grafana metrics via http://localhost:3001 (default login: dynamo/dynamo) and look for KVBM Dashboard
Once the model is loaded ready, follow below steps to use LMBenchmark to benchmark KVBM performance:
More details about how to use LMBenchmark could be found here.
NOTE: if metrics are enabled as mentioned in the above section, you can observe KV offloading, and KV onboarding in the grafana dashboard.
To compare, you can remove the kv_connector_config section from the LLM API config and run trtllm-serve with the updated config as the baseline.