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.
| Split | Task IDs | Number of tasks | Intended use |
|---|---|---|---|
| Few-shot prompts | 1 to 10 | 10 | Examples placed in the prompt |
| Test | 11 to 510 | 500 | Reported evaluation results |
| Validation | 511 to 600 | 90 | Tuning prompts and settings |
| Training | 601 to 974 | 374 | Fine-tuning experiments |
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.
| Variant | Size | Main difference |
|---|---|---|
| Full MBPP test split | 500 tasks | Original wording and tests |
| Sanitized MBPP | 427 tasks across splits | Clarified descriptions |
| MBPP+ (EvalPlus) | Curated subset | Many additional generated tests |
| Zero-shot setting | Any variant | No worked examples in the prompt |
| Few-shot setting | Any variant | Three or more solved examples in the prompt |
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.
| Benchmark | Task type | Difficulty | Main strength |
|---|---|---|---|
| MBPP | One-sentence request to function | Basic | Broad everyday coverage |
| HumanEval | Docstring to function | Basic to moderate | Widely cited baseline |
| BigCodeBench | Tasks using many libraries | Moderate to hard | Realistic API usage |
| LiveCodeBench | Recent contest problems | Moderate to hard | Reduced contamination |
| SWE-bench | Fix real repository issues | Hard | End-to-end engineering |
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.
| Problem | Consequence | Mitigation |
|---|---|---|
| Only three tests per task | Incorrect code can still pass | Use MBPP+ with extra tests |
| Ambiguous descriptions | Correct intent fails the tests | Prefer the sanitized subset |
| Data contamination | Inflated scores from memorized tasks | Add newer, held-out benchmarks |
| Score saturation | Leading models cluster near the top | Report harder benchmarks too |
| Python only | No view of other languages | Use multilingual translations |
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.