APB: Accelerating Distributed Long-Context Inference by Passing Compressed Context Blocks across GPUs

Yuxiang Huang, Mingye Li, Xu Han, Chaojun Xiao, Weilin Zhao +5 more
2/17/2025
cs.LGcs.CL

Official code: thunlp/APB (37 stars, last commit 2026-04-06).

Abstract

While long-context inference is crucial for advancing large language model (LLM) applications, its prefill speed remains a significant bottleneck. Current approaches, including sequence parallelism strategies and compute reduction through approximate attention mechanisms, still fall short of delivering optimal inference efficiency. This hinders scaling the inputs to longer sequences and processing long-context queries in a timely manner. To address this, we introduce APB, an efficient long-context inference framework that leverages multi-host approximate attention to enhance prefill speed by reducing compute and enhancing parallelism simultaneously. APB introduces a communication mechanism for essential key-value pairs within a sequence parallelism framework, enabling a faster inference speed while maintaining task performance. We implement APB by incorporating a tailored FlashAttn kernel alongside optimized distribution strategies, supporting diverse models and parallelism configurations. APB achieves speedups of up to 9.2x, 4.2x, and 1.6x compared with FlashAttn, RingAttn, and StarAttn, respectively, without any observable task performance degradation. We provide the implementation and experiment code of APB in https://github.com/thunlp/APB.

View on arXivView PDF

Code Implementations(1)

thunlp/APBOfficial100%

Official Implementation of APB (ACL 2025 main Oral) and Spava (ACL 2026 main).

375C, C++Feb 16, 20256 months ago

Cite this paper

@article{huang2025apb,
  title  = {APB: Accelerating Distributed Long-Context Inference by Passing Compressed Context Blocks across GPUs},
  author = {Yuxiang Huang and Mingye Li and Xu Han and Chaojun Xiao and Weilin Zhao and Sun Ao and Hao Zhou and Jie Zhou and Zhiyuan Liu and Maosong Sun},
  year   = {2025},
  eprint = {2502.12085},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2502.12085v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2502.12085.svg)](https://codeofpaper.com/paper/2502.12085)

Discussion