AI Logic

Datasets and Benchmarks

MMLU

Updated:

MMLU subjects and evaluation procedure. Left: the 57 subjects grouped into four areas (STEM, humanities, social sciences, and other), with the number of subjects, example subjects, and question counts per split. Right: the flow in which a prompt containing a subject description, five dev examples, and a test question is given to the model, the model outputs probabilities for A to D, the highest is taken as the answer, and accuracy is computed over all questions.

Overview

MMLU (Measuring Massive Multitask Language Understanding) is a benchmark of four-choice questions across 57 subjects, including mathematics, history, law, and medicine, that measures how broad a language model's knowledge is and how well it can use it. Hendrycks and colleagues at the University of California, Berkeley published it in 2020 (ICLR 2021). It contains about 16,000 questions, and the metric is accuracy.

It was created because models quickly reached human performance on sentence-understanding benchmarks such as GLUE and SuperGLUE. Meanwhile, how much specialized knowledge large models pretrained on Wikipedia and books had acquired went unmeasured. MMLU is therefore designed as follows.

  • Cover a wide range of subjects people study: It includes subjects of varying difficulty, from elementary arithmetic up to graduate entrance exams and professional licensing exams for doctors and lawyers.
  • Provide no training data: Only five example questions per subject are given, and models must answer using knowledge acquired during pretraining alone (zero-shot or few-shot). This resembles how people are evaluated with exams.
  • Use four choices to simplify scoring: Scoring generated free-text answers is difficult, so models choose one of A–D and are compared by accuracy.

MMLU measures not "Can the model solve tasks it learned from training data?" but "Can it apply knowledge gained from text read during pretraining to unseen questions?" For this reason, it became a leading metric for comparing the performance of large language models with a single number from GPT-3 onward.

Contents: 57 subjects and splits

The questions were collected manually by graduate and undergraduate students from questions freely available online. They include practice questions for the US Graduate Record Examination (GRE) and the United States Medical Licensing Examination (USMLE), questions for university courses, and questions for readers of Oxford University Press books. Even within the same field, subjects are divided by difficulty into levels such as "elementary," "high school," "college," and "professional." For example, "professional psychology" is built from practice questions for professional psychology licensing exams, and "high school psychology" from questions like those on advanced high school exams (AP).

The 57 subjects fall into four broad areas (subject counts follow the classification in the official repository).

AreaSubjectsExample subjectsSkills required
STEM18Abstract algebra, college physics, high school mathematics, machine learning, electrical engineeringCalculation and step-by-step reasoning
Humanities13Professional law, moral scenarios, philosophy, formal logic, world historyApplying rules to situations, understanding norms
Social sciences12Econometrics, high school psychology, US foreign policy, sociologyWorld knowledge and qualitative and quantitative reasoning
Other14Professional medicine, marketing, accounting, virology, global factsSpecialized knowledge requiring long study, business knowledge

The "moral scenarios" subject in the humanities uses questions from the ETHICS dataset by the same authors. Mathematical expressions are written as text using LaTeX or symbols such as * and ^.

The splits are all for evaluation.

SplitQuestions in the paperQuestions in the released dataUse
dev5 per subject285Examples placed in few-shot prompts
validation1,5401,531Hyperparameter tuning
test14,07914,042Final accuracy

Every subject has at least 100 test questions. The counts in the paper differ slightly from those in the Hugging Face release (cais/mmlu). The release also includes auxiliary training data for fine-tuning experiments (auxiliary_train, 99,842 questions).

Each question is a set of "question text, four choices, and the letter of the correct answer." In the paper's example from high school mathematics, "How many numbers are in the list 25, 26, ..., 100? (A 75, B 76, C 22, D 23)," the answer is B.

As reference points for human performance, the paper gives the following two figures.

  • Non-experts: Amazon Mechanical Turk workers score 34.5%.
  • Expert level: Applying the accuracy of the top 5% (95th percentile) of the original exam takers to each subject, and estimating subjects without data, gives about 89.8%.

