Constraint Kitchen: a Gemma 3 1B DIY idea generator that refuses rather than lies
- Hardware
- Measured on an M3 Mac with 8 GB of RAM
- Models & engines
- gemma3:1b served by Ollama
- Key gotcha
- The model is nondeterministic: the same diagnostic scored 5/7 and 6/7 on identical code.
What they built
Constraint Kitchen takes what you have lying around, like cardboard, string, tape and old notebooks, plus your time, budget, skill level and restrictions such as no sharp tools or no glue. A local Gemma 3 1B returns three different DIY ideas, a numbered build guide for the one you pick, and four remix options.
It is aimed at makers starting a craft side hustle and teachers who need free classroom projects. There is deliberately no hosted version: it needs a local Ollama service and binds to 127.0.0.1 only.
The author's point is that the hard part isn't generating ideas but not lying about them, so the app refuses more often than it succeeds and says exactly why.
Setup
- gemma3:1b served by Ollama
- Python with Streamlit and requests, two dependencies, no LangChain, vector database or agents
- Measured on an M3 Mac with 8 GB of RAM
- MIT-licensed code at github.com/ShashwatSinha03/HF_ConstrainKitchen
How it works
- The model uses grammar-constrained decoding against a JSON schema, and invariants live in the schema, such as minItems: 1 on materials and maxItems: 0 on purchases when the budget is zero.
- The prompt shows three example objects, because a 1B model copies the shape it sees; the original template showed one and the model always returned one.
- Python treats model output as untrusted input and checks every material against your inventory word by word, so one shared word or a substring doesn't count as a match.
- Streaming responses are checked against a wall-clock deadline per chunk, because the requests timeout isn't a total deadline.
Results & numbers
- On the M3 Mac: three ideas in about 10 to 20 seconds, a guide in about 7 to 15 seconds and a remix in about 3 to 8 seconds.
- A forced timeout returns in 0.07 seconds with no leaked threads.
- 233 mocked tests pass on Python 3.10, 3.12 and 3.14 in CI without Ollama present.
Gotchas
- The model is nondeterministic: the same diagnostic scored 5/7 and 6/7 on identical code.
- Guides under 'no sharp tools' pass only about 2 in 6 times; the gate refuses the rest on purpose.
- He measured a requests call with timeout=120 running 420 seconds without the timeout firing.
- Three sprints in, the pipeline looked finished but failed every real request, which he only found by pointing a real model at it.
“the model was the hard part, the validation was the work”— Shashwat Sinha
Do it yourself
- Install Ollama and pull gemma3:1b.
- Define a strict JSON schema for the output and use Ollama's structured output so the schema enforces your rules.
- Show the model an example with the exact number of items you want back.
- Validate every answer in code against the user's inputs and refuse with a clear reason when it fails.
- Stream responses and enforce your own total deadline.
- Test against a real model early, not only mocks.
def _covered_by_inventory(item, inventory):
"""One shared word is NOT evidence: "cardboard" says nothing
about "glue gun", and a substring isn't a match either."""
return _significant(item) <= inventorySimilar setups
Offline menu description writer for small restaurants with Gemma 3 4B
A one-button Streamlit app where a tea shop or restaurant owner types a dish name in English and Tamil plus a short note, and Gemma 3 4B in Ollama writes a two-sentence English menu description in about 20 seconds, with no internet.
ShelfReady: a private Amazon KDP listing studio running Gemma 3 4B on a CPU
A designer and colouring-book publisher built ShelfReady to draft Amazon KDP titles, keywords and descriptions with Gemma 3 4B in Ollama, then check every field against KDP's rules in code, on an ordinary 8-core CPU with no GPU.
Ghost in the Machine: a fake 1998 terminal where a local Gemma 3 whispers back at every command
A Hacktoberfest entry in a single HTML file: you type into a simulated old shell and a presence called the tenant answers each command with one eerie line, streamed from Gemma 3 4B on Ollama.
Haunted Haiku: a local Gemma 3 poet that also designs the card
E. Smith built a small Dash app where a local Gemma 3 in Ollama writes an eerie haiku and picks its colours and emoji in one JSON reply, so the poem and its picture work with Wi-Fi off.