arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2502.10001cs.CLcs.ARcs.DCcs.LG
收藏

EmbBERT:在2MB内存下使用注意力机制

EmbBERT: Attention Under 2 MB Memory

Department of Electronics, Information and Bioengineering(电子信息与生物工程系)

Riccardo Bravin, Massimo Pavan, Hazem Hesham Yousef Shalby, Fabrizio Pittorino, Manuel Roveri

AI总结:

本文提出EmbBERT,一种高效的极小语言模型,通过紧凑的嵌入层、流线型前馈块和高效的注意力机制,在严格内存预算下实现高性能,仅需2MB内存即可达到与SotA模型相当的准确率。

摘要:

基于注意力机制的Transformer架构已革新自然语言处理(NLP),在几乎所有NLP任务中都带来了重大突破。然而,其显著的内存和计算需求仍然阻碍了在超受限设备(如可穿戴设备和物联网单元)上的部署,其中可用内存仅限于几个兆字节。为解决这一挑战,我们引入了EmbBERT,一种专为极端效率设计的极小语言模型(TLM)。该模型集成了紧凑的嵌入层、流线型前馈块和高效的注意力机制,共同实现了在严格内存预算下的最佳性能。通过为极端边缘环境重新设计,我们证明了高度简化的Transformer架构在紧资源约束下仍然表现出色。EmbBERT仅需2MB的总内存,并实现了与需要10倍内存预算的SotA模型相当的准确率。在经过精心编写的TinyNLP基准和GLUE套件的广泛实验中,EmbBERT实现了具有竞争力的准确率,与更大的SotA模型相当,并且在BERT和MAMBA类似大小的缩小版本上持续优于。此外,我们展示了该模型对8位量化具有鲁棒性,进一步将内存使用减少到仅781 kB,并证明了EmbBERT架构在亚兆字节到几十兆字节范围内的可扩展性。最后,我们进行了消融研究,证明了所有组件和预训练过程的积极贡献。所有代码、脚本和检查点均已公开发布以确保可重复性:https://github.com/RiccardoBravin/tiny-LLM。

英文摘要:

Transformer architectures based on the attention mechanism have revolutionized natural language processing (NLP), driving major breakthroughs across virtually every NLP task. However, their substantial memory and computational requirements still hinder deployment on ultra-constrained devices such as wearables and Internet-of-Things (IoT) units, where available memory is limited to just a few megabytes. To address this challenge, we introduce EmbBERT, a tiny language model (TLM) architecturally designed for extreme efficiency. The model integrates a compact embedding layer, streamlined feed-forward blocks, and an efficient attention mechanism that together enable optimal performance under strict memory budgets. Through this redesign for the extreme edge, we demonstrate that highly simplified transformer architectures remain remarkably effective under tight resource constraints. EmbBERT requires only 2 MB of total memory, and achieves accuracy performance comparable to the ones of state-of-the-art (SotA) models that require a $\mathbf{10\times}$ memory budget. Extensive experiments on the curated TinyNLP benchmark and the GLUE suite confirm that EmbBERT achieves competitive accuracy, comparable to that of larger SotA models, and consistently outperforms downsized versions of BERT and MAMBA of similar size. Furthermore, we demonstrate the model resilience to 8-bit quantization, which further reduces memory usage to just 781 kB , and the scalability of the EmbBERT architecture across the sub-megabyte to tens-of-megabytes range. Finally, we perform an ablation study demonstrating the positive contributions of all components and the pre-training procedure. All code, scripts, and checkpoints are publicly released to ensure reproducibility: https://github.com/RiccardoBravin/tiny-LLM.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