kotraj / README.md
drlee1's picture
v0.2: anonymize teacher identifiers, drop 21 leaked records
ede32cd verified
|
Raw
History Blame Contribute Delete
6.85 kB
---
license: cc-by-4.0
language:
- ko
task_categories:
- text-generation
tags:
- tool-use
- function-calling
- agent
- korean
- synthetic
size_categories:
- 10K<n<100K
configs:
- config_name: default
data_files:
- split: train
path: data/train-*.parquet
---
# kotraj — Korean Agentic Tool-Use Trajectories
**11,357** synthetic multi-turn Korean conversations in which an assistant calls tools, reads their responses, and completes a user's task. Across three domains (commerce, travel, calendar) with 30 mock tools.
Every trajectory was produced by simulating three roles — a user, the assistant, and a deterministic mock tool environment — and then verified by replaying the recorded calls against that environment.
## Version
This is **v0.2**. The previous release is tagged:
```python
from datasets import load_dataset
ds = load_dataset("drlee1/kotraj") # v0.2 (current)
ds = load_dataset("drlee1/kotraj", revision="v0.1") # v0.1 (10,684 trajectories)
```
v0.2 adds 2,282 trajectories from a second teacher and five provenance columns (`teacher`, `judge_model`, `judge_a`, `judge_b`, `pair_id`). Existing columns are unchanged, so v0.1 loaders keep working — pin `revision="v0.1"` if you need the exact earlier snapshot.
## Composition
| | count |
| --- | --- |
| **verified** | 8,749 |
| **unverified** | 2,608 |
| **total** | **11,357** |
| Teacher | count | pipeline |
| --- | --- | --- |
| `teacher-a` | 9,075 | v0.1 |
| `teacher-b` | 2,282 | v0.2 |
Both teachers are Upstage-family models; specific model identifiers are not disclosed. The v0.2 additions are retries: trajectories the v0.1 pipeline failed to verify, regenerated by the second teacher from the same task specifications. `pair_id` links a retry to the original attempt.
| Domain | count | | Case pattern | count |
| --- | --- | --- | --- | --- |
| calendar | 3,980 | | multi_turn | 3,824 |
| travel | 3,811 | | sequential | 3,627 |
| commerce | 3,566 | | single | 1,611 |
| | | | parallel | 1,207 |
| | | | no_call | 1,088 |
Average 3.89 turns and 4.64 tool calls per trajectory. Mean judge score on verified trajectories: 4.89 / 5.
## The two tiers
**`verified`** passed a deterministic rule gate *and* an LLM judge:
1. JSON Schema validation of every tool call's arguments
2. Call/response ID consistency across the conversation
3. **Replay against the mock environment** — re-executing the recorded calls must reproduce the same results and the same terminal state
4. All `required_calls` from the task specification satisfied, in the required order
5. Terminal state matches the task's success criteria
6. Judge scores ≥ 4/5 on goal completion, consistency, and naturalness
**`unverified`** trajectories are clean conversations — no malformed calls, no format contamination — that did not complete the task. They are kept because they are useful for preference learning and failure analysis, but **filter them out for supervised fine-tuning** unless you specifically want them.
```python
verified = ds["train"].filter(lambda r: r["verify_status"] == "verified")
```
Roughly 60% of rule-gate rejections came from unmet required calls. The deterministic gate, not the judge, is what carries quality here.
## Schema
| Column | Type | Description |
| --- | --- | --- |
| `id` | string | Trajectory identifier |
| `domain` | string | `commerce` \| `travel` \| `calendar` |
| `tools` | string (JSON) | Tool definitions shown to the model, OpenAI format |
| `messages` | string (JSON) | The conversation, OpenAI format (`tool_calls`, `role: tool`) |
| `n_turns` | int | User turns |
| `n_tool_calls` | int | Tool calls made |
| `call_pattern` | string | `single` \| `sequential` \| `parallel` \| `multi_turn` \| `no_call` |
| `tool_env` | string | `mock` (deterministic) |
| `success_criteria` | string (JSON) | Required calls and terminal-state conditions |
| `verify_status` | string | `verified` \| `unverified` |
| `judge_score` | float | Mean of three judge axes, 1–5 |
| `teacher` | string | `teacher-a` \| `teacher-b` — which teacher generated it |
| `judge_model` | string | Which judge(s) scored it |
| `judge_a` | string (JSON) | Per-axis scores from the first judge |
| `judge_b` | string (JSON) | Per-axis scores from the second judge, when cross-judged |
| `pair_id` | string | Links a v0.2 retry to its v0.1 original |
| `gen_model` | string | `upstage-family` |
| `pipeline_ver` | string | `v0.1` \| `v0.2` |
| `seed` | int | Mock environment seed — replay is reproducible from this |
`messages` and `tools` are JSON strings, not nested structs. Parse them:
```python
import json
row = ds["train"][0]
messages = json.loads(row["messages"])
tools = json.loads(row["tools"])
```
## Fine-tuning note
Tool call arguments are stored as **JSON strings** (OpenAI convention), but chat templates generally expect a mapping. Convert before calling `apply_chat_template`, or every sample containing a tool call will silently fail to serialize:
```python
def to_template_messages(messages):
out = []
for m in messages:
if m.get("tool_calls"):
calls = [{**tc, "function": {**tc["function"],
"arguments": json.loads(tc["function"]["arguments"] or "{}")}}
for tc in m["tool_calls"]]
out.append({**m, "content": m.get("content") or "", "tool_calls": calls})
else:
out.append({**m, "content": m.get("content") or ""})
return out
```
A model fine-tuned on this dataset is available at [drlee1/kotraj-qwen3.5-2B](https://huggingface.co/drlee1/kotraj-qwen3.5-2B).
## Limitations
- **Three domains, 30 mock tools.** Generalization to unseen tool schemas is untested.
- **`no_call` is underrepresented** (1,088 / 11,357 ≈ 10%). Models trained on this mix become more eager to call tools, which costs them on cases where the right answer is to decline or answer directly. We measured this regression in the companion model.
- **Synthetic throughout.** No human-written conversations and no human review of individual trajectories. Verification is automated: deterministic replay plus an LLM judge.
- **Self-judged in part.** For most trajectories the teacher and the judge belong to the same model family. The deterministic rule gate is independent of the model and does the bulk of the filtering, but the judge layer is not an independent check.
- **Personas and situations are synthetic.** Regional and register variation was prompted, not sampled from real users.
## License
CC-BY-4.0. Generated using Upstage-family models under terms permitting derivative dataset release.
## Citation
```bibtex
@misc{kotraj2026,
title = {kotraj: Korean Agentic Tool-Use Trajectories},
author = {DONGRYEOL LEE},
year = {2026},
url = {https://huggingface.co/datasets/drlee1/kotraj}
}
```