统一位置编码让混合模型更高效准确
TransXSSM: A Hybrid Transformer State Space Model with Unified Rotary Position Embedding
- 用统一旋转位置编码融合Transformer与状态空间模型
- 4千序列长度下训练快42.3%,推理快29.5%,精度高4%以上
- 适合长文本建模,尤其对大模型性能提升显著
Transformer擅长捕捉长距离依赖,而状态空间模型(SSM)可实现线性时间序列建模。然而二者在位置编码机制上存在根本矛盾:Transformer使用显式的旋转位置编码(RoPE),而SSM通过卷积隐式表示位置。这一差异常导致不连续和性能下降。为此,我们提出统一旋转位置编码(Unified RoPE),为自注意力与状态空间组件建立一致的位置编码框架。基于此,我们构建了TransXSSM,一种在统一位置编码下协同整合Transformer与SSM层的混合架构。在4K序列长度下,TransXSSM的训练速度比标准Transformer快42.3%,推理速度提升29.5%;在语言建模基准上,精度超过基线超过4%。该模型还展现出更好扩展性:TransXSSM-1.3B相比其320M版本平均精度提升7.22%(等效模型约6%)。结果表明,统一位置编码有效解决了混合模型中的位置不兼容问题,实现了高效且高性能的长上下文建模。
原文摘要 · Abstract (English)
Transformers exhibit proficiency in capturing long-range dependencies, whereas State Space Models (SSMs) facilitate linear-time sequence modeling. Notwithstanding their synergistic potential, the integration of these architectures presents a significant challenge, primarily attributable to a fundamental incongr inuity their respective positional encoding mechanisms: Transformers rely on explicit Rotary Position Embeddings (RoPE), while SSMs leverage implicit positional representations via convolutions. This divergence often precipitates discontinuities and suboptimal performance.To address this impediment, we propose a unified rotary position embedding (Unified RoPE) methodology, thereby establishing a consistent positional encoding framework for both self-attention and state-space components. Using this Unified RoPE, we introduce TransXSSM, a hybrid architecture that coherently integrates the Transformer and SSM layers under this unified positional encoding scheme. At a 4 sequenceK length, TransXSSM exhibits training and inference speeds that are 42.3% and 29.5% faster, respectively, relative to standard Transformer models. It also delivers higher accuracy: under comparable settings, it surpasses a Transformer baseline by over 4% on language modeling benchmarks.TransXSSM furthermore scales more effectively: TransXSSM-1.3B gains 7.22% in average accuracy over its 320M version (versus about 6% gains for equivalent Transformers or SSMs). Our results show that unified positional encoding resolves positional incompatibility in hybrid models, enabling efficient, high-performance long-context modeling.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。