Not Far Away, Not So Close: Sample Efficient Nearest Neighbour Data Augmentation via MiniMax

Ehsan Kamalloo, Mehdi Rezagholizadeh, Peyman Passban, Ali Ghodsi

Abstract

Knowledge Distillation (KD) is a widely used technique for compressing large-scale language models into smaller, deployable versions. However, the effectiveness of KD is often hampered by data sparsity, where the student model lacks sufficient guidance in regions of the input space not covered by the training set. We present MiniMax-kNN, a sample-efficient data augmentation strategy that retrieves real-world sentences from massive unlabeled corpora and selects the most informative ones using a minimax approach. By applying a radial constraint for semantic relevance ("Mini") and maximizing the KL-divergence between teacher and student outputs ("Max"), our method achieves state-of-the-art performance while utilizing up to 60% less augmented data. This approach not only improves accuracy across diverse NLP benchmarks but also significantly reduces training time.

Introduction

In the era of massive language models, Knowledge Distillation has become essential for practical deployment. The process involves a compact "student" model learning to replicate the outputs of a high-capacity "teacher." A fundamental bottleneck in this process is the "empty space" problem: if the training data is limited, the student may never learn how the teacher behaves on inputs outside the immediate training distribution.

Traditional augmentation techniques, such as adversarial noise or standard kNN retrieval, often fall short. Adversarial methods can produce uninterpretable gibberish, while standard kNN retrieval is computationally expensive and often includes redundant or unhelpful data. MiniMax-kNN addresses these limitations by focusing on "hard" examples—sentences that are semantically related to the task but specifically challenge the student's current understanding.

Methods: The MiniMax-kNN Framework

The MiniMax-kNN method follows a structured four-step pipeline to ensure that augmented data is both relevant and informative.

The MiniMax-kNN architecture: (1) Teacher training, (2) Nearest neighbor retrieval, (3) Filtering via radial constraint and KL-divergence maximization, and (4) Distillation.
  1. Retrieval: For every sentence in the training set, the system utilizes a paraphrastic encoder (SASE) to retrieve the $k$ nearest neighbors from a 100-million-sentence repository (Common Crawl).
  2. The "Mini" (Radial Constraint): To ensure the retrieved sentences remain semantically relevant, a maximum distance threshold ($\epsilon$) is applied. This prevents the model from learning from "out-of-domain" noise.
  3. The "Max" (Selection): This is the core innovation. Instead of training on all $k$ neighbors, the system performs a forward pass to identify where the teacher and student models disagree most. It selects the $n$ samples that maximize the KL-divergence between the two models.
  4. Distillation: The student is then trained on the original data plus this highly filtered, informative subset of augmented data.

Experimental Results

The researchers evaluated MiniMax-kNN on five text classification benchmarks: SST-2, SST-5, TREC, CR, and IMP. The results demonstrate that focusing on samples where the student is most "confused" leads to superior learning outcomes.

Performance comparison of MiniMax-kNN against baseline models. Note the significant reduction in augmented data size (#forward / #backward passes) while maintaining or improving accuracy.

Key Insights

  • Efficiency Gains: MiniMax-kNN consistently outperformed vanilla kNN augmentation and standard KD. On the IMP (hate speech detection) dataset, the method reduced the amount of augmented data needed by 60% while simultaneously improving accuracy.
  • Data Quality over Quantity: The authors found that using just 1 or 2 "high-disagreement" samples often yielded better results than using 8 random similar samples. This suggests that "harder" data is more valuable for distillation than a larger volume of redundant data.
  • Teacher as a Reranker: While general-purpose encoders are effective at finding similar sentences, the teacher model—fine-tuned for the specific task—is far better at identifying which retrieved sentences are truly relevant to the target label.
  • Few-Shot Performance: In scenarios with extremely limited labeled data (e.g., 20 examples per label), MiniMax-kNN showed a significant performance boost over previous state-of-the-art methods like SentAugment.

Conclusion

MiniMax-kNN represents a significant step forward in making data augmentation for Knowledge Distillation both more interpretable and efficient. By selecting samples that are "Not Far Away" (semantically similar) but "Not So Close" (challenging for the student), the method optimizes the use of unlabeled data. While the initial maximization step adds some computational cost, the overall reduction in training time and the boost in accuracy make it a compelling choice for model compression in NLP.

Paper Citation: Kamalloo, E., Rezagholizadeh, M., Passban, P., & Ghodsi, A. (2021). Not Far Away, Not So Close: Sample Efficient Nearest Neighbour Data Augmentation via MiniMax. Findings of the Association for Computational Linguistics: ACL-IJCNLP 2021.

Summary updated

BibTeX
@inproceedings{kamalloo2021not,
  author = {Ehsan Kamalloo and Mehdi Rezagholizadeh and Peyman Passban and Ali Ghodsi},
  title = {{Not Far Away, Not So Close: Sample Efficient Nearest Neighbour Data Augmentation via MiniMax}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2021},
  doi = {10.18653/v1/2021.findings-acl.309},
}
Figure