ChatPaper.aiChatPaper

LServe: 통합 희소 주의력을 활용한 효율적인 장거리 시퀀스 LLM 서빙

LServe: Efficient Long-sequence LLM Serving with Unified Sparse Attention

February 20, 2025
저자: Shang Yang, Junxian Guo, Haotian Tang, Qinghao Hu, Guangxuan Xiao, Jiaming Tang, Yujun Lin, Zhijian Liu, Yao Lu, Song Han
cs.AI

초록

대규모 언어 모델(LLM)은 긴 시퀀스 처리에서 뛰어난 잠재력을 보여주었지만, 프리필 단계에서 어텐션의 이차 계산 복잡성과 디코딩 단계에서 KV 캐시의 큰 메모리 공간으로 인해 이러한 장문 컨텍스트 모델을 효율적으로 서비스하는 것은 여전히 어려운 과제입니다. 이러한 문제를 해결하기 위해, 우리는 하이브리드 희소 어텐션을 통해 장문 시퀀스 LLM 서비스를 가속화하는 효율적인 시스템인 LServe를 소개합니다. 이 방법은 프리필과 디코딩 어텐션을 위한 다양한 하드웨어 친화적 구조적 희소 패턴을 단일 프레임워크로 통합하며, 덜 중요한 토큰에 대한 계산을 블록 단위로 건너뜁니다. LServe는 장문 컨텍스트 LLM 어텐션에서 정적 및 동적 희소성의 호환성을 입증합니다. 이 설계는 이러한 최적화를 결합하여 곱셈적 속도 향상을 가능하게 합니다. 구체적으로, 우리는 프리필과 디코딩 단계에서 어텐션 헤드의 절반을 거의 무료 스트리밍 헤드로 변환합니다. 또한, 컨텍스트 길이와 관계없이 장문 컨텍스트 기능을 유지하기 위해 일정한 수의 KV 페이지만 필요하다는 것을 발견했습니다. 그런 다음, 쿼리 중심 유사성을 기반으로 KV 페이지를 동적으로 정리하는 계층적 KV 페이지 선택 정책을 설계합니다. 평균적으로 LServe는 vLLM 대비 프리필 속도를 최대 2.9배, 디코딩 속도를 1.3-2.1배 가속화하며 장문 컨텍스트 정확도를 유지합니다. 코드는 https://github.com/mit-han-lab/omniserve에서 공개되었습니다.
English
Large language models (LLMs) have shown remarkable potential in processing long sequences, yet efficiently serving these long-context models remains challenging due to the quadratic computational complexity of attention in the prefilling stage and the large memory footprint of the KV cache in the decoding stage. To address these issues, we introduce LServe, an efficient system that accelerates long-sequence LLM serving via hybrid sparse attention. This method unifies different hardware-friendly, structured sparsity patterns for both prefilling and decoding attention into a single framework, where computations on less important tokens are skipped block-wise. LServe demonstrates the compatibility of static and dynamic sparsity in long-context LLM attention. This design enables multiplicative speedups by combining these optimizations. Specifically, we convert half of the attention heads to nearly free streaming heads in both the prefilling and decoding stages. Additionally, we find that only a constant number of KV pages is required to preserve long-context capabilities, irrespective of context length. We then design a hierarchical KV page selection policy that dynamically prunes KV pages based on query-centric similarity. On average, LServe accelerates LLM prefilling by up to 2.9x and decoding by 1.3-2.1x over vLLM, maintaining long-context accuracy. Code is released at https://github.com/mit-han-lab/omniserve.

Summary

AI-Generated Summary

PDF62February 21, 2025