Artificial Intelligence · 15.08.2026, 11:40 UTC
Fine-Tuning Tool-Calling LLMs: A Complete Guide Using XYZ-Aquila-SFT and Qwen3
| Schweregrad | info |
|---|---|
| Kategorie | Artificial Intelligence |
| Quelle | MarkTechPost ↗ |
| Veröffentlicht | 15.08.2026 UTC |
Sicherheitsmeldung mit Schweregrad noch nicht bewertet. Technische Details im Tab „Originaltext“; empfohlene Schritte in der Checkliste.
In this tutorial, we implement an end-to-end supervised fine-tuning pipeline for the XYZ-Aquila-SFT dataset, Hugging Face Transformers, PyTorch, and PEFT. We stream and inspect the dataset, parse multi-turn tool-use trajectories, extract structured tool calls, analyze corpus characteristics, and preserve embedded reasoning and observation patterns. We then convert tool schemas between message-embedded and structured formats, render Qwen-compatible ChatML with assistant-only loss masking, prepare a custom PyTorch dataset and collator, and fine-tune Qwen3-0.6B with LoRA. Finally, we evaluate tool-call prediction before and after training and export both the transformed dataset and corpus statistics for further experimentation.
Copy CodeCopiedUse a different Browserimport os, sys, subprocess CFG = dict( REPO = "XYZAILab/XYZ-Aquila-SFT", LANG = "en", N_STREAM = 400, N_EVAL = 40, MODEL_ID = "Qwen/Qwen3-0.6B", MAX_SEQ_LEN = 2048, LENGTH_POLICY = "truncate", RUN_TRAINING = True, MAX_STEPS = 30, GRAD_ACCUM = 8, LR = 1e-4, LORA_R = 16, RUN_EVAL = True, N_EVAL_PROBES = 24, OUT_DIR = "/content/aquila_out", SEED = 0, ) os.makedirs(CFG["OUT_DIR"], exist_ok=True) def pip(*pkgs): subprocess.run([sys.executable, "-m", "pip", "install", "-q", "-U", *pkgs], check=False) pip("datasets>=3.0.0", "transformers>=4.51.0", "peft>=0.13.0", "accelerate>=1.0.0") import json, re, math, random, statistics as stats from collections import Counter, defaultdict from dataclasses import dataclass, field from typing import Any, Dict, List, Optional import torch import matplotlib.pyplot as …