提出分层序列感知并行框架,解决混合上下文序列的注意力计算难题。
HSAP: A Hierarchical Sequence-aware Parallelism for Hybrid-Context Generative Models

- 设计序列感知并行算法,优化跨设备组的通信与部分注意力计算。
- 在多个指标上优于现有最先进序列并行方法,提升训练效率。
- 适合大规模语言模型高效预训练与微调,尤其适用于混合上下文场景。
本文旨在结合现有序列并行范式的优势并克服其缺陷,尤其是无法在混合上下文压缩序列中正确计算因果注意力的问题。在高效预训练和微调大语言模型时,序列压缩技术会导致注意力计算中的交叉污染问题,该问题在不使用序列长度维度并行时可被有效解决。然而,在序列并行中,现有方法要么忽略混合上下文序列场景,要么为支持该场景而牺牲并行度。为此,我们创新性地提出一种高效的序列感知并行算法,克服密集张量传输与跨多设备组的部分注意力计算障碍。该算法利用即时编译(JIT)优化所有设备组在NCCL层级的通信策略。进一步,我们将现有序列并行范式整合进分层序列感知并行框架,受益于序列感知算法。同时,我们详细阐述了分层框架中的内存与通信开销管理以优化性能。通过多项实验验证,所提方法在多个指标上优于其他最先进的序列并行方案。
原文摘要 · Abstract (English)
In this paper, we aim to combine the advantages of existing sequence parallelism paradigms and overcomes their drawbacks, the most serious of which is the incapability to correctly compute causal attention on the hybrid-context packed sequences, in a stronger sequence parallelism framework. The practical technique of packing sequences for efficiently pretraining and fine-tuning large language models causes cross-contamination problem in attention computation, which can be effectively solved when no parallelism in the sequence length dimension is taken. However, in sequence parallelism, existing approaches either ignore the scenario of hybrid-context sequences or conversely sacrifice and limit parallelism degree for supporting the scenario. To this end, we innovatively propose an efficient Sequence-Aware Parallelism algorithm to conquer the obstacles of intensive tensor transmission and partial attention computation across multiple device groups. Our algorithm utilizes JIT (Just-In-Time) compilation to optimize the communication strategy of all device groups in NCCL level. Further, we integrate existing sequence parallelism paradigms into a Hierarchical Sequence-Aware Parallelism framework which benefits from our sequence-aware algorithm. We additionally elaborate on the memory and communication overhead management of the hierarchical framework to optimize its performance. Through multiple experiments, we demonstrate that our proposed approach outperform other state-of-the-arts sequence parallelism approches in multiple metrics.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。