Dataset Distillation Meets Handwritten OCR: Why Compressing Training Lines Flatlines
By Gregory Hain
Based on: Dataset Distillation for Handwritten Text Recognition: An Empirical Study — Félix Fuentes-Hurtado, Aric Ayllón, Juan C. Alfaro
If you train document recognition models on historical archives, you know the computational demands that come with every new collection. A new collection brings different handwriting, a different period, or a different language. To get decent accuracy, you adapt your recognizer. Then another archive arrives, and you train again, potentially revisiting old data so the model does not forget how to read earlier hands. Repeated training cycles and hyperparameter searches make processing full collections an expensive routine.
In mainstream computer vision, researchers have spent the past several years exploring an elegant workaround called dataset distillation. The pitch is simple: take a large training dataset, optimize a much smaller set of synthetic images, and train your models on that condensed set instead. On image classification benchmarks, methods built around this idea have reported substantial gains over random or coreset selection at small data budgets.
Naturally, that raises a question for handwritten text recognition (HTR). If you could distill thousands of unruly document lines into a small synthetic set that packs the punch of the whole archive, repeated training could become cheaper.
A research team from the University of Alicante and the University of Castilla-La Mancha—Félix Fuentes-Hurtado, Eric Ayllón, and Juan C. Alfaro—decided to find out. In a paper posted to arXiv on November 16, 2026, titled "Dataset Distillation for Handwritten Text Recognition: An Empirical Study", they presented what they describe, to their knowledge, as the first dataset distillation study for line-level HTR.
Their conclusion is blunt but specific: the three adapted methods did not consistently improve recognition over the real lines they started from. Across four datasets and three tight data budgets, the experiments found no significant overall benefit from pixel optimization. Stronger optimization generally made recognition worse.
Here is an engineering teardown of what the team built, where optimization stalled, and why this null result offers practical guidance for evaluating document training pipelines.

