The problem
Real conversations rarely consist of one question and one answer. A support chat might run to ten exchanges: a greeting, a clarifying question, two partial answers and a final solution. Some of those assistant replies are worth learning and others are not. A training format has to express both the full context and the choice of which replies count.
Approach 1: weights per message
Some formats let each assistant message carry a weight. The whole conversation is one record; replies marked weight: 1 are learned, and replies marked weight: 0 are context only — read, but not graded.
{"messages": [
{"role": "user", "content": "Hi"},
{"role": "assistant", "content": "Hello! How can I help?", "weight": 0},
{"role": "user", "content": "Export my report as PDF"},
{"role": "assistant", "content": "Open the report, click Export → PDF…", "weight": 1}
]}This is the efficient option. Each record is processed once, all targets in a conversation share its context, and the choice of what to learn is exact.
Approach 2: one record per target
Formats without weights can only say “here is a conversation; learn its assistant replies”. To learn a particular reply, the conversation is cut off right after it and written as a record of its own. A conversation with three targets becomes three records, each longer than the last.
{"messages": [
{"role": "user", "content": "Hi"},
{"role": "assistant", "content": "Hello! How can I help?"},
{"role": "user", "content": "Export my report as PDF"},
{"role": "assistant", "content": "Open the report, click Export → PDF…"}
]}There are two side effects. Any earlier assistant reply inside a record is learned as well, because the format cannot mark it as context only — including replies you did not choose. And the early part of the conversation appears in several records, so it is processed, and paid for, several times.
- A conversation has four exchanges of about 250 tokens each. Replies 2 and 4 are targets; replies 1 and 3 are not.
- With weights: one record of about 1,000 tokens. Replies 2 and 4 are learned once each; 1 and 3 are context.
- Without weights: one record cut after reply 2 (about 500 tokens) and one cut after reply 4 (about 1,000 tokens) — 1,500 tokens in all, 50% more.
- Every assistant reply in a record is learned: replies 1 and 2 twice, replies 3 and 4 once. Replies 1 and 3, which you did not choose, are learned anyway.
When it matters
The difference is small when conversations are short or every assistant reply is good. It matters when conversations are long, when early replies are poor (a wrong first attempt that was corrected later), or when you deliberately left replies out. With a provider that supports weights you get exactly what you chose; with one that does not, it is worth correcting the weak replies before training.
Common mistakes
- Assuming a reply you did not mark will never be learned, whatever the provider's format.
- Leaving a wrong early reply in a long conversation when the provider cannot exclude it.
- Comparing token counts between providers without allowing for repeated context.
- Splitting the records of one conversation between training and validation; the split is made by conversation for this reason.
References and further reading
External sources open in a new tab.
- 01SFT TrainerHugging Face TRL docs · huggingface.coTraining on assistant turns only within a whole conversation.
- 02Chat templatesHugging Face Transformers docs · huggingface.coHow multi-turn chats are laid out for a model, and how assistant turns are located.
- 03Supervised fine-tuningOpenAI API docs · developers.openai.comA provider's chat-format training data, including multi-turn examples.
- 04Prepare supervised fine-tuning data for Gemini modelsGoogle Cloud documentation · docs.cloud.google.comThe contents format with user and model roles.