AI without an LLM: build your own AI model
Build a local Kazakh text model that analyzes words, checks sources, and can say “I don't know”. All 30 lessons are open.
·
Every lesson is open: reading needs no account.
-
Before you begin: AI without an LLM
Across 30 lessons you will build a small system for short questions about an imaginary school club. It analyzes familiar Kazakh forms, identifies the question type, finds an approved record, and shows an answer with its source. Without enough evidence it says білмеймін (“I don't know”).
-
Lesson 1. What problem will our model solve?
Imagine a school club with a timetable. A student asks, “Сабақ қашан?” (“When is the class?”). A careful desk clerk first asks which class, then checks an approved record. Without a record, the clerk does not invent a time.
-
Lesson 2. The first checkable program step
A person can read a timetable. A program needs an exact instruction. First, we will display one approved record and distinguish source code from its output.
-
Lesson 3. Where does a language put grammatical meaning?
A program sees letters, but we need meaning. “To our houses” contains a house, plurality, possession, and direction. These additions are grammatical meanings. Before writing rules, we must ask where a language stores them: in separate words, in a chain of parts, or together in one part.
-
Lesson 4. Analyze a word without guessing
One meaning can appear in several word forms. To recognize “house” in үйде and үйлерде, our program looks for a stem: the part from which forms are built. Other parts add meanings. A stem dictionary lists stems known to the program and what they mean.
-
Lesson 5. Build a model you can run by hand
Before trusting a program to analyze words, we should be able to perform the steps ourselves. A manual model is a written procedure that lets any reader reproduce the result. It exposes missing rules.
-
Lesson 6. Read Kazakh Cyrillic without losing letters
Change one letter on an envelope and it may go to the wrong address. For our model, үй and уй are also different spellings. Before analyzing a word, we need to receive exactly what the person typed.
-
Lesson 7. Split a short question into words
A librarian makes separate cards before looking up individual books. Our model likewise needs separate words before it can find stems. A token here means one separated word; tokenization is the act of obtaining those words from a line.
-
Lesson 8. Build a dictionary of known stems
A guest list tells a door attendant who is invited; a similar name is not enough. Our stem dictionary likewise lists only forms the model knows. For now we enter one bare stem without an ending. We will learn үйлер and мектепте later.
-
Lesson 9. Six forms of the plural marker
You can pack the same kind of item in boxes of different sizes. The meaning “more than one” stays, while the sound of the added part adjusts to its neighbors. In Kazakh, the plural ending has six forms: -лар, -лер, -дар, -дер, -тар, -тер. The hyphen shows a boundary for study; it is not written in the complete word.
-
Lesson 10. Check the order of word parts
On a letter, you write the address and then add the stamp; the familiar procedure has an order. Word parts have positions too. Our example follows stem → plural → possession → direction. Possession says “whose?”; direction says “toward what?” The Kazakh үй-лер-іміз-ге means “to our houses.” Hyphens help us see the parts; the written word is үйлерімізге.
-
Lesson 11. Tell “to our houses” from “in our houses”
Imagine two tickets: one takes you to a museum; the other admits you inside it. Both mention the museum, but their jobs differ. A Kazakh word can likewise keep its stem and possession while changing its final part: үйлерімізге means “to our houses”; үйлерімізде means “in our houses.”
-
Lesson 12. Keep more than one possible meaning
A door marked “hall” might lead to a sports hall or a concert hall; you need more information. Kazakh ат likewise means “horse” and “name.” One isolated word cannot justify choosing either. A [dictionary of literary Kazakh](https://sozdikqor.kz/sozdik/?id=38) records both meanings.
-
Lesson 13. Find the subject of a question
If you ask a librarian “When does the chess club open?”, they first need to know which club you mean. Our fictional study club has two lesson names: Шахмат (“chess”) and Сурет (“drawing”). Call the named thing the subject of the question. In software it is often called an *entity*: a specific item we may later look up in a catalog.
-
Lesson 14. Identify what the person asks for
Шахмат қашан? (“When is chess?”) and Шахмат қайда? (“Where is chess?”) concern the same class but ask for different records. The question type, often called *intent*, is the kind of information wanted: time or place here. It is not the information itself. A form saying “item requested” is not the delivered item.
-
Lesson 15. Ask for clarification instead of guessing
A ticket clerk cannot issue a ticket if the buyer names two films and no showing. They ask which one the buyer wants. Our model must also stop when it cannot tell which class or which kind of information is requested. A refusal here means “not enough verified information for the next step,” not “your question is bad.”
-
Lesson 16. A catalog of checked records
A library gives each book a card with a title and shelf. We will give each exercise fact a similar record. Here “checked” means the fictional club author entered it into our learning catalog; it is not a real timetable.
-
Lesson 17. Look up a record by two keys
An author name alone may identify several library books. Our catalog also needs two keys: activity and information type. Lesson 15 already extracted this pair from a short question.
-
Lesson 18. Source and check date
A class time on a notice board is useful when we know which notice it came from and when someone checked it. Add those details to each card.
-
Lesson 19. Build an answer from a template
A form has fixed wording and one blank for a checked value. Such a template does not invent a timetable: it only displays the selected card clearly.
-
Lesson 20. Stop on conflicts and expired records
If a notice board has two different notices for one activity, choosing the first is unsafe. Once a notice has expired, its old schedule cannot be presented as current. Combine question parsing, lookup, and these two checks.
-
Lesson 21. Label questions by hand
A teacher prepares answer cards before marking a pupil’s work. A model likewise needs a question paired with a correct exercise label. Without labeled examples, it has nothing to learn from and we have no way to inspect its mistakes.
-
Lesson 22. Separate training, tuning, and testing
If a pupil has already seen the test answers, a high mark proves little. Put the questions into three envelopes: one for learning, one for adjusting the rule, and one to open only for the final check.
-
Lesson 23. Learn the question type from examples
A pupil notices that time cards often contain “қашан” while place cards contain “қайда.” Let the program count such patterns. This small classifier chooses a known question type. It has no club facts and does not generate free text.
-
Lesson 24. Require enough evidence before choosing
A receptionist sees both “when” and “where” in a note. Even if “when” appears twice, the receptionist should ask which question the writer wants answered. The previous counter made exactly that mistake.
-
Lesson 25. Measure correct answers and refusals
A teacher distinguishes a wrong answer from an honest “I do not know yet.” Too many refusals are still a problem. One attractive number is not enough: count correct answers and known questions left unanswered.
-
Lesson 26. Compare our learning parser with Adam FST
Two people inspect a bicycle: a learner names three familiar parts, while a workshop also records each part’s condition. Compare only the work they have in common. Our lesson 11 recognizes two preset forms; adam_fst is a separate Rust tool that analyzes a Kazakh word into a root and grammatical features. It is not a source for club schedules.
-
Lesson 27. Check misspellings and unrelated topics
A receptionist checks a visitor’s name against a list. If the name is unclear or two passes are requested at once, the receptionist asks rather than guessing. Our classifier should likewise stop on an unknown word, a typo, or a question asking for both time and place.
-
Lesson 28. Measure time, memory, and cost
A kettle takes time to heat from cold; pouring already-hot water is faster. A program likewise has a fresh-start cost and a cost for calling a ready function again. Measure both, file size, and observed memory allocations.
-
Lesson 29. Audit locality and explain each answer
A food label tells us where an item came from, when it was checked, and when it expires. A fact card needs similar information. For each answer, record a decision trail: what was recognized, how many cards matched, and why an answer was allowed.
-
Lesson 30. Release the command-line model and check our claims
A first-aid kit is useful when each item has a name, expiry, and instructions. Our release is also a complete kit: program, rules, exercise cards, a run command, and checkable boundaries. It answers only two kinds of short question about a fictional club.