arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2603.01875cs.CLcs.AIcs.LG
收藏

KDFlow:一种用户友好且高效的大型语言模型知识蒸馏框架

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

Key Laboratory of Big Data & Artificial Intelligence in Transportation, (Beijing Jiaotong University), Ministry of Education(大数据与人工智能交通运输联合实验室,(北京交通大学)教育部);School of Computer Science and Technology, Beijing Jiaotong University, Beijing, China(计算机科学与技术学院,北京交通大学,北京,中国);Tencent Inc, China(腾讯公司,中国)

Songming Zhang, Xue Zhang, Tong Zhang, Bojie Hu, Yufeng Chen, Jinan Xu

AI总结:

KDFlow通过解耦架构和SGLang实现高效蒸馏,平衡通信成本与性能,实现1.44至6.36倍加速。

摘要:

知识蒸馏(KD)是压缩大型语言模型(LLMs)的关键技术,但现有框架普遍使用同质训练后端导致效率低下。本文提出KDFlow框架,采用解耦架构和SGLang进行教师推理,结合FSDP2的训练效率与SGLang的推理效率,通过零拷贝数据传输和学生端重新计算logits,实现通信成本与蒸馏性能的平衡。此外,KDFlow支持离线和在线蒸馏,并通过可扩展的API实现跨分词器蒸馏。实验表明,KDFlow相比现有框架在速度上提升1.44至6.36倍,使研究人员能快速原型和扩展LLM蒸馏,且工程开销极低。代码可在https://github.com/songmzhang/KDFlow获取。

英文摘要:

Knowledge distillation (KD) is widely used to compress and post-train large language models (LLMs), yet many existing frameworks execute teacher inference with the same training-oriented backend as student optimization, leading to suboptimal efficiency. In this paper, we propose KDFlow, a novel framework for LLM distillation that features a decoupled architecture and employs SGLang for teacher inference. KDFlow combines SGLang for teacher inference with PyTorch FSDP2 for student optimization, allowing each model to run on a backend tailored to its workload. To enable efficient full-vocabulary distillation in this decoupled architecture, KDFlow transfers the teacher's final hidden states via Ray's object store and recomputes teacher logits on each student worker using a frozen copy of the teacher's output head. Furthermore, our framework supports both off-policy and on-policy distillation and incorporates cross-tokenizer algorithms through highly extensible and user-friendly APIs. Experiments show that KDFlow achieves a 1.44$\times$ to 6.36$\times$ speedup over MS-SWIFT in off-policy distillation and a 1.43$\times$ to 1.75$\times$ speedup over verl in on-policy distillation. KDFlow further scales to 64 GPUs, achieving 3.68$\times$ and 2.52$\times$ strong-scaling speedups in two representative model configurations. The code and documentation are publicly available.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