Tinker Structured outputs

by Samy (Kondasamy Jayaraman)

Loading Larkspur mini

Larkspur miniThe schema: one field, note, free text up to 8 characters (maxLength: this site adds it; Anthropic’s structured outputs reject it).

Chapter 4 of 7

Tokens are not characters

The mask works. But a schema is written in characters, and the model writes tokens, pieces of one or more characters. The mask must judge whole tokens.

This chapter: How does a mask written for characters judge a token that carries several?

About this chapter

You will learn

  • Why the mask checks every byte of a token, not just its first
  • How a length cap blocks long tokens before short ones
  • What token healing fixes at the boundary between prompt and answer

Words you’ll meet

Byte
The smallest unit of text a computer stores. Larkspur mini’s tokens are runs of bytes; in plain English text one byte is one character.
Length cap
The most characters a free-text field may hold. Here every free field has one, so the answer always closes.
Token healing
Backing up over the prompt’s last token and letting the model’s first token start with it, so a prompt that ends mid-token is read the way the training text was split.

Step 1 of 4

A free note now, with a of 8 characters so it always closes inside the 32-token window.

Predict first.

The schema gives the note at most 8 characters. The model has written some, and two characters of room are left. Which tokens can the mask still allow?