Letter describing a measles outbreak in Francestown, New Hampshire (USA), February, 1856, second page — by gbaku via flickr, BY-SA 2.0.
Why text lines break the distillation playbook
To understand why dataset distillation stalled, you have to look at how it works in standard image classification.
In image classification, every image has a discrete class label. That gives class-based distillation methods a straightforward way to group real and synthetic examples:
- Gradient Matching (GM): Calculates network parameter gradients on real and synthetic examples, then updates the synthetic pixels so their gradients match those of the real data.
- Distribution Matching (DM): Passes real and synthetic images through randomly initialized feature extractors, then shifts the synthetic pixels to match mean feature representations.
- Matching Training Trajectories (MTT): Trains "expert" networks on real data and saves their parameter checkpoints. A student takes training steps on synthetic images, and optimization tunes those images so the student approaches a later expert checkpoint.
A class label leaves considerable freedom in what the synthetic image can represent. As the authors suggest in their discussion, an image can move toward a class prototype while retaining its label.
Handwritten text recognition presents a different problem:
- Virtually infinite output space: A text line does not belong to one of a small number of classes. Its target is a variable-length character sequence, creating a virtually infinite space of possible labels.
- Unaligned sequence learning: This study uses a Convolutional Recurrent Neural Network (CRNN) trained with Connectionist Temporal Classification (CTC). The model produces character and blank probabilities across temporal frames without requiring explicit character-to-frame alignments.
- Fixed sequence targets: In these experiments, each synthetic line retains one specific transcription. The authors hypothesize that this limits how much useful information pixel optimization can add. That is a proposed explanation, not proof that synthetic text images must preserve particular glyph shapes or that distortion necessarily makes CTC alignment impossible.
Because an HTR line has no discrete class label, adapting class-by-class matching requires an additional mechanism.
Engineering the bridge: Pseudo-classes and differentiable CTC
To give distillation methods a fighting chance on text, Fuentes-Hurtado and colleagues introduced several adaptations.
First, to support class-conditional matching, they created text pseudo-classes. They took the training transcriptions, extracted character 2-grams and 3-grams, weighted them with TF-IDF, and used k-means to form $K$ clusters, where $K$ is the synthetic-set size. For each cluster, they selected the real line closest to its centroid in TF-IDF space, which they call the text medoid. This supplied $K$ starting lines and allowed GM and DM to match each synthetic line against real lines from its cluster.
They also tested uniformly random starting lines. In that setup, GM and DM matched against real batches sampled from the whole training pool. MTT used random starting lines only, because it matches training trajectories rather than classes.
Second, they locked the text labels. Each synthetic line inherited the transcription and width of its starting image. Both stayed fixed throughout distillation; only pixel values changed.
Third, they tackled a low-level engineering hurdle in Gradient Matching. Computing how pixels should change to improve gradient matching requires differentiating through the CTC gradient: second derivatives of the CTC loss.
The paper reports that PyTorch's fused CTC kernel lacks this support. The authors therefore used a custom differentiable CTC implementation built from tensor operations, with forward recursion using logsumexp. MTT's inner training loop also relied on this implementation.
Finally, they addressed CTC's tendency toward an early all-blank solution. Following prior-based bias initialization, they initialized the CRNN's blank-symbol output bias to −5, an empirically chosen value. This was an initialization choice, not a permanently fixed bias or a guarantee against blank outputs.
With these mechanisms in place, they evaluated three strategies:
- GM-CTC: Matching real and synthetic gradients using differentiable CTC.
- DM-CTC: Averaging feature columns across each line's width using a frozen, randomly initialized CNN, periodically redrawn during optimization, then minimizing squared Euclidean distance between real and synthetic representations.
- MTT-CTC: Pre-training expert CRNNs on the full pool, then optimizing synthetic lines so a student taking 20 gradient steps approaches the expert's parameters one epoch later.
The testing grounds: Four handwriting datasets
The authors ran their experiments across four HTR benchmarks spanning modern and historical handwriting, different languages, and different numbers of writers:
- IAM: Modern English, 657 writers, 6,161 training lines, and a 79-character alphabet. Full-data reference test Character Error Rate (CER): 13.6%.
- George Washington (GW): Eighteenth-century English, two writers, 357 training lines, and a 70-character alphabet. Full-data reference test CER: 7.2%.
- READ 2016: German council minutes from 1470–1805, several hands, 8,366 training lines, and a 90-character alphabet. Full-data reference test CER: 10.5%.
- LAM: Italian letters from 1691–1750, one writer, 19,829 training lines, and an 89-character alphabet. Full-data reference test CER: 5.5%.
They evaluated budgets of 1%, 5%, and 10% of the training lines. On GW, 1% corresponds to just four lines, while 10% provides 36. On LAM, those budgets provide 198 and 1,983 lines.
All configurations trained the same small CRNN from scratch. Images were grayscale, resized to 64 pixels high while preserving aspect ratio. Training used validation-based early stopping and affine augmentation; reported test CER used greedy CTC decoding and included spaces. These experiments therefore tested training on compressed sets, rather than directly testing production fine-tuning or continual-learning workflows.
To prevent benchmarking illusions, the authors established a critical 0-iteration control. Distilled sets were stored and loaded as tensors, whereas the real-line selection baselines used an image-loading pipeline. Each control passed the exact starting lines through the tensor pipeline without pixel optimization.
Comparing a distilled set with that control, under the same training recipe and GPU type and paired by seed, isolated the effect of changing the pixels.
The numbers: Distillation flatlines across the board
Across the twelve dataset-and-budget combinations, the central result was consistent: none of the five method variants showed a significant overall improvement over its own starting lines after correction for multiple comparisons.
Here are the mean test CERs for methods initialized from random lines. The paper reports 95% confidence intervals as well; these are omitted here for readability. Most configurations used three seeds, with five on GW.
| Dataset | Budget ($K$) | Random Baseline | 0-Iter Control | DM (Distilled) | GM (Distilled) | MTT (Distilled) | Full Dataset |
|---|---|---|---|---|---|---|---|
| IAM | 1% (62) | 48.2% | 47.5% | 47.6% | 48.8% | 48.2% | 13.6% |
| 5% (308) | 28.3% | 28.4% | 27.9% | 28.2% | 29.0% | ||
| 10% (616) | 23.8% | 23.7% | 23.7% | 23.8% | 23.5% | ||
| GW | 1% (4) | 77.1% | 77.5% | 76.9% | 76.0% | 76.7% | 7.2% |
| 5% (18) | 53.5% | 47.0% | 49.3% | 49.9% | 53.8% | ||
| 10% (36) | 28.9% | 29.3% | 30.0% | 29.4% | 29.6% | ||
| READ 2016 | 1% (84) | 44.6% | 43.9% | 44.0% | 45.0% | 44.8% | 10.5% |
| 5% (418) | 26.7% | 26.9% | 27.3% | 26.8% | 26.5% | ||
| 10% (835) | 21.8% | 22.0% | 21.3% | 21.6% | 22.2% | ||
| LAM | 1% (198) | 19.0% | 19.2% | 19.1% | 18.6% | 19.2% | 5.5% |
| 5% (991) | 12.4% | 11.7% | 11.8% | 11.9% | 12.0% | ||
| 10% (1983) | 10.0% | 10.4% | 10.0% | 9.8% | 10.5% |
The authors applied Wilcoxon signed-rank tests to the twelve per-cell mean differences between each method and its control. For the random-initialized methods, the results were:
- Distribution Matching: $p = 0.97$, Holm-corrected $p = 1$.
- Gradient Matching: $p = 1$, Holm-corrected $p = 1$.
- Trajectory Matching: $p = 0.151$, Holm-corrected $p = 0.757$.
The medoid-initialized variants, DMmed and GMmed, also showed no significant overall difference from their controls.
Out of sixty method-cell confidence intervals, five excluded zero. Four indicated improvements of at most 0.53 CER points; the fifth indicated degradation for GMmed on READ 2016 at 5%, by $1.65 \pm 0.58$ points. With sixty 95% intervals, roughly three false positives would be expected by chance if all underlying effects were zero. Five isolated differences therefore do not establish a consistent benefit, but neither do they prove that every difference is random noise.
Even at the 10% budget, all methods remained substantially behind the full-data references.
The autopsy: Why the algorithms stalled
Why did these adaptations fail to deliver a consistent gain? The authors examined both how much the pixels changed and whether the methods actually reduced their objectives.
1. Minimal pixel movement under standard settings
Under the default settings—pixel learning rate 0.1 and 2,000 iterations—the synthetic images changed very little. Relative pixel displacement, $|S - S_0|_2 / |S_0|_2$, was generally 0.05–0.39% for DM and GM, with larger changes of 0.4–3.7% on GW. For MTT, it ranged from 0.21% to 2.83%.
GM and DM updated lines round-robin. Each line received only about 1–32 updates outside GW, versus 56–500 on the much smaller GW dataset. With each update shifting a pixel by roughly no more than 0.1 gray levels on a 0–255 scale, modest overall movement was unsurprising.
The default runs were therefore a weak test of what substantially altered synthetic lines might achieve. The authors followed up with stronger optimization.
2. Aggressive optimization worsened recognition
For DMmed and GMmed, the authors switched to unconditional batch-mode updates, swept pixel step sizes $\eta \in {0.1, 1, 10}$, and took snapshots at approximately 30, 300, and 3,000 updates per line. They tested one budget per dataset: 5%, except 10% on GW.
On IAM at 5%, the DM sweep showed the pattern clearly. Against a starting-line validation CER of $27.39 \pm 0.84$:
- At step size 0.1 and roughly 30 updates per line, validation CER was 27.36%.
- At step size 1 and roughly 3,000 updates per line, validation CER rose to 41.14%; the corresponding illustrated buffer had 11.1% pixel drift.
- At step size 10 and roughly 300 updates per line, validation CER reached 89.24%, with 74.1% drift. At roughly 3,000 updates, CER reached 95.60%.
The figure's 2.4% drift example belongs to step size 1 and roughly 30 updates per line, with validation CER about 27.9%.
The authors report a similar deterioration pattern for GM and the other datasets. After selecting configurations on validation and retraining with three seeds, all seven reported method–dataset cases remained statistically indistinguishable from their controls on validation and test.
For MTT, the stronger-optimization experiment varied only the pixel learning rate and used one seed. Increasing it from 0.1 to 1 to 10 worsened validation CER on all four datasets. These results establish that stronger optimization did not rescue the tested methods; they do not establish a specific visual-noise mechanism behind the deterioration.
3. Lowering the loss did not help—or barely happened
Did the algorithms at least minimize their intended losses?
- Distribution Matching lowered its objective without improving recognition. Under default settings, reductions were 0.1–2.5% outside GW and 8–30% on GW at the 1% and 5% budgets. In an extended IAM sweep at step size 0.1, the objective fell by 8.5% after roughly 3,000 updates per line, while validation CER worsened from 27.39% to 28.89%. The authors suggest that width-averaged features may be uninformative because they ignore character order, but explicitly leave this as an untested explanation.
- Gradient Matching barely moved its objective. Across the evaluated runs and network states, the final-to-initial loss ratio ranged from 0.969 to 1.002, with a median of 0.9996. Reductions were at most 0.5% outside GW and about 3% on GW. Thousands of updates in the IAM sweep did not substantially change this. The authors also observed non-finite second-order-gradient updates, but did not establish gradient noise as the cause of the stalled objective.
- Trajectory Matching's target was effectively unreachable under the tested setup. Its loss ended at 0.979–0.999, near its initial value. Running the same 20-step student loop on real lines, with a grid search over step sizes, also failed to approach the expert's next-epoch parameters. The median loss was 0.997 on IAM. Expert displacement and the mean training gradient were nearly orthogonal, with cosine similarities of 0.02–0.20.
The MTT result is consistent with prior reports about difficulties using Adam or momentum-trained experts. It does not isolate Adam as the sole cause. On IAM, SGD experts made the target reachable only early in training or when those experts converged poorly.
For GM and MTT, the authors emphasize a crucial distinction: an objective that barely changes or cannot be reached does not disprove the matching principle itself.

