fable-5-traces-sft-chatml
收藏资源简介:
Fable-5 Traces SFT ChatML是一个用于智能体任务监督微调(SFT)的数据集,基于Glint-Research/Fable-5-traces原始语料库构建,该语料库包含真实的Claude Fable 5智能体会话记录。数据集的核心价值在于将原始扁平化的会话转录文本转换为标准化的ChatML消息格式,并采用OpenAI函数调用格式的结构化工具调用(tool_calls),方便用户直接用于主流训练框架(如axolotl、LLaMA-Factory、TRL等),无需自行解析格式。数据内容包含4,665个样本,每个样本代表智能体与环境的单次交互步骤,核心是`messages`数组,其中包含完整的对话历史,角色包括`user`、`assistant`和`tool`。助手回合可能包含结构化的工具调用,工具回合则包含匹配的`tool_call_id`。每个样本的最后一个助手回合是训练目标,以思维链(Chain-of-Thought)推理块开头,后跟该步骤的实际行动(工具调用或纯文本回复)。数据规模方面,样本源自60个原始会话,其中以工具调用为目标的样本有3,799条,以文本回复为目标的样本有866条。整个数据集共包含38,697次工具调用,工具类型分布广泛,主要包括Bash、Edit、Read、Write、PowerShell等,反映了真实的智能体工作(如Shell操作、文件编辑、验证循环)。每个样本的对话轮数在2到45之间,中位数为18轮,数据集约包含1,100万令牌。字段包括`messages`、`uid`/`session`、`target_type`、`context_truncated`和`tool_args_valid`。适用任务包括训练支持工具调用和复杂推理的语言模型,适用于智能体、工具使用、函数调用等任务的监督微调。限制包括所有会话轨迹均来自单一助手模型(Claude Fable 5),主要涉及编码和终端工作,可能存在风格迁移,大部分样本的对话上下文开头被截断,数据许可证为AGPL-3.0。
Fable-5 Traces SFT ChatML is a dataset designed for supervised fine-tuning (SFT) of agent tasks. It is built from the Glint-Research/Fable-5-traces original corpus, which contains real Claude Fable 5 agent session traces. The core value of this dataset lies in converting the original flattened session transcripts into a standardized ChatML message format with structured tool calls in OpenAI function calling format, eliminating the need for users to parse the format manually and making it directly usable in mainstream training frameworks (e.g., axolotl, LLaMA-Factory, TRL). The data consists of 4,665 samples, each representing a single interaction step between the agent and the environment. The core of each sample is a `messages` array containing the complete dialogue history, with roles including `user`, `assistant`, and `tool`. Assistant turns may include structured tool calls (`tool_calls`), while tool turns contain matching `tool_call_id`. The last assistant turn in each sample is the training target, always starting with a Chain-of-Thought reasoning block (`[思考]...[/思考]`) followed by the actual action for that step (a tool call or a plain text response). In terms of scale and statistics, the samples originate from 60 original sessions, with 3,799 samples targeting tool calls (`tool_use`) and 866 targeting text responses (`text`). The entire dataset contains 38,697 tool calls, with a wide distribution of tool types, primarily including Bash (15,068 calls), Edit (10,068 calls), Read (4,552 calls), Write (3,186 calls), PowerShell (1,438 calls), reflecting real agent work (e.g., Shell operations, file editing, verification loops). The number of dialogue turns per sample ranges from 2 to 45, with a median of 18 turns. The dataset contains approximately 11 million tokens. Fields include: `messages`, `uid`/`session`, `target_type`, `context_truncated`, and `tool_args_valid`. It is suitable for training language models that support tool calling and complex reasoning, applicable to tasks such as agent, tool-use, and function-calling for supervised fine-tuning. Limitations include that all session traces come from a single assistant model (Claude Fable 5) and primarily involve coding and terminal work, which may lead to style transfer. Most samples (two-thirds) have truncated dialogue context beginnings, making them suitable for learning to act mid-session but not for full dialogue modeling. The data inherits the AGPL-3.0 license from the original corpus, and commercial use requires compliance with relevant service terms due to the original traces being from a third-party assistant.
数据集名称
Fable-5 Traces SFT ChatML
数据集简介
该数据集是 Claude Fable 5 智能体(Agent)会话轨迹语料库的重新格式化版本。它将原始数据集中的扁平化转录字符串,解析并重构为标准 ChatML 消息格式,并采用 OpenAI 风格的函数调用结构。数据集可直接用于支持聊天模板的 SFT 训练框架(如 Axolotl、LLaMA-Factory、TRL 等),无需额外的格式处理。
数据集规模与统计
- 样本数量:4,665 个(每个样本为一个智能体步骤)
- 来源会话数:60 个独立会话
- 最终轮次类型分布:
- 工具调用目标(tool_use):3,799 个
- 文本回复目标(text):866 个
- 上下文中的总工具调用次数:38,697 次
- 每个样本的轮次范围:最少 2 轮,中位数 18 轮,最多 45 轮
- 预估总 Token 数:约 1100 万
数据样本结构
每个样本是一个 JSON 对象,包含以下字段:
- messages:ChatML 格式的消息列表,包含角色(
user、assistant、tool)。助手轮次可能包含tool_calls(OpenAI 函数调用格式),工具轮次包含匹配的tool_call_id。最终助手轮次始终以<think>...</think>推理块开头。 - uid / session:来源语料库中的唯一标识符与会话标识符。相邻样本共享重叠上下文,建议按
session拆分训练/测试集。 - target_type:最终轮次的类型,
tool_use或text。 - context_truncated:布尔值,指示上下文窗口是否截断了会话的开头(4,121 个样本为
true)。 - tool_args_valid:布尔值,指示历史工具调用的参数是否被截断导致 JSON 不完整(3,102 个样本为
false),最终轮次的参数始终有效。
工具调用分布(基于 38,697 次调用)
| 工具名称 | 调用次数 |
|---|---|
| Bash | 15,068 |
| Edit | 10,068 |
| Read | 4,552 |
| Write | 3,186 |
| PowerShell | 1,438 |
| WebSearch | 529 |
| TaskUpdate | 489 |
| ToolSearch | 423 |
| 其他(如浏览器预览、调度工具) | 较少 |
使用方式
python from datasets import load_dataset ds = load_dataset("AnkitAI/fable-5-traces-sft-chatml", split="train")
from transformers import AutoTokenizer tok = AutoTokenizer.from_pretrained("Qwen/Qwen3-4B") text = tok.apply_chat_template(ds[0]["messages"], tokenize=False)
数据字段说明
- messages:ChatML 格式的消息列表。
- uid / session:来源会话的追踪键。
- target_type:最终轮次类型(
tool_use或text)。 - context_truncated:上下文是否被截断。
- tool_args_valid:历史工具调用参数是否完整。
数据集构建方法
- 将每个扁平化转录解析为带类型标记的轮次(
USER:、ASSISTANT (message):、ASSISTANT (tool call)、TOOL RESULT:)。 - 将工具调用规范化为 OpenAI 函数调用格式,并生成匹配的调用 ID。
- 删除开头孤立的工具结果,确保每个样本以模板干净的方式开始。
- 将来源中的
cot字段作为<think>推理内容,output字段作为结构化动作,附加为训练目标。 - 进行密钥、令牌的清理和精确去重。
已知限制
- 来自同一会话的步骤因滑动上下文窗口而高度重叠,评估时应按
session拆分或去重。 - 约三分之二的样本上下文开头被截断,模型会学习在会话中途开始行动,这匹配智能体部署场景,但不适合全对话建模。
- 所有轨迹均来自 Claude Fable 5 在编程和终端任务中的行为,输出会包含风格迁移和特定能力。
许可信息
该数据集继承自 Glint-Research/Fable-5-traces,许可证为 AGPL-3.0。由于轨迹源自第三方助手,其提供者的使用条款可能适用于下游训练与蒸馏。商业使用时需确认相关条款。




