I built a GBNF grammar compiler that makes 8B models reliably call tools - here's how it works (deep dive)
Summary
A developer built a GBNF grammar compiler in Rust for llama.cpp that enforces tool-calling JSON schemas, making small models (like 8B parameters) reliably call tools. The system narrows grammar to only matched tools per turn, improving reliability.
Similar Articles
How I made small local AI models stop breaking JSON - a grammar-based approach
The author presents a method using GBNF grammars in llama.cpp to constrain local AI model outputs, ensuring valid JSON. A compiler is built to convert tool schemas into grammar rules, with per-turn narrowing for relevant tools.
Little Brains, Big Feats: Exploring Compact Language Models
This paper benchmarks 17 compact language models (1B-8B parameters) as generators in Russian-language RAG systems under CPU-only inference, finding that Qwen-family models offer strong quality-latency tradeoffs for private, GPU-free deployment.
I benchmarked PrismML's 1-bit Bonsai-8B against IBM's Granite on CPU tool calling. The 1-bit model won, but only with grammar-constrained decoding
An independent benchmark of PrismML's 1-bit Bonsai-8B against IBM's Granite and other models on CPU tool calling shows that with grammar-constrained decoding, Bonsai-8B achieves a 92% pass rate, outperforming larger models, but fails without constraints. Granite is the best raw model at 72%.
10,000 Lines Later: When a Tool Became a Compiler - Rob Durst - Gleam Gathering 2026
At Gleam Gathering 2026, Rob Durst shared how he rewrote a YAML-to-Terraform configuration tool as a compiler using Gleam, and how he came to appreciate the power of type-driven design and the decoder pattern.
Build your project Zig-style
The author details building a tool called bygge-zig that uses the Zig build system to compile Rust projects, replicating Cargo's functionality in far fewer lines of code, highlighting the differences and challenges.