agentleFS
kiko197kiko197/ai-agent-skills/fine-tuning-prep/SKILL.md

fine-tuning-prep

Skill0 starsChanged 3 months agoMITView on GitHub

为 SFT 指令微调准备高质量数据集。当需要清洗、去重、构造指令-回复对、做训练/验证拆分、评估数据质量,为微调打基础时使用。

The file

Files
SKILL.md

微调数据准备(SFT)

"模型吃进去的就是吐出来的",数据准备决定微调成败。本技能专注于把原始语料加工成可直接用于指令微调的数据集。

使用步骤

1. 明确微调目标与格式

  • 确定任务类型:指令跟随、格式跟随、领域知识、角色模仿、还是工具调用。
  • 确定标注格式(如 ChatML / ShareGPT / Alpaca 的 instruction-input-output 结构)。
  • 明确 desired 行为样例长什么样。

2. 数据来源与初筛

  • 收集并盘点来源:爬取、问答、文档、人工编写。
  • 初筛:去重、去敏感、去低质量(太短/纯噪音/跑题)。

3. 清洗与规范化(可参考 data-cleaning 技能)

  • 文本规范化、去 HTML/标签杂讯、统一换行。
  • 去隐私(身份证/手机号/密钥)。

4. 构造指令-回复对

  • 高质量:指令清晰、输入与输出对齐、回答直接正确。
  • 覆盖多样:换不同问法、不同长度、正反例。
  • 避免"教科书式重复"的注水数据,宁缺毋滥。
  • 对需要领域知识的任务,确保答案是准确来源。

5. 去重与平衡(关键)

  • 语义去重(embedding 相似度),避免同质样本海量堆积。
  • 平衡各类别/各任务比例,防止模型偏科。
  • 控制总样本量合理(几条到几千条高质量常优于海量低质)。

6. 划分与格式校验

  • 按 train/validation(建议还留 test)拆分,避免泄露。
  • 用脚本校验每条样本字段完整、JSON/格式合法。
  • 抽样人工复核 5~10% 确认质量。

7. 产出

  • 训练集、验证集、测试集文件 + 样例卡片 + 数据卡片说明。
  • 清洗/校验脚本纳入仓库,保证可复现。

自查清单

  • 目标、格式、desired 行为是否明确。
  • 是否做过去重、去敏感、去低质量。
  • 指令-回复对是否高质量且多样。
  • 是否做好类目平衡与样本量控制。
  • train/val/test 拆分是否无泄露,校验脚本是否通过。

参考关联

  • 清洗通用流程见 data-cleaning;效果如何可用 llm-evaluation 验证;基础提示词见 prompt-engineering。

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.