Valid JSON Isn't Grounded: How to Add Semantic Validation to Streamed LLM Output
demirtasfurkan_ · reddit · 2026-11-22
The author argues schema enforcement only covers syntax and types; the harder failure mode is output that is syntactically valid but semantically wrong, such as a sourceid absent from the retrieved context or a score outside domain bounds.
He built a minimal zero-dependency Python prototype, neuroformatting, that separates structural checks from context-aware semantic rules on streamed chunks, and asks two engineering questions:
- Do you run semantic/grounding checks inside the stream consumer before committing output, or strictly post-hoc?
- On a grounding failure, do you trigger a targeted repair prompt with the exact validation error, or fall back deterministically?
More from coding & agent
- Stop Automating Everything: Why Humans Belong Inside the Agent Loop — dotey · 2026-11-22
- Grok Bot agents organized a 5,000-person summit in 6-7 months, vs the usual 18 — XFreeze · 2026-11-22
- One command adds a music-video generator plugin to Claude Code — AIandDesign · 2026-11-22
- Does the Next Run Improve? Community Weighs In on Chase's Knowledge Factory — hwchase17 · 2026-11-22
- Dev Gets Antigravity Account Banned After Using Its Provider Inside t3 Code — jeremyphoward · 2026-11-22
- Knowledge factory concept extended to computer use agents — hwchase17 · 2026-11-22