Self-distillation with Batch Knowledge Ensembling Improves ImageNet Classification

Yixiao Ge, Ching Lam Choi, Xiao Zhang, Peipei Zhao, Feng Zhu, Rui Zhao, Hongsheng LiarXiv 2021

Introduction

Standard supervised learning typically relies on "one-hot" labels, which assign a single category to an image with 100% confidence. However, this approach often fails to capture the inherent complexity of real-world data, where an image of a "dog" may also contain significant contextual information like "grass" or a "frisbee." Knowledge Distillation (KD) addresses this by utilizing "soft targets"—probability distributions from a teacher model that encapsulate "dark knowledge." While effective, traditional KD requires computationally expensive multi-teacher ensembles or complex peer-teaching architectures.

BAtch Knowledge Ensembling (BAKE) is a lightweight self-distillation framework designed to bridge this gap. By treating a single mini-batch as a temporary ensemble, BAKE achieves the performance gains of multi-teacher models with zero additional parameters and negligible computational overhead.

Methods: The BAKE Framework

The core innovation of BAKE lies in its ability to refine a sample's prediction by leveraging the collective knowledge of similar samples within the same mini-batch. The process follows several key steps:

  1. Inter-sample Affinities: For each image in a mini-batch, the model calculates a similarity score (affinity) relative to all other images based on their high-level feature representations.
  2. Knowledge Propagation: Predictions are "propagated" across the batch. If Image A is visually similar to Image B, Image B’s prediction is weighted more heavily when refining the target for Image A.
  3. Approximate Inference: To maintain efficiency, BAKE employs a closed-form mathematical shortcut—essentially a matrix inversion—to estimate the ensembled targets that would result from infinite propagation iterations.
  4. Per-class Data Sampling: To ensure the presence of similar samples, a specialized sampler ensures at least two images from the same class are included in every mini-batch.
  5. Self-Distillation: The network is trained to minimize the divergence between its raw prediction and the refined, ensembled "soft target."
The BAKE framework: Inter-sample propagation and ensembling within a mini-batch.

Key Results and Performance

BAKE was evaluated across diverse benchmarks, including ImageNet-1K, CIFAR-100, and fine-grained classification tasks like CUB-200-2011 (birds) and Stanford Dogs.

Classification Accuracy

On ImageNet-1K, BAKE significantly improved the performance of standard architectures. It boosted the Top-1 accuracy of ResNet-50 from 76.8% to 78.0% (+1.2%) and the Swin-Transformer (Swin-T) from 81.3% to 82.0% (+0.7%). These results outperform other single-network self-distillation and label regularization methods such as Label Smoothing and CS-KD.

Robustness and Transferability

Beyond standard accuracy, BAKE-trained models exhibit superior robustness to image corruptions (ImageNet-C) and adversarial attacks. In adversarial scenarios, BAKE provides a substantial safety margin over vanilla models, as seen in performance under varying epsilon values.

Robustness comparison: BAKE vs. Vanilla ResNet-50 under adversarial attacks.

Furthermore, BAKE-trained backbones show strong transferability to downstream tasks. When used for object detection on the COCO dataset, they consistently provided a 0.6–0.8 mAP improvement over vanilla baselines.

Discussion and Efficiency

A primary advantage of BAKE is its efficiency. Unlike traditional ensembling methods that are often too slow for production, BAKE adds only approximately 3.7% to the training time of a ResNet-50 and introduces zero overhead during inference. This makes it a highly practical solution for real-world machine learning pipelines.

The fundamental insight of BAKE is that a mini-batch is itself an ensemble. By using feature similarity as a proxy for label consistency, the model learns more robust representations. While the method's effectiveness depends on batch composition—requiring per-class sampling to ensure similarity—the resulting gains in accuracy and robustness make it a compelling alternative to more resource-intensive distillation techniques.

Summary updated

BibTeX
@misc{ge2021self,
  author = {Yixiao Ge and Ching Lam Choi and Xiao Zhang and Peipei Zhao and Feng Zhu and Rui Zhao and Hongsheng Li},
  title = {{Self-distillation with Batch Knowledge Ensembling Improves ImageNet Classification}},
  year = {2021},
  eprint = {2104.13298},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2104.13298},
}
Figure