StagFormer:时间交错Transformer解码实现层间并行运行
StagFormer: Time Staggering Transformer Decoding for RunningLayers In Parallel
AI总结:
提出StagFormer架构,通过沿序列轴交错执行打破层间依赖,实现Transformer解码深度并行,提升速度且保持质量,并探索权重共享、窗口注意力及多段扩展。
摘要:
基于Transformer的语言模型中的解码过程本质上是顺序执行的,因为一个token的嵌入需要经过网络中所有层之后,才能开始生成下一个token。在这项工作中,我们提出了一种新的架构StagFormer(交错Transformer),它沿着序列轴交错执行,从而使得解码过程能够沿模型深度方向并行化。我们通过打破第$l$层在时间步$i$处的token表示对来自第$l-1$层直到时间步$i$的token表示的依赖来实现这一点。相反,我们交错执行,只允许其依赖于直到时间步$i-1$的token表示。Transformer的后段部分仍然能够从前一段部分获取“丰富”的表示,但仅限于那些落后一个时间步的token位置。StagFormer允许模型的不同部分并行执行,从而在解码时带来潜在的速度提升,同时在我们的模拟中保持质量中性。我们还探索了这一思想的许多自然扩展。我们展示了在不同交错部分之间进行权重共享如何在内存受限的设置中更加实用。我们探索了使用有界窗口注意力在部分之间传递信息的有效性,这有助于在某些应用中进一步降低延迟。我们还探讨了交错思想在Transformer超过2个部分时的可扩展性。最后,我们展示了如何在推理期间通过权重共享来近似一个循环模型。这种变体在短生成中能够带来显著的质量提升,同时对延迟影响保持中性。
英文摘要:
Decoding in a Transformer based language model is inherently sequential as a token's embedding needs to pass through all the layers in the network before the generation of the next token can begin. In this work, we propose a new architecture StagFormer (Staggered Transformer), which staggers execution along the sequence axis and thereby enables parallelizing the decoding process along the depth of the model. We achieve this by breaking the dependency of the token representation at time step $i$ in layer $l$ upon the representations of tokens until time step $i$ from layer $l-1$. Instead, we stagger the execution and only allow a dependency on token representations until time step $i-1$. The later sections of the Transformer still get access to the "rich" representations from the prior section but only from those token positions which are one time step behind. StagFormer allows for different sections of the model to be executed in parallel yielding a potential speedup in decoding while being quality neutral in our simulations. We also explore many natural extensions of this idea. We present how weight-sharing across the different sections being staggered can be more practical in settings with limited memory. We explore the efficacy of using a bounded window attention to pass information from one section to another which helps drive further latency gains for some applications. We also explore the scalability of the staggering idea over more than 2 sections of the Transformer. Finally, we show how one can approximate a recurrent model during inference using weight-sharing. This variant can lead to substantial gains in quality for short generations while being neutral in its latency impact.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。