Datasets & Benchmarks
MNIST
The dataset of 70,000 handwritten digits, 28 × 28 pixels, that LeCun, Cortes and Burges built from NIST's handwriting collections at Bell Labs in 1994, how its writers were split and its images normalized, why its 10,000-image test set is saturated, and the EMNIST, QMNIST and Fashion-MNIST datasets that extend, reconstruct or replace it.
beginner
MNIST (Modified NIST) is a dataset of 70,000 images of handwritten digits, each a grayscale image of one digit with its class from 0 to 9, split into 60,000 training and 10,000 test images. Yann LeCun, Corinna Cortes and Christopher Burges built it at AT&T Bell Laboratories in 1994 by re-mixing two collections of the US National Institute of Standards and Technology (NIST): digits written by Census Bureau employees and digits written by high-school students. Bottou et al. (1994) were the first to describe it in print, according to Yadav and Bottou (2019), and LeCun, Bottou, Bengio and Haffner (1998) used it for the classifier comparison in which LeNet-5 appeared and gave the address where it could be downloaded. Small, clean, already normalized and stored in a format a few lines of code can read, it became what Yadav and Bottou call a standard machine learning benchmark for more than twenty years. Error rates fell from 12% for a linear classifier to about 0.2% by 2012, and today MNIST serves mostly as a sanity check and a teaching set, while its descendants EMNIST, QMNIST and Fashion-MNIST keep its format for harder or better-documented tasks.
Purpose
The digits come from NIST’s handprinted character collections, distributed on CD-ROM and used for a recognition competition in which the training data was NIST Special Database 3 and the test data a set Bottou et al. (1994) call NIST Test Data 1. The training digits had been written by Census Bureau employees and the test digits by high-school students, and the test digits were much harder: Bottou et al. report that many competitors who reached under 1% error on validation sets drawn from the training data did much worse on the test data. LeCun et al. (1998, §III.A) give the same reason for building a new database: SD-3 is much cleaner and easier to recognize than SD-1, and sensible conclusions from learning experiments need results that do not depend on which part of the full collection is chosen for training and which for testing. MNIST therefore mixes the two populations so that its training and test sets come from one distribution, while keeping the writers of the two sets apart.
The official page states the second purpose: a database for trying learning techniques and pattern recognition methods on real-world data with minimal effort spent on preprocessing and formatting. The digits arrive segmented, size-normalized and centred, so a classifier can be applied to the raw pixels; this is what made MNIST the standard comparison for image classification methods that learn from pixels.
Construction
Writers and the split
The recipe is printed three times in nearly the same words: by Bottou et al. (1994, §2.4), by LeCun et al. (1998, §III.A) and on the official page. The NIST test collection, given as 58,527 digits by 500 writers, stored in scrambled order, was unscrambled using its writer identities. The digits of the first 250 writers went to the new training set and those of the other 250 to the new test set, giving two sets of nearly 30,000 digits each. The training set was completed to 60,000 with digits from the NIST training collection starting at pattern 0, and the test set to 60,000 with digits from that collection starting at pattern 35,000. Only 10,000 test images were used in the 1998 experiments and distributed: 5,000 from each source.
Yadav and Bottou (2019) traced every MNIST digit back to its NIST source and corrected several of these details:
- Sources. The two collections are the partitions of NIST Special Database 19, which NIST describes as the final accumulation of its handprinted sample data (3,600 writers, about 810,000 character images, as of October 2026): series hsf0 to hsf3, written by writers 0 to 2099, and series hsf4, written by writers 2100 to 2599 (QMNIST README). Yadav and Bottou write that calling them SD-3 and SD-1, as the 1998 paper and the page do, is incorrect, and that the hsf4 partition contains 58,646 digits, not 58,527; the EMNIST paper’s table of Special Database 19 also gives 58,646 test digits.
- Training set. The even-numbered images among the first 58,100 are the digits of writers 2100 to 2349, all high-school students, in random order; the remaining images are NIST digits 0 to 30,949 in their original order. By our count that is 29,050 student digits and 30,950 Census Bureau digits. The official page’s statement that the training set contains examples from about 250 writers thus appears to count only the student half (our reading); the Census half comes from further writers, in NIST’s own order.
- Test set. The first 5,001 images appear to be drawn at random from writers 2350 to 2599, all high-school students; the next 4,999 are consecutive NIST digits 35,000 to 39,998, written by only 48 Census Bureau employees (writers 326 to 373). The writer ranges of the training and test sets do not overlap (for the Census digits, because NIST stores each writer’s digits in one block; our inference). The official page’s file-format section says the opposite about the order, that the first 5,000 test images come from the original NIST training set and are the cleaner ones; the trace contradicts it.
- Duplicates. The whole NIST collection contains exactly three duplicated digits, and the one inside MNIST’s segments had been removed by its creators.
Two practical consequences follow. Because training images alternate between a student digit and a Census digit, and the Census digits run in writer order, half of a minibatch of consecutive training images is likely to come from one writer; Yadav and Bottou recommend shuffling. And MNIST has no official validation set: a validation set must be carved from the 60,000 training images, and its writers will overlap those of the remaining training images unless it is chosen by writer, which only QMNIST’s metadata makes possible (our reasoning).
Preprocessing
NIST’s digits are bilevel (black and white) images of pixels. LeCun et al. (1998, §III.A) and the official page describe two steps:
- Size normalization. Each digit is scaled to fit in a box while preserving its aspect ratio, so the longer side of its bounding box becomes 20 pixels. The interpolation of the normalization algorithm turns the bilevel image into grey levels, which the paper calls anti-aliasing.
- Centring. The image is placed in a field so that the centre of mass of its pixels lies at the centre of the field.
Pixel values run from 0 for background to 255 for foreground. The page adds a note on its history: Burges and Cortes first selected and experimented with the digits using bounding-box normalization and centring, and the distributed version is LeCun’s, centred by centre of mass in the larger window. It also warns that some template-based methods, such as SVMs and k-nearest neighbours, do better on digits centred by bounding box, and asks authors who do this to report it.
The 1998 paper used three versions of the database: this regular one (sometimes extended to with background pixels, which is LeNet-5’s input); a deslanted one, sheared horizontally so that the principal axis of the ink, computed from its second moments, is vertical, and cropped to ; and, in early experiments, a version reduced to pixels. The regular version is the one the paper and the page give for download.
The descriptions leave out how the NIST images were cropped, how noise was removed, how the resampling worked and how the centre of mass was rounded. Yadav and Bottou reconstructed these steps, tuning their algorithm until its output matched the MNIST training images. Their findings about the original code:
- The resampling computes the exact overlap between input and output pixels rather than bilinear or bicubic interpolation, and the small NIST images were first doubled in resolution and then resampled to .
- A 0.99 fudge factor in that code produces faint periodic patterns in the dark interior of thick strokes.
- The final centring has a rounding error: the average centre of mass of MNIST digits lies half a pixel from the geometric centre of the field. This matters because, they report, training on correctly centred images gives substantially worse results on the standard test set.
- MNIST has noticeably more pixels of value 128 and fewer of value 255 than their linear mapping of each image’s range to 0–255 produces, and they could not find a simple algorithm that explains the difference.
Their final reconstruction, QMNIST, comes close: for at least three quarters of the training images the largest difference from the MNIST image is at most one grey level out of 255 (three in the worst case), once 147 of the 60,000 images are shifted back by the one pixel their reconstructed centre of mass had moved them across a pixel boundary (Tables 1 and 2).
Reproducing the preprocessing
The code renders digits from the fonts bundled with Matplotlib as bilevel images, with random size, width, slant, rotation, position and stroke thickness, as a stand-in for NIST’s scanned digits. It then applies the documented steps: crop the ink’s bounding box, resample it by exact pixel overlap so the longer side is 20 pixels, map the result to 0–255, and place it in a field by its centre of mass. Three placement rules are compared: centre of mass at the geometric centre (row and column index 13.5), centre of mass at index 14, which is one way a half-pixel offset like MNIST’s could arise, and bounding box at the centre. Finally, a 1-nearest-neighbour classifier trained on centre-of-mass digits is tested on digits placed by each rule.
import numpy as np
from matplotlib.font_manager import FontProperties
from matplotlib.textpath import TextPath
from matplotlib.transforms import Affine2D
from scipy.ndimage import binary_dilation
FONTS = [FontProperties(family=f, weight=w) for f in ("DejaVu Sans", "DejaVu Serif", "DejaVu Sans Mono")
for w in ("normal", "bold")]
yy, xx = np.mgrid[:128, :128] + 0.5
GRID = np.c_[xx.ravel(), 128 - yy.ravel()] # pixel centres, y axis pointing up
def nist_like(digit, rng):
"""A bilevel 128x128 image of a rendered digit with random size, slant, rotation, position, stroke."""
path = TextPath((0, 0), str(digit), size=1, prop=FONTS[rng.integers(len(FONTS))])
(x0, y0), (x1, y1) = path.vertices.min(0), path.vertices.max(0)
h = rng.uniform(40, 90) # glyph height in pixels
t = (Affine2D().translate(-(x0 + x1) / 2, -(y0 + y1) / 2)
.scale(h / (y1 - y0) * rng.uniform(0.7, 1.2), h / (y1 - y0))
.skew_deg(rng.uniform(-15, 15), 0).rotate_deg(rng.uniform(-10, 10))
.translate(*rng.uniform(40, 88, size=2)))
ink = t.transform_path(path).contains_points(GRID).reshape(128, 128)
return binary_dilation(ink, iterations=int(rng.integers(0, 3))) if ink.any() else ink
def overlap(n_in, scale, offset, n_out=20):
"""R[i, k] = length of input pixel k, mapped to [offset + k*scale, offset + (k+1)*scale),
that falls inside output pixel [i, i+1): exact area resampling."""
lo = offset + scale * np.arange(n_in)
i = np.arange(n_out)[:, None]
return np.clip(np.minimum(i + 1, lo + scale) - np.maximum(i, lo), 0, None)
def to_mnist(img, centring="mass"):
"""MNIST-style preprocessing of a bilevel image: fit the bounding box into 20x20 keeping the aspect
ratio (grey levels from area resampling), then place in a 28x28 field."""
r, c = np.nonzero(img)
crop = img[r.min():r.max() + 1, c.min():c.max() + 1].astype(float)
h, w = crop.shape
s = 20 / max(h, w) # longer side becomes exactly 20 pixels
box = overlap(h, s, (20 - h * s) / 2) @ crop @ overlap(w, s, (20 - w * s) / 2).T
box = np.round(255 * box / box.max()) # coverage fraction -> 0..255
if centring == "box": # bounding box centred in 28x28
dy = dx = 4
else: # centre of mass moved to the field's centre
idx = np.arange(20)
cy, cx = (box.sum(1) @ idx) / box.sum(), (box.sum(0) @ idx) / box.sum()
target = 14.0 if centring == "mass-index" else 13.5 # 13.5 = geometric centre in index units
dy, dx = (int(np.clip(np.floor(target - cy + 0.5), 0, 8)),
int(np.clip(np.floor(target - cx + 0.5), 0, 8)))
out = np.zeros((28, 28))
out[dy:dy + 20, dx:dx + 20] = box
return out
def com(x):
i = np.arange(28)
return (x.sum(1) @ i) / x.sum(), (x.sum(0) @ i) / x.sum()
def bbox_centre(x):
r, c = np.nonzero(x)
return (r.min() + r.max()) / 2, (c.min() + c.max()) / 2
# ---- One digit through the pipeline -------------------------------------------------------------
rng = np.random.default_rng(0)
raw = nist_like(7, rng)
r, c = np.nonzero(raw)
m = to_mnist(raw)
print(f"bilevel source: 128x128, ink box {np.ptp(r) + 1} x {np.ptp(c) + 1} pixels, values {np.unique(raw).astype(int)}")
print(f"MNIST-style: 28x28, ink box {np.ptp(np.nonzero(m)[0]) + 1} x {np.ptp(np.nonzero(m)[1]) + 1}, "
f"{len(np.unique(m))} grey levels, centre of mass ({com(m)[0]:.2f}, {com(m)[1]:.2f}), "
f"bounding-box centre ({bbox_centre(m)[0]:.1f}, {bbox_centre(m)[1]:.1f})")
for k, row in enumerate(m[4:27], start=4):
print(f" {k:2d} " + "".join("#" if v > 170 else "+" if v > 60 else "." if v > 0 else " " for v in row))
# ---- Where centring puts the ink, per class --------------------------------------------------
digits = [(d, nist_like(d, rng)) for d in np.repeat(np.arange(10), 100)]
for mode in ("mass", "mass-index", "box"):
X = np.array([to_mnist(img, mode) for _, img in digits])
cm = np.array([com(x) for x in X])
print(f"\n{mode:10} mean centre of mass (row, col) = ({cm[:, 0].mean():.2f}, {cm[:, 1].mean():.2f}), "
f"row range {cm[:, 0].min():.2f}-{cm[:, 0].max():.2f}")
if mode == "mass":
bc = np.array([bbox_centre(x) for x in X])
y = np.array([d for d, _ in digits])
print(" mean bounding-box centre row by class (13.5 = field centre):")
print(" " + " ".join(f"{d}:{bc[y == d, 0].mean():.1f}" for d in range(10)))
# ---- Training and test digits centred by different rules ---------------------------------------
def nn_error(Xtr, ytr, Xte, yte):
Xtr, Xte = Xtr.reshape(len(Xtr), -1), Xte.reshape(len(Xte), -1)
d2 = (Xte ** 2).sum(1)[:, None] - 2 * Xte @ Xtr.T + (Xtr ** 2).sum(1)[None]
return np.mean(ytr[d2.argmin(1)] != yte)
print("\n1-nearest-neighbour test error, trained on centre-of-mass digits (3,000 train, 1,000 test)")
errs = []
for seed in range(5):
rng = np.random.default_rng(100 + seed)
y = rng.integers(0, 10, 4000)
imgs = [nist_like(d, rng) for d in y]
Xtr = np.array([to_mnist(i, "mass") for i in imgs[:3000]])
e = [nn_error(Xtr, y[:3000], np.array([to_mnist(i, mode) for i in imgs[3000:]]), y[3000:])
for mode in ("mass", "mass-index", "box")]
errs.append(e)
print(f" seed {100 + seed}: test centred the same way {e[0]:.1%}, half-pixel target {e[1]:.1%},"
f" by bounding box {e[2]:.1%}")
errs = np.array(errs)
print(f" mean over seeds: {errs[:, 0].mean():.1%}, {errs[:, 1].mean():.1%}, {errs[:, 2].mean():.1%}")
Output (NumPy 2.3.5, SciPy 1.16.3, Matplotlib 3.10.6):
bilevel source: 128x128, ink box 55 x 32 pixels, values [0 1]
MNIST-style: 28x28, ink box 20 x 12, 30 grey levels, centre of mass (13.54, 13.40), bounding-box centre (15.5, 11.5)
4
5
6 .+++++###+
7 ##########.
8 +#########+
9 .##########
10 +#++++####
11 ####
12 +###.
13 +###.
14 +###.
15 +###.
16 +###.
17 .###+
18 .###+
19 .###+
20 .###+
21 ####
22 ####
23 ####
24 ####
25 +###
26
mass mean centre of mass (row, col) = (13.51, 13.50), row range 13.00-14.00
mean bounding-box centre row by class (13.5 = field centre):
0:13.5 1:13.0 2:13.2 3:13.5 4:13.2 5:13.5 6:13.0 7:15.1 8:13.5 9:14.1
mass-index mean centre of mass (row, col) = (14.15, 14.18), row range 13.50-14.50
box mean centre of mass (row, col) = (13.45, 13.71), row range 9.93-14.83
1-nearest-neighbour test error, trained on centre-of-mass digits (3,000 train, 1,000 test)
seed 100: test centred the same way 28.8%, half-pixel target 29.6%, by bounding box 33.7%
seed 101: test centred the same way 28.6%, half-pixel target 29.5%, by bounding box 31.7%
seed 102: test centred the same way 31.8%, half-pixel target 32.1%, by bounding box 36.3%
seed 103: test centred the same way 28.1%, half-pixel target 28.5%, by bounding box 32.3%
seed 104: test centred the same way 29.0%, half-pixel target 29.3%, by bounding box 31.3%
mean over seeds: 29.3%, 29.8%, 33.1%
The single digit shows what the two steps do. A tall, narrow 7 of pixels becomes : the height fills the box and the width shrinks in proportion, so narrow digits such as 1 and 7 stay narrow instead of being stretched. The bilevel source has two values; the resampled digit has 30 grey levels, all at the edges of strokes, which is the anti-aliasing the paper describes. Centring by mass then moves the whole digit down: the 7’s heavy top bar pulls its centre of mass up, so to bring that point to the middle of the field the bounding box must sit lower, with its centre at row 15.5 rather than 13.5.
Over 1,000 digits the same effect appears by class. Under centre-of-mass placement the centre of mass is always within half a pixel of the target (rows 13.0 to 14.0), but the bounding box of a 7 sits 1.6 pixels below the field’s centre on average and that of a 9 0.6 pixels below, while 1 and 6 sit half a pixel above. Bounding-box placement does the reverse: the boxes are centred and the centres of mass wander over five rows. Aiming the centre of mass at index 14 instead of 13.5 shifts every digit by a pixel or by none, depending on how its centre of mass rounds, and moves the average by about two-thirds of a pixel here; the exact average depends on the distribution of the fractional parts, which is why MNIST’s half pixel could only be measured on the real digits.
The classifier is the point of the last part. Its absolute error, about 29%, says only that six fonts under random distortions are hard to match pixel by pixel with 3,000 examples. What matters is the change: in every seed, test digits centred by the half-pixel rule score worse (29.8% against 29.3% on average) and test digits centred by bounding box much worse (33.1%). A template classifier compares pixels at fixed positions, so training and test images must be prepared by the same procedure, down to the rounding; this is consistent with Yadav and Bottou’s report that training on correctly centred images gives worse results on MNIST’s test set, and it is why the official page asks authors to report a change of centring.
Dataset Size
| Property | Value (official page) |
|---|---|
| Training images | 60,000 |
| Test images | 10,000 |
| Classes | 10 (digits 0–9) |
| Image size | pixels, 8-bit grayscale |
| Pixel values | 0 (background, white) to 255 (foreground, black) |
| Files | 4: training and test images and labels, gzip-compressed |
| Compressed sizes | 9,912,422 and 28,881 bytes (training images, labels); 1,648,877 and 4,542 bytes (test images, labels) |
The per-class counts are not given on the page or in the papers; they are visible only in the files, which we did not download.
File format
The files use the IDX format, defined on the official page for vectors and multidimensional arrays. A file starts with a 4-byte magic number whose first two bytes are 0, whose third byte gives the element type (0x08 for unsigned bytes, 0x09 signed bytes, 0x0B 2-byte shorts, 0x0C 4-byte integers, 0x0D floats, 0x0E doubles) and whose fourth byte gives the number of dimensions. The size of each dimension follows as a 4-byte integer, then the data in C order, the last index changing fastest. All integers are big-endian, which the page notes must be byte-swapped on little-endian (Intel) processors.
| File | Magic number | Header | Data |
|---|---|---|---|
train-images-idx3-ubyte |
0x00000803 (2051) | 60,000; 28 rows; 28 columns | pixels, row by row |
train-labels-idx1-ubyte |
0x00000801 (2049) | 60,000 | labels 0–9 |
t10k-images-idx3-ubyte |
0x00000803 (2051) | 10,000; 28; 28 | pixels, row by row |
t10k-labels-idx1-ubyte |
0x00000801 (2049) | 10,000 | labels 0–9 |
The format’s simplicity is one reason for MNIST’s spread: EMNIST, QMNIST and Fashion-MNIST all reuse it, and QMNIST adds a two-dimensional integer label file (magic number 3074) with eight columns per digit.
Classes
The ten digits 0 to 9, one label per image. There are no letters, no multi-digit strings and no rejection class. The 1998 paper’s Figure 8, the 82 test digits misclassified by LeNet-5, shows what remains hard: digits the authors describe as genuinely ambiguous, or written in a style under-represented in the training set. (Eighty-two errors are 0.82%, closer to the 0.8% the paper reports for training with distortions than to the 0.95% without; neither the caption nor the text says which of the trained LeNet-5 versions it is.)
Annotation Types
- One class label per image, inherited from NIST’s hand-checked classifications.
- No writer or source information in the official files. Writer identity, NIST series and the index of each digit in NIST are available only through QMNIST’s extended labels, which apply to MNIST because QMNIST’s training set and first 10,000 test images match MNIST’s one for one (QMNIST README, as of October 2026).
Splits
The official split is 60,000 training and 10,000 test images with disjoint writers, each set drawn about half from students and half from Census Bureau employees, as described under Construction. There is no validation split; papers usually hold out part of the training set, for example Simard et al. (2003), who trained on the first 50,000 training images (as the data augmentation article reports). The 50,000 test images prepared in 1994 but never distributed were reconstructed by QMNIST.
Tasks
The task is 10-way classification of an isolated, segmented, size-normalized digit: the character-classification stage of optical character recognition, with field location and segmentation already done. MNIST has also served as a dataset of images for other purposes, without a defined protocol: generative modelling and representation learning.
Evaluation
The reported number is the error rate on the 10,000 test images, which is one minus accuracy. There is no evaluation server and no hidden test set; the test labels have been public since the dataset’s release. The official results table lists each result with its preprocessing (none, deskewing, noise removal, blurring, pixel shifts, subsampling to ) and marks training with distortions, because both change the error rate; the 1998 paper’s Figure 9 marks results on the deslanted and versions and with distorted training data the same way, and puts the uncertainty of its error rates at about 0.1%.
With 10,000 images, one test error is 0.01%. Yadav and Bottou (2019) give the usual Wald interval for an error rate measured on test images,
so a 1% error rate is , about 100 ± 20 errors. Comparing two classifiers on the same test images is far more precise: by their paired test, which counts the images the first classifier gets wrong and the second right and vice versa, four additional errors out of 10,000 already make the difference significant at 95% confidence. Statistical significance in evaluation covers these tests. The pairing argument is also their explanation of why ranking models on the reused MNIST test set kept working (below).
License
The official MNIST page (archived copy of 9 January 2025) states no license or terms of use; it describes the data and asks nothing beyond reporting preprocessing changes. As of October 2026, its address returns an empty directory listing and the four files are no longer served there; the full page survives only in web archives. The terms for MNIST are therefore unclear. The derived datasets state theirs: QMNIST’s repository says QMNIST is licensed under its BSD-style license file, headed “BSD License For QMNIST software”; Fashion-MNIST’s repository gives the MIT License, copyright Zalando SE; NIST’s EMNIST page asks users to cite the paper and states no license (all as of October 2026). Both license texts are written for software, and neither repository states separate terms for its images (our reading).
Limitations and Bias
- Saturated. Test error went from 12% for a linear classifier (LeCun et al., 1998) to 0.23% for Cireşan, Meier and Schmidhuber’s committee of 35 convolutional networks (2012) and 0.21% for Wan et al. (2013). The differences at the top are a few images: Wan et al.’s 0.21% came from voting five networks, and they report it for networks with and without DropConnect alike (Table 3), while the 95% interval at that level is about ±0.1% (by the formula under Evaluation; our arithmetic). Cireşan et al. describe many of their 23 errors as digits with broken or strange strokes or with wrong labels, and the EMNIST authors argue that above 99.7% accuracy the labelling itself can be called into question.
- Too easy to separate methods. A linear classifier reaches 88% accuracy and nearest neighbours 95% on raw pixels (LeCun et al., 1998), so methods that fail on natural images can look competitive. Fashion-MNIST’s README (as of October 2026) gives three reasons to move on: MNIST is too easy, it is overused, and it cannot represent modern computer vision tasks.
- Unlike natural images. One centred, size-normalized object per image, no background, no colour, no texture, no occlusion and no pose beyond slant. Normalization removes the variation in scale and position that detectors and recognizers of photographs must handle, so invariances learned or tested on MNIST say little about photographs (our reasoning).
- A reused, public test set. Hundreds of publications report increasingly good results on the same 10,000 test images (Yadav and Bottou, 2019). QMNIST tested the consequence directly; the result, summarized under Related Datasets and in benchmark overfitting, is that absolute errors are slightly optimistic but rankings hold.
- Few writers in half the test set. The 4,999 Census Bureau test digits come from 48 writers. Yadav and Bottou note that this could raise concerns about statistical significance but that these clean digits contribute little to the total test error.
- Documentation errors. The source names, the size of the NIST test collection and the order of the test set were misreported, and the writer count probably was, in the original descriptions, and the preprocessing was not fully specified until its reconstruction (Construction).
- Narrow population. All writers were US Census Bureau employees or high-school students filling in NIST forms for collections that NIST released between 1990 and 1992 (release years from Yadav and Bottou’s reference list); the sources give no further demographic information.
Common Uses
- Sanity checks and teaching. A new implementation, optimizer or library is often run on MNIST first, and, as Xiao et al. (2017) note, machine learning libraries and deep learning frameworks provide loaders and examples for it.
- Classifier comparisons of the 1990s and 2000s. SVMs, boosting, nearest neighbours with invariant distances and convolutional networks were compared on it, as the official table records.
- Experiments on general methods where the data is incidental: dropout, the batch normalization paper’s study of internal covariate shift, autoencoders, and early generative models such as the GAN and VAE papers, which showed MNIST samples.
- A source format. EMNIST, QMNIST and Fashion-MNIST copy its image size and files so that existing code runs unchanged.
Historical Milestones
All results are test error rates on the 10,000 MNIST test images.
- 1994. Bottou et al. compare classifiers on the new data: 8.4% for a linear classifier, 2.4% for 3-nearest neighbours, 1.6% for a network with 300 hidden units, 1.7% for LeNet-1 and 1.1% for LeNet-4. The first three equal the results that the 1998 paper’s Figure 9 marks as obtained on the deslanted database, which suggests the 1994 runs used that version (our inference; the 1994 paper does not say).
- 1998. LeCun et al. publish the comparison on the regular database: 12.0% for the linear classifier and 5.0% for nearest neighbours on raw pixels, 0.95% for LeNet-5, 0.8% with distorted training images, and 0.7% for boosted LeNet-4; the LeNet article reproduces their table.
- 2002–2003. The official table lists 0.56% for a degree-9 polynomial virtual SVM with 2-pixel jitter on deskewed images (DeCoste and Schölkopf, 2002) and 0.4% for a convolutional network trained with elastic distortions (Simard et al., 2003); see data augmentation.
- 2012. Cireşan, Meier and Schmidhuber reach 0.23% with a committee of 35 convolutional networks, five trained with distorted digits on each of seven versions of the training set (the original and six width normalizations), and note that this approaches an estimated human error of about 0.2%. It is the last entry in the official table (archived January 2025).
- 2013. Wan et al. report 0.21% with five voting networks trained on cropped, rotated and scaled digits, without elastic distortions.
- 2019. QMNIST reconstructs the preprocessing and the 50,000 lost test digits.
The official page’s table, in the archived copy, lists 69 results from 1998 to 2012 in groups (linear classifiers, nearest neighbours, boosted stumps, non-linear classifiers, SVMs, neural networks, convolutional networks), each with its preprocessing and reference; one entry, 1.4% for a Gaussian-kernel SVM, has no reference.
Related Datasets
QMNIST (Yadav & Bottou, 2019) is a reconstruction of MNIST from NIST Special Database 19 with the full 60,000-image test set: its training set and first 10,000 test images match MNIST’s one for one, and the other 50,000 test images reconstruct the digits that were prepared in 1994 but never distributed. Its extended labels give each digit’s NIST series, writer and index, and the repository also provides all 402,953 NIST digits preprocessed the same way (README, as of October 2026). A LeNet-5 variant had 0.82% error on the MNIST test set, 0.81% on the reconstructed 10,000 and 1.08% on the new 50,000 (Table 3); trained on QMNIST’s training set instead, it scored within 0.01 points of these. Across nearest neighbours, SVMs, multilayer perceptrons and convolutional networks, errors on the new digits were consistently slightly higher, but the ranking on the MNIST test set predicted the ranking on the new digits almost perfectly; benchmark overfitting discusses what this says about test-set reuse. QMNIST is the closest substitute for MNIST when writer information or a larger test set is needed.
EMNIST (Cohen et al., 2017) converts all of Special Database 19, digits and upper- and lowercase letters, into MNIST’s format, with training and test sets mixed from both writer populations as in MNIST. Its conversion is not MNIST’s: each image is blurred with a Gaussian of , its bounding box is centred in a square frame with the aspect ratio preserved and a 2-pixel border, and the frame is resampled to by bicubic interpolation, so characters fill the field instead of a box centred by mass. It has six splits: ByClass (814,255 characters, 62 unbalanced classes), ByMerge (the same images with 15 upper- and lowercase letter pairs merged, 47 classes), Balanced (131,600, 47 classes), Letters, Digits (280,000, 10 classes) and MNIST (70,000, matching MNIST’s size). For Letters, the NIST page and the paper’s Figure 2 give 145,600 characters in 26 classes, while the paper’s Table II lists 37 classes and 103,600 (arXiv v2). The balanced splits reserve the end of the training set, equal in size to the test set, as a validation set. The paper’s baseline, a three-layer extreme learning machine trained with a pseudo-inverse method, reached a mean accuracy of 78.02% on Balanced with 10,000 hidden units, against 50.93% for a linear classifier.
Fashion-MNIST (Xiao et al., 2017) keeps MNIST’s format and split sizes but replaces the digits with photographs of fashion products from Zalando’s catalogue: 70,000 front-view product thumbnails in 10 classes (T-shirt/top, trouser, pullover, dress, coat, sandals, shirt, sneaker, bag, ankle boots), 7,000 per class, with 6,000 per class chosen at random for training. The thumbnails were trimmed, resized so the longer side is 28 pixels, sharpened, centred, inverted and converted to 8-bit grayscale; white products were left out for lack of contrast, and the labels are the products’ silhouette codes, assigned by Zalando’s fashion experts. The files are sorted by label, so shuffling is left to the user. The authors intend it as a drop-in replacement that is harder than MNIST; in their benchmark table (Table 3), all but one of the 126 scikit-learn configurations score lower on it than on MNIST (the exception, an extra-tree classifier, scores 0.739 against 0.737).
Earlier and smaller digit sets include the 9,298 zip-code digits from US mail used for the first LeNet (LeNet) and the digits bundled with scikit-learn. The EMNIST authors name CIFAR-10, CIFAR-100, STL-10 and the Street View House Numbers (SVHN) dataset as the other widely used standardized benchmarks of MNIST’s kind.
Resources
- Official MNIST page (archived copy of 9 January 2025): description, results table and file format; the original address no longer serves the page (October 2026).
- QMNIST repository: reconstructed training and 60,000-image test sets, extended labels, all NIST digits, and a PyTorch loader that torchvision now includes.
- EMNIST at NIST: the six splits in MNIST’s binary format and in Matlab format.
- Fashion-MNIST repository: data, loaders and a benchmark of classical classifiers.
- NIST Special Database 19: the source collection, second edition of September 2016.
Related
- LeNet
The family of small convolutional networks for handwritten character recognition that LeCun and colleagues built at Bell Labs from 1989 to 1998, from the zip-code network to LeNet-5, with its trainable subsampling, partial connection table and fixed RBF output codes, and how today's re-implementations differ.
- Benchmark Overfitting
How reusing one test set for years of model selection can inflate benchmark scores, what the theory of adaptive data analysis says about it, and what replication studies of CIFAR-10, ImageNet, MNIST and Kaggle found when they measured it.
- Statistical Significance in Evaluation
How much of a reported difference between two vision models is noise from the finite test set or from training randomness, and the confidence intervals, paired tests, multiple-comparison corrections and reporting practices that tell a real improvement from a lucky seed.
- Data Augmentation
Training a network on randomly transformed copies of its training images, such as crops, flips, colour changes, erasing and mixing, so that it learns invariances the small training set cannot show, provided each transformation keeps the label correct.
- Optical Character Recognition
Turning images of text into machine-readable characters, from scanned printed pages and handwriting to text in street scenes, with the classical document pipeline, segmentation-free line recognizers, scene text methods, benchmarks and the edit-distance metrics used to score them.
- Convolutional Neural Network
A neural network built from convolutional layers, small learned filters applied at every image position, interleaved with nonlinearities and downsampling, so that features grow from edges to object parts while the parameter count stays independent of image size.
References
- LeCun, Y., Bottou, L., Bengio, Y. & Haffner, P. (1998). Gradient-Based Learning Applied to Document Recognition. Proceedings of the IEEE, 86(11), 2278–2324.
- Bottou, L., Cortes, C., Denker, J. S., Drucker, H., Guyon, I., Jackel, L. D., LeCun, Y., Müller, U. A., Säckinger, E., Simard, P. & Vapnik, V. (1994). Comparison of Classifier Methods: A Case Study in Handwritten Digit Recognition. Proceedings of the 12th IAPR International Conference on Pattern Recognition, 2, 77–82.
- LeCun, Y., Cortes, C. & Burges, C. J. C. The MNIST Database of Handwritten Digits (official page; archived copy of 9 January 2025).
- Yadav, C. & Bottou, L. (2019). Cold Case: The Lost MNIST Digits. Advances in Neural Information Processing Systems 32 (NeurIPS).
- Facebook Research. QMNIST (GitHub repository: README and LICENSE at commit 9406136 of 30 September 2022; as of October 2026).
- Cohen, G., Afshar, S., Tapson, J. & van Schaik, A. (2017). EMNIST: Extending MNIST to Handwritten Letters. International Joint Conference on Neural Networks (IJCNN), 2921–2926 (read in arXiv:1702.05373v2, titled "EMNIST: an extension of MNIST to handwritten letters").
- National Institute of Standards and Technology. The EMNIST Dataset (accessed October 2026).
- National Institute of Standards and Technology. NIST Special Database 19: NIST Handprinted Forms and Characters Database (accessed October 2026).
- Xiao, H., Rasul, K. & Vollgraf, R. (2017). Fashion-MNIST: a Novel Image Dataset for Benchmarking Machine Learning Algorithms. arXiv:1708.07747.
- Zalando Research. Fashion-MNIST (GitHub repository: README and LICENSE at commit b2617bb of 21 March 2022; as of October 2026).
- Cireşan, D., Meier, U. & Schmidhuber, J. (2012). Multi-column Deep Neural Networks for Image Classification. IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 3642–3649 (read in the technical report version, arXiv:1202.2745v1).
- Wan, L., Zeiler, M., Zhang, S., LeCun, Y. & Fergus, R. (2013). Regularization of Neural Networks using DropConnect. Proceedings of the 30th International Conference on Machine Learning (ICML), PMLR 28(3), 1058–1066.