/ Модель

Характеристики

Контекст
32 768 токенов
Параметры
151 млн
Лицензия
Apache 2.0
Архитектура
ultrabert · dense
Библиотека
transformers
Опубликована
10 окт 2026

UltraBERT-150M

Заполнение пропусковТекст → текст

Англоязычный энкодер UltraBERT на 151 млн параметров с контекстом 32K для тонкой настройки под классификацию, поиск и другие задачи понимания текста.

73скачиваний за 30 дней3лайкавеса обновлены10 окт 2026

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

UltraBERT-150M — предварительно обученный англоязычный двунаправленный Transformer-энкодер семейства UltraBERT, разработанный dmis-lab. Модель содержит 151 млн параметров, 24 слоя и скрытый размер 768; она использует RoPE, SwiGLU и RMSNorm. Нативный контекст составляет 32 000 токенов: две трети слоёв применяют локальное внимание в пределах 128 токенов по обе стороны, остальные обрабатывают всю последовательность.

Энкодер предназначен для последующей тонкой настройки под классификацию, извлечение информации, разметку токенов и ответы на вопросы, а также может служить основой для retrieval-систем. В карточке заявлены сильные результаты на задачах классификации и поиска, включая сохранение высокой точности извлечения ключа в документах длиной до 32K токенов. Чекпойнт включает энкодер и MLM-голову, обученную на последовательностях с 5% маскированных токенов; это не готовый классификатор или эмбеддинг-модель.

Для использования требуются Transformers версии 5 или выше и trust_remote_code=True; для длинных входов рекомендуется FlashAttention 2, также поддерживаются SDPA и eager attention. Модель распространяется по лицензии Apache-2.0. Она рассчитана только на английский язык и может воспроизводить смещения обучающих веб-данных.

Сценарии применения

  • тонкая настройка классификатора текстов
  • извлечение релевантных фрагментов из длинных документов
  • разметка сущностей и других токенов
  • ответы на вопросы по текстовым документам
  • поиск ключевой информации в длинном контексте

Ограничения

Модель обучена только для английского языка и требует тонкой настройки под конкретную задачу; это не готовая эмбеддинг-модель. Она может воспроизводить смещения обучающих веб-данных.

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

UltraBERT-150M

UltraBERT is a family of English bidirectional encoders with a native 32K context that reach state of the art on both classification and retrieval, two task families on which previous encoders had to choose a side.

ModelParametersHiddenContextDescription
UltraBERT-150M (this model)150M76832KPre-trained encoder
UltraBERT-380M380M1,02432KPre-trained encoder
UltraBERT-Embed-150M150M76832KText embedding model built on UltraBERT-150M

For more information about UltraBERT, please check out our paper.

✨ Highlights

  • Classification and retrieval at once. Earlier encoders each excel in one area: Ettin on GLUE, RoBERTa on NER, LFM2.5-Encoder on BEIR. UltraBERT is the first encoder to take the top score on both classification and retrieval at the same size.
  • Native 32K context. The model is trained at 2K tokens and extended to 32K context length. On the LongEmbed passkey test it keeps 99% accuracy at every length up to 32K, where 8K-context encoders drop sharply.
  • Decoupled LM heads. Each pre-training batch mixes sequences masked at 5% and at 50%, and each masking ratio has its own LM head. Low ratios favor classification and high ratios favor retrieval; separate heads let one encoder learn both without the interference a shared head causes.
  • Pruning and distillation from a 1.3B teacher. The 380M model is width-pruned from a 1.3B encoder and the 150M model from the 380M model. Both are distilled from the 1.3B teacher with a KL loss, applied only to the 5% masked sequences, while the 50% sequences use the standard MLM loss.

🚀 Usage

The model needs transformers >= 5 (tested with 5.16.1) and trust_remote_code=True. FlashAttention 2 is recommended for long inputs; SDPA and eager attention are also supported.

import torch
from transformers import AutoModelForMaskedLM, AutoTokenizer

model_id = "dmis-lab/UltraBERT-150M"
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForMaskedLM.from_pretrained(
    model_id,
    trust_remote_code=True,
    dtype=torch.bfloat16,
    attn_implementation="flash_attention_2",  # or "sdpa"
    device_map="cuda",
)

