






















We're excited to announce the availability of Paged Attention and Prefix Caching in MAX Serve, bringing state-of-the-art LLM inference optimizations. These features are available in MAX nightly and the MAX Serve nightly Docker image.
To proceed, please make sure to install the magic CLI
Bash
curl -ssL https://magic.modular.com/ | bash
Or update it via
Bash
magic self-update
Now install the max-pipelines package with a single command
Bash
magic global install max-pipelines
Serve with optimizations enabled
Bash
max-pipelines serve \ --huggingface-repo-id modularai/llama-3.1 \ --cache-strategy paged \ --enable-prefix-caching
Check out what’s available with
Bash
max-pipelines serve --help
These features are available in Modular's officially supported models, leveraging the highly optimized MAX Graph APIs.
Multi-Head Attention (MHA) is a core building block of modern LLMs, but it can be computationally intensive during inference. MHA's computational complexity scales quadratically with sequence length O(n²) and linearly with batch size, making it particularly demanding for long sequences or large batches. KV Cache optimizes this by storing previously computed Key and Value projections, avoiding redundant computations during autoregressive generation. However, traditional KV caching faces memory management challenges with long sequences.
PagedAttention and Prefix Caching address these challenges.
Paged attention, introduced by vLLM, revolutionizes how we handle attention computation in LLMs with:
Learn more about paged attention vLLM: Easy, Fast, and Cheap LLM Serving with PagedAttention
Prefix caching, introduced by SGLang, provides powerful optimization for structured LLM programs:
Learn more prefix caching SGLang: Efficient Execution of Structured Language Model Programs
These improvements optimize GPU memory by up to 40% and throughput up to 3x. Here are a few resources to get you started:
We're excited to see what you'll build with MAX! Share your projects and experiences with us using #ModularAI on social media.
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。