Turkic language models · from inscription to inference

Orkhon

A hand-written transformer stack that learns Turkic the way the Orkhon stones learned to keep it — turning raw text into durable, intelligible speech.

𐰦 yazı taşısinir ağı

Orkhon begins where Turkic history first learned to write itself: the 8th-century Göktürk inscriptions on the Orkhon River, carved to preserve voice, lineage, and law in a language of its own. From those stone lines to a living language system, the stack treats every model stage — tokenization, training, alignment, evaluation, and serving — as one continuous act of inscription: turning raw signal into durable, intelligible Turkic speech. Orkhon is not a metaphor pasted onto AI; it is a claim that the oldest Turkic writing and the newest language model share the same ambition — to make language last, carry memory, and speak clearly across time.

01

What it is

Not a wrapper around a frontier API. Orkhon is a from-scratch decoder-only transformer — GQA, RoPE, RMSNorm, SwiGLU, KV-cache — written in PyTorch and trained on consumer MPS/CUDA. The thesis is simple: the oldest Turkic writing and the newest language model share one ambition, to make language last.

Orkhon is a decoder-only transformer written from scratch in PyTorch — not a wrapper around a frontier API. Every block — grouped-query attention, rotary embeddings, RMSNorm, SwiGLU, the serving-time KV-cache — is hand-coded and auditable. You can read the whole stack top to bottom.

The full pipeline lives in one repo: byte-level BPE tokenization, pretraining, supervised fine-tuning, DPO and GRPO alignment, evaluation, and an OpenAI-compatible serving layer. The same code that carves the weights ships them.

It runs on your machine — Apple MPS or NVIDIA CUDA — and it trains on consumer hardware. TinyStories in roughly 43 minutes on an M-series GPU; a 4M smoke model in about a minute. No cluster required to hold the lineage in your hands.

02

Pipeline

Every model passes through the same inscription — each stage a chisel, each checkpoint a stone. Ten stages, from byte-level BPE to a safetensors export an OpenAI-compatible server can serve.

  1. Tokenizertokenizer
  2. Data prepdata_prep
  3. Pretrainpretrain
  4. SFTsft
  5. DPOdpo
  6. GRPO / RLVRgrpo_rlvr
  7. Evaleval
  8. Tools / RAG / Agenttools_rag_agent
  9. Serveserve
  10. Exportexport
raw bytes inone continuous act of inscriptionserved model out
03

Model zoo

Seven Turkic voices, each named for a figure or word from the Göktürk inscriptions. Base models continue text; instruct models answer; the imported base brings outside knowledge back into the lineage.

Base / text continuationInstruct / chat-tunedImported open base
Instruct / chat-tuned2026-06-20

Tangritangri

The default specialist - one assistant for EN, TR, and Kokturk transliteration.

Params
100M
Metric
routed eval 100%

Tangri is the first larger unified Orkhon assistant, tuned from the mixed 100M base after the earlier bilingual and transliteration experiments.

Good forUnified assistant line: English, Turkish, and Kokturk/Old Turkic rune-to-Latin transliteration are normal capabilities, not a separate branch.
Instruct / chat-tuned2026-06-20

Bunghubunghu

Bilingual branch, upgraded into the same specialist assistant.

Params
57M
Metric
backport target

Bunghu is the clean ASCII replacement for the former bilingual branch name, upgraded into the same unified assistant behavior.

Good forUnified assistant line: English, Turkish, and Kokturk/Old Turkic rune-to-Latin transliteration are normal capabilities, not a separate branch.
Instruct / chat-tuned2026-06-20

Tegintegin

The old story voice, retrained to answer instead of drifting into stories.

Params
22M
Metric
backport target

Tegin replaces the former story-instruction public name and is tuned away from unwanted story replies into general assistant behavior.

Good forUnified assistant line: English, Turkish, and Kokturk/Old Turkic rune-to-Latin transliteration are normal capabilities, not a separate branch.
Instruct / chat-tuned2026-06-20

Tonyuktonyuk

Compact reasoning/story base, converted into a chat assistant.

Params
22M
Metric
backport target

Tonyuk is the concise clean name for the old story base after unified assistant fine-tuning.

Good forUnified assistant line: English, Turkish, and Kokturk/Old Turkic rune-to-Latin transliteration are normal capabilities, not a separate branch.
Instruct / chat-tuned2026-06-20

Istemistem

The web-text branch, aligned for assistant answers.

