[Paper Review] 98$ imes$ Faster LLM Routing Without a Dedicated GPU: Flash Attention, Prompt Compression, and Near-Streaming for the vLLM Semantic Router
The paper presents a multi-stage optimization (Flash Attention, prompt compression, and near-streaming) to achieve near 100× faster LLM routing on a shared GPU without a dedicated accelerator. It demonstrates a PCIe-shared AMD MI300X implementation enabling 8K–32K token routing with under 800 MB GPU footprint.
System-level routers that intercept LLM requests for safety classification, domain routing, and PII detection must be both fast and operationally lightweight: they should add minimal latency to every request, yet not require a dedicated GPU -- an expensive resource better used for LLM inference itself. When the router co-locates on the same GPU as vLLM serving instances, standard attention's $O(n^2)$ memory makes long-context classification (8K--32K tokens) impossible: at 8K tokens, three concurrent classifiers need ${\sim}$4.5\,GB for attention masks alone, far exceeding the memory left by vLLM. We present three staged optimizations for the vLLM Semantic Router, benchmarked on AMD Instinct MI300X, that solve both the latency and the memory problem. \emph{Stage~1}: a custom CK Flash Attention operator for ONNX Runtime on ROCm reduces attention memory from $O(n^2)$ to $O(n)$ and end-to-end (E2E) latency from 4{,}918\,ms to 127\,ms ( extbf{38.7$ imes$}), enabling 8K--32K tokens where SDPA OOMs. \emph{Stage~2}: classical NLP prompt compression (TextRank, position weighting, TF-IDF, and novelty scoring) reduces all inputs to ${\sim}$512 tokens without neural inference, capping both latency and GPU memory at a constant regardless of original prompt length (E2E 127$ o$62\,ms, extbf{2.0$ imes$}). \emph{Stage~3}: near-streaming body processing with adaptive chunking and zero-copy JSON eliminates serialization overhead (E2E 62$ o$50\,ms, extbf{1.2$ imes$}). Cumulatively: extbf{98$ imes$} improvement (4{,}918\,ms to 50\,ms), 16K-token routing in 108\,ms, and a total router GPU footprint under 800\,MB -- small enough to share a GPU with LLM serving and removing the need for a dedicated accelerator. Stage~1 targets AMD ROCm (NVIDIA GPUs already have FlashAttention via cuDNN); Stages~2 and~3 are hardware-agnostic.
Motivation & Objective
- Motivate fast, lightweight system-level routing for LLM requests that enforces safety, domain routing, and PII detection without consuming a dedicated GPU.
- Overcome memory and latency bottlenecks of quadratic attention when routing co-located on the same GPU as LLM inference instances.
- Develop hardware-agnostic techniques to enable long-context routing on consumer-grade/enterprise GPUs while maintaining accuracy and throughput.
- Show how integration with Envoy ext_proc can preserve low latency while allowing complex classification signals.
Proposed method
- Introduce CK Flash Attention for ONNX Runtime on ROCm to reduce attention memory from O(n^2) to O(n) and end-to-end latency from 4,918 ms to 127 ms for 8K–32K prompts.
- Implement a prompt-compression pipeline using classical NLP features (TextRank, position weighting, TF-IDF, novelty scoring) to reduce inputs to ~512 tokens with no neural inference.
- Design near-streaming body processing with adaptive chunking and zero-copy JSON to avoid serialization overhead in Envoy ext_proc.
- Co-locate the router on the same MI300X GPU as vLLM serving instances to improve GPU density and avoid a dedicated accelerator.
- Provide hardware-specific optimizations (FA on ROCm with CK) and hardware-agnostic stages (compression and streaming) applicable to GPUs or CPUs.
Experimental results
Research questions
- RQ1Can Flash Attention be integrated into ONNX Runtime on ROCm to enable long-context routing without OOM on co-located GPUs?
- RQ2How much can classical NLP prompt compression reduce latency and memory while preserving classifier accuracy?
- RQ3Does near-streaming body processing eliminate JSON serialization overhead and further reduce end-to-end latency in Envoy ext_proc routing?
- RQ4What is the cumulative latency/memory impact when combining FA, compression, and near-streaming for 8K–16K token prompts?
- RQ5Is GPU co-location with LLM inference viable for routing workloads without a dedicated accelerator?
Key findings
- Flash Attention integrated via a custom CK operator reduces attention memory from O(n^2) to O(n) and drops E2E latency from 4,918 ms to 127 ms for 8K prompts.
- Prompt compression to ~512 tokens with no neural inference yields ~19 ms compression latency and keeps GPU memory constant, enabling 8K–16K token routing without additional GPU pressure.
- Near-streaming with adaptive chunking and zero-copy JSON reduces E2E latency from 62 ms to 50 ms for 8K tokens and to 108 ms for 16K tokens, enabling 16K-token routing on a shared GPU.
- Cumulatively, the stack achieves ~98× improvement (4,918 ms to 50 ms) and a total router GPU footprint under 800 MB, enabling co-location with vLLM serving without a dedicated accelerator.
- Stage 1 targets AMD ROCm; Stages 2 and 3 are hardware-agnostic and benefit any backend.
- GPU+FA with streaming and compression yields 50 ms E2E latency at 8K tokens and 108 ms at 16K tokens; 16K+ tokens remain feasible under contention due to compression.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.