Understanding the Dataset and Prompt Styles
Two entries with identical content can look quite different once they are written in two different prompt styles. The content is the same; the surrounding text is what changes.
One Spelling Fix, Written as Text
Imagine a single training example with three pieces. The first is a request to fix a word. The second is the misspelled word itself. The third is the correct answer. In this article the misspelled word is 'Ocassion' and the corrected form is 'Occasion'. Keep this one example in mind, because the rest of the article follows it through two different layouts.
Before reading on, try to answer this question for yourself: if a model is going to learn from this example, what has to be decided about the three pieces before training can begin? Write down your answer, then compare it with the explanation that follows.
From Record to Training Text
A training example does not reach the model as a neat record with labeled slots. Someone has to write the three pieces out as one block of text, decide where the request goes, where the misspelled word goes, and where the answer goes, and mark those places so the model can tell them apart. The diagram below traces that path from the raw record to the text the model trains on.
Why a Prompt Style Is Needed
Instruction fine-tuning means training a model on a dataset in which the inputs and their matching outputs are given explicitly. Each entry pairs something the model should receive with something it should produce.
A prompt style is the fixed pattern used to build the training text from an entry. It decides which words and symbols wrap each part of the entry and the order in which the parts appear. Prompt styles are therefore different formats for structuring input-output pairs for LLMs.
Two entries with identical content can look quite different once they are written in two different prompt styles. The content is the same; the surrounding text is what changes.
The Alpaca Layout
Alpaca was one of the early LLMs to publish a detailed account of its instruction fine-tuning process, and its layout is widely used. The Alpaca style opens with a framing sentence and then uses labeled sections for the instruction, the input, and the response. The rest of this chapter uses this layout, so when a training entry appears later, assume it follows this structure unless the text says otherwise.
Here is the spelling example written in the Alpaca style. The framing sentence and the exact label wording shown here are an illustration of the pattern, applied to this example.
- The framing sentence comes first and tells the model what kind of task follows.
- The Instruction label marks the request.
- The Input label marks the misspelled word inside the sentence.
- The Response label marks where the correct answer begins.
The Phi-3 Layout
Phi-3 comes from Microsoft and is included here to show that prompt styles vary across models. Its style is simpler than Alpaca's. Instead of labeled sections, it uses designated user and assistant tokens: the user token marks the request, and the assistant token marks the reply.
The same spelling example in the Phi-3 style is shown below. The token strings are written in angle brackets here for readability; the exact spelling of the tokens is a property of the model's own format, not something this article defines.
- The user token opens the request, and the request includes the misspelled word.
- The assistant token opens the reply, and the reply holds the corrected sentence.
- There is no framing sentence and no separate Input label in this layout.
Comparing Markers Side by Side
Both layouts encode the same spelling correction. The misspelled word and the corrected form are identical in both. What differs is the scaffolding around them. The diagram lines up the markers position by position, so you can see which marker in one style corresponds to which marker in the other.
| Feature | Alpaca style | Phi-3 style |
|---|---|---|
| Opening | Framing sentence describing the task | Starts directly with the user token |
| Marks the request | Instruction label | User token |
| Marks the misspelled word | Input label | Inside the user part of the text |
| Marks the answer | Response label | Assistant token |
| Overall structure | Labeled sections | Designated role tokens |
Alpaca and Phi-3 encode the same spelling correction with different markers.
How Layout Shapes What Gets Trained
Because both styles can encode the same content, a difference in layout is not the same as a difference in meaning. The spelling fix is still the spelling fix in either layout. But the training text itself is different: a model trained on one layout sees one set of markers around the request and the answer, and a model trained on the other sees a different set. The style therefore decides the exact text that the training process works on, even when the underlying pair of request and answer is the same.
A layout change does not alter the facts in the pair. It alters the surrounding text that the model is trained on, and that surrounding text is part of what training works with.
The chapter includes an exercise that makes this concrete. You fine-tune a model with the Alpaca layout first, then try the Phi-3 layout from the comparison above, and then observe whether that change affects the quality of the model's responses. The point is to see the effect for yourself rather than assume it. Notice that the exercise asks you to observe, not to predict a fixed outcome.
Finding the Boundaries of the Response
A training entry tells the model two things: what to receive and what to produce. In the Alpaca layout, the boundary between request and answer is the Response label; everything after that label is the target the model should reproduce. In the Phi-3 layout, the boundary is the assistant token, which opens the reply. Locating these boundaries is the first thing to check when reading any formatted entry, because the target response is defined by where it begins.
Mistakes Learners Make With Prompt Styles
Common mistake Thinking the two layouts contain different information
What it looks likeConcluding that the Phi-3 version of the spelling fix lacks the correction because it has no Input label.
Why it failsBoth styles encode the same content. The correction 'Occasion' appears in both.
Do this insteadCompare the content first, then compare the markers around it.
Common mistake Treating the framing sentence as part of the answer
What it looks likeReading the whole Alpaca text as the response the model should produce.
Why it failsThe response is the material after the Response label, not the framing sentence at the top.
Do this insteadFind the Response label and treat only what follows it as the target.
Common mistake Assuming every model uses the Alpaca layout
What it looks likeWriting a Phi-3 entry with Instruction and Response labels.
Why it failsPrompt styles vary across models, and Phi-3 uses its own user and assistant tokens.
Do this insteadCheck which style a given model or chapter expects before building entries.
Common mistake Forgetting that the prompt style is a fixed pattern applied to every entry in the dataset
Practice Reading Both Layouts
Here is a new entry in the Alpaca style. The misspelled word is 'recieve' and the corrected form is 'receive'. Identify the three markers, state which part of the text is the target the model should reproduce, and then rewrite the same entry in the Phi-3 style.
Hints
- Start by locating the Response label, because the target begins there.
- In the Phi-3 style, the request goes inside the user token and the correction goes inside the assistant token.
- The content of both layouts should match exactly, word for word, apart from the markers.
Key Takeaways
- Instruction fine-tuning trains a model on explicitly provided input-output pairs, and each pair must be written out as text in some prompt style.
- The Alpaca style opens with a framing sentence and uses labeled sections for instruction, input, and response; the Phi-3 style uses designated user and assistant tokens to mark the request and the reply.
- Both styles can encode the same content, so a difference in layout is not a difference in meaning, but it does change the exact training text.
- The target response is defined by where it begins, so locating the response marker is the first step in reading any formatted entry.