Tool-use datasets are messy. Real trajectories have nested JSON, interleaved reasoning blocks, and schema formats that don’t match what today’s chat models expect. The XYZ-Aquila-SFT pipeline tackles that mess head-on, streaming 400 examples from the XYZAILab repo, parsing every tool call with a nesting-safe JSON scanner, then rebuilding the whole corpus into Qwen-compatible ChatML with assistant-only loss masking.

What makes this tutorial worth your time is the transformation step. Most fine-tuning guides hand you a clean dataset. This one shows the ugly middle: regex patterns for , , and <tool_response> blocks, a custom decoder that doesn’t choke on nested arguments objects, and a schema converter that moves tool definitions between message-embedded and structured formats. The authors clearly hit real parsing failures — hence the comment that naive regex like r’{.*?}’ breaks on every actual tool call.

The training setup is deliberately small for experimentation: Qwen3-0.6B, LoRA rank 16, learning rate 1e-4, gradient accumulation of 8, and just 30 max steps. That’s not a production fine-tune. It’s a smoke test to see whether tool-call prediction shifts measurably after training, evaluated on 24 probes before and after.

One honest limitation: the article streams only 400 rows and evaluates on 40. Corpus statistics and the transformed dataset get exported to /content/aquila_out, so you can scale up without redoing the parsing pipeline. The real deliverable isn’t the model — it’s a repeatable recipe for turning raw agent trajectories into training data that doesn’t leak assistant tokens into the loss or confuse the tokenizer with tool schemas jammed into system prompts.