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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
license: apache-2.0
|
| 5 |
+
task_categories:
|
| 6 |
+
- text-generation
|
| 7 |
+
tags:
|
| 8 |
+
- alfworld
|
| 9 |
+
- dbbench
|
| 10 |
+
- agentbench
|
| 11 |
+
- agent
|
| 12 |
+
- multi-turn
|
| 13 |
+
- sft
|
| 14 |
+
- deep-thinking
|
| 15 |
+
size_categories:
|
| 16 |
+
- 1K<n<10K
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
---
|
| 18 |
+
|
| 19 |
+
# Deepthinking ALFWorld & DBBench Spider v2
|
| 20 |
+
|
| 21 |
+
AgentBench 評価の 2 タスク(ALFWorld / DBBench)を統合した **マルチタスク SFT 訓練データセット**。
|
| 22 |
+
フォーマット検査・フィルタリング済みの **7,779 件**を、サイズ比率に基づく等間隔インターリーブで結合。
|
| 23 |
+
|
| 24 |
+
---
|
| 25 |
+
|
| 26 |
+
## Dataset Summary
|
| 27 |
+
|
| 28 |
+
| Metric | Value |
|
| 29 |
+
|--------|-------|
|
| 30 |
+
| **Total rows** | **7,779** |
|
| 31 |
+
| ALFWorld | 4,884 (62.8%) |
|
| 32 |
+
| DBBench | 2,895 (37.2%) |
|
| 33 |
+
| Avg messages per item | 18.3 |
|
| 34 |
+
| Columns | `messages` |
|
| 35 |
+
| Interleave method | 比率ベース等間隔マージ |
|
| 36 |
+
|
| 37 |
+
---
|
| 38 |
+
|
| 39 |
+
## Source Datasets
|
| 40 |
+
|
| 41 |
+
| Source | Rows | Description |
|
| 42 |
+
|--------|------|-------------|
|
| 43 |
+
| [mark-22/Deepthinking-sft_alfworld_final1](https://huggingface.co/datasets/mark-22/Deepthinking-sft_alfworld_final1) | 4,884 | ALFWorld タスク。GPT-OSS-120B で最初の THOUGHT に状況分析・常識推論・ステップ分解を挿入したデータ拡張版 |
|
| 44 |
+
| [mark-22/dbbench_spider_v4_mergeddata_final1](https://huggingface.co/datasets/mark-22/dbbench_spider_v4_mergeddata_final1) | 2,897 → 2,895 | DBBench タスク。Spider 生成データ (1,697) + u-10bei クレンジング済みデータ (1,200) の統合。フォーマット検査で 2 件除外 |
|
| 45 |
+
|
| 46 |
+
---
|
| 47 |
+
|
| 48 |
+
## Merge Pipeline
|
| 49 |
+
|
| 50 |
+
```
|
| 51 |
+
mark-22/Deepthinking-sft_alfworld_final1 (4,884)
|
| 52 |
+
↓ フォーマット検査: THOUGHT + ACTION パターン必須
|
| 53 |
+
↓ 除外: 0 件
|
| 54 |
+
↓ シャッフル (seed=42)
|
| 55 |
+
↓
|
| 56 |
+
├─────────────────────────────────────────────┐
|
| 57 |
+
│ 等間隔インターリーブ (サイズ比率ベース) │
|
| 58 |
+
├─────────────────────────────────────────────┘
|
| 59 |
+
↓
|
| 60 |
+
mark-22/dbbench_spider_v4_mergeddata_final1 (2,897)
|
| 61 |
+
↓ フォーマット検査: Action: Operation/Answer 必須
|
| 62 |
+
↓ 除外: 2 件(フォーマット違反)
|
| 63 |
+
↓ シャッフル (seed=42)
|
| 64 |
+
↓
|
| 65 |
+
→ 7,779 件(ALF:DB ≈ 63:37)
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
### Formatting Filters
|
| 69 |
+
|
| 70 |
+
#### ALFWorld
|
| 71 |
+
- 全 assistant メッセージに `THOUGHT:` と `ACTION:` の両方が含まれること
|
| 72 |
+
- `THOUGHT:` が `ACTION:` より前に出現すること
|
| 73 |
+
|
| 74 |
+
#### DBBench
|
| 75 |
+
- `"Ok."` 等の承認応答はスキップ
|
| 76 |
+
- それ以外の assistant メッセージに `Action: Operation` または `Action: Answer` が含まれること
|
| 77 |
+
- 少なくとも 1 回は Action が実行されていること
|
| 78 |
+
|
| 79 |
+
### Interleave Strategy
|
| 80 |
+
|
| 81 |
+
単純な連結ではなく、**比率ベースの等間隔マージ**を採用:
|
| 82 |
+
|
| 83 |
+
- 各データセットを独立シャッフル後、正規化位置 `(i + 0.5) / N` を付与
|
| 84 |
+
- 全アイテムを正規化位置でソートし、ALFWorld と DBBench が均等に混ざるよう配置
|
| 85 |
+
- 訓練時にタスクが偏らず、安定した学習を実現
|
| 86 |
+
|
| 87 |
+
```
|
| 88 |
+
結果のインターリーブパターン(先頭10件):
|
| 89 |
+
[0] ALF [1] DB [2] ALF [3] ALF [4] DB
|
| 90 |
+
[5] ALF [6] DB [7] ALF [8] ALF [9] DB
|
| 91 |
+
```
|
| 92 |
+
|
| 93 |
+
---
|
| 94 |
+
|
| 95 |
+
## Conversation Structures
|
| 96 |
+
|
| 97 |
+
### ALFWorld items
|
| 98 |
+
|
| 99 |
+
```
|
| 100 |
+
[system] Interact with a household to solve a task...
|
| 101 |
+
[user] You arrive in a room. You can see...
|
| 102 |
+
[assistant] THOUGHT: {AI-generated analysis} + {original thought}
|
| 103 |
+
ACTION: {action command}
|
| 104 |
+
[user] Environment response
|
| 105 |
+
...
|
| 106 |
+
```
|
| 107 |
+
|
| 108 |
+
### DBBench items
|
| 109 |
+
|
| 110 |
+
```
|
| 111 |
+
[user] I will ask you a question, then you should help me operate a MySQL database...
|
| 112 |
+
[assistant] Ok.
|
| 113 |
+
[user] Question text
|
| 114 |
+
[assistant] Thought + Action: Operation ```sql ... ```
|
| 115 |
+
[user] MySQL raw output
|
| 116 |
+
...
|
| 117 |
+
[assistant] ... Action: Answer Final Answer: ["..."]
|
| 118 |
+
```
|
| 119 |
+
|
| 120 |
+
---
|
| 121 |
+
|
| 122 |
+
## Usage
|
| 123 |
+
|
| 124 |
+
```python
|
| 125 |
+
from datasets import load_dataset
|
| 126 |
+
|
| 127 |
+
ds = load_dataset("mark-22/Deepthinking-alfworld_and_dbbench_spider_v2", split="train")
|
| 128 |
+
|
| 129 |
+
for item in ds:
|
| 130 |
+
messages = item["messages"]
|
| 131 |
+
# Detect task type by first message role:
|
| 132 |
+
# system -> ALFWorld
|
| 133 |
+
# user -> DBBench
|
| 134 |
+
task_type = "alfworld" if messages[0]["role"] == "system" else "dbbench"
|
| 135 |
+
```
|
| 136 |
+
|
| 137 |
+
---
|
| 138 |
+
|
| 139 |
+
## Merge Code
|
| 140 |
+
|
| 141 |
+
<details>
|
| 142 |
+
<summary>結合スクリプト全文(クリックで展開)</summary>
|
| 143 |
+
|
| 144 |
+
```python
|
| 145 |
+
import os, re
|
| 146 |
+
from datasets import load_dataset, Dataset, Features, Value
|
| 147 |
+
from huggingface_hub import login
|
| 148 |
+
|
| 149 |
+
ds_alf = load_dataset("mark-22/Deepthinking-sft_alfworld_final1", split="train")
|
| 150 |
+
ds_db = load_dataset("mark-22/dbbench_spider_v4_mergeddata_final1", split="train")
|
| 151 |
+
|
| 152 |
+
# Unify columns to "messages" only
|
| 153 |
+
ds_alf = ds_alf.select_columns(["messages"])
|
| 154 |
+
ds_db = ds_db.select_columns(["messages"])
|
| 155 |
+
|
| 156 |
+
unified_features = Features({
|
| 157 |
+
"messages": [{"role": Value("string"), "content": Value("string")}]
|
| 158 |
+
})
|
| 159 |
+
|
| 160 |
+
def fix_message_order(example):
|
| 161 |
+
return {"messages": [
|
| 162 |
+
{"role": msg["role"], "content": msg["content"]}
|
| 163 |
+
for msg in example["messages"]
|
| 164 |
+
]}
|
| 165 |
+
|
| 166 |
+
ds_alf = ds_alf.map(fix_message_order, features=unified_features)
|
| 167 |
+
ds_db = ds_db.map(fix_message_order, features=unified_features)
|
| 168 |
+
|
| 169 |
+
# Format validation
|
| 170 |
+
def is_valid_alfworld(example):
|
| 171 |
+
for msg in example["messages"]:
|
| 172 |
+
if msg["role"] == "assistant":
|
| 173 |
+
content = msg["content"]
|
| 174 |
+
t = re.search(r"THOUGHT\s*:", content, re.IGNORECASE)
|
| 175 |
+
a = re.search(r"ACTION\s*:", content, re.IGNORECASE)
|
| 176 |
+
if not t or not a or t.start() > a.start():
|
| 177 |
+
return False
|
| 178 |
+
return True
|
| 179 |
+
|
| 180 |
+
def is_valid_dbbench(example):
|
| 181 |
+
has_action = False
|
| 182 |
+
for msg in example["messages"]:
|
| 183 |
+
if msg["role"] == "assistant":
|
| 184 |
+
content = msg["content"].strip()
|
| 185 |
+
if content.lower() in ["ok", "ok.", "understood", "understood.", "yes", "yes."]:
|
| 186 |
+
continue
|
| 187 |
+
if not re.search(r"Action:\s*(Operation|Answer)", content, re.IGNORECASE):
|
| 188 |
+
return False
|
| 189 |
+
has_action = True
|
| 190 |
+
return has_action
|
| 191 |
+
|
| 192 |
+
ds_alf = ds_alf.filter(is_valid_alfworld)
|
| 193 |
+
ds_db = ds_db.filter(is_valid_dbbench)
|
| 194 |
+
|
| 195 |
+
# Independent shuffle + ratio-based interleave
|
| 196 |
+
ds_alf = ds_alf.shuffle(seed=42)
|
| 197 |
+
ds_db = ds_db.shuffle(seed=42)
|
| 198 |
+
|
| 199 |
+
alf_items = [((i + 0.5) / len(ds_alf), item) for i, item in enumerate(ds_alf)]
|
| 200 |
+
db_items = [((i + 0.5) / len(ds_db), item) for i, item in enumerate(ds_db)]
|
| 201 |
+
combined = sorted(alf_items + db_items, key=lambda x: x[0])
|
| 202 |
+
merged_ds = Dataset.from_list(
|
| 203 |
+
[item for _, item in combined], features=unified_features
|
| 204 |
+
)
|
| 205 |
+
|
| 206 |
+
merged_ds.push_to_hub("mark-22/Deepthinking-alfworld_and_dbbench_spider_v2")
|
| 207 |
+
```
|
| 208 |
+
|
| 209 |
+
</details>
|
| 210 |
+
|
| 211 |
+
---
|
| 212 |
+
|
| 213 |
+
## License
|
| 214 |
+
|
| 215 |
+
Apache 2.0
|