grug-think
收藏资源简介:
grug-think是一个用于训练语言模型进行高效工具调用和智能体推理的合成数据集。其核心目标是解决大型模型在工具调用前进行冗长思考(约400个token)的问题,通过训练模型使用极简短(中位数仅11个单词)但有效的内部推理,从而显著降低计算成本(token即金钱)。数据集包含100,891个完整的智能体对话示例,每个示例遵循统一格式:系统提示、用户查询、助手回复和工具消息。助手回复采用特定结构:首先在`<think>`和`</think>`标签内包含简短的“grug风格”推理(仅内部思考部分被重写为直接、无填充的短句),然后是面向人类的原始标准英语回复,最后是完整的工具调用(JSON格式保持不变且经过严格验证)。数据来源于多个公开数据集,包括glaive-function-calling-v2、hermes-function-calling-v1、ToolACE以及SWE-smith和nebius的智能体编码轨迹,涵盖约45%的代码修复任务(如查找bug、文件编辑、测试)和约55%的API工具调用任务。部分示例故意不包含工具调用,以训练模型判断何时无需调用工具。数据集通过将原始对话轨迹归一化后,使用DeepSeek-V4-Pro模型为每个助手回合生成简短的grug推理,并严格过滤和去重而构建。关键统计显示,共有542,799个带思考轨迹的助手回合,思考长度中位数为11词,说话部分平均31.1词,且所有工具调用JSON均完整无误。该数据集适用于微调模型以执行bash命令、文件操作、API调用和多轮对话等智能体任务,同时保持人类对话的自然性。局限性包括仅支持英语、推理为事后合成生成,以及包含部分弱智能体的“挣扎”轨迹用于训练恢复能力。数据基于开源许可证(Apache/MIT),建议用户核查上游许可。
grug-think is a synthetic dataset for training language models in efficient tool usage and agent reasoning. Its core goal is to address the issue of large models engaging in lengthy thinking (around 400 tokens) before tool calls, by training models to use extremely short (median of only 11 words) yet effective internal reasoning, thereby significantly reducing computational costs (tokens are money). The dataset contains 100,891 complete agent dialogue examples, each following a uniform format: system prompt, user query, assistant response, and tool messages. The assistant response adopts a specific structure: first, it includes brief grug-style reasoning within `<think>` and `</think>` tags (only the internal thinking part is rewritten as direct, filler-free short sentences), followed by the original standard English response for humans, and finally the complete tool call (JSON format remains unchanged and strictly validated). Data sources include multiple public datasets, such as glaive-function-calling-v2, hermes-function-calling-v1, ToolACE, and agent coding trajectories from SWE-smith and nebius, covering approximately 45% code repair tasks (e.g., finding bugs, file editing, testing) and about 55% API tool usage tasks. Some examples intentionally omit tool calls to train models in judging when not to use tools. The dataset is constructed by normalizing original dialogue trajectories, using the DeepSeek-V4-Pro model to generate short grug reasoning for each assistant turn, and strictly filtering and deduplicating. Key statistics show 542,799 assistant turns with thought trajectories, a median thought length of 11 words, an average speaking part of 31.1 words, and all tool call JSONs are complete and error-free. This dataset is suitable for fine-tuning models to perform agent tasks such as bash commands, file operations, API calls, and multi-turn dialogues, while maintaining natural human conversation. Limitations include English-only support, reasoning being post-hoc synthesized, and inclusion of some weak agent struggle trajectories for training recovery capabilities. The data is under open-source licenses (Apache/MIT), and users are advised to check upstream licenses.
数据集概述:grug-think
grug-think 是一个用于文本生成的英文数据集,旨在训练模型在进行工具调用前进行简洁、高效的推理,模仿“grug”式的思考模式——短、直接、无冗余。
- 许可证: Apache-2.0
- 语言: 英语
- 任务: 文本生成
- 标签: 函数调用、工具使用、智能体、推理、合成数据
- 数据集大小: 100,000 < 1,000,000 条样本
- 配置: 默认配置包含一个训练集,数据文件为
data/train.jsonl
结构与格式
数据集包含 100,891 个示例,每个示例都是一个完整的智能体对话,包括系统消息、用户消息、助手消息和工具消息。
消息格式遵循 OpenAI API 格式,并嵌入了 Hermes 风格的 <think> 标签。
- 助手回复结构:
<think>grug reasoning</think>: 首先进行简短、实时的推理(grug 思考)。- 普通英语文本 (say-words): 然后输出面向用户的正常英语。
- 工具调用 (tool_calls): 最后进行工具调用,其 JSON 格式保持完全不变。
关键点: 只有 <think> 标签内的内容是“grug风格”的短思考。外部与人交流的文本保持原始英语。工具调用的 JSON 被视为神圣不可修改的内容。
思考样本 (从数据集中提取)
<think>Tuple field likely in fields.py. View file to find implementation.</think> <think>Need exact line numbers for Tuple class. Use grep.</think> <think>Understand how _bind_to_schema works in base Field class. Tuple likely missing override that binds inner fields.</think> <think>Check how List field handles inner field binding - likely has pattern to follow for Tuple.</think>
这些样本展示了真实的假设链,无冗余填充词。
数据来源
数据集中的对话并非凭空创造,而是从其他大型开放数据集的真实智能体轨迹中提取,并重写了其中的“思考”部分。“说话”部分和“工具调用”则完全保持原样。
| 来源 | 数量 | 说明 |
|---|---|---|
| glaive-function-calling-v2 | ~40.8k | 简单的 API 工具调用对话 |
| hermes-function-calling-v1 | ~6.2k | 多轮工具使用 |
| ToolACE | ~8.9k | 多工具 API 调用 |
| SWE-smith trajectories (tool) | ~15k | 实时代码错误修复 (原生工具调用) |
| SWE-smith trajectories (ticks) | ~15k | 实时代码错误修复 (bash风格) |
| nebius SWE-agent trajectories | ~15k | 更多代理修复代码 |
- 约 45% 的数据为编码工作:查找错误、读写文件、编辑、测试、提交。
- 约 55% 的数据为 API 类工具调用。
- 部分示例故意不包含工具调用,旨在教会模型何时不应使用工具。
数据构建流程
- 格式化: 将所有来源数据统一为一种 schema。
- 生成思考: 使用大型模型 (DeepSeek-V4-Pro) 为每个助手回复生成简短的
<think>思考内容。- 规则: 最多约 70 个单词,内容必须涉及真实的工具调用推理,无填充词。
- 还原对话: 面向用户的“说话”部分恢复为原始文本。只有
<think>标签内是 grug 风格。 - 过滤: 丢弃缺失思考、思考过长、思考中包含“Lets”等大模型常用词的数据(约丢弃 0.4%)。
- 去重: 按 ID 移除重复示例。
关键统计数据
- 总助手思考轮次: 542,799
- 思考长度:
- 中位数: 11 个单词
- 90% 分位数: 20 个单词
- 平均数: 12.6 个单词
- 说话文本长度: 平均 31.1 个单词 (英语,来自原始数据)
- 工具调用 JSON 完整性: 100% 无损坏。
预期用途
该数据集用于微调模型,使其具备以下能力:
- 在每次工具调用前进行低成本推理。
- 对人类输出正常的英语(grug 思考仅存于内部)。
- 执行智能体工作:使用 bash、文件编辑、API 调用、多轮对话。
已知局限
- 语言: 仅限英语,不支持多语言。
- 推理性质: 思考过程是合成的,并且是事后生成的(模型在看到正确行为后写下的“后见之明”)。
- 数据质量: 部分 SWE 轨迹可能来自较弱的智能体,包含了无效的尝试过程,但这也教会了模型如何从失误中恢复。



