My LLM kept inventing numbers in slide decks — a 60-line validator fixed it

Finbro789 · reddit · 2026-12-02

A developer shares a docs → LLM → structured JSON outline → Gamma API slide-deck pipeline and the three failures that shaped it: (1) the model wrote prose instead of following the schema — fixed with strict JSON schema mode; (2) sections ran long — a maxwords field per section plus a validator that re-prompts once; (3) scariest, invented statistics — every number must carry a sourceid or the validator drops it. The validator is 60 lines and catches most problems before rendering. Lesson: don't trust the model to behave; build a cheap checkpoint that enforces it.

Original post →

More from coding & agent

coding & agent channel →