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

From the creator

🀝 Your team not maximizing Claude? I run 1:1 and team AI workshops for companies doing $10M+ per year: https://aibuilder.academy/yt/fAFJYbtTsC0 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-tuning-llms-for-tool-use-5f1db03d7c55?sk=2b2018e1eca3509eb88b1fbd59135319 πŸ’» GitHub Repo: https://github.com/ShawhinT/llm-tool-use-ft πŸ’Ώ Dataset: https://huggingface.co/datasets/shawhin/tool-use-finetuning πŸ€— Fine-tuned Model: https://huggingface.co/shawhin/gemma-3-1b-tool-use References [1] https://youtu.be/eC6Hd1hFvos [2] arXiv:2407.21783 [cs.AI] [3] https://www.llama.com/docs/model-cards-and-prompt-formats/llama3_1/#-tool-calling-(8b/70b/405b)- [4] arXiv:2503.19786 [cs.CL] [5] https://ai.google.dev/gemma/docs/core/huggingface_vision_finetune_qlora [6] https://gautam75.medium.com/fine-tuning-llama-3-1-8b-for-function-calling-using-lora-159b9ee66060 [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

Find a job · 1 live role

Jobs in AI.
Apply now.

Apply once › get screened › meet the company

See all roles

More like this

Running one yourself?

List your AI event,
wherever it is.

A meetup, a workshop, a hackathon, a conference. Any city, or online. Tell us about it and it lands in front of people already learning this stuff.