AI without an LLM: a Kazakh text model
Build a local Kazakh text model that analyzes words, checks sources, and can say “I don't know”. The first fifteen of 30 planned lessons are open.
·
Every lesson is open: reading needs no account.
-
Before you begin: AI without an LLM
We will build a small program for short questions about an imaginary school club. It analyzes Kazakh words, finds an approved record, and answers from that record. Without a record it says “білмеймін” (“I don't know”). You need a computer and Python 3.10 or newer; Lesson 2 explains setup. The course is free and needs neither a paid API nor a dedicated GPU.
-
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?
“To our houses” combines a house, plurality, possession, and direction. Grammar is the set of rules connecting such meanings. Morphology is the part of grammar concerned with word structure. A morphological type names a common pattern, not a rigid label for every word.
-
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.”