New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
大语言模型(LLM)后训练数据准备相关笔记 #95
Comments
赞 |
学到了很多,非常感谢 |
感谢分享 |
请问 Continue Pre-Training的怎么处理的? |
二次预训练就用无标注的文本数据即可。
每篇文章一行 在数据集配置中指定读取text列 参考数据集:https://huggingface.co/datasets/olm/olm-wikipedia-20221220 |
谢谢你的回复,我刚好在用这个框架,我直接填到prompt也就是alpaca 的Instruction里面,然后后面必填的我就随便写个值。反正不算loss |
本文是对 LLM 进行微调以及二次预训练时,阅读数据训练相关文章的一些学习笔记,包含极少的经验总结。
参考资料:
0x01 数据格式介绍
1. Question and Answer Dataset
2. Text Summarization
3. Instruct Tuning
部分模型指令微调的数据集增加 Input,Input 可以为空,此时的例子如下:
4. Human-Bot Conversation
<human>: what are the five most common causes of stress among people? \n<bot>: a 2017 study showed that the top causes of stress in america were: money (64%) work (60%) the economy (49%) family responsibilities (47%) personal health problems (46%) \n<human>: how would someone cope with stress from financial difficulties and work? \n<bot>:
Prompt 的格式和具体的模型有关。
5. Continue Pre-Training
准备包含长文本的数据集,以便进一步预训练语言模型。
0x20 数据准备流程
0x21 数据导入
从不同的数据源(connector中)导入文档,需要将不同格式的原始数据处理为带有 metadata 的文本格式。
0x22 数据清理
目的是删除数据中低质量部分,包括:
同时此时可以使用一些数据质量检查方法(Bleu/Meteor/相似度/奖励模型)自动剔除低质量数据。
0x23 数据过滤
数据过滤和清理不同,数据过滤目的是过滤掉不符合模型训练的文本,可以应用不同的过滤器,典型如:
0x24 数据去重(De-duplication)
研究表现,训练数据中的重复数据会极大的降低模型的能力。所以需要对训练数据进行去重。有一些库如deduplicate-text-datasets, and datasketch。
针对微调训练集,也可以使用向量检索的方式进行去重。
0x25 数据去污(Decontamination)
需要尽量避免在训练数据集中包含测试数据集,否则可能会高估模型性能。
污染包括输入输出污染以及输入污染两种。
这里有一个数据去污的例子:https://github.com/EleutherAI/lm-evaluation-harness/blob/master/docs/decontamination.md#decontamination
0x26 价值观控制
从数据中过滤掉不符合所在国家法律或者道德要求的的内容。比如种族歧视、言语暴力等。具体应该以所在国家的法律规定为准。
0x27 个人信息脱敏
从数据中去除法律规定的个人信息数据,如ID、医疗记录等。有presidio and pii-codex 库等。
0x28 数据转换
0x30 数据构建
指令微调数据准备是对数据标注员要求极高的工作,一个经验丰富的具备大学学历的数据标注员,标注速度可能会低于 5 条每小时。
有三种方法可以提高数据构建效率:
The text was updated successfully, but these errors were encountered: