Self-Distillation from the Last Mini-Batch for Consistency Regularization

Yiqing Shen, Liwu Xu, Yuzhe Yang, Yaqian Li, Yandong Guo · DOI

Introduction

Knowledge Distillation (KD) has emerged as a powerful technique for enhancing the generalization capabilities of neural networks by encouraging a "student" model to mimic the "soft" probability distributions of a "teacher" model. Despite its success, traditional KD paradigms—such as offline distillation from a pre-trained teacher or online distillation from an ensemble—impose significant computational and memory overheads. Self-distillation methods attempt to mitigate these costs by using the model as its own teacher. However, many existing approaches require auxiliary architecture components or rely on "stale" model snapshots from previous epochs.

In this paper, we discuss Self-Distillation from the Last Mini-Batch (DLB), a novel regularization technique that facilitates self-knowledge transfer without additional parameters or complex architectural modifications. By utilizing predictions from the immediate past training step, DLB provides a highly efficient and "temporally recent" teacher signal.

Methodology: The DLB Framework

The primary innovation of DLB lies in its unique data sampling and consistency regularization strategy. Unlike standard training where mini-batches are sampled independently, DLB introduces a structured overlap between consecutive iterations.

1. The Overlapping Mini-Batch Strategy

In each training iteration $t$, the mini-batch is constructed such that it shares 50% of its samples with the previous iteration $t-1$. Specifically, if a batch size is $2N$, $N$ samples are carried over from the previous step, and $N$ new samples are introduced (which will, in turn, be carried over to iteration $t+1$).

2. Consistency Regularization

During iteration $t-1$, the model's output logits for its samples are cached. In the subsequent iteration $t$, the model processes the overlapping samples again. The training objective then incorporates two components:

  • Cross-Entropy Loss: Calculated over the entire current mini-batch using ground-truth labels.
  • Kullback-Leibler (KL) Divergence Loss: Calculated specifically for the $N$ samples that appeared in iteration $t-1$. This loss penalizes discrepancies between the model's current predictions and the predictions it made just one step ago.

This mechanism ensures that the model maintains internal consistency, effectively acting as a teacher for its future self.

Experimental Evaluation

The authors evaluated DLB across several standard image classification benchmarks, including CIFAR-10, CIFAR-100, and TinyImageNet. To demonstrate the method's architecture-agnostic nature, experiments were conducted using a variety of backbones: ResNet, VGG, DenseNet, and WideResNet.

Performance Gains

DLB consistently improved top-1 accuracy across all tested configurations. For instance, on CIFAR-100, DLB reduced the error rate of a VGG-16 model by 2.50% and a WideResNet (WRN20-8) by 1.63%. These results outperformed established self-distillation methods such as Be Your Own Teacher (BYOT) and Class-wise Self-Knowledge Distillation (CS-KD).

Robustness and Synergy

Beyond standard accuracy, DLB demonstrated two significant advantages:

  1. Noise Tolerance: In scenarios with 60% label noise, DLB-trained models exhibited superior stability. The consistency loss allows the model to rely on its own evolving internal representations rather than overfitting to corrupted hard labels.
  2. Augmentation Compatibility: DLB works synergistically with data augmentation techniques. When paired with CutMix, it yielded an additional 1.02% improvement on CIFAR-100 compared to CutMix alone.

Discussion and Key Insights

The success of DLB can be attributed to Temporal Recency. By distilling from the "last mini-batch," the teacher signal is always synchronized with the model's current learning state. This avoids the "stale teacher" problem found in snapshot-based methods. Furthermore, DLB functions as a form of Dynamic Label Smoothing, where the smoothing effect is sample-specific and evolves throughout the training process.

Crucially, DLB achieves these gains with zero computational overhead. The only requirement is a small buffer to store logits from the previous step, making it an attractive "drop-in" regularization technique for resource-constrained environments.

Conclusion and Future Work

Self-Distillation from the Last Mini-Batch (DLB) offers a simple yet potent method for improving model generalization and robustness. While the current study focuses on image classification on small-to-medium datasets, the results suggest significant potential for broader applications. Future research should investigate the scalability of DLB to large-scale datasets like ImageNet and its applicability to other domains, such as object detection and semantic segmentation.

Summary updated

BibTeX
@misc{shen2022self,
  author = {Yiqing Shen and Liwu Xu and Yuzhe Yang and Yaqian Li and Yandong Guo},
  title = {{Self-Distillation from the Last Mini-Batch for Consistency Regularization}},
  year = {2022},
  eprint = {2203.16172},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2203.16172},
}
Figure