Fine-Tuning, and When Not ToLesson 30 of 84

Module 4 · Building the dataset

The three formats, and the conversion trap

In this lesson

  • 8 min read
  • 5 reading sections
  • Knowledge check
  • Lesson 3 of 11 in this chapter

This chapter’s goalAssemble a training set from named sources with checked licences, convert it to one chat format, filter and deduplicate it, mix in replay data at a stated ratio, and publish a data card that lets a stranger reproduce the set.

This chapter’s media

The film explains chapter ideas. The audiobook narrates the complete teaching text.

FormatEnglishहिंदी
Chapter filmNot availableNot available
Full audiobookNot availableNot available
Three formats in, one format usedAlpaca: instruction,input, outputTwo fields that haveto become one usermessage. The separatoryou choose is part ofthe prompt format.ShareGPT:conversations, from,valueA conversation listwith its ownvocabulary for theroles.Convert on the wayin, onceOne function, used bytraining and byserving. Then counthow many examplesexceed your maximumlength before thetokenizer decides foryou.Messages: role andcontentWhat TRL, Axolotl andLlama-Factory acceptnatively, whatrepresents tool callswithout extension, andwhat every chattemplate maps onto.The rule that prevents a whole class of bug: the code that formats training examples and the code thatformats inference requests must be the same function, imported from one module.
The rule that prevents a whole class of bug: the code that formats training examples and the code that formats inference requests must be the same function, imported from one module.

Figure

A little at a time

Explore an idea, try it, then check what stays.

Step 1 of 6Free · no account needed
Lesson steps

Three shapes you will meet

Instruction data comes in three formats. You will have to convert between them, and the conversion is where errors enter.

Alpaca style. Three fields, one of which is optional:

JSON
{"instruction": "Summarise the complaint in one sentence.",
 "input": "I ordered on the 3rd and it still hasn't...",
 "output": "Customer reports a delayed order placed on the 3rd."}

ShareGPT style. A conversation list with its own vocabulary:

JSON
{"conversations": [{"from": "human", "value": "..."},
                    {"from": "gpt",   "value": "..."}]}

Messages style. What the OpenAI API popularised and what has become the default:

JSON
{"messages": [{"role": "system", "content": "You are a triage assistant."},
              {"role": "user", "content": "..."},
              {"role": "assistant", "content": "..."}]}

Use messages style. TRL, Axolotl and Llama-Factory all accept it natively, it represents multi-turn and tool calls without extension, and it maps cleanly onto every model’s chat template. Convert everything to it on the way in, once, and never think about the others again.

Your place and first choices stay on this browser. Classroom credit is recorded separately.

Every lesson here is open. Your progress is recorded once you pass the Running Models Yourself exam.

Stuck on something?Ask Rafael, your AI tutor

How to cite: Addaly (2026) ‘The three formats, and the conversion trap’, in Fine-Tuning, and When Not To. Edited by M. Mun. Addaly. Available at: https://addaly.com/learn/fine-tuning/instruction-data-formats (Accessed: 29 November 2026).