Output format keeps drifting across varied inputs. What does Anthropic's guidance recommend?
Why C is the answer
3 to 5 varied examples in example tags
Examples are among the most reliable ways to steer format. Vary them so the model does not copy one case too closely.
In detail
- Examples are among the most reliable ways to steer format and tone.
- Anthropic suggests 3 to 5 varied examples, wrapped in example tags.
- Variety stops the model from copying one case too closely.
- Include edge cases in the examples, so the model sees how to handle them.
Use case
An illustrative scenario, not a real incident.
A team needs one-line summaries, but the format drifts on unusual tickets. Adding four examples, including a tricky one, in example tags steadies the output.
See it in different ways
flowchart LR
A["Model output"] --> B{"Matches schema?"}
B -->|Yes| C{"Do the values make sense?"}
C -->|Yes| D["Accept"]
C -->|No| E["Review or retry"]mindmap
root(("Examples"))
n1["How many"]
n2["3 to 5"]
n3["What to include"]
n4["Common cases"]
n5["Edge cases"]
n6["How to mark"]
n7["example tags"]Key point: Show the format with varied examples.
Why the other options are wrong
- A. A lower max_tokens, so that the model has less room to drift from the format
- A lower max_tokens may cut replies off and does not improve format.
- B. A separate retry request whenever the format of a reply looks slightly wrong
- Retries pay for the same drift again instead of preventing it.
- D. A longer description of the format, repeated at both ends of the prompt
- Repeating a description adds text, but it shows less than an example does.

