Fine-tuning LLMs for Tool Use (w/ Example Code)

Опубликовано: 25 Апрель 2026
на канале: Shaw Talebi
13,678
521

📈 Transform Your Business with AI: https://aibuilder.academy/yt/fAFJYbtTsC0
🤓 Get the (free) Claude Code Course: https://aibuilder.academy/courses/yt/...

Here, I discuss how to fine-tune gemma-3-1b-it to use tools. I review how this works conceptually, then walk through a concrete example with Python code.

📰 Read More: https://medium.com/@shawhin/fine-tuni...
💻 GitHub Repo: https://github.com/ShawhinT/llm-tool-...
💿 Dataset: https://huggingface.co/datasets/shawh...
🤗 Fine-tuned Model: https://huggingface.co/shawhin/gemma-...

References
[1]    • Fine-tuning Large Language Models (LLMs) |...  
[2] arXiv:2407.21783 [cs.AI]
[3] https://www.llama.com/docs/model-card...
[4] arXiv:2503.19786 [cs.CL]
[5] https://ai.google.dev/gemma/docs/core...
[6]   / fine-tuning-llama-3-1-8b-for-function-call...  
[7] arXiv:2304.08354 [cs.CL]
[8] arXiv:2302.04761 [cs.CL]

Intro - 0:00
What is Fine-tuning? - 0:16
Training Data - 1:27
Example: Fine-tuning Gemma 3 to Use Tools - 5:34
Step 1: Define Tools - 6:48
Step 2: Generate Queries - 8:49
Step 3: Generate Traces - 10:05
Step 3.5: Refine Traces - 15:57
Step 4: Fine-tune Model - 17:12
Step 5: Evaluate Model - 23:10