Enterprise DNA

Omni by Enterprise DNA

Enterprise DNA Resources

Insights on data, AI & business. Practical AI operating-system thinking for owners, operators, and teams doing real work.

220k+

Data professionals

Omni

AI agents and apps

Audit

Map the manual work

Structured Outputs: What Engineers Actually Found
Blog AI

Structured Outputs: What Engineers Actually Found

Honest look at LLM structured outputs in production. What works, what breaks, and what teams pair it with after six months of real use.

Sam McKay

The promise was clean. Pass a JSON schema, get JSON back. No more regex parsers over freeform text, no more fragile json.loads calls wrapped in try/except blocks. When OpenAI shipped Structured Outputs in August 2024 and competitors followed within months, the developer community had a clear reaction. Finally.

Then production happened.

Six months in, the picture on r/LocalLLaMA, the OpenAI developer forum, and HN threads tells a more nuanced story. Structured Outputs works, and it works well for a specific shape of problem. It also has rough edges that don’t show up until you’re handling 50,000 requests a day and your schema has 40 nested fields.

What practitioners expected vs what they got

The marketing pitch was simple. Constrained decoding guarantees valid JSON matching your schema. No more hallucinated keys, no more missing required fields, no more parsing failures at 3am.

What most teams expected was a drop-in replacement for the regex-and-prompt-engineering stack they’d been running. Drop in the schema, sleep better, move on.

What they got was something more interesting. Developers on the OpenAI forum reported schema adherence rates above 99% on simple schemas, which is genuinely impressive. But the same threads surfaced a pattern. Complex schemas with deep nesting, large enums, or recursive structures started showing edge cases that nobody had warned about.

A thread from late 2024 on r/MachineLearning captured the mood well. The original poster had built an extraction pipeline for legal documents, expecting Structured Outputs to eliminate their validation layer. After two weeks, they posted that they still needed Pydantic validation downstream because roughly 0.5% of responses had subtle issues. Wrong types in optional fields, truncated arrays, or values that matched the schema but not the intent.

The takeaway from that thread, and others like it, was that Structured Outputs solves the syntactic problem, not the semantic one. You get valid JSON. You don’t necessarily get correct JSON.

Where it genuinely delivers

The wins are real, and they’re concentrated in three areas.

First, simple extraction tasks. Pull a name, email, and phone number from a customer message. Extract line items from an invoice. Parse a meeting transcript into action items. For these workloads, the practitioner consensus is overwhelmingly positive. Latency overhead compared to plain completion is small, usually 50-150ms in reports from teams running their own benchmarks. Cost is identical to standard token pricing since you’re not paying extra for the constraint, just for the tokens themselves.

Second, function calling at scale. Teams running agentic workflows with dozens of tool definitions reported that Structured Outputs reduced their retry rates by 60-80%. One HN commenter building a customer support agent said their tool selection accuracy went from “good enough” to “actually reliable” once they switched from prompt-based JSON to constrained decoding.

Third, integration with typed languages. The Python and TypeScript SDKs ship with native schema support, and the developer experience is noticeably better than the JSON mode that preceded it. Teams using Pydantic or Zod can define their schema once and reuse it across validation layers.

The latency numbers worth noting. In informal benchmarks shared across the community, Structured Outputs adds roughly 100-300ms to first-token latency for moderately complex schemas. For schemas with 20+ properties or deep nesting, that climbs to 400-600ms. Token costs run the same as standard completions, typically $0.15 to $2.50 per million input tokens depending on model tier, with output at 2-4x that rate.

Where it falls short

The edge cases cluster around four patterns.

Schema complexity limits. Practitioners on the OpenAI developer forum reported hitting undocumented limits around 15-20 levels of nesting. One team building a financial reporting tool had to flatten their schema from a deeply nested structure to a flat one with prefixed keys because the API started rejecting requests above a certain depth. The error messages were not helpful.

Large enums and string constraints. If your schema has an enum with 500+ values, or a string field constrained to a long regex pattern, generation slows down noticeably. A practitioner on r/LocalLLaMA benchmarked a 1000-value enum and saw a 3x increase in latency compared to an unconstrained string field. The model has to consider more possibilities at each decoding step.