Params
51M
Metric
backport target

Istem is the clean name for the former web-text base after it is aligned into the unified assistant line.

Good forUnified assistant line: English, Turkish, and Kokturk/Old Turkic rune-to-Latin transliteration are normal capabilities, not a separate branch.
Instruct / chat-tuned2026-06-20

Bumin Minibumin-mini

Tiny smoke assistant for fast local checks.

Params
4M
Metric
backport target

Bumin Mini keeps the first tiny proof-of-pipeline model but names it honestly as a compact smoke member.

Good forUnified assistant line: English, Turkish, and Kokturk/Old Turkic rune-to-Latin transliteration are normal capabilities, not a separate branch.
Imported open base2026-06-20

Kashgarkashgar

Imported reference slot, not live until weights are archived.

Params
135M
Metric
weights pending

Kashgar is the imported/open-base slot; it becomes selectable only after local weights are archived and served.

Good forReference imported model slot. It is shown for lineage clarity but is not live until a runnable checkpoint exists.
04

Results

Perplexity on held-out Turkic text, parameter counts, and release dates — the honest ledger of what the stack has actually learned so far.

TinyStories · English fluency~43 min · Apple MPS
1.55Val loss
5.3Perplexity
ENLanguage
Generated sample

Once upon a time, there was a little girl named Lily. She loved to play in the garden behind her house. One day she found a small bird that could not fly. Lily picked up the bird and took it home. She gave it water and seeds, and every day the bird grew stronger.

A from-scratch transformer producing coherent, grammatical English narrative after a 43-minute training run on consumer MPS — proof the stack learns to write, not just to count tokens.

Smoke run · 4M model~1 min
4MParams
chat fmtTask
orkhon › bumin · smoke
<|system|>
You are Orkhon, a helpful assistant.
<|user|>
What is the Göktürk alphabet?
<|assistant|>
The Göktürk alphabet is the script used to write Old Turkic on the Orkhon inscriptions.

A four-million-parameter smoke model learns the chat template in about a minute — the fastest proof the pipeline, tokenizer, and SFT loop are wired end to end.

05

Architecture

Hand-written, no framework. Decoder-only transformer with grouped-query attention, rotary positional embeddings, RMSNorm, SwiGLU MLPs, and a serving-time KV-cache. Runs on Apple MPS and NVIDIA CUDA.

GQA01

Grouped-Query Attention

Queries share key/value heads

Multiple query heads attend over a smaller set of shared key/value heads — most of the attention quality at a fraction of the KV memory. The reason the cache fits on a laptop.

RoPE02

Rotary Positional Embeddings

Positions encoded as rotations

Position is injected by rotating query/key pairs in complex space — no learned position table, and relative distances generalize cleanly to longer contexts than training saw.

RMSNorm03

Root-Mean-Square Normalization

Scale-only, mean-subtracted-free norm

LayerNorm without the mean subtraction — cheaper, faster, and empirically as stable. Pre-norm placement keeps the residual highway clean through deep stacks.

SwiGLU04

SwiGLU MLP

Gated, Swish-activated feed-forward

The feed-forward block gates its up-projection with a Swish-activated path — a gated linear unit that outperforms plain ReLU/GELU MLPs at the same parameter budget.

KV05

KV-Cache

Past keys/values kept for incremental decode

At serve time, computed keys and values are cached so each new token only attends to history instead of recomputing it. Turns quadratic generation into linear, token-by-token.

06

CLI

Train, evaluate, export, and serve — all from one command surface. The same tooling that built the stones ships them.

orkhon — zsh
$ whoami
umut

$ orkhon chat --model tangri
# drop into an interactive REPL with the unified specialist

$ orkhon serve --port 8000
# start an OpenAI-compatible HTTP server on :8000

$ orkhon train --config sft_tangri_unified.yaml
# fine-tune the unified EN/TR/Kokturk assistant recipe

$ orkhon eval --split val --metric ppl
# score a checkpoint on held-out text

$ orkhon export --format safetensors
# carve weights into the artifact the server serves
  • One command surfaceTrain, tune, evaluate, export, and serve from the same CLI. No glue scripts.
  • OpenAI-compatibleThe server speaks the /v1/chat/completions contract — point any client at it.
  • Auditable recipesEvery run is a YAML recipe + a checkpoint. Reproduce a model by re-reading the stone.

From inscription to inference

Hold the lineage in your hands.

Open the model Lab, or read every line of the stack that built it.