Skip to main content
Function-calling fine-tuning adapts a model to invoke tools in response to user queries. The result is a model that produces well-formed tool_calls with high reliability, useful for agents and any pipeline that depends on structured function invocation. This page covers the function-calling data shape, supported models, and launch parameters.

Supported models

The following bases support function-calling fine-tuning. See supported models for context lengths and batch limits.
OrganizationModelAPI ID
QwenQwen 2.5 (1.5B–72B)Qwen/Qwen2.5-*
QwenQwen 3 (0.6B–32B, 30B-A3B, 235B-A22B)Qwen/Qwen3-*
QwenQwen 3 Coder (30B-A3B, 480B-A35B)Qwen/Qwen3-Coder-*
QwenQwen 3 Next (80B-A3B Instruct, Thinking)Qwen/Qwen3-Next-80B-A3B-*
QwenQwen 3 VL (8B, 30B-A3B, 32B, 235B-A22B)Qwen/Qwen3-VL-*
QwenQwen 3.5 (0.8B–397B)Qwen/Qwen3.5-*
QwenQwen 3.6 35B A3BQwen/Qwen3.6-35B-A3B
Moonshot AIKimi K2 family (Base, Instruct, Thinking, 0905), Kimi K2.5moonshotai/Kimi-K2*
Z.aiGLM 4.6, GLM 4.7, GLM 5, GLM 5.1zai-org/GLM-*
GoogleGemma 4 31B IT, Gemma 4 26B A4B ITgoogle/gemma-4-*
NVIDIANemotron Nano 9B v2, Nemotron 3 Super 120B A12B BF16nvidia/NVIDIA-Nemotron-*
MetaLlama 3.1 (8B, 70B, 405B), Llama 3.2 (1B, 3B), Llama 3.3 70Bmeta-llama/Meta-Llama-3.1-*, meta-llama/Llama-3.2-*, meta-llama/Llama-3.3-*
MetaLlama 4 Scout 17B 16E (Instruct, VLM), Llama 4 Maverick 17B 128E (Instruct, VLM)meta-llama/Llama-4-*
OpenAIGPT-OSS 20B, GPT-OSS 120Bopenai/gpt-oss-*

Prepare your data

Prepare data in a JSONL file. Each line should carry:
  • messages: The conversation. Assistant messages can include tool_calls (a list of structured invocation objects) in place of content. Tool results come back via messages with the tool role.
  • tools: A list of available tools for the example.

Conversational format

{
  "messages": [
    {"role": "system", "content": "You are a helpful travel planning assistant."},
    {"role": "user", "content": "What is the current temperature in San Francisco?"},
    {
      "role": "assistant",
      "tool_calls": [
        {
          "id": "call_abc123",
          "type": "function",
          "function": {
            "name": "getCurrentWeather",
            "arguments": "{\"location\": \"San Francisco, CA\"}"
          }
        }
      ]
    },
    {"role": "tool", "content": "{\"location\": \"San Francisco\", \"temperature\": \"65\", \"unit\": \"fahrenheit\"}"}
  ],
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "getCurrentWeather",
        "description": "Get the current weather in a given location",
        "parameters": {
          "type": "object",
          "properties": {
            "location": {"type": "string", "description": "The city and state, e.g. San Francisco, CA."}
          },
          "required": ["location"]
        }
      }
    }
  ]
}

Preference format

For preference fine-tuning, the tools array nests inside input. See Preference tuning for the broader DPO workflow.
{
  "input": {
    "messages": [
      {"role": "system", "content": "You are a helpful travel planning assistant."},
      {"role": "user", "content": "What is the current temperature in San Francisco?"}
    ],
    "tools": [
      {"type": "function", "function": {
        "name": "getCurrentWeather",
        "description": "Get the current weather in a given location",
        "parameters": {"type": "object", "properties": {"location": {"type": "string"}}, "required": ["location"]}
      }}
    ]
  },
  "preferred_output": [
    {"role": "assistant", "tool_calls": [
      {"id": "call_abc123", "type": "function", "function": {
        "name": "getCurrentWeather", "arguments": "{\"location\": \"San Francisco, CA\"}"
      }}
    ]}
  ],
  "non_preferred_output": [
    {"role": "assistant", "content": "Sorry, I can't help you with that."}
  ]
}

Validate and upload

Upload your data using the Together Python/TypeScript SDK or the Together CLI:
from together import Together

client = Together()

train_file = client.files.upload(
    file="function_calling_dataset.jsonl",
    purpose="fine-tune",
    check=True,
)
print(train_file.id)

Launch the job

LoRA is the default and recommended training mode. Pass lora=False for full fine-tuning.
job = client.fine_tuning.create(
    training_file=train_file.id,
    model="Qwen/Qwen3-8B",
    lora=True,
)
print(job.id)
For details on all available parameters, see the API reference.

Watch and deploy

Function-calling jobs use the same lifecycle as text jobs: