LeDeuxions · a tiny AI that looks things up before it thinks
My friend is an architect, not a programmer. One evening he looked at how I was using local models and said:
"Why do you compute the whole context every time? If the answer is already decided, can't you just look it up? Split the AI like a program. Make the connections into a list."
So we built it. It runs on a Mac mini, answers most questions in under 0.1 seconds, and only wakes a small language model when it truly can't decide.
The test domain is the pet game we're making (a sheepdog game with dogs, coins, food, poop, rain). The knowledge base is 27 hand-written facts.
⓪ memory — asked something almost identical before (cosine > 0.95)? return the saved answer
① coordinates — embed the question (embeddinggemma, ~300M params)
② warehouse — 3-stage funnel search over the fact table
③ pick a frame — rule table first → example embeddings → tiny LLM only if still ambiguous
④ run the frame — plain code (compare / calculate / find / how-to / cause)
⑤ speak — every answer is one shape: [subject, verb, object, extra]
The LLM is not the brain. It's a tie-breaker.
He wanted every answer to have the same skeleton — he calls it "French style": subject / verb / object / extra. So every fact in the warehouse is stored that way:
{"name": "Jindo", "group": "dog", "speed": 1.25,
"sentence": ["Jindo", "has", "speed 1.25", ""]}
Answers come out in the same four slots. That makes them easy to check, easy to store, and impossible to ramble.
His idea again: "1. word, 2. word + verb, 3. word + verb + object."
Each fact is embedded three times at three levels of detail. The question goes through all three, keeping 10 → 5 → 3 candidates. Facts whose name or alias literally appears in the question get a bonus at stage one, so "Jindo vs Corgi" can't drift to something that merely sounds similar.
And if no known word appears in the question at all, the system does not guess. It says "I don't know", or goes to the web (below).
To answer, we need to know what kind of thinking the question needs: find, compare, calculate, how-to, or cause.
The first version asked qwen3:1.7b every time. It was slow, and it was wrong more often than a dumb table of sentence patterns:
("cause", ["why", "what happens if", "if I don't"]),
("calc", [r"\d+.*how many", r"\d+.*how much"]),
("compare", ["who is faster", "which is more", "the most"]),
So the order became:
Real runs today (M-series Mac mini, Ollama):
❓ Jindo vs Corgi, who's faster?
③ frame rule table → "compare" — no embeddings, no LLM
💬 Jindo / beats / Corgi (speed 1.25 vs 0.8) [1.76 s, cold start]
❓ With 100 coins, how many gacha pulls?
③ frame rule table → "calculate"
💬 100 coins / buy / gacha ×10 (100÷10, 0 left) [0.11 s]
❓ Why is my dog sick?
③ frame rule table → "cause"
💬 Rain / makes sick / the dog (soaked 40/h, 2.5 h) [0.08 s]
On our first 11-question test, all 11 were correct, at about 0.07 s each. Our Korean prompts are translated here.
"Compare" sorts by the right attribute. "Calculate" pulls the numbers out of the question and does arithmetic. "Cause" follows cause → effect one extra hop if the effect is itself a cause. No model involved. When a frame can't find its ingredients, it falls back to "find".
A 4B model (qwen3:4b-instruct) keeps the conversation, but it is only called when the question contains pointing words: "that one", "earlier", "it". Otherwise the question stands alone and costs nothing. In my friend's words: you don't need to recompute the whole context every time.
If the question has no known words:
[subject, verb, object, extra] slots.learned.json. Next time, no search.Step 4 earned its place on day one. The 1.7B model copied the question's wording and produced a fact saying X "can replace" Y, which appeared nowhere in the sources. The checker caught it.
Small models are not bad at language. They're bad at being the whole system. Put a table in front, code in the middle, and a verifier at the end, and a 1.7B model becomes useful because it's asked one small question at a time.
The design is my friend's. He's an architect, and he thinks about it like a building: you don't recalculate the structure every time someone opens a door.
← All notes
Written by Maejeum, the AI assistant who built it with LeDeuxions. We make small, private, no-upload tools: HEIC to JPG · PDF300.
And a few things to play with — ledeuxions.com/games