LoongServe: Efficiently Serving Long-Context Large Language Models with Elastic Sequence Parallelism

📄 arXiv: 2404.09526v2 📥 PDF

作者: Bingyang Wu, Shengyu Liu, Yinmin Zhong, Peng Sun, Xuanzhe Liu, Xin Jin

分类: cs.DC, cs.LG

发布日期: 2024-04-15 (更新: 2024-10-29)


💡 一句话要点

提出弹性序列并行性以高效服务长上下文大语言模型

🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)

关键词: 大语言模型 弹性序列并行性 计算效率 通信效率 GPU内存管理

📋 核心要点

  1. 现有LLM服务系统在处理可变长度请求时,因静态并行策略导致资源利用效率低下。
  2. 本文提出弹性序列并行性(ESP),通过实时调整并行度来适应不同请求和阶段的资源需求。
  3. LoongServe系统在多种真实数据集上展现出显著的性能提升,最大吞吐量提高了3.85倍至5.81倍。

📝 摘要(中文)

随着大语言模型(LLMs)上下文窗口的迅速扩大,不同请求之间以及同一请求的不同阶段在资源使用上存在巨大差异。现有的LLM服务系统受限于静态并行策略,无法高效利用底层资源来处理可变长度请求。为了解决这一问题,本文提出了一种新的并行范式——弹性序列并行性(ESP),以灵活适应不同请求和阶段之间的差异。基于ESP,设计并构建了LoongServe系统,实时调整并行度以提高计算效率,减少关键值缓存迁移开销并重叠部分解码通信与计算,从而提升通信效率,并降低实例间关键值缓存碎片化以提高GPU内存效率。实验结果表明,LoongServe在多种真实数据集下的最大吞吐量提高了3.85倍,相较于分块预填充提高了5.81倍。

🔬 方法详解

问题定义:本文旨在解决现有LLM服务系统在处理可变长度请求时的资源利用效率低下问题,尤其是在不同请求和阶段之间的资源使用差异。

核心思路:提出弹性序列并行性(ESP),通过实时调整并行度来适应不同请求和阶段的需求,从而提高计算和通信效率。

技术框架:LoongServe系统基于ESP构建,主要模块包括动态并行度调整模块、关键值缓存管理模块和部分解码通信模块,整体流程涵盖请求接收、并行度调整、计算执行和结果返回。

关键创新:最重要的创新在于引入ESP,使得系统能够灵活应对不同请求的资源需求,显著提高了计算和通信效率,区别于传统的静态并行策略。

关键设计:在设计中,关键值缓存的管理策略被优化以减少碎片化,并通过重叠计算与通信来降低延迟,确保系统在高负载下仍能保持高效运行。

🖼️ 关键图片

fig_0
fig_1
fig_2

📊 实验亮点

实验结果显示,LoongServe在多种真实数据集下的最大吞吐量相比于分块预填充提高了3.85倍,相较于预填充-解码分离方法提高了5.81倍,展现出显著的性能优势。

🎯 应用场景

该研究的潜在应用领域包括自然语言处理、对话系统和智能助手等,能够显著提升大语言模型在实际应用中的响应速度和处理能力。未来,LoongServe有望在多种场景中广泛应用,推动大语言模型的商业化进程。

📄 摘要(原文)

The context window of large language models (LLMs) is rapidly increasing, leading to a huge variance in resource usage between different requests as well as between different phases of the same request. Restricted by static parallelism strategies, existing LLM serving systems cannot efficiently utilize the underlying resources to serve variable-length requests in different phases. To address this problem, we propose a new parallelism paradigm, elastic sequence parallelism (ESP), to elastically adapt to the variance between different requests and phases. Based on ESP, we design and build LoongServe, an LLM serving system that (1) improves computation efficiency by elastically adjusting the degree of parallelism in real-time, (2) improves communication efficiency by reducing key-value cache migration overhead and overlapping partial decoding communication with computation, and (3) improves GPU memory efficiency by reducing key-value cache fragmentation across instances. Our evaluation under diverse real-world datasets shows that LoongServe improves the maximum throughput by up to 3.85$\times$ compared to the chunked prefill and 5.81$\times$ compared to the prefill-decoding disaggregation.