Skip to main content
QUICK REVIEW

[Paper Review] A Comparative Study of Clinical ModernBERT and BioMedical ModernBERT on the DDXPlus Dataset

Benjamin C. Warner|arXiv (Cornell University)|Dec 18, 2024
Video Analysis and SummarizationComputer Science23 citations
TL;DR

The paper introduces ModernBERT, an encoder-only transformer optimized for long-context, memory efficiency, and code-aware data; it evaluates ModernBERT against existing encoders on natural language understanding, retrieval, and code tasks, including long-context and multi-vector settings.

ABSTRACT

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.

Motivation & Objective

  • Motivate and build a modern encoder-only model (ModernBERT) that improves downstream performance and efficiency over longer sequences.
  • Train on large-scale, diverse data (including code) to enable versatile retrieval and classification across domains.
  • Demonstrate state-of-the-art performance on NLU, single/multi-vector retrieval, and programming-related tasks while maintaining hardware-efficient inference.

Proposed method

  • Architectural enhancements including RoPE positional embeddings, GeGLU activations, pre-normalization, and bias/disabling strategies in linear layers.
  • Efficient long-context modeling via alternating global/local attention with unpadding and Flash Attention kernels.
  • Hardware-aware model design (Deep & Narrow configuration) to maximize GPU utilization and inference speed.
  • Data mixture of 2 trillion tokens with a code-inclusive corpus and a modern BPE tokenizer (vocabulary size 50,368).
  • Training regimen with StableAdamW, trapezoidal learning rate schedules with 1-sqrt decay, and sequence packing for high training efficiency.
  • Context-length extension from 1024 to 8192 tokens via RoPE theta adjustments and staged retraining.

Experimental results

Research questions

  • RQ1Can ModernBERT achieve state-of-the-art performance on standard encoder benchmarks (GLUE, BEIR) while offering superior inference efficiency?
  • RQ2How does long-context support (8192 tokens) affect retrieval and NLU performance across single-vector and multi-vector settings?
  • RQ3Does training on code-inclusive data improve performance on code-related tasks without sacrificing natural language understanding?
  • RQ4What are the efficiency gains (throughput and memory) of ModernBERT across varying context lengths and hardware settings?

Key findings

  • ModernBERT outperforms existing encoders on GLUE base and large settings, achieving superior NLU results.
  • In retrieval, ModernBERT achieves strong performance in both single-vector (DPR) and multi-vector (ColBERT) setups, often leading among base/large models.
  • For long-context retrieval, ModernBERT shows notable improvements, especially in ColBERT-style multi-vector retrieval and in-domain long-context tuning.
  • Code-related benchmarks (CodeSearchNet, StackOverflow-QA) show ModernBERT benefits from its code-inclusive pretraining, improving code understanding and retrieval.
  • Efficiency-wise, ModernBERT is highly memory-efficient and achieves higher tokens-per-second at long context lengths, with competitive or superior throughput compared to peers.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.