Fine-Tuning, and When Not ToLesson 64 of 84

Module 7 · Fine-tuning beyond a chat model

Getting structure without training for it

In this lesson

  • 9 min read
  • 6 reading sections
  • Knowledge check
  • Lesson 7 of 9 in this chapter

This chapter’s goalAdapt an embedding model, a reranker, a text classifier, a speech model, a vision-language model or an image generator, and name in each case what differs from fine-tuning a text LM and which cheaper technique should be tried first.

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

A little at a time

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

Step 1 of 7Free · no account needed
Lesson steps

Make invalid output impossible

Fine-tuning for format makes bad output rarer. Constrained decoding makes it impossible, and it needs no training at all.

The mechanism is simple and worth understanding rather than treating as magic. At every generation step the model produces a logit for each of 128,000 tokens. A constrained decoder maintains a state machine built from your schema, works out which tokens could legally come next given what has been generated, and sets every other logit to negative infinity before sampling.

If the schema says the next character must be " or }, then every token that does not begin with one of those has zero probability. The model cannot produce invalid JSON, not because it has learned not to, but because the invalid continuations were removed from the choice.

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) ‘Getting structure without training for it’, in Fine-Tuning, and When Not To. Edited by M. Mun. Addaly. Available at: https://addaly.com/learn/fine-tuning/structure-without-training (Accessed: 27 November 2026).