Hybrid kv cache for LLaMA4 (#6563)

Co-authored-by: Cheng Wan <54331508+ch-wan@users.noreply.github.com>
Co-authored-by: tarinkk <rt572@physics.rutger.edu>
Co-authored-by: tarinkk <rt572@rutgers.physics.edu>
Co-authored-by: Hanming Lu <69857889+hanming-lu@users.noreply.github.com>
This commit is contained in:
tarinkk
2025-06-27 21:58:55 -04:00
committed by GitHub
parent 357921aa51
commit eb6c2c1663
11 changed files with 519 additions and 59 deletions

View File

@@ -61,6 +61,7 @@ class ServerArgs:
is_embedding: bool = False
enable_multimodal: Optional[bool] = None
revision: Optional[str] = None
hybrid_kvcache_ratio: Optional[float] = None
impl: str = "auto"
# Port for the HTTP server
@@ -817,6 +818,18 @@ class ServerArgs:
default=ServerArgs.page_size,
help="The number of tokens in a page.",
)
parser.add_argument(
"--hybrid-kvcache-ratio",
nargs="?",
const=0.5,
type=float,
default=ServerArgs.hybrid_kvcache_ratio,
help=(
"Mix ratio in [0,1] between uniform and hybrid kv buffers "
"(0.0 = pure uniform: swa_size / full_size = 1)"
"(1.0 = pure hybrid: swa_size / full_size = local_attention_size / context_length)"
),
)
# Other runtime options
parser.add_argument(