Artificial
How I made small local AI models stop breaking JSON - a grammar-based approach
I wrote a post about a specific problem with running AI agents on local models: they're unreliable with structured output. You ask for JSON, they mostly deliver, but then they forget a closing brace, invent a tool name, or add a paragraph of text after the JSON object. Hosted APIs like OpenAI handle this server-side. Locally, you're on your own. My approach: llama.cpp supports GBNF grammars that constrain which tokens the model can produce. I wrote a compiler that turns each tool's schema into...
Read the full discussion on Reddit
This article was aggregated from Reddit. Click to join the conversation.
View on Reddit