arXiv:2410.05224cs.CLcs.LG2024-10被引 5

用程序化模板生成数据,让大模型学会规律,提升生成能力。

Cookbook: A framework for improving LLM generative abilities via programmatic data generating templates

  • 用Python函数模板生成带规律的训练数据,不依赖真人或大模型。
  • 微调后任务准确率最高提升52.7个百分点,多任务平均表现领先。
  • 适合想低成本提升模型生成能力的研究者和开发者。

在指令数据集上微调大语言模型是提升其生成能力的常用方法。然而,人工构建指令数据成本高、耗时长;而大模型自动生成的数据可能违反用户隐私协议或服务条款。为此,本文提出Cookbook框架,通过程序化方式生成由随机词元构成的简单模式数据,实现可扩展、低成本且无法律与隐私风险的训练数据构造。首先,Cookbook使用模板(即数据生成的Python函数)生成训练数据,引导模型学习对应任务的显式规律。实验表明,基于Cookbook生成数据微调后,模型在对应任务上的准确率最高提升52.7个百分点。其次,由于指令数据能同时提升多个下游任务性能,Cookbook算法自动混合不同模板数据,以优化多任务表现。在标准多任务GPT4ALL评估套件中,使用Cookbook生成数据微调的Mistral-7B模型平均准确率优于其他70亿参数指令微调模型,并在8个任务中有3个表现最佳。最后,本文分析了Cookbook提升性能的条件与机制,提出一个指标验证:性能提升主要源于模型生成结果更符合模板规则。

原文摘要 · Abstract (English)

Fine-tuning large language models (LLMs) on instruction datasets is a common way to improve their generative capabilities. However, instruction datasets can be expensive and time-consuming to manually curate, and while LLM-generated data is less labor-intensive, it may violate user privacy agreements or terms of service of LLM providers. Therefore, we seek a way of constructing instruction datasets with samples that are not generated by humans or LLMs but still improve LLM generative capabilities. In this work, we introduce Cookbook, a framework that programmatically generates training data consisting of simple patterns over random tokens, resulting in a scalable, cost-effective approach that avoids legal and privacy issues. First, Cookbook uses a template -- a data generating Python function -- to produce training data that encourages the model to learn an explicit pattern-based rule that corresponds to a desired task. We find that fine-tuning on Cookbook-generated data is able to improve performance on its corresponding task by up to 52.7 accuracy points. Second, since instruction datasets improve performance on multiple downstream tasks simultaneously, Cookbook algorithmically learns how to mix data from various templates to optimize performance on multiple tasks. On the standard multi-task GPT4ALL evaluation suite, Mistral-7B fine-tuned using a Cookbook-generated dataset attains the best accuracy on average compared to other 7B parameter instruction-tuned models and is the best performing model on 3 out of 8 tasks. Finally, we analyze when and why Cookbook improves performance and present a metric that allows us to verify that the improvement is largely explained by the model's generations adhering better to template rules.

大模型微调数据生成程序化模板指令数据

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。