Solving Broken JSON Outputs in Local LLMs Using GBNF Grammars

paulqq · reddit · 2026-07-30

When running AI agents locally, smaller models often struggle with structured JSON outputs, resulting in missing braces, hallucinated tool names, or appended text. The author shares a grammar-based approach to completely eliminate these formatting issues.

Key Implementations:

This approach is implemented in Eris, an open-source local agent built in Rust that uses Markdown notes for memory.

Related event: Fix Local LLM JSON Output Errors with GBNF Grammar Constraints(2 posts)→

Original post →

More from coding & agent

coding & agent channel →