MBPP

Also known as: Mostly Basic Python Problems

On this page 7

MBPP, short for Mostly Basic Python Problems, is a code generation benchmark of 974 short programming tasks, each pairing a one-sentence natural-language description with a reference solution and three automated test cases. In AI for coding, it is one of the standard ways to measure whether a language model can turn a plain request into a correct Python function.

The dataset was released by Google Research in 2021 together with a study of program synthesis with large language models. Its tasks were written to be solvable by an entry-level programmer, which makes MBPP a test of everyday coding competence rather than of advanced algorithmic skill.

How MBPP problems and tests are structured

Every MBPP item has three parts: a short task description such as a request to find the shared elements of two lists, a reference solution written by a human, and three assert statements that call the function and check its output. The model receives the description and, in the usual setup, the test cases so that it knows the expected function name and signature.

A generated program counts as correct only if it passes all three tests when executed. This functional correctness criterion replaced older text-similarity scores, because two programs can look very different and still both be right. The table below lists the official splits of the full dataset.

SplitTask IDsNumber of tasksIntended use
Few-shot prompts1 to 1010Examples placed in the prompt
Test11 to 510500Reported evaluation results
Validation511 to 60090Tuning prompts and settings
Training601 to 974374Fine-tuning experiments
Official splits of the full MBPP dataset

Problems cover list and string manipulation, simple mathematics, basic data structures and short loops. Typical reference solutions are under ten lines, and few tasks require knowledge of libraries beyond the Python standard library.

Scoring with pass@k and the sanitized subset

Results on MBPP are usually reported as pass@k: the probability that at least one of k sampled programs passes all tests. Pass@1 reflects the experience of a user who accepts the first answer, while pass@10 or pass@100 shows how often a correct answer exists somewhere in the model’s samples. The unbiased estimator draws n samples per problem and computes the expected pass rate for k of them.

Because some original descriptions were ambiguous or inconsistent with their tests, the authors also released a sanitized subset of 427 problems with hand-verified wording. Scores from the full and sanitized versions are not directly comparable, so serious reports state which variant, which prompt format and which sampling temperature they used.

VariantSizeMain difference
Full MBPP test split500 tasksOriginal wording and tests
Sanitized MBPP427 tasks across splitsClarified descriptions
MBPP+ (EvalPlus)Curated subsetMany additional generated tests
Zero-shot settingAny variantNo worked examples in the prompt
Few-shot settingAny variantThree or more solved examples in the prompt
Common MBPP reporting variants

MBPP compared with other coding benchmarks

MBPP is usually reported alongside HumanEval, and the two benchmarks are complementary. HumanEval gives the model a function signature and docstring, while MBPP gives a plain one-sentence request, so MBPP tests prompt interpretation slightly more. Both are short, single-function tasks, which is why newer benchmarks were created for repository-level and contamination-resistant evaluation.

BenchmarkTask typeDifficultyMain strength
MBPPOne-sentence request to functionBasicBroad everyday coverage
HumanEvalDocstring to functionBasic to moderateWidely cited baseline
BigCodeBenchTasks using many librariesModerate to hardRealistic API usage
LiveCodeBenchRecent contest problemsModerate to hardReduced contamination
SWE-benchFix real repository issuesHardEnd-to-end engineering
Where MBPP sits among code benchmarks

In practice, MBPP serves as a quick sanity check: a model that scores poorly on it will almost certainly struggle with harder agentic coding work, but a high score says little about multi-file editing, debugging or working inside a large codebase.

Using MBPP correctly in model evaluation

Running MBPP requires executing untrusted model output, so evaluation harnesses run each program inside a sandbox with time limits and no network access. Results also depend on details that are easy to overlook, which is why the following practices are standard.

  • Fix the prompt template and state whether test cases appear in the prompt.
  • Report sampling settings, including temperature and number of samples per task.
  • Specify the dataset variant: full, sanitized or MBPP+.
  • Strip extra output such as explanations before executing the code.
  • Compare models under one harness, not across numbers from different papers.

Teams fine-tuning their own code models often use MBPP as a regression test: a sudden drop after a training change signals damaged basic coding ability even when headline chat quality looks unchanged.

Limitations, saturation and contamination

MBPP has well-known weaknesses that limit how much a single score can prove. The most important are summarized below together with their typical mitigation.

ProblemConsequenceMitigation
Only three tests per taskIncorrect code can still passUse MBPP+ with extra tests
Ambiguous descriptionsCorrect intent fails the testsPrefer the sanitized subset
Data contaminationInflated scores from memorized tasksAdd newer, held-out benchmarks
Score saturationLeading models cluster near the topReport harder benchmarks too
Python onlyNo view of other languagesUse multilingual translations
Known weaknesses of MBPP

Because the dataset has been public since 2021, many tasks have likely appeared in web-scale training data. Strong recent models score very high on MBPP, so differences of a few points between top systems are rarely meaningful.

In simple terms

MBPP is a set of small programming exercises for AI. Each exercise asks for one short Python function. Examples include reversing words or finding the largest number in a list.

The AI writes code, and a computer runs three quick checks on it. If all three checks pass, the answer counts as correct. The final score is the share of exercises solved. It works like a basic driving test: passing shows core skill, not readiness for every road.

A practical example

An engineering team at a mid-sized software company is choosing a small open-weight model for in-editor code completion. They shortlist three models of 7 to 15 billion parameters and evaluate all of them in one harness on sanitized MBPP and MBPP+, using pass@1 at temperature zero inside a Docker sandbox.

Two models score within two points of each other on MBPP, but one drops much further on MBPP+, showing that it often writes code that passes the three original tests but fails edge cases. The team selects the more robust model, then confirms the choice with a week of internal trials measuring suggestion acceptance rate. MBPP did not make the final decision alone, but it quickly removed a weaker candidate at almost no cost.