[论文解读] A Comparative Study of Clinical ModernBERT and BioMedical ModernBERT on the DDXPlus Dataset
论文提出 ModernBERT,一种针对长上下文、内存效率和代码感知数据优化的仅编码器变形器;它在自然语言理解、信息检索和代码任务上对比现有编码器,覆盖长上下文和多向量设置。
Encoder-only transformer models such as BERT offer a great performance-size tradeoff for retrieval and classification tasks with respect to larger decoder-only models. Despite being the workhorse of numerous production pipelines, there have been limited Pareto improvements to BERT since its release. In this paper, we introduce ModernBERT, bringing modern model optimizations to encoder-only models and representing a major Pareto improvement over older encoders. Trained on 2 trillion tokens with a native 8192 sequence length, ModernBERT models exhibit state-of-the-art results on a large pool of evaluations encompassing diverse classification tasks and both single and multi-vector retrieval on different domains (including code). In addition to strong downstream performance, ModernBERT is also the most speed and memory efficient encoder and is designed for inference on common GPUs.
研究动机与目标
- 提出动机并构建一个现代的仅编码器模型(ModernBERT),使其在更长序列上改进下游性能和效率。
- 在大规模、多样化数据上进行训练(包括代码),以实现跨领域的多样化检索和分类。
- 在自然语言理解(NLU)、单向量/多向量检索以及编程相关任务上展示最先进的性能,同时保持硬件高效推理。
提出的方法
- 包括 RoPE 位置嵌入、GeGLU 激活、预归一化,以及线性层中的偏置/禁用策略等架构改进。
- 通过交替全局/局部注意力、去填充和 Flash Attention 内核实现高效的长上下文建模。
- 面向硬件的模型设计(Deep & Narrow 配置),以最大化 GPU 利用率和推理速度。
- 包括代码的数据混合语料,总量为 2 trillion tokens,采用现代 BPE 分词器(词汇表大小 50,368)。
- 训练方案采用 StableAdamW、带有 1-sqrt 衰减的梯形学习率调度,以及用于高训练效率的序列打包。
- 通过 RoPE theta 调整与分阶段再训练,将上下文长度从 1024 扩展到 8192 tokens。
实验结果
研究问题
- RQ1在标准编码器基准(GLUE、BEIR)上,ModernBERT 能否在提供更高推理效率的同时实现最先进的性能?
- RQ2长上下文支持(8192 tokens)在单向量和多向量设置下如何影响检索和 NLU 性能?
- RQ3在包含代码的训练数据上进行训练是否在不牺牲自然语言理解的情况下提升代码相关任务的表现?
- RQ4在不同上下文长度和硬件设置下,ModernBERT 的效率提升(吞吐量与内存使用)是多少?
主要发现
- ModernBERT 在 GLUE base 和 large 设置上优于现有编码器,取得更优的 NLU 结果。
- 在检索中,ModernBERT 在单向量(DPR)和多向量(ColBERT)设置都取得强劲表现,常居 base/large 模型之首。
- 在长上下文检索方面,ModernBERT 显示出显著改进,尤其是在 ColBERT 风格的多向量检索和领域内长上下文调优方面。
- 代码相关基准(CodeSearchNet、StackOverflow-QA)显示 ModernBERT 从其代码包容的预训练中受益,提升代码理解和检索。
- 就效率而言,ModernBERT 具有很高的内存效率,在长上下文长度下达到更高的每秒 token 数,与同类相比具有竞争力或更高的吞吐量。
阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。