The medoid paradox: Why random sampling was stronger
Another notable finding concerns how the starting lines were selected.
The authors clustered transcriptions by character n-grams and chose a central line from each cluster. That supplies a straightforward text-based selection baseline. It did not, however, deliver a consistent advantage over random sampling.
Random selection was the stronger starting strategy in these experiments, although it did not significantly beat medoids in every cell.
- Text medoids were significantly worse within four cells: READ 2016 at all budgets and LAM at 1%. Their overall comparison with random selection did not pass Holm correction ($p = 0.0684$).
- DMmed was worse than random-initialized DM in five cells. This comparison did pass Holm correction ($p = 0.0107$), the study's only significant across-cell comparison after correction.
- GMmed was worse than GM in five cells, but its overall comparison did not pass Holm correction ($p = 0.0742$).
- Conditional versus unconditional matching showed no significant overall difference: $p = 0.91$ for DMmed and $p = 0.569$ for GMmed, with Holm-corrected $p = 1$ for both.
Why were medoids weaker? The study does not establish a mechanism. The selector operates on transcription n-grams rather than visual handwriting features, but the paper does not demonstrate that it omitted rare characters, lost stylistic diversity, or selected overly average sentences. Those would require separate measurements.
The results nevertheless expose a benchmarking trap. MTT beat text medoids in four individual cells, although that overall comparison did not survive Holm correction. Against random real lines, MTT showed no significant advantage in any cell. Its apparent benefit over medoids therefore reflected the choice of starting lines, rather than a demonstrated gain from pixel optimization.
Why it matters for document AI teams
This paper provides practical takeaways for teams evaluating data compression for handwriting recognition.
1. Do not assume pixel-level distillation will reduce HTR training costs
These adaptations of GM, DM, and MTT did not establish a recognition benefit over their starting lines. For a small CRNN trained with CTC and fixed transcriptions, stronger pixel optimization generally made matters worse.
That is a reason to demand evidence before investing in this particular approach, rather than a reason to abandon all HTR distillation research. The study did not test every architecture, trainable-label strategy, or adaptation workflow. Its GM and MTT diagnostics also show why unsuccessful optimization must be distinguished from an unsuccessful underlying idea.
2. Uniform random sampling remains an essential baseline
Before building a complex selector, measure what several random subsets can achieve. Here, transcription-based medoids supplied no significant improvement over random lines and were worse in several cells.
That does not make random sampling universally optimal, nor does it guarantee coverage of rare characters at tiny budgets. It makes random selection a necessary comparison for claims that a more elaborate compression method adds value.
3. Always compare against the zero-iteration control
For methods that optimize real starting examples, the paper's strongest control is simple: train on those exact examples without optimization, using the same loading pipeline, training recipe, and GPU type.
If the optimized set does not beat that control, the experiment has not demonstrated added value from optimization. Comparing only against a separately selected or differently loaded baseline can obscure where performance comes from.
The authors also recommend checking whether each method lowers its own objective. For trajectory matching, test whether real data can approach the target before interpreting a synthetic-data failure.
4. Beware of low-budget sampling variance
At very small budgets, the selected lines can materially affect the result. On READ 2016 at 1%, one subset fixed across training seeds produced test CER of $49.8 \pm 4.1$%, while using a different subset for each seed produced $44.6 \pm 2.6$%.
That 5.2-point difference was large enough to change the apparent story. MTT's 44.8% test CER looked better than the fixed subset, yet its own starting lines achieved 43.9% through the tensor pipeline without optimization.
A single fixed subset can therefore confound selection luck with method quality. Report variation across subsets, rather than assuming training seeds alone capture the uncertainty.
Limitations and the road ahead
The study's boundaries leave room for further research:
- Single architecture: All experiments used one small CRNN with four convolutional blocks and a bidirectional LSTM. The results do not establish how other recognizers would respond.
- Fixed transcriptions and widths: Only pixels were learned. The authors suggest learning transcriptions or alignments alongside the pixels as a future direction; they did not test whether that would improve HTR.
- Generative priors: Optimizing a handwriting generator's latent space is another proposed direction. It was not evaluated here, so its ability to improve compression remains open.
- Limited statistical precision: Most experiments used three seeds, with five on GW. Many cell-level confidence intervals were wide, often around ±2 CER points. The study found no consistent gain, but small effects remain unresolved.
- Restricted follow-up experiments: Strength sweeps began with one seed; validation tuning was applied only to DD. MTT used five experts on LAM rather than fifteen, SGD experts were tested only on IAM, and GM's objective was evaluated on fresh or briefly co-adapted networks. GPU types shifted CER by about 0.5 points, although comparisons did not mix GPU types.
The bottom line
It is easy to get swept up in techniques from adjacent computer vision tasks. When dataset distillation offers gains on classification benchmarks, document engineers naturally want to know whether those gains carry over to transcription.
Fuentes-Hurtado, Ayllón, and Alfaro provide a carefully controlled answer for one concrete setting. With a small CTC-based CRNN, fixed transcriptions, and these adaptations of GM, DM, and MTT, optimizing synthetic line pixels did not deliver a consistent improvement over the real starting lines.
The practical lesson is to make compression earn its complexity. Compare against multiple random subsets, preserve the zero-iteration control, and verify that the optimization is doing what it claims. In this study, the starting lines did the useful work; distillation added no demonstrated overall recognition benefit.