Skip to main content
Back

Facebook AI's RoBERTa-base Lands on Hugging Face With Full Training Recipe

Facebook AI's RoBERTa-base masked language model is available on Hugging Face with training details, usage code, and known limitations documented.

Pro

  • Facebook AI's RoBERTa-base model card on Hugging Face documents the pretraining recipe and intended uses.
  • Pretrained with masked language modeling on 160GB of English text across five datasets.
  • Trained on 1024 V100 GPUs for 500K steps, batch size 8K, sequence length 512.
  • GLUE fine-tuning results include 94.8 on SST-2, 92.8 on QNLI, and 87.6 on MNLI.
  • Intended for fine-tuning on classification, tagging, and QA, not text generation.
  • Card explicitly documents demographic bias from unfiltered internet training data.

Facebook AI's RoBERTa-base is published on Hugging Face as a pretrained English language model, with a model card written by the Hugging Face team since the original authors did not provide one. The listing packages the checkpoint, training recipe, evaluation numbers, and honest documentation of the model's biases into a single reference point for anyone building on top of it.

The weights come from the paper RoBERTa: A Robustly Optimized BERT Pretraining Approach, and the Hugging Face page frames the checkpoint as a foundation to fine-tune rather than a general purpose generator.

What Facebook AI actually shipped

RoBERTa is a transformer pretrained on a large corpus of English text in a self-supervised fashion, meaning it saw raw text only with no human labels, using an automatic process to generate inputs and labels from that text. The training objective is masked language modeling: the model randomly masks 15% of the words in the input, runs the entire masked sentence through the network, and predicts what was hidden.

Traditional recurrent networks see words one after the other, and autoregressive models like GPT internally mask future tokens. Masked language modeling instead lets RoBERTa learn a bidirectional representation of the sentence. That bidirectional context is why the model continues to be a workhorse for classification and tagging tasks where you want the encoder to see the whole sentence at once.

Fine-tune it, do not chat with it

The card is blunt about scope. You can use the raw checkpoint for masked language modeling, but it is mostly intended to be fine-tuned on a downstream task, and it is primarily aimed at problems that use the whole sentence to make decisions: sequence classification, token classification, or question answering. For text generation, the card points you at GPT2 instead.

The quickest way to try it is the fill-mask pipeline from Transformers:

from transformers import pipeline
unmasker = pipeline('fill-mask', model='roberta-base')
unmasker("Hello I'm a <mask> model.")

Or load the encoder directly to extract features that you feed into a classifier head:

from transformers import RobertaTokenizer, RobertaModel
tokenizer = RobertaTokenizer.from_pretrained('roberta-base')
model = RobertaModel.from_pretrained('roberta-base')
encoded = tokenizer("Replace me by any text you'd like.", return_tensors='pt')
output = model(**encoded)

The training recipe, in numbers

The Hugging Face card documents both the data mix and the optimizer settings, which is unusual for a checkpoint this old and useful if you are trying to reproduce or extend it. The pretraining corpus is a union of five datasets:

  • BookCorpus, 11,038 unpublished books
  • English Wikipedia, excluding lists, tables and headers
  • CC-News, 63 million English news articles crawled between September 2016 and February 2019
  • OpenWebText, an open source recreation of the WebText dataset used to train GPT-2
  • Stories, a subset of CommonCrawl filtered to match the style of Winograd schemas

Together these weigh 160GB of text. Inputs are tokenized with a byte-level Byte-Pair Encoding scheme over a 50,000 token vocabulary, and the model consumes 512 contiguous tokens at a time, which may span document boundaries.

The masking scheme deviates from vanilla BERT in a couple of important ways. Fifteen percent of the tokens are masked. In 80% of those cases the masked tokens are replaced by the mask token, in 10% they are replaced by a random token different from the one they replace, and in the remaining 10% they are left as is. Critically, the masking is applied dynamically during pretraining, so it changes at each epoch rather than being fixed once, which is one of the changes that separates RoBERTa from BERT.

Compute-wise, training ran on 1024 V100 GPUs for 500K steps with a batch size of 8K and a sequence length of 512. The optimizer was Adam with a learning rate of 6e-4, beta1 of 0.9, beta2 of 0.98, epsilon of 1e-6, weight decay of 0.01, warmup over 24,000 steps, and linear decay afterward.

What the benchmarks look like

The card publishes GLUE test results after fine-tuning, which is the honest way to measure an encoder that is not meant to be used raw:

MNLIQQPQNLISST-2CoLASTS-BMRPCRTE
87.691.992.894.863.691.290.278.7

Those numbers are why RoBERTa-base still shows up as a starting point for sentiment classifiers, entailment models, and question answering heads. For a 0.1B parameter encoder, the accuracy per dollar on CPU or a small GPU is hard to beat when your task is well defined.

Bias baked into the weights

The card devotes real space to bias, and the examples are worth reading before you push a fine-tune into production. The training data pulls heavily from unfiltered internet text, which is far from neutral, so the model can produce biased predictions. To demonstrate, the card prompts the fill-mask pipeline with occupation templates and shows that predictions shift substantially based on the demographic descriptor in the prompt. Any fine-tune inherits that behavior unless you actively counter it.

When it is the right tool

RoBERTa-base is worth reaching for when you match a specific profile:

  • You need an English encoder for classification, token tagging, or extractive question answering, and you plan to fine-tune.
  • You want something small enough to serve cheaply, at roughly 0.1B parameters and a 512-token context.
  • You value ecosystem support: the checkpoint ships with PyTorch, TensorFlow, JAX, Rust, and Safetensors weights, plus SageMaker and Azure deployment paths.
  • You want a documented training recipe you can point to for compliance or reproduction.

It is the wrong tool if you need long context, multilingual coverage, generation, or instruction following. For those, the model card itself points you elsewhere, and that self-awareness is part of what makes this listing a useful reference rather than just another checkpoint drop.