Instruct-SFT-Mix-v2 / README.md
rpisano's picture
Tool use in OpenAI/HF format (tools, tool_calls, tool role); cleaning of unusable tool rows; README
0a7d5d9 verified
|
Raw History Blame Contribute Delete
6.46 kB
---
dataset_info:
features:
- name: id
dtype: string
- name: messages
list:
- name: role
dtype: string
- name: content
dtype: string
- name: tool_calls
list:
- name: id
dtype: string
- name: type
dtype: string
- name: function
struct:
- name: name
dtype: string
- name: arguments
dtype: string
- name: tool_call_id
dtype: string
- name: tools
dtype: string
- name: lang
list: string
- name: source
dtype: string
- name: recipe_a
dtype: bool
- name: recipe_b
dtype: bool
splits:
- name: train
num_examples: 3655089
configs:
- config_name: default
data_files:
- split: train
path: data/train-*
---
# Instruct SFT Mix (v2) for MinervaE
This is the full version 2 SFT mixture for the instruction-tuned MinervaE model. It is a combination of three (and a half) datasets:
**English/multilingual data** 🇬🇧
- [Dolci-Instruct-SFT](https://huggingface.co/datasets/allenai/Dolci-Instruct-SFT)
- [Tulu 3](https://huggingface.co/datasets/allenai/tulu-3-sft-mixture)
**Italian data** 🇮🇹
- [Dolci-Instruct-SFT-IT (strict)](https://huggingface.co/datasets/minerva-post-training/Dolci-Instruct-SFT-IT) (Translated instances from the Dolci-Instruct-SFT mixture, by SapienzaNLP).
- [Dromedario 3](https://huggingface.co/datasets/sapienzanlp/dromedario-3-sft-dataset) (Translated instances from the Tulu 3 SFT mixture, by SapienzaNLP)
After deduplication and cleaning, the **Instruct SFT Mix (v2)** counts 3,655,089 SFT examples in total across several tasks and domains.
## Recipes
![Language shares](https://cdn-uploads.huggingface.co/production/uploads/6628f9ffcd36b08d03e18ea9/v7hM0V0RTyeBxEu4xonDK.png)
| Recipe | Description | size | it/en/other |
|:---|:---|---:|---|
| recipe_a | Uses all the available data. | 3,655,089 | 37.7 / 58.4 / 3.9 |
| recipe_b | Subsamples English instances to balance with Italian instances. | 2,752,691 | 47.5 / 47.5 / 5.0 |
## Dataset Merging Results
Final numbers per source dataset.
| source | kept instances | removed instances |
|:---|---:|---:|
| allenai/Dolci-Instruct-SFT | 2,063,466 | 88,577 |
| minerva-post-training/Dolci-Instruct-SFT-IT | 753,103 | 155,267 |
| allenai/tulu-3-sft-mixture | 218,058 | 721,045 |
| sapienzanlp/dromedario-3-sft-dataset | 620,462 | 2,218 |
In-detail results for deduplication.
| reason | dropped_from | kept_from | n_dropped |
|:---|:---|:---|---:|
| ... | See Mix v1 for details | See Mix v1 for details | ... |
| same text | minerva-post-training/Dolci-Instruct-SFT-IT | sapienzanlp/dromedario-3-sft-dataset | 80,519 |
| same id | minerva-post-training/Dolci-Instruct-SFT-IT | sapienzanlp/dromedario-3-sft-dataset | 59,857 |
| same text | minerva-post-training/Dolci-Instruct-SFT-IT | minerva-post-training/Dolci-Instruct-SFT-IT | 13,361 |
| same text | minerva-post-training/Dolci-Instruct-SFT-IT | allenai/tulu-3-sft-mixture | 71 |
| same text | minerva-post-training/Dolci-Instruct-SFT-IT | allenai/Dolci-Instruct-SFT | 3 |
## Cleaning
On top of deduplication:
- **Turn alignment of the Italian Dolci rows.** Every Dolci-Instruct-SFT-IT row has the same sequence of turns and roles as its English original (matched by `id`).
- **No hard-coded identity data.** The Dolci `Hardcoded Data` rows and the Tulu `tulu_hard_coded` rows (model name / creator answers) are not in the mix.
- **Tool-use rows.** Rows that cannot be used for training are removed (English / Italian):
| reason | EN | IT |
|:---|---:|---:|
| an assistant turn with neither text nor a tool call | 1,082 | 909 |
| a tool call that cannot be parsed, or that names a function not in `tools` | 1,135 | 961 |
| a tool output with no preceding tool call | 162 | 107 |
## Tool use
The tool-use rows (ids `olmo-toolu-*`, from Dolci-Instruct-SFT and Dolci-Instruct-SFT-IT) are 225,124 in English and 181,738 in Italian, with 1,002,057 and 781,202 tool calls. They use the OpenAI / Hugging Face chat format, so any chat template with tool support can render them:
| field | content |
|:---|:---|
| `tools` | JSON string with the list of available tools, `[{"type": "function", "function": {"name", "description", "parameters"}}]`. `null` on rows without tools. |
| `messages[].tool_calls` | on assistant turns that call tools: `[{"id": "call_0", "type": "function", "function": {"name": ..., "arguments": "<JSON string>"}}]`. Several calls in one turn are parallel calls. |
| role `tool` | the tool output, with `tool_call_id` set to the first call of the preceding assistant turn. |
- An assistant turn can hold text and calls together: the text comes before the calls.
- The system turn does not describe the tools or the call syntax. The chat template is expected to render that from `tools`.
- In the Italian rows the user and assistant text is in Italian, while tool definitions, call arguments and tool outputs are in English.
Example (shortened):
```json
{
"tools": "[{\"type\": \"function\", \"function\": {\"name\": \"weather.forecast_weather_api\", \"description\": \"Fetches weather forecast and alerts from a weather API.\", \"parameters\": {...}}}]",
"messages": [
{"role": "user", "content": "Puoi confrontare le previsioni del tempo per i prossimi 5 giorni a Parigi e Madrid?"},
{"role": "assistant", "content": "", "tool_calls": [
{"id": "call_0", "type": "function", "function": {"name": "weather.forecast_weather_api", "arguments": "{\"q\": \"Paris\", \"days\": 5}"}},
{"id": "call_1", "type": "function", "function": {"name": "weather.forecast_weather_api", "arguments": "{\"q\": \"Madrid\", \"days\": 5}"}}]},
{"role": "tool", "tool_call_id": "call_0", "content": "{\"results\": {\"forecast\": [...]}}"},
{"role": "assistant", "content": "Ho confrontato le previsioni del tempo per i prossimi 5 giorni..."}
]
}
```
`arguments` and `tools` are stored as JSON strings because Arrow cannot hold objects whose keys change from row to row. Parse them before applying a chat template, since templates such as Qwen3.5 iterate the arguments as a mapping:
```python
import json
tools = json.loads(row["tools"]) if row["tools"] else None
for m in row["messages"]:
for call in m.get("tool_calls") or []:
call["function"]["arguments"] = json.loads(call["function"]["arguments"])
text = tokenizer.apply_chat_template(row["messages"], tools=tools, tokenize=False)
```