Flipping Knowledge Distillation: Leveraging Small Models' Expertise to Enhance LLMs in Text Matching

Mingzhe Li, Jing Xiang, Qishen Zhang, Kaiyang Wan, Xiuying Chen

Abstract

While Large Language Models (LLMs) are typically used as teachers for smaller models, this research explores a "flipped" paradigm. In specialized tasks like text matching—determining the semantic equivalence of two sentences—domain-specific Small Language Models (SLMs) often possess superior representation capabilities compared to general-purpose LLMs. We introduce Flipped Knowledge Distillation, a framework where SLMs guide LLMs to improve their performance in domain-specific text matching. By reinterpreting LLM architectures through Low-Rank Adaptation (LoRA) and employing a margin-aware loss function, our approach enables LLMs to outperform both their base versions and models distilled from much larger teachers.

Introduction

In the current AI landscape, the prevailing trend is that larger models yield better performance. However, for specific tasks such as text matching, decoder-only LLMs often struggle. These models are primarily optimized for next-token prediction, lacking the dedicated encoder machinery found in smaller, BERT-style models that excel at creating rich, domain-specific text representations.

In specialized fields like finance or medicine, a fine-tuned 300M parameter model can often outperform a 70B parameter giant because it captures nuanced relationships between domain-specific terms. The challenge lies in combining the broad reasoning capabilities of an LLM with the specialized expertise of a focused SLM.

Flipped Knowledge Distillation overview and representation space dynamics.

Methodology: The Flipped Framework

The proposed framework "flips" the traditional distillation hierarchy through three main pillars:

1. Reinterpreting LLMs via LoRA

LLMs are typically decoders, which are not inherently optimized for text matching. To bridge this gap, the authors utilize Low-Rank Adaptation (LoRA) to treat the LLM as an encoder-decoder structure. Specifically, the LoRA $A$ matrix acts as an "encoder" that compresses input into a representation space $z$, while the $B$ matrix projects it back. This allows for the extraction of internal embeddings from a decoder-only model without altering its base weights.

Architectural comparison of SLM bi-encoders and the LoRA-based reinterpretation of LLMs.

2. Margin-aware Contrastive Learning (MCL)

Instead of relying on binary labels, the SLM teacher provides continuous similarity scores. The Margin-aware Contrastive Learning (MCL) loss uses angular distances (arccosine) and specific "margin zones." This forces the LLM to not only distinguish between positive and negative pairs but also to understand the relative semantic distances within those groups, leading to more nuanced representations.

3. Dual-Sided Denoising

To account for imperfections in the SLM teacher, the system implements a denoising mechanism. If the SLM's similarity score significantly contradicts the ground-truth label (e.g., assigning a very low similarity to a "matched" pair), the sample is filtered out. This prevents the LLM from learning noise and ensures high-quality knowledge transfer.

Experimental Results

The researchers evaluated the framework across three domains: finance (ATEC), medicine (NFCorpus), and real-world FAQ retrieval (ByteDance Internal).

  • Performance Gains: On the ATEC finance dataset, a Qwen-0.5B model distilled from a FinBERT teacher achieved an F1 score of 0.8247, surpassing the base model (0.8133) and approaching the performance of a Llama-7B model (0.8307).
  • Outperforming Large Teachers: In the medical domain, a flipped GLM-10B model outperformed PMC-Llama (13B), which was distilled from ChatGPT. This demonstrates that a small, specialized teacher can be more effective than a massive, general-purpose one for domain-specific tasks.
  • Industrial Impact: Deployment at ByteDance resulted in search accuracy improvements of up to 10.64% in the insurance sector, highlighting the practical utility of the approach.

Conclusion and Future Work

The core insight of this work is that distillation success depends on task alignment rather than just model size. SLMs are "experts" at representation learning due to their bi-encoder architecture, while LLMs are "generalists" at generation. By using LoRA as an architectural bridge, we can inject specialized expertise into LLMs.

Future work will explore extending this "flipped" approach to generative tasks like dialogue and summarization, balancing representation learning with text fluency, and investigating if SLMs can serve as specialized tutors across a broader range of NLP challenges.

Summary updated

BibTeX
@inproceedings{li2025flipping,
  author = {Mingzhe Li and Jing Xiang and Qishen Zhang and Kaiyang Wan and Xiuying Chen},
  title = {{Flipping Knowledge Distillation: Leveraging Small Models' Expertise to Enhance LLMs in Text Matching}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2025},
  url = {https://openreview.net/forum?id=ttlkew6g0b},
}
Figure