Evaluating LLM Outputs: Building an Eval Harness That Actually Catches Regressions
"It looked fine when I tried it" is not an evaluation strategy. Here is the harness we run before any prompt or model change ships.
Parsing a model's free-text response with a regex is how production incidents get written. Here is what reliable structured output actually requires.
Any system that hands an LLM's output to another piece of software — which is most agent architectures — lives or dies on whether that output reliably parses. "Return valid JSON" as an instruction gets you close, and close is exactly the failure mode that shows up in production three weeks after launch, on the one input shape nobody tested.
Every major provider now supports constrained decoding against a JSON schema — the model is architecturally prevented from producing output that violates the schema, rather than merely asked to. If your provider or model supports it, use it as the default, not a fallback. It converts an entire category of production bug into something that cannot happen.
The parse-and-hope approach — try/catch around a JSON.parse and pray — is the single most common root cause we find when debugging a client's "the AI feature randomly breaks" ticket. It is rarely random. It is an unhandled shape the model was always going to produce eventually, given enough traffic.
Deeply nested, highly conditional schemas are harder for a model to fill correctly, even with enforcement. Flatten where you can, make fields optional rather than conditionally required, and resist the urge to encode complex business logic into the schema shape itself — that logic belongs in the code that consumes the output, where it is testable in the ordinary way.
More from the same category.
"It looked fine when I tried it" is not an evaluation strategy. Here is the harness we run before any prompt or model change ships.
The clever prompt phrase mattered when models were smaller. What actually moves the needle now is what you put in the context window, and what you leave out.
The vector database market is crowded and most comparisons focus on benchmark recall numbers that won't matter for your actual traffic.
Thirty minutes with the people who would actually do the work — no discovery deck, no account manager.