Senior interview question
Where in the stack can you push a model towards a format, and what would you use for a classifier that must never invent a label?
Model answer
AI Engineering lists five places: prompting, post-processing and test time compute are "more like bandages"; constrained sampling and finetuning are the intensive treatment. LinkedIn's defensive parser took correct YAML from 90% to 99.99%, as the book cites, but post-processing works only when mistakes are easy to fix. For fixed labels, constrain sampling to them, or use a classifier head. Neither makes the label right: GPT-2 constrained to planet names picks " Earth" over " Jupiter". Still measure the correct rate on labelled examples.
Practise the rest
10 Structured outputs questions, 492 in all, each with a model answer. Free.
More Structured outputs interview questions
- What is in-context learning, and what does each example in the prompt cost you?
- Your API's JSON mode is on. In what ways can an output still break the code that reads it?
- Your few-shot sentiment prompt lists six positive examples, then two negative ones at the very end. What's the risk, and what would you do?
- You add a repair step that keeps the first JSON object and closes open braces. Nearly every output now parses, but half are still invalid. Why?
- Each attempt gives valid output 90% of the time. A colleague proposes up to three attempts to reach 99.9%. What do you say?
- Zero-shot or few-shot prompting: what's the difference, and when do you add examples?