tuner module to enhance your agents’ performance on specific tasks.
The tuner module currently supports three different methods to tune your agents:
This tutorial will guide you through how to leverage the
tuner module, including:
- Introducing the core components of the tuner module
- Demonstrating the key code required for the tuning workflow
- Showing how to configure and run the tuning process
Core Components
Thetuner module introduces three core components essential for all three tuning methods:
- Task Dataset: A collection of tasks for tuning and evaluating the agent.
- Workflow Function: Encapsulates the agent’s logic to be tuned.
- Judge Function: Evaluates the agent’s performance on tasks and provides reward signals for tuning.
tuner to tune a simple math agent.
Task Dataset
A collection of tasks that the agent will be tuned and evaluated on during the tuning process. Each task typically includes input data and expected outputs. In math agent tuning, the task dataset may consist of various math problems along with their correct solutions.tuner requires the task dataset follows the Huggingface Datasets format, and can be loaded directly through the datasets.load_dataset API.
A simple example of satisfying this requirement is shown below:
jsonl files represents a single task sample in JSON format, for example:
Workflow Function
The workflow function defines how the agent processes each task. It encapsulates the logic of the agent, including how it interprets the input data and generates responses.In most cases, the workflow function requires no code changes compared to your original agent implementation — you simply wrap the agent logic into a function with a specific signature. Different tuning methods require different input parameters, but the core idea remains the same.