Evaluation rules

MMLU is evaluated with the following steps. The original paper focuses on few-shot evaluation in which the model answers without fine-tuning.

  1. Build the prompt. It begins with "The following are multiple choice questions (with answers) about [subject].", followed by up to five dev questions from that subject with answers, and ends with the test question in a form ending with "Answer:". With no examples it is zero-shot; with five it is 5-shot.
  2. Have the model predict the next token. Compare the probabilities that "A," "B," "C," or "D" follows "Answer:" and take the highest as the model's answer.
  3. Compute accuracy over all questions. Accuracy is computed over the test questions of all 57 subjects combined.

With xix_i as the prompt for question ii, yiy_i as the correct answer, and NN as the number of test questions, overall accuracy can be written as follows.

Acc=1N∑i=1N1 ⁣[arg⁡max⁡c∈{A,B,C,D}p(c∣xi)=yi]\mathrm{Acc} = \frac{1}{N} \sum_{i=1}^{N} \mathbf{1}\!\left[ \arg\max_{c \in \{A, B, C, D\}} p(c \mid x_i) = y_i \right]

1[⋅]\mathbf{1}[\cdot] is a function that is 1 when its argument is true and 0 when it is false. With four choices, random guessing yields 25% accuracy. The averages in the original paper's table are accuracy over all questions from all subjects combined (an average weighted by the number of questions).

MMLU scores change by several points depending on the evaluation method. Values from different papers cannot be compared unless the number of examples (zero-shot or 5-shot), the prompt wording, how answers are determined (choosing by the probabilities of the letters A–D, or generating text and extracting a letter), and how the average is taken (weighted by question or averaging per-subject accuracy) are matched. Always state these conditions when reporting.

Besides accuracy, the original paper also examines how far the model's confidence diverges from its accuracy (calibration). For zero-shot GPT-3, the gap between average confidence and actual accuracy per subject reached up to 24%, and up to 14% even with 5-shot.

Usage and historical significance

MMLU became the standard benchmark for comparing the knowledge and problem-solving ability of large language models with a single accuracy number. Many papers introducing new models report 5-shot MMLU scores.

At the time of the original paper, most models performed close to random.

ModelEvaluation methodHumanitiesSocial sciencesSTEMOtherAverage
Random guessingNone25.025.025.025.025.0
RoBERTa-baseFine-tuning27.928.827.027.727.9
ALBERT-xxlargeFine-tuning27.225.727.727.927.1
GPT-2Fine-tuning32.833.330.233.132.4
UnifiedQA (11B parameters)As trained on other QA tasks45.656.640.254.648.9
GPT-3 (13B parameters)Few-shot27.125.624.326.526.0
GPT-3 (175B parameters)Few-shot40.850.436.748.843.9

Values are in %. GPT-3 scored about 25% up to 13B parameters, no better than random, and rose to 43.9% only at 175B parameters. Differences across subjects were also large: GPT-3's accuracy ranged from 69% on US foreign policy to 26% on college chemistry. It was especially weak on calculation-heavy STEM subjects and on subjects involving human value judgments, such as law and morality. Using the example that GPT-3 can explain the order-of-operations rule (PEMDAS) yet cannot apply it in actual calculations, the paper points out the difference between knowing something as knowledge and being able to use it as a procedure.

Later, as models grew larger and training data increased, 5-shot accuracy rose sharply.

PaperModel5-shot average
Rae et al. (2021)Gopher (280B parameters)60.0
Hoffmann et al. (2022)Chinchilla (70B parameters)67.5
Touvron et al. (2023)LLaMA-65B63.4
OpenAI (2023)GPT-486.4
Hendrycks et al. (2020)Expert level (estimated)89.8

(Gopher and Chinchilla values are from the leaderboard in the official MMLU repository; the LLaMA value is from Table 9 of the LLaMA paper.)

