Self attention encoders such as Bidirectional Encoder Representations from Transformers(BERT) scale quadratically with sequence length, making long context modeling expensive. Linear time state space models, such as Mamba, are efficient; however, they show limitations in modeling global interactions and can suffer from padding induced state contamination. We propose MaBERT, a hybrid encoder that interleaves Transformer layers for global dependency modeling with Mamba layers for linear time state updates. This design alternates global contextual integration with fast state accumulation, enabling efficient training and inference on long inputs. To stabilize variable length batching, we introduce paddingsafe masking, which blocks state propagation through padded positions, and mask aware attention pooling, which aggregates information only from valid tokens. On GLUE, MaBERT achieves the best mean score on five of the eight tasks, with strong performance on the CoLA and sentence pair inference tasks. When extending the context from 512 to 4,096 tokens, MaBERT reduces training time and inference latency by 2.36x and 2.43x, respectively, relative to the average of encoder baselines, demonstrating a practical long context efficient encoder.


翻译:诸如来自Transformer的双向编码器表示(BERT)等自注意力编码器的计算复杂度随序列长度呈二次方增长,使得长上下文建模代价高昂。线性时间状态空间模型,例如Mamba,虽然高效,但在建模全局交互方面存在局限,并且可能受到填充引起的状态污染影响。我们提出MaBERT,一种混合编码器,它交错使用Transformer层进行全局依赖建模和Mamba层进行线性时间状态更新。这种设计将全局上下文整合与快速状态累积交替进行,从而实现对长输入的高效训练和推理。为了稳定可变长度批处理,我们引入了填充安全掩码(阻止状态通过填充位置传播)和掩码感知注意力池化(仅从有效令牌聚合信息)。在GLUE基准测试中,MaBERT在八个任务中的五个上取得了最佳平均分数,在CoLA和句子对推理任务上表现出色。当上下文长度从512个令牌扩展到4,096个令牌时,相对于编码器基线的平均值,MaBERT分别将训练时间和推理延迟降低了2.36倍和2.43倍,证明其是一种实用的长上下文高效编码器。

0
下载
关闭预览

相关内容

Mamba之后是什么?朝着更具表现力的递归更新规则迈进
专知会员服务
15+阅读 · 2025年1月18日
阿里巴巴发布最新《时间序列Transformer建模》综述论文
专知会员服务
137+阅读 · 2022年2月16日
【Amazon】使用预先训练的Transformer模型进行数据增强
专知会员服务
58+阅读 · 2020年3月6日
BERT/Transformer/迁移学习NLP资源大列表
专知
19+阅读 · 2019年6月9日
进一步改进GPT和BERT:使用Transformer的语言模型
机器之心
16+阅读 · 2019年5月1日
BERT大火却不懂Transformer?读这一篇就够了
大数据文摘
12+阅读 · 2019年1月8日
BERT相关论文、文章和代码资源汇总
AINLP
19+阅读 · 2018年11月17日
国家自然科学基金
0+阅读 · 2017年12月31日
国家自然科学基金
0+阅读 · 2016年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
18+阅读 · 2012年12月31日
VIP会员
最新内容
《对信息环境分析实现人工智能预测冲突》96页
专知会员服务
3+阅读 · 今天9:59
《面向海军应用的无人机网络安全仿真环境》
专知会员服务
4+阅读 · 今天9:41
无人机与僵局:俄乌战争难以突破
专知会员服务
3+阅读 · 今天9:02
《控制对手感知:电子战愿景与赋能技术》
专知会员服务
5+阅读 · 今天8:51
自主、人工智能与可消耗集群时代的海军情报
专知会员服务
8+阅读 · 4月6日
“史诗狂怒行动”中的海军动态
专知会员服务
10+阅读 · 4月5日
相关VIP内容
相关基金
国家自然科学基金
0+阅读 · 2017年12月31日
国家自然科学基金
0+阅读 · 2016年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
18+阅读 · 2012年12月31日
Top
微信扫码咨询专知VIP会员