Optional fields and nullability. This is where the semantic gap shows up most clearly. A field marked as optional in your schema can be filled with null, with a default value, or sometimes with a plausible-looking but incorrect value. Multiple developers reported that optional fields were the most common source of downstream validation failures.

Streaming and partial outputs. Structured Outputs works best when you wait for the full response. If you’re streaming tokens to a UI, you don’t get the same guarantees until the response completes. Teams building real-time interfaces reported having to buffer output and validate at the end, which defeats some of the latency benefits.

The cost surprise that caught several teams off guard was retry overhead. When a response fails validation downstream, you retry the whole request. With Structured Outputs, the failure rate is lower, but the failures that remain are often harder to diagnose. One team on HN estimated they spent an extra 8-12% on inference costs in the first quarter after adoption, mostly from retries on edge cases they hadn’t anticipated.

Who it fits best

The pattern from community discussions is clear. Structured Outputs works best for teams in a specific profile.

Team size matters less than use case shape. Solo developers and small teams of 2-5 people building extraction pipelines or document parsers report the highest satisfaction. The setup cost is low, the schemas are simple, and the time savings over regex-based parsing are substantial.

Larger teams of 10+ engineers building production agentic systems also benefit, but they tend to layer additional tooling on top. Pure Structured Outputs without downstream validation is rare in this group.

The use cases that fit best:

  • Data extraction from unstructured text where the schema has fewer than 30 fields
  • Function calling for tool selection in agentic workflows
  • Form filling and structured data entry
  • API generation from natural language descriptions

The use cases that don’t fit as well:

  • Schemas with deep nesting or recursive structures
  • High-velocity streaming interfaces
  • Scenarios where the model needs to reason about which fields to include
  • Cost-sensitive applications where every millisecond of latency matters

Stack context matters too. Teams already using Pydantic, Zod, or similar typed schema libraries get the most value because they can reuse their existing definitions. Teams working in languages without strong type systems or schema validation libraries reported more friction.

What teams pair it with or replace it with

The most common pairing in the Python ecosystem is the Instructor library. It wraps Structured Outputs with Pydantic validation, retry logic, and cleaner error handling. Multiple HN threads and blog posts from late 2024 and early 2025 highlighted Instructor as the de facto standard for production use. The library handles the cases where Structured Outputs alone isn’t enough, semantic validation, field-level constraints, and structured retries.

For teams that need more control, BAML (Basically a Made-up Language) has emerged as an alternative. It’s a schema definition language that compiles to multiple LLM providers and handles the validation layer natively. Practitioners who switched from raw Structured Outputs to BAML cited better debugging tools and more predictable behavior across providers.

On the replacement side, the main alternatives are:

Anthropic’s tool use with JSON schema. Practitioners report similar reliability to OpenAI’s Structured Outputs, with some differences in how complex schemas are handled. For teams already using Claude, this is the default choice.

Gemini’s structured output mode. Google’s implementation has improved significantly, and teams running multi-model pipelines sometimes route different tasks to different providers based on schema complexity.

Open source alternatives like Outlines and Guidance. These libraries run locally and provide constrained decoding for open-weight models. The trade-off is inference speed and the operational overhead of running your own models. Teams with strict data residency requirements or cost constraints at scale tend to go this route.

JSON mode without schema constraints. Some teams reverted to the older JSON mode plus aggressive downstream validation. The reasoning was that the schema enforcement wasn’t worth the latency cost for their specific use case. This was more common for simple extraction tasks where the schema had fewer than 10 fields.

The honest summary from six months of community discussion. Structured Outputs is a real improvement, not a silver bullet. It moves the failure mode from “JSON doesn’t parse” to “JSON parses but means the wrong thing.” For most teams, that’s a worthwhile trade. For teams building high-stakes systems, it’s a starting point, not a finished solution.

Want the practical version of this? The free Working With Claude field guide covers the full Claude ecosystem, Claude Code, and how to roll it out across a real business. Download it here.