PulseExploreJournal ClubDebatesTrendingResearchersJournals
Instagram
HomeExploreJournal ClubTrending
Synapse
⌘+K
Synapse
July 24, 20240 citationsOpen Access

Efficient LLM Training and Serving with Heterogeneous Context Sharding among Attention Heads

View Full Paper
XLXihui LinYZYunan ZhangSGSuyu Ge

Key Points

Key points are not available for this paper at this time.

Abstract

Existing LLM training and inference frameworks struggle in boosting efficiency with sparsity while maintaining the integrity of context and model architecture. Inspired by the sharding concept in database and the fact that attention parallelizes over heads on accelerators, we propose Sparsely-Sharded (S2) Attention, an attention algorithm that allocates heterogeneous context partitions for different attention heads to divide and conquer. S2-Attention enforces each attention head to only attend to a partition of contexts following a strided sparsity pattern, while the full context is preserved as the union of all the shards. As attention heads are processed in separate thread blocks, the context reduction for each head can thus produce end-to-end speed-up and memory reduction. At inference, LLMs trained with S2-Attention can then take the KV cache reduction as free meals with guaranteed model quality preserve. In experiments, we show S2-Attentioncan provide as much as (1) 25.3X wall-clock attention speed-up over FlashAttention-2, resulting in 6X reduction in end-to-end training time and 10X inference latency, (2) on-par model training quality compared to default attention, (3)perfect needle retrieval accuracy over 32K context window. On top of the algorithm, we build DKernel, an LLM training and inference kernel library that allows users to customize sparsity patterns for their own models. We open-sourced DKerneland make it compatible with Megatron, Pytorch, and vLLM.

Ask AI
Helpful
Bookmark
Share
View Full Paper

Cite This Study

Lin et al. (2024) studied this question.

synapsesocial.com/papers/68e5f50bb6db6435875897fahttps://doi.org/10.48550/arxiv.2407.17678
Ask AI
Helpful
Bookmark
Share
View Full Paper

Also Consider

Synapse has enriched 5 closely related papers on similar clinical questions. Consider them for comparative context:

  1. 1Near-Lossless Acceleration of Long Context LLM Inference with Adaptive Structured Sparse Attention2024
  2. 2Polar Sparsity: High Throughput Batched LLM Inferencing with Scalable Contextual Sparsity2025
  3. 3Accelerating Prefilling for Long-Context LLMs via Sparse Pattern Sharing2025
  4. 4MInference 1.0: Accelerating Pre-filling for Long-Context LLMs via Dynamic Sparse Attention2024 · 4 citations
  5. 5ShadowLLM: Predictor-based Contextual Sparsity for Large Language Models2024