What it is used for

RoBERTa is used for understanding text in large quantities. Its standard work is classifying writing, for example sorting customer reviews into satisfied and disappointed, routing incoming mail by its business, or tagging news by topic. It is also used to find answers inside documents, to judge whether two sentences mean similar things, and as the reading engine behind search that understands what a question means. Because it is small compared with modern generative models, it remains a cheap and fast choice for classification work like this in many systems to this day.

Those jobs are exactly what its standard test suites measure. GLUE, a suite of nine language understanding tasks, covers judging the feeling of a sentence, recognising paraphrases, scoring the similarity of two sentences, and deciding whether one sentence logically follows another. SQuAD tests finding an answer inside a passage, including recognising questions whose answer is not there. RACE tests comprehension of long passages from English examinations in Chinese middle and high schools, with more than 28,000 passages and nearly 100,000 multiple choice questions, many of which demand reasoning rather than word matching.

How to use it

RoBERTa is not used by asking it questions. A developer takes its openly released base model, then tunes it further with labelled examples from the intended job, for example hundreds of reviews already marked satisfied or disappointed, until the model is skilled at that job. Once tuned, the model receives new text and returns its class or its confidence score. Its authors released the model and code, and they spread widely through Hugging Face, so this tuning work can be done on one's own machines without a paid service.

The paper itself gives an honest picture of that tuning work. Its authors tried small batch sizes of 16 or 32 examples with very small learning rates, trained for about ten passes, and stopped early once the development measure stopped rising. Because a tuning result can shift with its random starting point, they reported the middle value of five runs, not the best number that happened to appear. For the small tasks inside GLUE, their tuning started not from the base model but from a model already tuned on the largest task, MNLI, and borrowing the tuning of a large task in this way helped tasks with few examples. For SQuAD they deliberately added no outside question answering data, unlike their competitors, and still reached the top position.

Its training data

Half of RoBERTa's lesson is its data. The original BERT trained on 16 gigabytes of text, namely BookCorpus and English Wikipedia. RoBERTa's authors kept that data and added three more corpora until the whole exceeded 160 gigabytes, ten times as much. The largest is CC-News, a corpus they collected themselves from the news portion of CommonCrawl: 63 million English news articles gathered from September 2016 to February 2019, amounting to 76 gigabytes after filtering. After it come OpenWebText at 38 gigabytes, web material from addresses shared on Reddit that received at least three upvotes, and Stories at 31 gigabytes, a filtering of CommonCrawl chosen because its style resembles stories. All five corpora are English, and their authors showed in layers that adding data and training longer kept raising results, until even their longest trained model showed no sign of having had enough of its data.

Practitioner level

Practitioners choose between its two sizes: the base at about 125 million parameters for speed and low cost, and the large at about 355 million parameters for higher accuracy. What most decides its quality is not the base model but the labelled examples for tuning it: clean examples that represent the real work are worth far more than a larger model. Practitioners also remember that RoBERTa is only as good as the language of its training material; the original model is English, and for other languages people use descendants of its recipe trained across many languages.

Two further practical points are worth knowing before choosing it. First, the way it cuts text into word pieces uses a byte based encoding of 50,000 units, larger than BERT's 30,000, and the benefit shows daily: any text at all, including foreign words, misspellings, and mixtures of symbols, can be encoded with no piece turning into an unknown marker. Second, training a model like this from nothing is not a practitioner's job: its paper records RoBERTa's initial training running on 1,024 V100 graphics cards for about a day, and its training ladder was extended from 100,000 to 500,000 steps. Nearly all users therefore take the finished model and pay only the far smaller cost of tuning. Also worth budgeting is the uncertainty of tuning itself: on tasks with few examples, results can differ from one run to another, so a careful practitioner tunes several times and judges on held back data rather than trusting a single number.

Expert level

RoBERTa's recipe consists of four simple changes, measured one by one in a careful replication study: training longer with larger batches over far more data, removing the next-sentence guessing objective, which turned out not to help, training on longer text sequences, and changing the hidden-word pattern dynamically each time the data comes in, rather than fixing one pattern forever. Its authors also collected a new news corpus called CC-News of 76 gigabytes, bringing all the training material to about 160 gigabytes, ten times BERT's original material. The result read on the GLUE board as a score of 88.5 and the top position of its time. The lesson it left reaches beyond the model itself: before declaring a new method better, check first whether the old method was simply undertrained, because training choices can matter as much as model design.

Behind that summary sit the details that make its proof strong. In its masked lesson, 15 percent of words are chosen to be guessed, and of those chosen, 80 percent are replaced by the mask marker, 10 percent are left as they are, and 10 percent are replaced by a random word. The original BERT made that mask pattern once at the start and duplicated its data ten times, so each sentence was seen with the same mask four times during training; RoBERTa draws a fresh pattern every time a sentence comes in, and the dynamic way proved equal or slightly better. For the next-sentence lesson, they compared four input forms and found that full sentences taken in order from a single document, with that lesson removed entirely, gave the best results, contrary to the original BERT paper's report that removing it hurt. For batch size, they showed the same cost can be spent as 256 sequences for a million steps or 8,000 sequences for 31,000 steps, and the large batch form gave better quality and was easier to split across many machines. The final ladder of results shows the causes in layers: on the original data at 100,000 steps its SQuAD scores were 93.6 and 87.3; adding data to 160 gigabytes raised them; and training longer to 500,000 steps brought them to 94.6 and 89.4, with MNLI at 90.2. On SQuAD 2.0 it set a new best mark of its time, and on RACE an accuracy of 83.2 that was the best at both school levels.

Limits and risks

RoBERTa does not generate text, so it cannot replace a conversational model for writing or answering in its own words. Nor can it be used as it stands: every job demands tuning with labelled examples, and skewed examples produce a skewed classifier, for example a review judge that is harsh toward one dialect or style of language. The original model is English and carries 2019 knowledge, and for complicated understanding work larger modern models are now generally more accurate, at a higher cost as well. Its lasting position is as the standard reference on training quality and as a light worker for text classification, not as an all-purpose model.

Its language limit is not just a label: all five of its training corpora are English, and its news corpus stops in February 2019, so terms, names, and events after that are absent from its knowledge. Its tuning results also carry an uncertainty that must be managed: the paper itself reports the middle of five runs because a single run can stray, above all on tasks with few examples, so a quality figure from one tuning run must not be treated as a promise. And while tuning it is cheap, initially training a model of this class demands large data centre infrastructure, so users depend on the weights its makers released and cannot easily recheck its training from nothing.