The GPT-4 technical report also states that MMLU was translated into 26 languages with Azure Translate, and that in 24 of them GPT-4 surpassed the previous best English-language result. As accuracy approached expert level, harder successor benchmarks such as MMLU-Pro were created.

Caveats

License: The question data and evaluation code are released under the MIT License in the official repository. They can be used for commercial evaluation, but the copyright and license notice are required. The official repository asks users to cite, along with MMLU, the paper on the ETHICS dataset on which some questions are based.

MMLU contains erroneous questions. The MMLU-Redux paper (Gema et al. 2024) had experts review 5,700 questions across the 57 subjects and estimated that about 6.49% of all MMLU questions contain errors (wrong answer keys, incomplete questions, multiple correct answers, etc.). In virology, 57% of the reviewed questions contained errors. Small differences between models with accuracy near 90% may be determined by errors in the questions.

Test-set leakage: MMLU's questions were collected from problem sets published online, and MMLU itself is distributed online. If questions and answers appear verbatim in pretraining data, accuracy will be higher than the model's true ability. The original paper found no sign that GPT-3 had memorized the questions, but when evaluating new models, check for overlap with the training data or compare on questions without overlap.

Limits of the multiple-choice format: Because the task is guessing one of four letters, it cannot measure the ability to explain answers or to solve problems without choices. Scores can also change with the order of choices or small differences in the prompt. In the original paper, UnifiedQA's accuracy dropped by several points just from removing one trailing character from the input.

Averages hide weaknesses: Even with a high average accuracy, a model may score low on calculation-heavy subjects or on law and morality. Check the accuracy of the subjects relevant to your use case individually.

Focused on English and US content: The questions are in English, and many subjects are based on US exams, such as US history, law, and foreign policy. MMLU cannot measure knowledge of Japanese or Japanese institutions.

Comparison with similar benchmarks

Benchmarks for comparing language models line up as follows from the same perspective.

BenchmarkQuestion formatWhat it measuresHow it is evaluatedBest suited for
MMLUFour choices across 57 subjects; about 14,000 test questionsBroad knowledge and problem-solving abilityFew-shot choice among A–D; accuracyComparing the breadth of knowledge of large language models
GLUESingle- and two-sentence classification in nine tasksSentence understanding (sentiment, paraphrase, inference)Predictions of fine-tuned models scored on a serverComparing fine-tuning of pretrained models
SuperGLUEEight tasks: classification, coreference, question answeringHarder reasoning and reading comprehension than GLUESame as aboveComparing models that GLUE no longer separates
SQuADExtract the answer span from a paragraphReading comprehensionExact match and F1Comparisons focused on reading comprehension and question answering
MMLU-ProUp to 10 choices across 14 areas; 12,032 questionsKnowledge questions requiring more reasoning than MMLUAccuracy (also evaluated with written reasoning steps)Comparing models that MMLU no longer separates

(MMLU-Pro details are from the MMLU-Pro paper.)

MMLU-Pro (Wang et al. 2024) regroups MMLU's 57 subjects into 14 areas, removes overly easy and erroneous questions, adds questions that require reasoning, and increases the number of choices from four to up to ten. The paper reports that accuracy drops by 16–33% compared with MMLU and that score variation due to prompt differences shrinks from 4–5% to 2%.

Rough guidelines for choosing:

  • To compare the breadth of knowledge of large language models under the same conditions as other papers, report 5-shot MMLU accuracy along with the evaluation conditions.
  • To see differences among top models, use MMLU-Pro or the corrected MMLU-Redux, since MMLU hardly separates them.
  • To fine-tune and compare sentence-understanding models, use GLUE or SuperGLUE.
  • To measure reading comprehension that finds answers in text, use SQuAD.

PyTorch example

Show code
python
import torch
from datasets import load_dataset
from transformers import AutoModelForCausalLM, AutoTokenizer

"""
Evaluate MMLU (cais/mmlu) with 5-shot prompts in the same format as the original paper's official evaluation code
Place the five dev questions of each subject in front as examples, and choose the answer by which of A, B, C, D is most likely to follow the final "Answer:"
"""

