让循环Transformer并行运行,提速降耗不丢精度
Parallel Loop Transformer for Efficient Test-Time Computation Scaling
- 通过跨循环并行计算,同一轮内同时处理多个循环
- 保持与标准Transformer相当的延迟和内存开销
- 适合对推理速度敏感的实时大模型应用
大语言模型虽强大,但推理时往往过慢且成本高。循环Transformer通过复用权重减少参数量,但传统方法中循环串行执行,导致延迟和内存随循环数线性增长,难以用于快速场景。为此,我们提出并行循环Transformer(PLT)。PLT采用两项关键技术:一是跨循环并行(CLP),在单次前向传播中并行计算不同token的不同循环;二是高效表征增强策略,共享首个循环的键值缓存(KV cache)给所有循环,并利用门控滑动窗口注意力(G-SWA)融合全局与局部信息,保持高精度。实验表明,PLT实现了传统循环模型的高精度,同时延迟和内存开销几乎与标准Transformer持平。
原文摘要 · Abstract (English)
Large Language Models (LLMs) are powerful but often too slow and costly for real-world use during inference. Looped transformers save on parameters by reusing the same weights for multiple computational steps, or "loops." However, this approach has a major flaw: the loops run one after another, causing inference latency and memory requirements to increase with each added loop. This makes them impractical for fast applications. To solve this problem, we introduce the Parallel Loop Transformer (PLT). PLT is a new architecture that delivers the performance benefits of a deep, looped model but with the low latency of a standard, non-looped model. PLT works using two key techniques. First, Cross-Loop Parallelism (CLP) breaks the sequential dependency by computing different loops for different tokens at the same time, all within a single pass. Second, to prevent memory costs from growing, we use an Efficient Representation Enhancement strategy. This method shares the memory (KV cache) from the first loop with all other loops. It then uses a Gated Sliding-Window Attention (G-SWA) to combine this shared global information with local information, maintaining high accuracy. Our experiments show that PLT achieves the high accuracy of a traditional looped model but with almost no extra latency or memory cost compared to a standard transformer.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。