math-toolcall-tr
收藏资源简介:
math-toolcall-tr是一个专门为训练大型语言模型(LLM)正确调用数学函数并清晰呈现结果而创建的土耳其语合成数据集。该数据集包含2,127个采用ShareGPT格式的多轮对话,每个对话都嵌入了模型思考链(`<think>...</think>`)。其核心目标是同步训练模型的两项关键技能:1) 在需要时准确选择工具并推断参数,避免不必要的调用;2) 将原始数值结果转化为自然、流畅的语言向用户解释。数据集有意包含了多样性:约29.6%的样本(629个)不涉及任何工具调用,用于训练模型判断问题是否可通过已有知识解答或参数是否缺失;同时,有761个样本包含多次工具调用,用于训练复杂场景下的推理能力。数据内容全面覆盖了13个数学子领域(包括代数、分析、金融数学、几何、算术、三角学、数论、线性代数、概率组合、单位换算、统计学、离散数学和优化)下的70个具体主题。此外,数据集设计了8种不同的工具调用场景来模拟现实挑战,例如:判断工具是否必要(`arac_gereksiz`)、处理错误(如除以零,`hata_yonetimi`)、在相似工具中做出正确选择(`yanlis_arac_tuzagi`)、对缺失参数进行澄清提问而非捏造(`eksik_parametre`),以及处理多步骤任务(`cok_adimli_gorev`)、并行调用(`paralel_cagri`)和链式调用(`zincirli_cagri`)。样本还按难度分为简单(819个)、中等(603个)和困难(705个)三个级别。数据采用标准的对话列表格式,每个样本的`conversations`字段包含一系列由`from`(角色,如`human`, `gpt`)和`value`(内容)组成的消息。在需要工具调用的样本中,对话通常为四轮结构,依次为用户问题、带思考链和工具调用的模型响应、模拟的工具响应结果,以及模型最终的自然语言解答。该数据集通过两阶段合成流程生成,全部使用`gpt-5.4-mini`模型完成。首先生成涵盖特定主题、场景和难度的问题及可能用到的函数模式,然后由同一模型生成包含推理步骤、工具调用、预期工具结果和最终答案的完整对话。需要注意的是,数据集是合成且未经人工验证的,`tool_response`中的工具结果是模型生成的而非真实计算得出,可能存在数学错误或少量场景不一致,并且其风格和推理模式受限于单一的源模型。它专为土耳其语数学工具调用任务设计,不适用于其他语言或领域。
math-toolcall-tr is a synthetic Turkish dataset created specifically for training large language models (LLMs) to correctly call mathematical functions and clearly present results. The dataset contains 2,127 multi-turn dialogues in ShareGPT format, each embedded with model chain-of-thought (`<think>...</think>`). Its core objective is to simultaneously train two key model skills: 1) accurately selecting tools and inferring parameters when needed, avoiding unnecessary calls; 2) transforming raw numerical results into natural, fluent language explanations for users. The dataset intentionally includes diversity: approximately 29.6% of samples (629) involve no tool calls, training the model to judge whether problems can be solved with existing knowledge or if parameters are missing; meanwhile, 761 samples contain multiple tool calls for training reasoning in complex scenarios. Data content comprehensively covers 70 specific topics across 13 mathematical subfields (including algebra, analysis, financial mathematics, geometry, arithmetic, trigonometry, number theory, linear algebra, probability and combinatorics, unit conversion, statistics, discrete mathematics, and optimization). Additionally, the dataset designs 8 different tool-calling scenarios to simulate real-world challenges, such as: determining if tools are necessary (`arac_gereksiz`), handling errors (e.g., division by zero, `hata_yonetimi`), making correct choices among similar tools (`yanlis_arac_tuzagi`), clarifying missing parameters instead of fabricating them (`eksik_parametre`), as well as handling multi-step tasks (`cok_adimli_gorev`), parallel calls (`paralel_cagri`), and chained calls (`zincirli_cagri`). Samples are also categorized by difficulty into simple (819), medium (603), and hard (705) levels. The data uses a standard dialogue list format, where each samples `conversations` field contains a series of messages consisting of `from` (role, e.g., `human`, `gpt`) and `value` (content). In samples requiring tool calls, dialogues typically follow a four-turn structure: user question, model response with chain-of-thought and tool call, simulated tool response result, and the models final natural language answer. The dataset is generated through a two-stage synthetic process, entirely using the `gpt-5.4-mini` model. First, problems and potential function patterns covering specific topics, scenarios, and difficulties are generated, then the same model generates complete dialogues including reasoning steps, tool calls, expected tool results, and final answers. It is important to note that the dataset is synthetic and not manually verified; tool results in `tool_response` are generated by the model rather than real calculations, potentially containing mathematical errors or minor scenario inconsistencies, and its style and reasoning patterns are limited by the single source model. It is designed specifically for Turkish mathematical tool-calling tasks and is not suitable for other languages or domains.
数据集名称
- math-toolcall-tr:土耳其语数学导向的函数调用数据集,包含 2,127 个 ShareGPT 格式的对话样本,带有推理步骤(
<think>)。
任务与标签
- 任务类别:文本生成、问答。
- 标签:函数调用、工具使用、数学、土耳其语、合成、推理、ShareGPT、Unsloth。
数据集规模与结构
- 大小:1,000 < 样本数 < 10,000。
- 特征:
conversations列表,每条含from(角色)和value(内容)。 - 划分:仅训练集 (train),包含 2,127 个样本。
文件格式
- 配置:默认配置 (
default),数据文件路径为data/train-*。
核心教学内容
- 正确选择工具与参数推断:包括避免不必要的调用。
- 将数值结果转换为自然语言反馈。
- 无工具调用样本占比 29.6%:当问题可直接回答或参数缺失时,模型应提问澄清而非虚构。
对话格式
-
工具调用样本:4 轮对话。
- 第 1 轮:
human– 用户问题。 - 第 2 轮:
gpt– 包含<think>…</think>和<tool_call>{"name":…,"arguments":…}</tool_call>。 - 第 3 轮:
human– 包含<tool_response>{…}</tool_response>。 - 第 4 轮:
gpt– 自然语言最终回答。
- 第 1 轮:
-
无需工具样本:仅 1 轮
gpt,包含<think>和回答。 -
训练时建议使用
train_on_responses_only,仅计算gpt轮的损失,掩码tool_response轮。
覆盖范围
- 13 个子领域,70 个主题:
| 子领域 | 样本数 | 子领域 | 样本数 |
|---|---|---|---|
| 代数 | 275 | 概率与组合 | 145 |
| 分析 | 192 | 单位与测量 | 140 |
| 金融数学 | 186 | 统计 | 155 |
| 几何 | 205 | 离散数学 | 105 |
| 算术 | 171 | 优化 | 86 |
| 三角学 | 146 | ||
| 数论 | 181 | ||
| 线性代数 | 140 |
场景分布
| 场景 | 样本数 | 教学目标 |
|---|---|---|
| 工具不必要 | 318 | 不调用不必要的工具 |
| 单次调用 | 305 | 正确参数调用单个工具 |
| 错误处理 | 276 | 解释除以零等错误 |
| 工具混淆陷阱 | 286 | 从相似工具中选择正确工具 |
| 参数缺失 | 237 | 提问澄清而非虚构 |
| 多步骤任务 | 220 | 单次请求完成 3 次以上调用 |
| 并行调用 | 255 | 同时进行独立计算 |
| 链式调用 | 230 | 第二个调用的输入来自第一个调用的结果 |
- 难度:容易 819 / 中等 603 / 困难 705。
- 无工具调用样本:629。
- 多调用样本:761。
使用方式
python from datasets import load_dataset dataset = load_dataset("bilalabic/math-toolcall-tr", split="train")
- 可与 Unsloth 配合,使用
standardize_data_formats和apply_chat_template进行格式化。
生成方法
-
两阶段合成生成,全部基于
gpt-5.4-mini(推理努力程度:中等)。- 问题生成:为每个(子领域,主题,场景,难度)组合选择 2-4 个函数模式,其中仅 1-2 个真正需要,其余为干扰项。
- 回答生成:生成推理步骤、工具调用、预期工具结果和最终回答。
-
排除重复问题。通过优先处理未覆盖主题达成 70/70 主题全覆盖。
-
生成代码:完全开源,地址为 https://github.com/BilalAbic/math-toolcall-tr
相关模型
-
LoRA 适配器:https://huggingface.co/bilalabic/gemma_4_math-toolcall-tr_lora
-
训练笔记本:https://github.com/BilalAbic/math-toolcall-tr/blob/main/notebooks/gemma4_e4b_math_toolcall_lora.ipynb
-
GitHub 仓库:https://github.com/BilalAbic/math-toolcall-tr
-
基于 Gemma-4 E4B 使用 LoRA (r=8) 训练 3 个 epoch,采用
train_on_responses_only。 -
⚠️ 该适配器基于数据集早期 757 个样本 快照训练,而非当前完整的 2,127 个样本。
模型基准测试结果(基于 757 样本训练)
- 评估:在 150 个未见过的样本(按场景均衡选取)上测试。
| 数学工具调用指标 | 基座模型 | 微调后 | 差异 |
|---|---|---|---|
| 总体准确率 | 56.67% | 59.33% | +2.66 分 |
| 工具选择 | 53.77% | 54.72% | +0.95 分 |
| 不回答(abstain) | 63.64% | 70.45% | +6.81 分 |
| 格式有效性 | 98.67% | 99.33% | +0.66 分 |
- 完整评估(含土耳其语 MMLU 和 GSM8K)见模型卡。
局限性
- 合成数据,未经人工验证。
- 工具结果不真实:
tool_response由模型生成,未实际执行函数。 - 可能存在数学错误:虽然提示要求数学正确性,但未逐条验证。
- 场景不一致性:约 3.5%(74 个样本)中预期有工具调用但调用的列表为空,主要集中在错误处理场景。
- 单一模型来源:风格和推理模式受限于单一模型。
- 仅限土耳其语和数学:无法泛化到其他领域或语言。
引用格式
bibtex @misc{math-toolcall-tr, title = {math-toolcall-tr: Turkish Math Tool-Calling Dataset}, author = {Bilal Abiç}, year = {2026}, url = {https://huggingface.co/datasets/bilalabic/math-toolcall-tr} }