text = f"The capital of France is {tokenizer.mask_token}."
inputs = tokenizer(text, return_tensors="pt").to(model.device)
with torch.no_grad():
    logits = model(**inputs).logits

mask_index = (inputs.input_ids == tokenizer.mask_token_id).nonzero()[0, 1]
print(tokenizer.decode(logits[0, mask_index].argmax()))

Fine-Tuning

The checkpoint loads into the usual task classes:

from transformers import AutoModelForSequenceClassification

model = AutoModelForSequenceClassification.from_pretrained(
    "dmis-lab/UltraBERT-150M", num_labels=2, trust_remote_code=True
)

We recommend starting from the settings used in the paper. For classification: AdamW (β1 0.9, β2 0.98, ε 1e-6), weight decay 0.1, a linear schedule with 5% warm-up, and a learning rate swept over {5e-6,8e-6,1e-5,3e-5,5e-5,8e-5}. For dense retrieval: mean pooling with a contrastive loss and a wider learning-rate sweep of {1e-5,3e-5,5e-5,8e-5,1e-4,2e-4,3e-4,5e-4,8e-4,1e-3}.

[!WARNING] 💡 Note: UltraBERT consistently prefers lower learning rates than other encoders, by up to 10x. For example, the best learning rates for UltraBERT-150M and UltraBERT-380M are 5e-5 and 3e-5, respectively, whereas other encoders typically prefer 3e-4 to 5e-4.

📊 Evaluation

Classification vs retrieval performance across encoder models

Every model is fine-tuned per task with the same grid search. For the retrieval tasks, each encoder is fine-tuned on a subset of MS MARCO or MLDR under the same sweep, so these scores reflect the potential information retrieval capability of each encoder. Dedicated embedding models are usually trained further on hundreds of millions of pairs with much longer training schedules.

Base Size (at most 200M parameters)

ModelParamsGLUESQuAD 2.0MultiCoNER v2Few-NERDReward-BenchBEIRRARb CodeRARb MathMLDRLongEmbed
BERT110M84.776.353.866.659.436.76.627.529.029.3
RoBERTa125M86.483.756.567.163.239.611.733.428.733.8
MosaicBERT137M85.479.457.865.762.541.412.730.929.640.5
NomicBERT137M84.082.760.166.964.142.013.830.229.945.0
GTE-en-MLM137M85.682.759.266.463.442.412.033.637.158.5
ModernBERT149M88.486.757.466.768.042.629.646.137.763.2
Ettin Encoder149M88.987.457.466.570.342.431.847.135.960.1
UltraBERT152M89.589.257.967.473.045.239.155.443.572.0

Medium Size (at most 500M parameters)

ModelParamsGLUESQuAD 2.0MultiCoNER v2Few-NERDReward-BenchBEIRRARb CodeRARb MathMLDRLongEmbed
BERT334M85.281.857.767.862.638.612.233.029.830.0
RoBERTa355M88.989.462.368.168.542.820.337.829.532.2
GTE-en-MLM434M87.687.263.067.162.239.413.532.040.857.0
NeoBERT222M89.086.657.466.457.642.917.333.421.732.4
LFM2.5-Encoder230M88.286.159.667.667.546.730.950.243.770.0
LFM2.5-Encoder355M89.287.262.767.968.547.338.650.244.571.7
ModernBERT395M90.489.860.967.672.845.234.046.139.963.5
Ettin Encoder395M90.890.462.367.876.745.938.554.040.964.3
UltraBERT380M91.090.963.568.378.847.747.061.744.174.9

Long-Context Passkey Retrieval

Passkey retrieval accuracy on LongEmbed by document length

Passkey retrieval accuracy on LongEmbed as a function of document length, for (a) base and (b) medium encoders. Every baseline degrades once the document exceeds its context length: the 512-context models fail beyond 1K tokens and the 8K-context models drop sharply at 16K and 32K. UltraBERT is the only model that retains 99% accuracy at every length up to 32K, at both sizes.

🏛️ Model Description

