cd /news/large-language-models/smallwords-controlled-vocabulary-gen… · home › topics › large-language-models › article
[ARTICLE · art-151001] src=discuss.huggingface.co ↗ pub= topic=large-language-models verified=true sentiment=↑ positive

Smallwords: controlled-vocabulary generation with one inspectable contract

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.

read1 min views1 publishedOct 15, 2026

I built smallwords, a small MIT-licensed Python package for controlled-vocabulary LLM output.

The 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:

The 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.

Simple

The missile is now where it is.

The missile should be where it should be.

The difference tells the missile how far to move.

Pirate

First place is where the ship is now.

Second place is where it should be.

Difference tells the crew which way to sail.

Cowboy

Where the cattle are now is the first place.

Where the ranch is is the second place.

The difference tells the cowboy which way to ride.

These 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.

pip install smallwords

I would be interested in feedback from people using constrained decoding with local models, particularly around multilingual vocabularies, grammar size, and additional output shapes.

── more in #large-language-models 4 stories · sorted by recency
── more on @smallwords 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/smallwords-controlle…] indexed:0 read:1min 2026-10-15 · —