World's Fair 2025
MCP Agent Fine tuning Workshop - Ronan McGovern
Overview
This workshop details the process of fine-tuning an AI agent that utilizes the Model Context Protocol (MCP) for tool access. It covers generating high-quality reasoning traces from agent interactions with tools, saving these multi-turn conversations, and using them to fine-tune a language model, specifically demonstrating with a Quen model. The goal is to improve the agent's performance by training it on its own successful interactions.
Who should watch
- AI Engineers looking to improve agent capabilities.
- Developers working with tool-using LLMs.
- Builders aiming to fine-tune open-source models for specific tasks.
- Those interested in the MCP protocol and its application.
- Individuals seeking to create more robust and capable AI agents.
Key takeaways
- MCP enables language models to access and utilize external tools, such as web browsers, by providing a structured protocol for tool information and execution.
- Generating high-quality training data involves running an agent, capturing its reasoning traces and tool interactions, and then using these logs for fine-tuning.
- The process requires setting up an OpenAI-style API endpoint for the language model and ensuring proper conversion between MCP's tool format and the API's expected JSON structure.
- Fine-tuning can be performed using techniques like LoRA (Low-Rank Adaptation) to efficiently update model weights on a smaller dataset, improving performance on specific tasks.
- Data preparation for fine-tuning involves formatting multi-turn conversations and tool logs into a single text string, with options to "unroll" longer conversations into multiple training examples.
- While fine-tuning can significantly improve performance, especially for smaller models, starting with curated, high-quality traces is crucial for effective supervised fine-tuning before potentially moving to reinforcement learning.
- The workshop provides a practical guide using a repository with scripts and a notebook, demonstrating data collection, logging, and the fine-tuning process.
Notable quotes
*MCP is a protocol for providing services to LLMs namely access to tools.*
*The LLM is being told okay you have access to deal to these tools.*
*We need to know a list of the tools and we need the full conversation history.*
Unofficial community note. Prefer the recording for nuance.