{"slug": "smallwords-controlled-vocabulary-generation-with-one-inspectable-contract", "title": "Smallwords: controlled-vocabulary generation with one inspectable contract", "summary": "Developer released smallwords, an MIT-licensed Python package that derives prompt, grammar, JSON Schema, and validation surfaces from a single WordlistSpec to prevent controlled-vocabulary drift in LLM output. The v0.2.0 package ships source-backed English word lists plus caveman, pirate, and cowboy remixes, and its runnable example used Granite 4.2 locally through llama-server to rewrite a missile-guidance monologue, with each sampled output passing the focused grammar contract and the complete preset. The author is seeking feedback on constrained decoding with local models, specifically around multilingual vocabularies, grammar size, and additional output shapes.", "body_md": "I built `smallwords`, a small MIT-licensed Python package for controlled-vocabulary LLM output.\n\nThe practical problem is drift. A project may describe its allowed language in a prompt, encode it again in a grammar, approximate it in JSON Schema, and then write separate validation logic. `smallwords` keeps one `WordlistSpec` at the center and derives all four surfaces from it:\n\nThe package includes source-backed English lists plus playful caveman, pirate, and cowboy remixes. For the current example, I used Granite 4.2 locally through `llama-server` to rewrite a compressed line from the missile-guidance monologue.\n\n**Simple**\n\nThe missile is now where it is.\n\nThe missile should be where it should be.\n\nThe difference tells the missile how far to move.\n\n**Pirate**\n\nFirst place is where the ship is now.\n\nSecond place is where it should be.\n\nDifference tells the crew which way to sail.\n\n**Cowboy**\n\nWhere the cattle are now is the first place.\n\nWhere the ranch is is the second place.\n\nThe difference tells the cowboy which way to ride.\n\nThese are sampled model outputs under generated GBNF. Each output passes the focused grammar contract and the complete v0.2.0 preset. The runnable example prints every prompt, grammar, schema, model response, and validation report.\n\n```\npip install smallwords\n```\n\nI would be interested in feedback from people using constrained decoding with local models, particularly around multilingual vocabularies, grammar size, and additional output shapes.", "url": "https://wpnews.pro/news/smallwords-controlled-vocabulary-generation-with-one-inspectable-contract", "canonical_source": "https://discuss.huggingface.co/t/smallwords-controlled-vocabulary-generation-with-one-inspectable-contract/190645#post_1", "published_at": "2026-10-15 22:06:05+00:00", "updated_at": "2026-10-15 22:59:44.336512+00:00", "lang": "en", "topics": ["large-language-models", "ai-tools", "developer-tools", "ai-products"], "entities": ["smallwords", "Granite 4.2", "llama-server", "WordlistSpec", "GBNF"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/smallwords-controlled-vocabulary-generation-with-one-inspectable-contract", "markdown": "https://wpnews.pro/news/smallwords-controlled-vocabulary-generation-with-one-inspectable-contract.md", "text": "https://wpnews.pro/news/smallwords-controlled-vocabulary-generation-with-one-inspectable-contract.txt", "jsonld": "https://wpnews.pro/news/smallwords-controlled-vocabulary-generation-with-one-inspectable-contract.jsonld"}}