CacheGen#
警告
本页记录了 LMCache 的进程内模式(已弃用)的行为。请考虑使用 LMCache MP 模式 以获得更好的功能支持和性能。有关此页面的 MP 模式等效内容,请参见 CacheGen。
Cachegen 利用 KV Cache 的分布特性,将 KV Cache 编码为更紧凑的比特流表示,解码开销可以忽略不计。
在 LMCache 中配置 CacheGen#
设置应该与 naive KV cache sharing 非常相似。只需进行少量配置即可启用 CacheGen。
要在离线推理中启用 CacheGen,我们需要设置:
# Enable cachgen compression in LMCache
os.environ["LMCACHE_REMOTE_SERDE"] = "cachegen"
要在在线推理中启用 CacheGen,我们需要在配置 yaml 中设置 remote_serde:
# Enable cachgen compression in LMCache
remote_serde: "cachegen"