【LLM+知识蒸馏】Distilling Step-by-Step! Outperforming Larger Language Models with Less Training Data and

研究提出Distillingstep-by-step,通过利用LLM生成的额外监督和多任务训练,用更少的标注数据和更小的模型尺寸提升性能。实验结果显示,该方法在NLP任务上超越大模型,且对资源要求远低于传统微调和蒸馏。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Distilling Step-by-Step! Outperforming Larger Language Models with Less Training Data and Smaller Model Sizes 逐步蒸馏!以较少的训练数据和较小的模型规模超越较大的语言模型

2023. 7 ACL2023 Findings

论文地址
代码地址
论文笔记(LLM+蒸馏):Distilling step-by-step+代码分析

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

Abstract

Deploying large language models (LLMs) is challenging because they are memory inefficient and compute-intensive for practical applications. In reaction, researchers train smaller task-specific models by either finetuning with human labels or distilling using LLM-generated labels. However, finetuning and distillation require large amounts of training data to achieve comparable performance to LLMs. We introduce Distilling step-by-step, a new mechanism that (a) trains smaller models that outperform LLMs, and (b) achieves so by leveraging less training data needed by finetuning or distillation. Our method extracts LLM rationales as additional supervision for training small models within a multi-task framework. We present three findings across 4 NLP benchmarks: First, compared to both finetuning and distillation, our mechanism achieves better performance with much fewer labeled/unlabeled training examples. Second, compared to few-shot prompted LLMs, we achieve better performance using substantially smaller model sizes. Third, we reduce both the model size and the amount of data required to outperform LLMs; our finetuned 770M T5 model outperforms the few-shot prompted 540B PaLM model using only 80% of available data on a benchmark, whereas standard finetuning the same T5 model struggles to match even by using 100% of the dataset. We release the code at: https://github.com/google-research/distilling-step-by-step

部署大型语言模型(LLM)具有挑战性,因为它们在实际应用中内存效率低、计算密集。

为此,研究人员通过使用人类标签进行微调或使用 LLM 生成的标签进行蒸馏,来训练针对特定任务的较小模型。

然而,微调和蒸馏需要大量的训练数据,才能达到与 LLM 相当的性能。

我们逐步引入蒸馏法,这是一种新的机制,

  1. (a)训练的模型更小,性能优于 LLM,
  2. (b)通过利用微调或蒸馏法所需的更少的训练数据来实现这一目标。

我们的方法在多任务框架内提取 LLM 理由作为训练小型模型的额外监督。

我们通过 4 个 NLP 基准得出了三项发现:

  1. 首先,与微调法和蒸馏法相比,我们的机制能以更少的标注/未标注训练示例获得更好的性能。

  2. 其次,与少量提示的 LLM 相比,我们使用更小的模型规模就能获得更好的性能。

  3. 第三,我们同时缩小了模型规模和所需数据量,从而超越了 LLMs;

我们的经过微调的 770M T5 模型在基准测试中只使用了 80% 的可用数据,就超越了少次提示的 540B PaLM 模型,而标准微调的 T5 模型即使使用 100% 的数据集也难以与之匹敌。

Results

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

### DeepSeek LLM及其长期主义扩展开源语言模型的最佳实践 #### 概述 DeepSeek作为一个致力于开发先进的人工智能解决方案的企业,其大型语言模型LLM)旨在通过创新的技术手段实现更高效、更具影响力的自然语言处理能力。为了推动这一目标,在实践中采用了多种策略和技术来优化和扩展开源语言模型。 #### 长期主义视角下的模型扩展方法 对于希望采用长期主义原则扩展开源语言模型的研究者而言,可以借鉴如下几种方式: - **持续的数据更新机制**:保持训练语料库的新鲜度至关重要。定期引入新的高质量数据集有助于提升模型的理解能力和表达多样性[^4]。 - **模块化架构设计**:构建易于维护升级的系统结构,使得各个组件之间解耦合良好,便于单独迭代改进不同部分而不影响整体稳定性[^2]。 - **社区驱动的发展模式**:鼓励全球范围内的贡献者参与进来共同完善项目生态;这不仅限于代码层面还包括文档编写、测试反馈等方面的工作[^1]。 #### 实施细节与最佳实践建议 当具体实施上述理念时,应考虑以下几个方面: - **资源分配规划**:合理安排计算资源用于实验探索与生产部署之间的平衡;优先支持那些具有潜力带来显著收益的方向进行深入研究[^3]。 - **性能监控体系建立**:设立完善的指标跟踪框架以便及时发现潜在瓶颈所在,并据此调整算法参数或硬件配置以求得最优性价比表现。 - **安全性和隐私保护措施加强**:随着模型规模不断扩大,确保用户信息安全成为不可忽视的任务之一。采取加密传输协议、匿名化处理敏感信息等手段有效降低风险隐患。 ```python import torch from transformers import AutoModelForCausalLM, AutoTokenizer def load_model(model_name="deepseek/llm"): tokenizer = AutoTokenizer.from_pretrained(model_name) model = AutoModelForCausalLM.from_pretrained(model_name) return model, tokenizer model, tokenizer = load_model() print("Model loaded successfully.") ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值