CHOICES = ['A', 'B', 'C', 'D']


def format_example(ex, with_answer=True):
  text = ex['question']
  for letter, choice in zip(CHOICES, ex['choices']):
    text += f'\n{letter}. {choice}'
  text += '\nAnswer:'
  if with_answer:
    text += f' {CHOICES[ex["answer"]]}\n\n'  # answer is an index from 0 to 3
  return text


def build_prompt(subject, shots, ex):
  head = f'The following are multiple choice questions (with answers) about {subject.replace("_", " ")}.\n\n'
  return head + ''.join(format_example(s) for s in shots) + format_example(ex, with_answer=False)


@torch.no_grad()
def evaluate(model_name, subjects):
  tok = AutoTokenizer.from_pretrained(model_name)
  model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype=torch.bfloat16)
  model.eval()  # evaluation, so disable Dropout etc.
  # token IDs for " A" to " D" following "Answer:" (whether the leading space is included depends on the tokenizer)
  letter_ids = [tok(' ' + c, add_special_tokens=False).input_ids[-1] for c in CHOICES]
  correct, total, per_subject = 0, 0, {}
  for subject in subjects:
    data = load_dataset('cais/mmlu', subject)
    shots = list(data['dev'])[:5]  # fix the examples to the five dev questions
    hits = []
    for ex in data['test']:
      ids = tok(build_prompt(subject, shots, ex), return_tensors='pt').input_ids
      logits = model(ids).logits[0, -1]  # prediction for the next token
      pred = int(torch.argmax(logits[letter_ids]))  # the most probable of the four choices
      hits.append(pred == ex['answer'])
    per_subject[subject] = sum(hits) / len(hits)
    correct += sum(hits)
    total += len(hits)
  # the original paper's average is accuracy over all questions combined (weighted by number of questions)
  return correct / total, per_subject


# subjects = ['abstract_algebra', 'anatomy', ...]  # 57 subjects ('all' loads them together)
# acc, per_subject = evaluate('model-name', subjects)

FAQ

Q. Does MMLU have training data?
A.

The core of MMLU is for evaluation only: five dev questions per subject (few-shot examples), validation (for tuning), and test (for final evaluation). Assuming that models acquire knowledge from the text they read during pretraining, the original paper is designed not to provide a large training set. The release also includes auxiliary training data (auxiliary_train), but you must not train on the test questions.

Q. How much do 5-shot and zero-shot scores differ?
A.

For GPT-3 (175B parameters) in the original paper, zero-shot scored about 37.7% and 5-shot 43.9%, and accuracy rose as the number of examples increased. The gap differs by model, however. When comparing scores, compare only values evaluated with the same number of examples.

Q. If a model has high MMLU accuracy, is it expert-level?
A.

Not necessarily. MMLU is an exam of guessing one of four letters, so it cannot measure the ability to explain the reasoning behind an answer or to solve real problems without choices. In addition, about 6.49% of the questions are estimated to contain errors, and test questions may have leaked into the training data. Judge in combination with accuracy on subjects relevant to your use case and with other benchmarks.

References

  1. Hendrycks, D., Burns, C., Basart, S., Zou, A., Mazeika, M., Song, D., & Steinhardt, J. (2020). Measuring Massive Multitask Language Understanding. ICLR 2021.
  2. hendrycks/test (official repository, evaluation code, and leaderboard).
  3. cais/mmlu (Hugging Face dataset card).
  4. Touvron, H., et al. (2023). LLaMA: Open and Efficient Foundation Language Models.
  5. OpenAI (2023). GPT-4 Technical Report.
  6. Gema, A. P., et al. (2024). Are We Done with MMLU? (MMLU-Redux).
  7. Wang, Y., et al. (2024). MMLU-Pro: A More Robust and Challenging Multi-Task Language Understanding Benchmark. NeurIPS 2024 Datasets and Benchmarks Track.