UltraBERT-150MUltraBERT-380M
Layers2424
Hidden size7681,024
SwiGLU size1,0243,072
Attention heads68
Head dimension128128
Attention patternlocal x2, globallocal x2, global
Local attention window128 tokens each side128 tokens each side
RoPE base (local / global)10K / 2.56M10K / 2.56M
Context length32,76832,768
Vocabulary49,15249,152
NormalizationRMSNorm (eps 1e-6)RMSNorm (eps 1e-6)
Parameters152M380M

UltraBERT is a pre-norm Transformer encoder with RoPE, SwiGLU feed-forward layers, RMSNorm and no bias terms. Two of every three layers use local attention restricted to 128 tokens on each side, and every third layer attends over the whole sequence. The depth is fixed at 24 layers for every size and only the width is scaled. The LM head is untied from the input embeddings.

What Is in This Checkpoint

  • model.safetensors in float32 (the pre-training master weights), with config.dtype: float32.
  • The encoder and the MLM head.
  • The MLM head is the one trained on the 5% masked sequences (the distilled head); the 50% head is not included.
  • Remote code for transformers 5.x with UltrabertModel, UltrabertForMaskedLM, UltrabertForSequenceClassification, UltrabertForQuestionAnswering and UltrabertForTokenClassification.

⚙️ Pre-Training

Objective. Masked language modeling with two masking ratios in every batch, 5% and 50% at a 4:1 sequence ratio, each with its own LM head. The 5% head is trained with a KL divergence loss against the logits of a 1.3B teacher; the 50% head with the standard MLM loss.

Pruning and distillation. The 1.3B teacher is width-pruned to 380M and the distilled 380M model is pruned again to 150M. Importance of hidden channels, attention heads and FFN neurons is estimated from activations on 2,000 calibration documents, and the top-scoring units are kept. Both sizes are distilled from the 1.3B teacher directly.

Optimization. AdamW (β1 0.9, β2 0.95, ε 1e-8), weight decay 0.1, gradient clipping 1.0, peak learning rate 1e-4 with a warmup-stable-decay schedule (10B warm-up tokens, linear decay over the last 10%). Batch size 4M tokens, and 2T tokens in total; the context is extended to 32K, raising the global-attention RoPE base from 640K to 2.56M. Trained on a single TPU v4-512, v5e-256 or v6e-256 slice with data parallelism and FSDP.

Data. One fixed mixture for the whole run (Table 4 of the paper).

CategoryDatasetUnique tokens (B)EpochsTrained tokens (B)Share
WebDCLM756.41.17881.744.1%
WebFineWeb-Edu195.42.33455.522.8%
CodeStack-Edu120.32.33280.514.0%
AcademicpeS2o60.72.33141.67.1%
MathMegaMath20.92.8058.42.9%
MathFineMath10.92.8030.51.5%
MathInfiWebMath9.62.8026.91.3%
ReferenceCosmopedia v228.12.3365.63.3%
ReferenceWikipedia (Dolma)3.92.339.20.5%
InstructionFLAN19.02.3344.42.2%
InstructionStackExchange (RedPajama)1.52.333.40.2%
InstructionNatural Reasoning1.02.332.40.1%
Total1,227.81.632,000.0100%

Limitations

  • English only. The pre-training mixture is English web, code, academic, math and instruction text.
  • This is a pre-trained encoder, not a ready-to-use classifier or embedding model: it needs fine-tuning for a task. For a ready-to-use text embedding model built on it, see UltraBERT-Embed-150M.
  • The model can reproduce biases of its web-scale training data; evaluate it for your use case.

Citation

@article{park2026ultrabert,
  title   = {UltraBERT: Beyond the Limit of BERT Pre-Training},
  author  = {Park, Jungwoo and Lee, Taewhoo and Kang, Jaewoo},
  journal = {arXiv preprint arXiv:{ARXIV_ID}},
  year    = {2026}
}

Acknowledgments

The pre-training was primarily supported by Cloud TPUs from Google's TPU Research Cloud (TRC) program.

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · transformers · fill-mask

Нельзя запустить

Модели нужен код из репозитория; автор пока не в списке доверенных организаций.

Класс архитектуры
UltrabertForMaskedLM
Ревизия весов
599f3a8

0 моделей