arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2406.17328cs.CLcs.AI
收藏

大语言模型的双空间知识蒸馏

Dual-Space Knowledge Distillation for Large Language Models

Beijing Jiaotong University(北京交通大学)

Songming Zhang, Xue Zhang, Zengkui Sun, Yufeng Chen, Jinan Xu

AI总结:

针对大语言模型知识蒸馏中输出空间不一致及词表差异问题,提出双空间知识蒸馏框架DSKD,通过统一输出空间和跨模型注意力机制对齐表示,显著提升不同词表模型间的蒸馏效果。

摘要:

知识蒸馏(KD)被认为是一种通过将大语言模型(LLMs)的知识迁移到较小模型来压缩大语言模型的有前景的解决方案。在此过程中,白盒知识蒸馏方法通常最小化两个模型输出分布之间的距离,以便迁移更多知识。然而,在当前的白盒知识蒸馏框架中,输出分布来自两个模型各自的输出空间,并使用它们各自的预测头。我们认为,这种空间差异会导致教师模型和学生模型在表示层面和分布层面上的相似度较低。此外,这种差异还阻碍了具有不同词表的模型之间的知识蒸馏过程,而不同词表在当前大语言模型中很常见。为了解决这些问题,我们提出了一种双空间知识蒸馏(DSKD)框架,该框架统一了两个模型用于知识蒸馏的输出空间。在DSKD的基础上,我们进一步开发了一种跨模型注意力机制,该机制可以自动对齐具有不同词表的两个模型的表示。因此,我们的框架不仅像当前框架一样兼容各种用于知识蒸馏的距离函数(例如KL散度),还支持任意两个大语言模型之间的知识蒸馏,无论它们的词表是否相同。在任务无关的指令遵循基准上的实验表明,DSKD在使用各种距离函数时显著优于当前的白盒知识蒸馏框架,并且也超越了针对具有不同词表的大语言模型的现有知识蒸馏方法。

英文摘要:

Knowledge distillation (KD) is known as a promising solution to compress large language models (LLMs) via transferring their knowledge to smaller models. During this process, white-box KD methods usually minimize the distance between the output distributions of the two models so that more knowledge can be transferred. However, in the current white-box KD framework, the output distributions are from the respective output spaces of the two models, using their own prediction heads. We argue that the space discrepancy will lead to low similarity between the teacher model and the student model on both representation and distribution levels. Furthermore, this discrepancy also hinders the KD process between models with different vocabularies, which is common for current LLMs. To address these issues, we propose a dual-space knowledge distillation (DSKD) framework that unifies the output spaces of the two models for KD. On the basis of DSKD, we further develop a cross-model attention mechanism, which can automatically align the representations of the two models with different vocabularies. Thus, our framework is not only compatible with various distance functions for KD (e.g., KL divergence) like the current framework, but also supports KD between any two LLMs regardless of their vocabularies. Experiments on task-agnostic instruction-following benchmarks show that DSKD significantly outperforms the current white-box KD framework with various distance functions, and also surpasses existing KD methods for LLMs with different vocabularies.

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

↑