Sep 17, 2024 · 1h 12m · latent-space
Building AGI with OpenAI's Structured Outputs API
gold bands on the timeline = statements, start to end. Hover to read, click to jump. CC turns on captions
OpenAI Tech Lead Michelle Pokrass sits down with Alessio Fanelli and Shawn Wang to provide an in-depth technical look at the engineering, constrained decoding mechanics, and developer best practices behind Structured Outputs. She also shares lessons from scaling AI platform infrastructure, expanding multimodal APIs, and building resilient agentic systems.
How this conversation actually went
Every chapter scored 0–10 on four independent dynamics. Hover any point for the reasoning behind the score. The hosts hold 36.7% of the talking time here. How this is scored →
speaking balance: gold is the hosts, purple is the guest (3 minute bins)
Michelle firmly rejects Swyx's suggestion that function calling and structured outputs are synonymous, clearly demarcating programmatic action taking from structured user-facing generation.
Hardest push from the hosts ▶ 19:11 Swyx challenging the refusal field design instead of HTTP error codesSwyx pushes back against returning model refusals in the response body payload rather than conventional HTTP error codes, arguing that developers already have established error-handling pipelines.
Biggest teaching moment ▶ 11:27 Explaining why token masking alone causes infinite whitespace loopsMichelle explains that engineering-level constrained decoding without model post-training leads to degenerative whitespace looping, educating the hosts on the necessity of co-training models for structured outputs.
The host holds their own ▶ 37:42 Swyx providing concrete production cost reduction dataSwyx demonstrates deep domain expertise by citing exact production figures from his application, revealing that ripping out third-party retry wrappers saved 55% on API costs.
the scores for every segment, with the reasoning behind each
| Chapter | Topic | The hosts as informed peer | Guest teaching | Guest disagreement | The hosts pushing back | Why |
|---|---|---|---|---|---|---|
| Michelle Pokrass's Background and Scaling Engineering Infrastructure | 6 | 2 | 1 | 2 | The hosts engage with Michelle's early career at Waterloo, Coinbase, and Clubhouse, sharing technical domain knowledge about derivative trading, Postgres scaling bottlenecks, and DynamoDB architecture. The tone is highly collegial and conversational. | |
| Joining OpenAI and Scaling Early API Infrastructure | 5 | 3 | 1 | 2 | Swyx and Alessio ask about joining OpenAI pre-ChatGPT and early infrastructure scaling challenges. Michelle shares operational insights about authorization systems and GPU allocation during the ChatGPT launch surge. | |
| The Evolution and Architecture of Structured Outputs | 6 | 6 | 2 | 2 | Michelle explains the technical difference between JSON mode token masking and training models specifically for constrained decoding to prevent whitespace loops. Alessio compares this to pre-fills and instructor patterns. | |
| Distinguishing Function Calling from Structured Outputs | 5 | 7 | 4 | 3 | Swyx asks whether function calling and structured outputs should be considered synonymous. Michelle firmly clarifies the architectural and semantic difference between programmatic tool calling and structured conversational responses. | |
| Constrained Decoding Grammars and API Safety Refusals | 6 | 6 | 3 | 5 | Swyx and Michelle debate the design choice of returning safety refusals inside the JSON response body rather than throwing standard HTTP 4xx or 5xx status codes. Michelle explains why HTTP semantics break down for model-side non-compliance. | |
| ChatML Protocol and Eliminating Schema Errors | 5 | 6 | 2 | 2 | Michelle educates the hosts on how structured outputs eliminated ChatML recipient hallucination errors under high temperatures by enforcing valid tool selection constraints. | |
| Benchmarking Structured Outputs and Parallel Function Calling | 6 | 6 | 3 | 4 | Swyx questions benchmark saturation and why parallel function calling is not yet supported with structured outputs. Michelle explains the latency overhead of re-indexing combined schemas on dynamic function lists. | |
| Latency Optimization, Caching, and Agentic Reliability | 6 | 5 | 2 | 3 | Alessio and Michelle discuss the foundation of autonomous agents, analyzing how moving from 95% to 100% schema reliability prevents error magnification across multi-step chains. | |
| JSON Schema Dialects, Dynamic UIs, and Prompting Best Practices | 8 | 4 | 2 | 3 | Swyx shares concrete engineering benchmarks from his production system AI News, reporting a 55% API cost reduction by switching from Instructor retries to native Structured Outputs. Michelle details OpenAI's JSON schema dialect decisions. | |
| Model Selection Strategy, Fine-Tuning GA, and Version Pinning | 6 | 5 | 3 | 4 | The conversation covers fine-tuning GA announcements and version pinning. Swyx questions why developers would ever use unpinned rolling ChatGPT models over deterministic API endpoints. | |
| OpenAI's Platform Vision and DevDay Outage War Stories | 5 | 4 | 1 | 2 | Michelle shares behind-the-scenes war stories from DevDay 2023, including fixing live API outages two hours before Sam Altman's keynote, and explains upgrades to the Assistants file search architecture. | |
| Platform Capabilities: Logit Bias, Rate Limits, and Batch Processing | 6 | 5 | 2 | 4 | The hosts explore logit bias, rate-limit tiering, and the Batch API. Swyx pushes back on the Batch API's rigid 24-hour SLA, arguing developers need a 2-4 hour turnaround option. | |
| Multimodal APIs: Vision, Whisper, Advanced Voice, and Enterprise Security | 7 | 5 | 3 | 4 | Alessio presses Michelle on why Whisper API lacks speaker diarization despite community demand. Michelle explains Whisper v2 vs v3 performance tradeoffs and suggests prompt hacks for spelling corrections. | |
| Engineering Culture, Decision Science, and OpenAI Hiring | 5 | 4 | 1 | 2 | The discussion closes on behavioral economics, Richard Thaler's Misbehaving, cognitive biases in engineering, and the specific low-ego traits sought in OpenAI hiring. |