SFT Records
SFT Records
Supervised fine-tuning (SFT) records teach the model to produce desired outputs for given inputs.
Requirements
- At least one assistant message in the messages array
- Messages should represent a complete interaction
Basic Example
{
"id": "sft-001",
"messages": [
{
"role": "user",
"content": [{ "type": "text", "text": "What is the capital of Japan?" }]
},
{
"role": "assistant",
"content": [{ "type": "text", "text": "The capital of Japan is Tokyo." }]
}
]
}
Multi-Turn Conversations
SFT records support multi-turn interactions:
{
"id": "sft-multi-001",
"messages": [
{
"role": "system",
"content": [{ "type": "text", "text": "You are a helpful coding assistant." }]
},
{
"role": "user",
"content": [{ "type": "text", "text": "Write a Python function to reverse a string." }]
},
{
"role": "assistant",
"content": [{ "type": "text", "text": "def reverse_string(s):\n return s[::-1]" }]
},
{
"role": "user",
"content": [{ "type": "text", "text": "Can you add a docstring?" }]
},
{
"role": "assistant",
"content": [{ "type": "text", "text": "def reverse_string(s):\n \"\"\"Reverse a string.\n \n Args:\n s: The string to reverse.\n \n Returns:\n The reversed string.\n \"\"\"\n return s[::-1]" }]
}
]
}
With Tool Use
SFT records can include tool calls:
{
"id": "sft-tool-001",
"messages": [
{
"role": "user",
"content": [{ "type": "text", "text": "What is 15% of 240?" }]
},
{
"role": "assistant",
"content": [
{
"type": "tool_call",
"name": "calculator",
"call_id": "calc-1",
"arguments": { "expression": "240 * 0.15" }
}
]
},
{
"role": "tool",
"content": [
{
"type": "tool_result",
"name": "calculator",
"call_id": "calc-1",
"result": { "value": 36 }
}
]
},
{
"role": "assistant",
"content": [{ "type": "text", "text": "15% of 240 is 36." }]
}
]
}
With Reasoning
Include reasoning traces for chain-of-thought training:
{
"id": "sft-reasoning-001",
"messages": [
{
"role": "user",
"content": [{ "type": "text", "text": "If a train travels 120 miles in 2 hours, what is its average speed?" }]
},
{
"role": "assistant",
"content": [
{
"type": "reasoning",
"text": "To find average speed, I divide total distance by total time: 120 miles / 2 hours = 60 miles per hour."
},
{
"type": "text",
"text": "The train's average speed is 60 miles per hour."
}
]
}
]
}
Multimodal SFT
Include images, audio, or other media:
{
"id": "sft-image-001",
"messages": [
{
"role": "user",
"content": [
{ "type": "text", "text": "What do you see in this image?" },
{ "type": "image", "ref": { "asset_id": "img-001" } }
]
},
{
"role": "assistant",
"content": [{ "type": "text", "text": "The image shows a sunset over the ocean with vibrant orange and purple colors." }]
}
]
}
Best Practices
- Vary conversation lengths - Include short and long conversations
- Include system messages - Or use defaults for consistency
- Quality over quantity - High-quality examples beat noisy data
- Cover edge cases - Include refusals, corrections, and clarifications
- Balance topics - Avoid over-representing any single domain