KDFlow: A User-Friendly and Efficient Knowledge Distillation Framework for Large Language Models

· Source: cs.CL updates on arXiv.org · Field: Technology & Digital — Artificial Intelligence & Machine Learning, Software Development & Engineering · Depth: Expert, long

Summary

KDFlow is a novel framework designed for efficient knowledge distillation (KD) of large language models (LLMs). It addresses the suboptimal training efficiency of existing frameworks by employing a decoupled architecture, assigning the teacher model to the high-throughput inference engine SGLang and the student model to the dedicated training engine PyTorch FSDP2. KDFlow achieves this by transferring the teacher's compact hidden states using zero-copy data transfer and recomputing full logits on the student side, balancing communication cost and KD performance. This approach yields a 1.44$\times$ to 6.36$\times$ speedup compared to current KD frameworks, especially for Mixture-of-Experts (MoE) teachers, without compromising downstream task performance. The framework also supports off-policy, on-policy, and cross-tokenizer distillation through user-friendly APIs.

Key takeaway

For AI Scientists and Machine Learning Engineers focused on LLM compression, KDFlow offers a critical solution to efficiency bottlenecks. By decoupling teacher inference and student training, KDFlow delivers significant speedups (1.44$\times$ to 6.36$\times$) without sacrificing distillation quality, particularly for MoE teachers. You should consider integrating KDFlow into your research or development pipeline to accelerate experimentation and deployment of smaller, performant LLMs.

Key insights

KDFlow decouples LLM KD, using optimized backends for teacher inference (SGLang) and student training (FSDP2) to boost efficiency.

Principles

Method

KDFlow uses Ray to coordinate a Trainer, RolloutActorGroup (SGLang), TeacherActorGroup (SGLang), and StudentActorGroup (FSDP2) for decoupled KD workflows.

In practice

Topics

Code references

Best for: NLP Engineer, Research Scientist, AI Scientist, Machine Learning Engineer, AI Engineer

Related on AIssential

Open in AIssential →

Editorial summary, takeaway, and curation by AIssential. Original article published by cs.CL updates on arXiv.org.