Search papers, labs, and topics across Lattice.
The paper introduces KDFlow, a knowledge distillation framework for LLMs that uses a decoupled architecture with separate training (FSDP2) and inference (SGLang) backends for student and teacher models, respectively, to improve efficiency. KDFlow minimizes communication overhead by transmitting teacher hidden states instead of full logits and recomputing logits on the student side. Experiments demonstrate a 1.44x to 6.36x speedup compared to existing KD frameworks, while also supporting off-policy and on-policy distillation and cross-tokenizer KD.
KDFlow unlocks 6x faster LLM knowledge distillation by decoupling student training and teacher inference, using hidden state transfer to minimize communication overhead.
Knowledge distillation (KD) is an essential technique to compress large language models (LLMs) into smaller ones. However, despite the distinct roles of the student model and the teacher model in KD, most existing frameworks still use a homogeneous training backend (e.g., FSDP and DeepSpeed) for both models, leading to suboptimal training efficiency. In this paper, we present a novel framework for LLM distillation, termed \textbf{KDFlow}, which features a decoupled architecture and employs SGLang for teacher inference. By bridging the training efficiency of FSDP2 and the inference efficiency of SGLang, KDFlow achieves full utilization of both advantages in a unified system. Moreover, instead of transferring full logits across different processes, our framework only transmits the teacher's hidden states using zero-copy data transfer and recomputes the logits on the student side, effectively balancing the communication cost and KD performance. Furthermore, our framework supports both off-policy and on-policy distillation and incorporates KD algorithms for cross-tokenizer KD through highly extensible and user-friendly APIs. Experiments show that KDFlow can achieve \textbf{1.44$\times$ to 6.36$\times$} speedup compared to current KD frameworks, enabling researchers to rapidly prototype and scale LLM distillation with minimal engineering overhead. Code is available at: https://github.com/songmzhang/KDFlow