arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2410.19185cs.AI
收藏

Tailored-LLaMA:利用任务特定提示优化剪枝 LLaMA 模型中的少样本学习

Tailored-LLaMA: Optimizing Few-Shot Learning in Pruned LLaMA Models with Task-Specific Prompts

Technological University Dublin(都柏林理工大学)

Danyal Aftab, Steven Davy

AI总结:

本文提出 Tailored LLaMA,通过结构化剪枝、任务特定提示与 LoRA 微调,在显著压缩 LLaMA 的同时保持少样本分类和生成性能。

摘要:

大型语言模型在语言理解和生成方面表现出令人瞩目的能力。然而,从头训练这些模型,即便是复杂度最低的十亿参数变体,也需要大量计算资源,这使其对许多组织而言在经济上不切实际。随着大型语言模型充当通用任务求解器,本文研究其任务特定微调。我们使用任务特定数据集和提示来微调两个具有 50 亿和 40 亿参数的剪枝 LLaMA 模型。该过程利用预训练权重,并通过 LoRA 方法聚焦于权重的一个子集。微调 LLaMA 模型的一个挑战是设计针对特定任务的精确提示。为解决这一问题,我们提出一种在两个主要约束下微调 LLaMA 模型的新方法:任务特定性和提示有效性。我们的方法 Tailored LLaMA 首先采用结构化剪枝,将模型规模从 7B 缩减至 5B 和 4B 参数。随后,它应用精心设计的任务特定提示,并利用 LoRA 方法加速微调过程。此外,对剪枝 50% 的模型进行不到一小时的微调后,通过 50 shots 的少样本学习,分类任务的平均准确率在 20% 压缩率下恢复至 95.68%,在 50% 压缩率下恢复至 86.54%。我们在这两个剪枝变体上对 Tailored LLaMA 的验证表明,即使压缩至 50%,模型在少样本分类和生成任务中仍保持超过基线模型准确率 65% 的水平。这些发现凸显了我们的定制方法在显著减小模型规模的同时保持高性能的有效性。

英文摘要:

Large language models demonstrate impressive proficiency in language understanding and generation. Nonetheless, training these models from scratch, even the least complex billion-parameter variant demands significant computational resources rendering it economically impractical for many organizations. With large language models functioning as general-purpose task solvers, this paper investigates their task-specific fine-tuning. We employ task-specific datasets and prompts to fine-tune two pruned LLaMA models having 5 billion and 4 billion parameters. This process utilizes the pre-trained weights and focuses on a subset of weights using the LoRA method. One challenge in fine-tuning the LLaMA model is crafting a precise prompt tailored to the specific task. To address this, we propose a novel approach to fine-tune the LLaMA model under two primary constraints: task specificity and prompt effectiveness. Our approach, Tailored LLaMA initially employs structural pruning to reduce the model sizes from 7B to 5B and 4B parameters. Subsequently, it applies a carefully designed prompt specific to the task and utilizes the LoRA method to accelerate the fine-tuning process. Moreover, fine-tuning a model pruned by 50\% for less than one hour restores the mean accuracy of classification tasks to 95.68\% at a 20\% compression ratio and to 86.54\% at a 50\% compression ratio through few-shot learning with 50 shots. Our validation of Tailored LLaMA on these two pruned variants demonstrates that even when compressed to 50\%, the models maintain over 65\% of the baseline model accuracy in few-shot classification and generation tasks. These findings highlight the efficacy of our tailored approach in maintaining high performance with significantly reduced model sizes.

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

↑