Loading Larkspur mini
Larkspur miniThe prompt: “Where is order 1042?”. The schema: one field, status, on time or delayed.
Chapter 3 of 7
The mask
Retries got nowhere. New idea: stop the model writing anything the schema doesn’t allow, one token at a time.
This chapter: How can a schema stop a model writing invalid JSON, before it writes it?
About this chapter
You will learn
- That the schema allows some tokens at each step and blocks the rest
- How the blocked tokens’ probability goes to the allowed ones
- Why the answer then always fits the schema
Words you’ll meet
- Mask
- At one step of writing, the set of tokens the schema allows. Blocked tokens get zero probability, and the model picks among the rest.
- Constrained decoding
- Writing an answer with a mask applied at every step, so only text the schema accepts can come out.
Step 1 of 4
A stencil plate now stands across the belt: the schema. At each step it lets some tokens through and stops the rest.
Predict first.