Concepts / Formatting Training Examples for Finetuning

Formatting Training Examples for Finetuning

A finetuned model works best when the prompts you send match the format of its finetuning data, including small details such as punctuation and spacing.

  • Programming

The Assumption That Breaks

A common assumption among people new to finetuning goes like this: the model has been trained, so it should understand any reasonable request. If an instruction is clear to a human reader, it should be clear to the model. This belief feels natural, and it leads many learners to treat prompt wording as a minor detail once training is finished.

This lesson shows why that assumption can break down. Once a model has been finetuned, the way you phrase and format a prompt becomes a far more important choice than it first appears. We will follow one small example from training to inference and watch which details matter.

What do you think happens?

Suppose you finetuned a model on examples where every input looked like the word burger followed by an arrow, written as 'burger -->'. Which of these three prompts looks most like the training data: 'burger', 'Item: burger -->', or 'burger --> ' with a trailing space? Which ones might cause trouble?

Reveal answer
Answer:

The prompt 'burger -->' matches the training format exactly. 'Item: burger -->' adds an extra prefix, 'burger' drops the arrow, and 'burger --> ' appends a trailing space. The two prompts that differ from the training shape are the ones that can cause issues.

The source notes that near-miss prompts such as a missing arrow, an extra prefix, or an appended space can cause issues even when their meaning is clear. It does not claim every deviation will fail, so treat the differing prompts as risky rather than certainly broken.

Anatomy of a Training Example

Finetuning teaches a model from examples, and each example carries a particular shape. In the burger case, the shape is the word burger, a single space, and then an arrow written as -->. The words, punctuation, and spacing together form the pattern the model was shown.

burgerthe item word the inputbegins withspaceseparates the word from thearrow-->arrow that closes thetraining inputfollowed byfollowed by
Which token in the training input carries the pattern, and what does each piece contribute to the shape the model learns?

The arrow is the signal that the input has ended in the training data. Every element of the example is part of the pattern, not decoration. When you later write a prompt, you are supplying the same kind of input the model was taught to recognize, so each of these elements counts.

Near-Miss Prompts That Drift Off Format

The central principle is that the prompts you send to a finetuned model should match the format of the data used to finetune it. When a prompt departs from that shape, you are asking the model to operate on input it was not trained to expect. The source does not claim that every deviation will fail, but it does warn that near-miss prompts can cause issues, even when their meaning is clear to a human.

burger -->exact training formatburgermissing arrowItem: burger -->extra prefixburger --> withtrailing spaceappended space
Which prompts keep the training format, and which ones drift from it in a small but meaningful way?

Each near-miss variant changes one detail while leaving the meaning intact. The word burger is still there in every version, so a human would read all three as the same request. The model, however, was trained on one specific arrangement. A missing arrow, an added prefix, or an extra space each moves the prompt away from that arrangement. This is why the source treats small punctuation and spacing details as part of the format rather than as cosmetic choices.

  • Common mistake

    Assuming that a clear human request is automatically a matching prompt

    What it looks like

    Sending 'burger' when training used 'burger -->' because the word clearly refers to the same item

    Why it fails

    The model learned a specific shape, not only a meaning, so a clear request can still be a near-miss

    Do this instead

    Compare the prompt against the training format itself, character by character, before sending it

  • Common mistake

    Treating spacing and punctuation as minor details after training is finished

    What it looks like

    Adding a trailing space to 'burger -->' because it looks harmless on screen

    Why it fails

    The source identifies small details such as spacing as part of the format the model learned

    Do this instead

    Keep the spacing and punctuation of your inference prompts identical to the training examples

  • Common mistake

    Adding a prefix to make the prompt look more descriptive

    What it looks like

    Writing 'Item: burger -->' to label the input more clearly

    Why it fails

    An extra prefix is one of the near-miss changes the source warns about

    Do this instead

    Send the input in the same structure used in training, unless you have tested a different format

From Training Data to Inference

It helps to see the whole path a prompt takes. First you prepare training data, then you finetune a model on it, and then you send prompts at inference time. The format constraint does not apply only at one step. It is set when you write the training examples, and it is enforced again every time you send a prompt to the finetuned model.

Prepare trainingexampleschoose the data formatFinetune the modelmodel learns the exampleshapeSend inference promptmust match the trainingformatFinetuned responsequality depends on thematchexamples in chosen formatnew input at inferencemodel responds
At which step does the format constraint apply, and what must stay consistent across the path?

Shorter Prompts and Input Token Cost

Finetuning also offers a benefit that runs in the opposite direction from careful formatting. Once a model has learned the behavior you want from its training examples, you can often send a much shorter prompt than you would need for a base model that has not been finetuned. The instructions and examples that a base model would need spelled out in every request are already reflected in what the finetuned model learned.

This matters because input tokens are part of what you pay for when you use a model. If you are concerned about how many input tokens your instructions consume, finetuning is one approach the source offers for managing that cost. The reduction comes from the fact that the model no longer needs the full set of instructions in every request.

Notice how the two ideas fit together. Formatting is about sending the input the model expects. Finetuning can shorten what you send because the model has absorbed the instructions. Both depend on the same underlying fact: the finetuned model has learned from a specific set of examples, and your prompts should continue to resemble those examples.

Why Format Experiments Pay Off

The format of the finetuning data itself matters. The source notes that different finetuning data formats can change how well the resulting model performs. The format you choose when preparing data is therefore not only a bookkeeping decision. It shapes what the model learns and, by extension, which kinds of prompts it responds to well.

The source does not identify a single best format for every situation. Instead, it recommends running experiments to find the format that works best for your particular use. In practice, this means preparing examples in more than one format, finetuning a model on each version, and comparing the results on the task you care about.

Experiments also keep evaluation honest. A format that looks tidy on paper may not produce the best behavior once a model is trained on it, and only testing reveals that difference. Whichever format you settle on, the central principle still applies: the prompts you send after finetuning should follow that same format.

Practice: Spotting Near-Misses

EASY

Suppose your training examples all used the pattern sky => followed by the input, written with a single space before the arrow. Which of these inference prompts is closest to the training format, and which are near-misses? Prompts: 'sky =>', 'sky=>', 'Input: sky =>', 'sky => '. For each near-miss, name the specific detail that differs.

Hints
  • Compare each prompt to the training shape one character at a time, including spaces.
  • Check whether any prompt has an extra prefix, a missing space, or a trailing space.
  • The meaning of the word sky is the same in all four, but the format is what the model learned.

Key Takeaways

  • A finetuned model works best when the prompts you send match the format of its finetuning data, including punctuation and spacing.
  • Near-miss prompts, such as a missing arrow, an extra prefix, or an appended space, can cause issues even when their meaning is clear to a human reader.
  • Finetuning can allow much shorter prompts than a base model would need, which can help manage input token costs, though actual savings should be measured.
  • Different finetuning data formats can affect performance, so preparing and comparing several formats is a practical way to choose the best one for your task.

Related concepts

More concepts starting with F