Lattice
Skip to content
← Comparisons

Instructor vs JSON mode vs constrained decoding

Asking a model for JSON is not the same as getting JSON. These three approaches differ in whether they give you a guarantee or a tendency — and that difference decides whether you can retry safely.

Short answer

Use a library like Instructor for extraction work: validation, typed retry and partial streaming are worth more than an absolute guarantee.

By Lattice editorial · Licence and cost facts verified · method

Instructor vs JSON mode vs constrained decoding compared across 6 dimensions
DimensionInstructorGuidanceOutlines
GuaranteeValidated, with typed retryToken-level constraint — cannot be violatedToken-level constraint, schema or grammar
Works across providersYes, with capability detectionYesYes, via local or hosted inference
StreamingPartial objects supportedYesYes
Handles messy extractionYes — its main use caseAwkwardAwkward
Constraint stylePost-hoc validation and repairToken masking + control flowToken masking, incl. JSON Schema and regex
Where it losesNot a hard guarantee like token constraintsLess ergonomic for plain extractionMost setup of the three

Scroll the table sideways to see every tool.

What this table is not. These are editorial judgements, not benchmarks: Lattice has not run these tools head to head, and no cell uses GitHub stars or vendor benchmark claims as evidence. Licence and cost facts are re-checked on a schedule the build enforces — the receipt is public.

The recommendation

Which should you choose: Instructor, Guidance or Outlines?

Use a library like Instructor for extraction work: validation, typed retry and partial streaming are worth more than an absolute guarantee. Reach for true constrained decoding — Guidance or Outlines — when downstream code cannot tolerate a malformed response at all, because there the guarantee is worth the reduced flexibility. Treat a provider's JSON mode as a convenience rather than a contract, and validate regardless.

Rules of thumb

  • Validate in code regardless of what the provider promises. Modes get relaxed without notice.
  • Design the schema before the prompt. A schema that reflects how you will consume the data produces better extractions.
  • Constrained decoding restricts the token space, so it can make a model look worse at reasoning than it is. Do not benchmark reasoning through it.

Quick answers

When should you use Instructor, and when should you skip it?
Use Instructor when: schema-validated extraction with typed retry and partial streaming. Skip it when: you need a hard token-level guarantee rather than validation.
When should you use Guidance, and when should you skip it?
Use Guidance when: constrained decoding with control flow interleaved into generation. Skip it when: you need better ergonomics for plain extraction.
When should you use Outlines, and when should you skip it?
Use Outlines when: token-level constrained generation from a JSON schema or grammar. Skip it when: post-hoc validation is enough for your use case.