README проекта с github.com/volotat/mini-AGI. Одним файлом markdown: README.md.
mini-AGI - is a continual learning byte-level language model that assembles its own architecture, trains from scratch on a single 8 GB VRAM GPU, and keeps learning from everything it reads. It stores its weights as ordinary files on disk and pages them onto the card as it needs them, so the parameter count is bounded by free disk space rather than by VRAM. It grows new capacity while training when it runs short, prunes what nothing asks for, and reads through exactly the same code path it serves on. Targeted at a PC or laptop with at least a 6 GB VRAM GPU on the board.
NOTE: as of now this is a small toy-level model. Do not expect a frontier level capabilities. This is rather a small experiment to show, that continual learning from the single stream of data without catastrophic forgetting is possible. Furthermore it is possible on a modest hardware. Which means that almost everyone could train their own version of the model (or simply continue training this one) exactly as they see it fit. And the capabilities would be bounded by the actual hardware, scale and quality of the data available and the amount of time one willing to spend on training the model.
The name is a half-joke and not a statement of the current capabilities of the model, but rather the potential and traits it has. Continual single-stream learning and natural size and processing adaptation to the available resources exactly what I myself expect from an AGI to have. It has just a small toy-level memory footprint and hence it is “mini-AGI”.
Here is how min-run dashboard looks like. The model is pointed to the corpus to constantly read and learn from.
History - here is the samples from the whole training run history so far. You can inspect them yourself to see how the model improved over the course of training/reading the corpus.
The "final" weights are not published yet. The run is still reading its first pass over the corpus, the weights go up once it has been through all of it, which is several weeks away at the current rate. If you would like to play with undertrained weights as they are right now, you can find the most recent (9 Nov 2026) snapshot here: Volotat/mini-AGI-undertrained

Every sample round of the run to date: 7,604.5M characters over 5,919 evaluations; held-out from before the in-flight corrections is drawn moved onto today's level.
The round with the lowest held-out loss so far - 0.5509 nats at 6,127.8M characters. Each prompt is written the way chat writes, by the rule the header names. The whole history is in runs/samples.txt.
==============================================================================
step 2,992,435 6127.8M of 8,037M characters (76.24%) 4933 min 425 experts
context 4,096 characters of 4,096 reading 1,823 char/s writing 28.6 char/s still gaining -0.0516 deep into it
grad norm 3.77 against a clip of 1 clipping
train loss 0.5540 lr 2.52e-06 evidence t +6.59 over 65.7 (effect +0.1466) rate x0.00841
attention logit 18.25 at most prelude.0 12.44 prelude.1 16.38 recur.0 18.25
held-out loss 0.5509 +/-0.0221 nats 0.7947 bits/char perplexity 1.73 gap -0.0032 level -0.0105
arithmetic 0.610 chat 0.448 chat_hermes 0.733 chess 0.372 code 0.453 reasoning 0.525 stories 0.443 wikipedia 0.823
written temperature 0.5: repeats 16% of 8-grams
==============================================================================
--- stories ---
prompt: 'Once upon a time, there was a little boy named Tom. One day he '
[written] repeated 8-grams 1%
was playing with his toy car when he saw a big dog. The dog had a long nose and sharp teeth. Tom was scared and ran away.
Tom felt sad and said, "Don't worry, dog. I will help you." He picked up the dog and put it in his mouth. The dog was so happy and started to play with Tom.
But then Tom heard a loud noise. It was
--- code ---
prompt: 'def merge_sorted(a, b):\n '
[written] repeated 8-grams 59%
pos = -b
while pos < 0:
pos += 1
pos -= 1
pos -= 0
pos -= 1
while pos < -2
pos += 1
return pos
def merge_sorted(a, b):
pos = -b
while pos < -2
pos -= 1
pos -= 1
pos -= 0
while pos < -2
pos -= 1
return pos
pos -= 1
while pos < -2
p
--- arithmetic ---
prompt: 'add 4917 + 388 = '
[written] repeated 8-grams 1%
5305
add 5 + 4 = 9
mod 6 % 71 = <think> 71*0=0 71*1=71>6 6-0=6 </think> 6
sub 88 - 9 = 79
mul 233 * 77 = 18941
add 76 + 2 = 78
sub 171 - 6 = 165
add 99 + 4 = 103
add 947 + 319 = 1266
mul 563 * 9 = 5067
sub 64 - 8 = 56
mul 0 * 6 = 0
add 3 + 9 = 12
sub 9263402 - 199 = 9263203
add 7 + 1 = 8
add 4 + 6 = 10
add 384 + 45 = <think> 4+5+0=9c0 8+
--- chat ---
prompt: '<user>\nWhat are you?\n</user>\n<bot>\n'
[written] repeated 8-grams 0%
In a directory, one file per expert. That disk starts with every key in the state earns at every mess everything else rises by more. Taking a window from each in turn keeps 8 that step of the loaded experts run for each character, which is thinking you can inspect.
</bot>
<user>
what is the recurrence?
</user>
<bot>
After the first 2 bloc
--- chat_hermes ---
prompt: '<user>\nA train travels 60 km in 45 minutes. What is its speed in km/h?\n</user>\n<bot>\n'
[written] repeated 8-grams 28%
The speed of the train is 25 km x 3 = 75 km.
The speed of the train is 2 km x 2 = 4 km.
The speed of the first train is 75 km x 2 = 140 km.
The speed of the second train is 4 km x 2 = 80 km.
The total speed of the train and the train is 75 + 80 + 80 + 80 = 260 km.
#### 260
The answer is: 260
</bot>
<user>
A college selects three
--- reasoning ---
prompt: '<user>\nWrite a Python function that returns the largest number in a list.\n</user>\n<bot>\n<think>\n'
[written] repeated 8-grams 27%
Okay, so I need to find the largest number in a list that allows me to compute the largest number in a list based on the given conditions. Hmm, let's start by understanding the problem.
First, let's think about how to compute the largest number in a list. The largest number is at least 1. So the largest number is 1. T
--- wikipedia ---
prompt: '== History ==\nThe [[Roman Empire]] was '
[written] repeated 8-grams 25%
founded in [[1692]] and [[Emperor of Japan|Emperor]] of [[Japan]] in [[1786]]. The Emperor was inducted into the [[Latin American]] [[Territorial Empire]] in [[1838]]. The Emperor was inducted into the [[Territorial Accelerated Day (1908-1999)|Territorial Accelerated Day (1908-1999)]] in [[1909]]. The [[War of the Floo
--- chess ---
prompt: '<g>1700 1-0 1. e4 e5 2. '
[written] repeated 8-grams 0% 39 legal moves, then Qf6
Nf3 d6 3. Bc4 Be6 4. Bxe6 fxe6 5. d4 exd4 6. Nxd4 Qd7 7. O-O Nf6 8. Nc3 Be7 9. Bg5 O-O 10. Nf3 Nc6 11. Bxf6 Bxf6 12. Qd2 Ne5 13. Nxe5 Bxe5 14. Rad1 Rf6 15. f4 Bd4+ 16. Kh1 Raf8 17. Nd5 Qe8 18. Nxf6+ Rxf6 19. c3 Bb6 20. f5 Qf7 21. Qg5 Qf6 22. Qg4 d5 23. exd5 exd5 24. Rxd5 Rf7 25. Rd8+ Rf8 26. Rxf8+ Qxf8 27. Qd7 Qf7 28.
--- self-knowledge ---
prompt: '<user>\nhow do you decide which experts to use?\n</user>\n<bot>\n'
[written] repeated 8-grams 2%
With the router, and by the whole text: one row of numbers per expert, always on the card, so an expert on disk is scored exactly like one that is loaded. Every character scores all 397 and asks for its 8 best, each request weighted by the probability the router gave it, and those requests are the text's vote. A forwar
Every language model you can actually own today is a model somebody else trained and then froze. You can fine-tune around the edges of it, but you cannot train one from scratch on your own hardware, and you cannot keep training it on what you do day to day - the moment you try, it forgets what it knew before. The result is that a personal model is always somebody else's model with a thin layer of you on top, and it stops learning the day it ships.
mini-AGI model has small enough GPU footprint that it is possible to train end-to-end on one consumer card, and it is built so that training never has to stop. It reads a stream of characters one chunk at a time, takes a gradient step on each, and the same path serves generation. There is no separate fine-tuning regime and no frozen base: reading and being trained are the same event.
Three constraints shape everything else in the design:
The model is genuinely yours: trained on your hardware, on your data, that keeps learning from every conversation you have with it, and that nobody else can take it away or switch it off.
Characters (bytes) does not pass through a fixed stack of layers as it would be in a traditional LLM. Instead, it passes through two dense prelude blocks and then through one recurrent block applied up to 24 times, each application choosing its own experts from a shared pool. The latent state between applications is never decoded - it is merged with the embedded input by an adapter each time round, so the loop cannot drift away from the text it is reading.
Three distinct blocks, up to 26 block-applications per character.
Every box is a layer, every ⊕ a residual add, and the shaded groups are what repeats: the prelude layer twice, the recurrent layer up to 24 times with the same weights. On the right, the inside of each attention layer - its 8 heads, the cache they read, and where their output goes.

This is the architecture assembling itself, one character at a time, captured from the live model.
Each tile on the left is one expert; colour is expert identity and stays the same for the whole clip. A row is one application of the recurrent block, and the eight tiles in it are the eight experts that row actually ran. The stack grows downward as the model keeps going, and the amber line is where halting stopped it - the grey rows below are computation the model declined to spend.
The trace on the right is how many rows each character took. It moves constantly between 9 and 15 against a ceiling of 24, and the caret under the text shows which character is being read. The text is a held-out story, read one character at a time after its first 2,048, and every character is a forward of its own: it adds its requests to the story's vote and routes among the 32 experts the story so far has asked for most, each row picking its eight from those. Over these 160 characters the card does not change once - the 2,048 characters before them have already voted, and the story goes on asking for the same experts.
Positions are rotary and carry no learned parameters, which is why the context window can be extended by continued training rather than by re-initialising anything.

The clip above is the model reading - every character is held-out text it is being shown. This one is the model writing: it was primed with 2,495 characters of held-out stories and then continued on its own, so the grey text is what it was given and the green text is entirely its own. Greedy decoding with the repetition guard - the adapted reading in the sample log - and no sampling anywhere: run it twice and you get the same sentence.
Two things are worth watching. The stack behaves the same way, because generating and reading are the same forward pass in this model - the only difference is whether the next character comes from a file or from the model's own argmax - and it costs about the same: 11.8 rows a character over the 140 characters written, against 12.1 over the 160 read from the same stories. And the whole text chooses the experts, the way it does in training. The prompt's forward admitted the 32 its characters asked for most; after that, every character added its own requests to the vote and routed among what the prompt and the reply so far had asked for. This reply never moved the vote far enough to change the card, so not one expert was loaded after the prompt; a reply that wanders from its prompt takes the card with it. Letting each character choose alone instead, as an earlier version did, made its predictions on the same held-out text a fifth worse, 1.35 nats a character against 1.11, and garbled its words. Nothing was written back: nothing is trained while it writes.
What it produced, continuing the story about a cherry tree that the prompt ends on:
They would stay inside, but only for any more.
One day, the cherry tree saw another cherry. It was very big, and it had long, shiny wings.
Spelled right and on the story it was given, but "only for any more" means nothing, and the other cherry has wings - a fair picture of where the model was at 648.6M characters, when the clip was recorded.
Every expert is a file on disk holding its weights and its optimiser moments. Above disk sit a RAM cache and the card:
| key | what it is | |
|---|---|---|
| disk | — | every expert the model has; bounded by free space |
| RAM | ram_cache |
the experts used most recently, least-recently-used evicted |
| VRAM | resident |
the experts the current forward admitted - what a character may route through |
Selection is one rule: the text chooses. Every character ranks the whole pool with the router - one row per expert, always on the card, so an expert on disk is scored exactly like one in VRAM - and asks for its top 8, each request carrying the probability the router gave it. Every forward's first pass adds its characters' requests to the vote of its text - everything read since position 0 - and the forward is admitted the experts its text has voted for most, until the card's 32 slots are full. Every character then routes with the same router over the admitted experts only and takes its top 8 of those, so a character whose request was not admitted gets its best admitted experts instead.
The 32 is the resident setting, and the card's memory is what limits it: everything a training forward used has to stay on the card through its backward pass and the optimiser step. Fitting it to your hardware says what each slot costs. In training a window is a text of its own, and the first pass of its 4,096 characters already asks for well over a hundred experts, so the window's 32 are its first pass's most requested. When the model writes, every character is a forward of its own that adds its requests to the vote the prompt and the reply so far have cast, and routes among the 32 that whole text has asked for most - the choice a training window over that text would make, cut off at the character being written. The set follows the text as it goes and moves only when the vote does, so a reply loads a new expert now and then rather than at every character, from RAM or from disk.
Three rules the project holds to:
What was on the card before changes the cost, never the choice. Admission reads only the text and the weights, so the same text admits the same experts whatever was read before it; history decides only how many of them have to be loaded. And because the rows that admit experts are the rows that route every character, admission is learned by the ordinary gradient. When a character mixes its experts, the loss raises the router score of each one whose output helped more than the mixture as a whole and lowers the score of each that helped less. Only the rows of experts the window admitted receive that signal, and the next text whose states look like those asks more strongly for the experts that helped.
While it trains, the router is taught to use the whole pool. That gradient only reaches experts that get chosen, and left alone the router keeps choosing the same ones: reading held-out text on its own, it put just 59 of its 118 experts on a card across every subject. So the loss carries a balance term - the Switch Transformer's, with one change. Every expert keeps a running share of the recent training forwards that admitted it, and every forward that trains pays, on the router's probability for each expert over the whole pool, in proportion to that share: balance × (experts × Σ share × probability − 1), zero when use is even. Probability on a busy expert costs more than on an idle one, so the router's rows move toward the idle. Switch charges each expert by its share of the current batch; here the share is taken over the last thousand or so training forwards, because a training window is one text and a text should be free to want few experts - what has to be even is the use across texts. Only the router's rows learn from it, since the characters' states are detached, so it cannot bend what the trunk computes. And because it changes the router itself, reading and writing choose the way training does. In a 15-minute test at weight 0.01, the experts the router put on a card across held-out rose from 59 to 114, at a cost of 0.023 in held-out loss over those minutes. The exploration bonus it replaced acted only while training: over the same 15 minutes it spread the training work across 116 experts, while the model reading on its own still used 58. The weight sets how hard the term leans against learning the text on the experts in use, and the default is gentler, 0.003. An expert no text admits gets no other gradient. Under Adam that was enough: Adam scales each weight's step by that weight's own history, so it moved an idle row at the usual pace whatever the weight. Muon spends each step on the router's largest directions, and an idle row's balance gradient is too small to move it, so newborns are brought in by the routing bias instead (below).
The pool grows when it is short of capacity and shrinks when parts of it stop being asked for.
New experts are added on speculation, at a small gate so they change almost nothing, and kept only if something goes on asking for them. A new expert is built by recombination - whole hidden units taken from several existing experts - because a clone of one parent is not novel enough to be worth routing to, and a random expert computes nothing worth routing to. Its router row is its parents' rows averaged, weighted by how many units each gave, so it starts out scoring every character with the same weighted average of its parents' scores. With parents drawn at random, that average sits near the pool's average row, and no text in particular asks for it: none of the first 22 experts born under Muon was ever admitted. So while a newborn is on trial, the routing bias lifts it. The bias is an offset added to its score where experts are chosen, never to the weights it is mixed with. It rises a little after every training step in which characters chose the newborn less than a tenth of an even share, and falls back to zero as the newborn's own row earns that share. A lifted request also counts lifted in the card's vote, so the newborn reaches the card and gets chosen, and its row, gate and weights learn from what it computes. When its trial ends the offset goes, and it lives or dies by its own use.
Growth is refused unless every brake agrees:
Dead means unaddressed. Both the growth brake and the pruner read how long it has been since a forward last admitted an expert, and never its gate. The gate is not merely uninformative here, it is anti-predictive: the smallest gates belong to the busiest experts - one that behaves as a sink, chosen constantly and contributing little per character, reads as dead on a gate test, while a high-gate expert nothing has asked for in a long time reads as alive.
A new expert is safe for a full survival window no matter what, so it cannot be judged before it has had a chance to be chosen. When the model grows an expert a new file appears; when it prunes one, that file is deleted.
Training on a single stream, one subject at a time, is the classic recipe for catastrophic forgetting. The test here is deliberately the worst case: the model is switched cold onto PG19 - 19th-century novels, a domain it has never read - and made to read 1,048,576 consecutive characters of it and nothing else, at batch 1.
The trunk learning rate is the mechanism. The trunk - embeddings, attention, routers, the halting head - is the part every character passes through, and it carries 98% of the squared gradient norm. Running it at 0.1x the experts' rate is the difference between a model that absorbs a new domain and one that is wrecked by it.
| configuration | PG19, the new domain | the 8 it already knew | learned per nat forgotten | retained vs chance |
|---|---|---|---|---|
| experts frozen, trunk LR = expert LR | -0.2909 | +1.2663 | 0.23 | 74.12% |
| swapping, trunk LR = expert LR | -0.3106 | +1.2628 | 0.25 | 74.25% |
| swapping, trunk at 0.1x - what the run uses | -0.4216 | +0.1297 | 3.25 | 97.30% |
| interleaved: PG19 added as a 9th lane | -0.3124 | -0.0065 | nothing forgotten | 100.13% |
These arms were measured before expert selection moved to the rule under How paging works, when the experts on the card were re-chosen before every chunk; the probe now runs the current rule.
The fourth column is the exchange rate: nats gained on the new domain for every nat lost across the eight. The mitigated configuration is 13x better at that trade than either unmitigated one - and interleaved there is no trade at all.

Panel A is what happened to the eight subjects the model did not read - zero means nothing was forgotten. Two configurations climb to +1.27 nats, which is the model losing most of what it knew. The third, at a trunk learning rate one tenth of the experts', reaches +0.13 after more than a million characters of a single unfamiliar domain.
Panel B: what it learned while it was there. The mitigated configuration is not trading plasticity for retention - it learns PG19 faster than either unmitigated arm, -0.4216 nats against -0.3106 and -0.2909, while forgetting ten times less. Slowing the trunk does not slow learning. It accelerates it, because the trunk stops being dragged around by every passage and the experts are free to specialise.
A million consecutive characters of one subject is 32 passages back to back. The run never does this: it reads a passage of 32,768 characters, moves to another subject, and comes back to each one within about a million characters at most - sooner to the subjects still learning fastest. It is the analogous to a person who does one thing for a solid week and a person who changes activity through the day.
Nothing in normal use looks like the massed arm either. A conversation wanders, and a model reading your files reads whatever is there. Such regime only arises deliberately - a bot specialised on one subject and fed nothing else for a long stretch.
So, the last row here is the one that describes the actual system:
pg19 1.6773 -> 1.3649 -0.3124 (read)
reasoning 0.7076 -> 0.6846 -0.0230 (read)
code 0.6552 -> 0.6404 -0.0148 (read)
chat 0.7402 -> 0.7289 -0.0113 (read)
stories 0.5599 -> 0.5537 -0.0063 (read)
wikipedia 1.2549 -> 1.2493 -0.0056 (read)
arithmetic 0.6419 -> 0.6433 +0.0014 (read)
chess 0.4955 -> 0.4989 +0.0035 (read)
chat_hermes 1.1043 -> 1.1085 +0.0042 (withheld)

Add a new domain as a ninth lane and six of the nine improve. PG19 falls by 0.31 nats and the eight the model already knew improve by 0.0065 on average - nothing moves more than +0.004 in the wrong direction, and the subject it was best at is untouched. Adding a domain to this model costs nothing: 100.13% retained is the eight coming out very slightly ahead of where they started. In the figure the eight are the flat band at zero and PG19 is the line leaving it - the same read that costs 0.13 nats when it is massed costs nothing when it is interleaved.
Two readings matter here:

What that same read looks like from the inside. This is the working configuration - trunk at 0.1x - during the 1,048,576-character PG19 read. On the left, every subject against where it started. PG19 drops away from the pack; the eight withheld subjects drift up together, and the ones that drift most are chat, stories and reasoning - the prose-like lanes, nearest to Victorian novels. Chess and arithmetic barely move, at +0.009 and +0.043. The damage lands where the representations overlap, which is what the routing story predicts.
The right panel is why the damage is bounded at all. Over the whole read only 44 of 174 experts received any gradient - 75% of the model was structurally untouched, because routing never selected it: the pool confines an update to the part of the model that the text actually addressed.
Which subject comes next follows the evidence too. Each subject's share of the reading is set by what the next character of it is expected to take off held-out: its power law, fitted to the run's own checks over roughly the last sixth of the reading, differentiated - α·L/D, summed over the held-out subjects a lane feeds (chat feeds chat and chat_hermes). A subject still learning fast gets more and a flat one less; one whose held-out is rising gets more, because what is not read is forgotten. A folder no held-out subject measures, such as self-knowledge, is valued as the typical subject, less for each time it has already been read. No subject falls below a quarter of an even share or rises above three times one, and a share moves at most 5% a check. The shares are of characters: a visit reads 32,768 characters of one subject - part of a long file, or short files joined end to end by <|endoftext|> - so the subject changes once a passage and each gets exactly its share. --lane-schedule equal gives every subject an even share; --lane-weights pins the shares by hand (minagi/lanes.py).
The learning rate is not scheduled. A cosine schedule asserts that the run ends, which for a model that reads continually is false. Instead a controller nudges the rate at every held-out evaluation, by an amount set by how clearly held-out is still improving - read off two exponentially weighted fits of held-out against time, one remembering about 66 evaluations and one about 12. Unless the improvement is clear, the rate eases down a fraction of a percent at a time: on a plateau about 0.2% an evaluation, a tenth or less in six hours, never more than 0.4% at once and never below 0.1% of the base rate. Clear improvement holds it up and can raise it by at most 0.08% an evaluation, and a confirmed jump in held-out, which means the material changed, doubles it. Easing is the resting posture because on this run a lower rate was measured to help on a plateau: from the same weights, the same 3M characters read at a third of the rate came out ahead on every held-out check and in every subject. Three things are not evidence: a reading that does not hold at the next check (this run's spikes are single readings 0.01 to 0.02 above their neighbours), an evaluation with nothing read since the last, and the step a restart makes in held-out, which is measured on the first five readings after it and taken out, so a changed setting is neither progress nor harm.
The probe, all four arms and the figures ship in replication/.
Weights for the checkpoint every number above was measured on:
| data read | held-out | experts | download |
|---|---|---|---|
| 428.2M characters | 0.7702 nats / 1.1112 bits/byte | 174 | Volotat/mini-AGI-cl-replication-weights |
Download the weights/ folder into the repository root. Held-out there is the probe's own baseline - the eight training domains under data/val, 16 chunks each - which is what every figure above is measured against, and is evaluated on fewer chunks than the training run's own log.
To run it:
python3 -m corpora all # data/train and data/val
python3 -m corpora pg19 --split validation \
--out data/cl/pg19 # the new domain, 50 books
cp -a weights /tmp/w # a COPY - paging marks experts dirty
python3 replication/forgetting_probe.py --weights /tmp/w \
--domain pg19 --read-root data/cl --steps 512 \
--at 0,64,128,256,384,512 --eval-chunks 16 --chunk 2048 \
--lr 2.08e-4 --held-out data/cl_val \
--trunk-lr-mult 0.1 --out replication/results/mine.json
python3 replication/cl_summary.py # the table, control verdict first
python3 replication/plot_figures.py # redraws the figures above
--read-root keeps the new domain outside data/train on purpose: put PG19 in the corpus and the training run would start reading it too. data/cl_val holds the eight existing held-out sets plus PG19 books that are never read, so "PG19 improved" cannot be memorisation. The PG19 validation split is used rather than the test split, so the PG19 benchmark further down this page stays untouched.
Set --trunk-lr-mult 1.0 for the unmitigated arm, add --no-swap to freeze the experts the first window admits, and pass --rotate pg19,chess,code,stories,arithmetic,wikipedia,chat,reasoning for the interleaved control.
Read the control first. cl_summary.py prints a verdict on it before anything else: every lane is read there, so forgetting is impossible by construction and any degradation is the instrument rather than the model.
python3 train.py read ~/notes # a dry read - nothing kept
python3 train.py read ~/src ~/docs --passes 3 --save
Point it at files or directories. There is nothing to prepare: the alphabet is the 256 byte values, so a file is already written in the only vocabulary the model has. Directories are walked, binaries are skipped by sampling their contents rather than trusting the extension, and each file is read from its beginning to its end because a document has an order.
It is the same path training uses: same chunking, same cache, same gradient step.
| flag | |
|---|---|
--passes N |
read the whole set N times |
--save |
keep what it learned; without it weights/ is untouched |
--lr |
default 5e-5, below a training run: reading should adjust the model, not overwrite it |
--mix "" |
skip the before/after scoring |
Two defaults worth knowing. Nothing is saved without --save, so a read is a dry run until you decide otherwise. A dry read works on a copy of weights/ made of hard links, which takes disk space only for the experts it rewrites and is deleted when the read ends. And it scores the held-out mixture before and after, then says plainly if reading your files cost the model ground elsewhere.
The numbers below are for tracking purposes and move as the run continues. Held-out loss is reported with its standard error, and the size of the evaluation is what sets that error - a difference smaller than it is noise.
Held-out is read as whole blocks of 4,096 characters spread evenly over everything each subject holds in data/val, the same blocks every time, and a block scores exactly what it would if its file were read from the top. Each round's check reads 8 blocks of each subject, and a few blocks sit a little above or below the whole set, so every session starts with a 30-block evaluation and reports each of its checks at that level: what the check reads, plus the difference the two had at the start. The run has read held-out this way since 18 Oct 2026, and the checks from before are shown moved onto it - memory/corrections.md says how.
There is a second variance underneath these figures. The same configuration run twice lands about 0.014 apart, because the expert dispatch is not deterministic on CUDA. Treat about 0.03 as the threshold for a real difference, not the error bar printed beside one score.
Where the model is (7,604.5M characters read, 424 experts; held-out measured on the model as it stands, on 30 blocks of 4,096 characters spread over all of each subject):
| nats/char | bits/byte | |
|---|---|---|
| held-out, all 8 subjects | 0.5480 ± 0.0113 | 0.7906 |
| train | 0.5878 | 0.8480 |
Held-out loss per subject:
| Subject | nats/char | bits/byte |
|---|---|---|
chess |
0.374 | 0.540 |
chat |
0.439 | 0.633 |
code |
0.447 | 0.645 |
stories |
0.448 | 0.646 |
reasoning |
0.532 | 0.768 |
arithmetic |
0.618 | 0.892 |
chat_hermes |
0.720 | 1.039 |
wikipedia |
0.806 | 1.163 |
enwik9 is the first billion bytes of English Wikipedia from March 2006, the text compressors and language models are most often compared on. Published models of up to 1.6B parameters, in bits per byte:
| model | params | date | trained on | training cost ↓ | scored in | enwik9 bits/byte ↓ |
|---|---|---|---|---|---|---|
| Llama-3.2-1B | 1.23B | Sep 2024 | 9T tokens (~36 TB) | ~$0.9M | Tsai, Revisiting Data Compression with Language Modeling, Jan 2026 | 0.68 |
| Chinchilla 1B | 1B | Mar 2022 | ~$68k (est.) | Delétang et al., Language Modeling Is Compression, Sep 2023 | 0.90 | |
| GPT-2 XL | 1.56B | Feb 2019 | 40 GB, passes not published | ~$43k | measured | 1.07 |
| mini-AGI (best effort)** | 1.34B | 8 Nov 2026 | 4.6 GB | ~$81 | measured | 1.09 |
| GPT-2 Large | 0.77B | Feb 2019 | 40 GB, passes not published | ~$21k (est.) | measured | 1.12 |
| GPT-2 Medium | 0.35B | Feb 2019 | 40 GB, passes not published | ~$10k (est.) | measured | 1.17 |
| mini-AGI (dynamic evaluation)* | 1.34B | 7 Nov 2026 | 4.6 GB | ~$81 | measured | 1.18 |
| mini-AGI (frozen) | 1.34B | 7 Nov 2026 | 4.6 GB | ~$81 | measured | 1.26 |
| GPT-2 Small | 0.12B | Feb 2019 | 40 GB, passes not published | ~$3k (est.) | measured | 1.33 |
* Learning while it reads, known as dynamic evaluation: each piece is scored first and then learned from, so no byte is scored by weights that have already seen it. Read frozen, the same weights score 1.26. The learning is done on a copy of the weights, which is thrown away after the measurement, so nothing learned from enwik9 ever reaches the weights the run goes on training, or any later score. For mini-AGI this is simply how it runs: it is a continual learning model, and this is the learning it does in training and in every conversation, on the same code path and at its own rate, which its controller sets as it does in training. The frozen models above would need a separate fine-tuning loop added to be scored this way (Krause et al., 2017), so this row is closer to online compressors that learn as they compress, such as NNCP and cmix, than to the frozen rows.
** Best effort: the model used exactly as it is used in training and in conversation - every page of the slice, whole, in its native 4,096-byte window, sliding 2,048 characters at a time, learning as it goes on a copy that is thrown away afterwards, as above - every chunk scored before it is learned from, and what it learns carried into everything it reads after. This is its most natural score, but it sees more of each page at once than the 2,048-byte pieces the other mini-AGI rows, GPT-2 and Chinchilla 1B are scored on, so it is not on the same footing as them.
Date is when each model came out: Llama-3.2-1B's release, the Chinchilla paper (its weights were never released), and the GPT-2 paper (the Small weights came with it; Medium, Large and XL followed in May, Aug and Nov 2019); mini-AGI's is the day these weights were measured, as it is still training.
Trained on is how much text each model learned from, and training cost roughly what that training cost when it came out:
Bits per byte - lower is better - is how many bits a model needs, on average, to encode each byte of the text: the total -log2 of the probabilities it gave the text, divided by the text's length in bytes. The papers report a compression rate instead - compressed size ÷ original size - and bits per byte is that rate × 8:
<|endoftext|>, at full precision. Bits per byte is the total -log2 probability of the tokens ÷ the pieces' bytes, ± 0.005 for GPT-2 XL, 0.005 for GPT-2 Large, 0.005 for GPT-2 Medium, 0.006 for GPT-2 Small.<page> to </page> - each from its top in its 4,096-byte window sliding by 2,048 characters, 49.92M characters in all, every chunk scored first and then learned from at 2.1×10-6 - its base rate times the factor its training had come down to, then set by its controller as in training, from a held-out check every 10 minutes - 71 of them, ending at 1.6×10-6, so what it learns from one page carries into every page after it. Read frozen in the same windows, the same pages score 1.122, and chunk by chunk alone 1.181.These mini-AGI rows are slightly optimistic, as the note at the top of Benchmarks explains: scored the way it writes, the frozen row comes out about 0.02 bits per byte higher. The other two were not re-measured.
PG19 is a set of books from Project Gutenberg published before 1919, gathered by Rae et al., 2019 for long-range language modelling. Its test split is 100 whole books, 41 MB, and it is the set the byte-level models on the scaling chart below report their scores on. In bits per byte:
| model | params | date | trained on | training cost ↓ | context, bytes | scored in | PG19 bits/byte ↓ |
|---|---|---|---|---|---|---|---|
| MambaByte-972M | 0.97B | Jan 2024 | 75 GB of PG19 | ~$4k (est.) | 8,192 | Wang et al., MambaByte, Jan 2024 | 0.883 |
| MegaByte-758M+262M | 1.02B | May 2023 | 80 GB of PG19 | ~$1.6k (est.) | 8,192 | Yu et al., MEGABYTE, May 2023 | 1.000 |
| Transformer-320M | 0.32B | May 2023 | 80 GB of PG19 | ~$1.6k (est.) | 1,024 | Yu et al., MEGABYTE, May 2023 | 1.057 |
| PerceiverAR-248M | 0.25B | May 2023 | 80 GB of PG19 | ~$1.6k (est.) | 8,192 | Yu et al., MEGABYTE, May 2023 | 1.104 |
| mini-AGI (best effort)* | 1.34B | 9 Nov 2026 | 4.6 GB, none of it PG19 | ~$81 | 4,096 | measured | 1.557 |
| mini-AGI (frozen) | 1.34B | 8 Nov 2026 | 4.6 GB, none of it PG19 | ~$81 | 4,096 | measured | 2.010 |
The published models were trained on PG19's own training books, 75 to 80 GB of them, and are scored on more books like those. mini-AGI has never been trained on PG19 and has read no Victorian novels, so for it these books are out of its domain.
* Best effort: the model used exactly as it is used in training and in conversation - whole books, each from its top, in its native 4,096-byte window sliding 2,048 characters at a time, and learning as it reads, as in the enwik9 table above: every chunk is scored first and then learned from, on a copy of the weights that is thrown away afterwards. It reads all 100 books of the split, the frozen row's books, one after another, so what it learns from one book carries into every book after it.
Date is when each model came out: the MEGABYTE paper for the three trained there, and the MambaByte paper; mini-AGI's is the day those weights were measured, and its size the pool it had then, as it is still training and growing.
Trained on is how much text each model learned from, and training cost roughly what that training cost when it came out. Neither paper says what its training cost or what it ran on, so the published costs are best-effort estimates of what their authors paid: the training compute by the 6ND rule - 6 × the parameters each byte runs through × the bytes trained on - on A100s at 40% utilisation, as the enwik9 notes assume for Chinchilla, at what AWS charged on demand for an A100 when the papers came out: $32.77 an hour for a machine with eight, $4.10 each, the same on its pricing page in May 2023, December 2023 and April 2024. Smaller clouds rented A100s for less - Lambda for $1.10 in May 2023, about a quarter as much - so the real cost may have been lower:
Context is how many bytes each model reads at once: 1,024 for the Transformer, 8,192 for the other published models, and 4,096 for mini-AGI, the window it was built with.
Bits per byte - lower is better - is printed by both papers. Yu et al. give 1.057 for the Transformer, 1.104 for PerceiverAR and 1.000 for MegaByte, in the PG-19 column of their Table 2. Wang et al. give 0.883 for MambaByte-972M in their Table 5, where they time how fast it writes, and 0.863 for the same model scored with a sliding window; the table shows the first. MambaByte is shown by its best model only: the smaller MambaByte-353M, which Wang et al. train on the same compute per byte as MegaByte-758M+262M, scores 0.930 after 30 billion bytes (their Table 2).
mini-AGI's two rows are measured here:

Everything purple on this chart is bits-per-byte on the PG19 test split - one held-out set, so it compares directly: the diamonds are this model, the hollow circles the published byte-level models in the PG19 table above. This model scores 2.010 BPB over the whole split (100 books, 41,289,001 bytes) at a context of 4,096, against its own mixture's 0.82. PG19 is out of distribution for it: it was trained on a corpus assembled for this project and has read no Victorian novels, so much of that gap is subject matter rather than capability.
The green squares are this model on enwik9, the set the enwik9 table above compares it with published models on: Wikipedia, which it trains on, though never on these pages. It scores 1.259 BPB there after 4.58B characters. The dotted line carries it on to one pass of the corpus at the rate enwik9 itself improved at between its 9 measurements (α 0.070), where it reaches 1.21. The hollow green circle far to the right is Llama-3.2-1B, the only model in that table whose training data is published: 0.68 after about 36 TB - about 7,900 times what this model has read, scored on 2,048 tokens, about 8 KB, at a time. The rest are not drawn, because how much they read was never published.
The red line is the fitted power law on this model's own held-out, L ∝ D^-0.161 with R² 0.94 over every point past the warmup - between Kaplan's 0.095 and Chinchilla's 0.28, and it has held for more than a decade of data. How steep it looks depends on where the fit starts, and the band on the chart spans that range.
Read straight off that trend, on this model's own mixture. It has read 7.60B characters so far, in about 63 days of running. The days below assume the pace of the last 4 days of it: 1,671 characters a second on the wall clock, held-out checks and rounds of samples included, because the reading waits for them.
| held-out | total data read | further reading | days from here at ~1,671 char/s |
|---|---|---|---|
| 0.78 BPB | 8.04B | +0.43B | ~3 |
The right panel shows which subjects are still moving. chat, code, reasoning, stories are the steep ones; arithmetic and wikipedia have the shallowest slopes.
Every mini-AGI row of the enwik9 and PG19 tables, and the scaling chart, comes from one script, which measures whatever model is in weights/ - the undertrained snapshot above, say, or one you trained yourself:
python3 -m corpora enwik9 # the 50 MB enwik9 slice, checked against the one measured here
python3 -m corpora pg19 # PG19's 100 test books
./measure_benchmarks.sh # about a day on an RTX 3070 Laptop GPU
It needs the GPU to itself, so stop any training run first. Every measurement that learns also runs the learning rate's controller exactly as training does - the controller is part of the model, and sets how fast it adapts - so it reads the held-out set in data/val, which python3 -m corpora all builds along with the corpus; without it the rate stays where the run left it. Every measurement that learns does it on a copy of the weights that is deleted afterwards, so weights/ is never changed, and the script then rewrites this README's tables and chart with what it measured. The GPT-2 rows of the enwik9 table were measured on the same pieces by tools/measure_enwik9_gpt2.py.
NVIDIA and AMD GPUs both run it, and so does a CPU on its own. Speeds at the settings this repository trains with - a 4,096-character window, read 2,048 characters at a time, 32 experts on the card:
| Hardware | Computes in | Reading | Writing | VRAM used |
|---|---|---|---|---|
| NVIDIA RTX 3070 Laptop, 8 GB | bf16 | 2,042 char/s | 28.4 char/s | 5.1 GiB |
| AMD Radeon RX 6800 XT, 16 GB | fp32 (its default) | 1,388 char/s | 34.7 char/s | 10.1 GiB |
| AMD Radeon RX 6800 XT, 16 GB | bf16 | 301 char/s | 15.1 char/s | 7.1 GiB |
| AMD Ryzen 9 9900X, CPU only | bf16 | 186 char/s | 27.6 char/s | - |
Reading is learning: characters trained on per second. Writing is a reply being generated. The speeds were measured on early snapshots of the weights, with 127-133 experts. Only 32 experts are on the card at a time, so the size of the pool barely changes how much VRAM the model needs. Measured again on 18 Nov 2026 with 425 experts, it reads about 1,860 characters a second on the 3070 and writes about 25. It never used more than 4.5 GiB of VRAM, so any NVIDIA card from the RTX 30 series on with 6 GB is enough. More on this in Fitting it to your hardware.
MINAGI_GPU_BF16=1 chooses it, to leave memory for something else. PyTorch ships no fused attention kernels for these cards, so attention is computed in blocks - without the memory blow-up of PyTorch's own fallback.python3 tools/device_check.py measures what a particular machine does with the model: which attention kernels it has, bf16 against fp32, and one learning step.
The model isn't tied to the machine it was trained on. Its experts are ordinary files in weights/, and three settings in config.yaml decide how much of your hardware it uses:
pool.resident (default 32): how many experts sit on the GPU. It is also the most experts one forward pass can use.pool.ram_cache (default 384): how many experts are kept in RAM, so they don't have to be read from disk.growth.max_disk_gb (default 10): how large the pool may grow on disk.To move the model to a better machine, copy weights/ over, adjust these three settings to the new hardware and start the run. Nothing needs converting and no code changes. The same works on the machine you already have: stop the run (it saves when it stops), edit config.yaml and start it again, since the settings are read at start-up. The learning-rate controller measures the small jump in held-out loss that a restart causes and leaves it out, so a changed setting doesn't throw it off.

GPU. With the default 32 experts on the card, the model never used more than 4.5 GiB of VRAM, even with every step at full depth over the full 4,096-character window. With PyTorch capped as it would be on a 6 GB card, it still ran fine. So any NVIDIA card from the RTX 30 series on with 6 GB or more runs the defaults as they are. Each extra expert on the card costs about 52 MiB, and on an 8 GB card 64 of them fit (6.1 GiB). More experts per forward pass means more characters get the experts they asked for instead of a substitute. It is not faster, though: at 64 the model read about a third slower (1,240 characters a second instead of 1,890), because it loads and trains more experts at every step. Whether 64 learns more per character than 32 hasn't been measured yet.
RAM. An expert takes about 19 MB of RAM, so the default 384 is about 7.3 GB.
Disk. At 19 MB an expert, the default 10 GB holds about 529 experts, and the pool is at 425 now. With a bigger disk, raise max_disk_gb and the model keeps growing new experts whenever it runs short.
git clone <repository-url>
cd mini-AGI
pip install torch numpy pyyaml matplotlib # the model, and its graphs
pip install flask # serve.py
pip install chess zstandard datasets # building corpora
pip install scipy # a few of the analysis tools
PyTorch has to match your CUDA version, or be the ROCm build on an AMD card - see the PyTorch install page. The reference environment is torch 2.6.0+cu124 with numpy 1.24.4. Only the first line is needed to train.python3 -m corpora all # all eight subjects, a few GB
python3 -m corpora all --limit 5000 # a small slice first, to try it
python3 -m corpora all --full # entire datasets: tens of GB, hours
Lanes already on disk are left alone, so an interrupted build can simply be run again. Individual lanes are available too - python3 -m corpora lists them - or skip this entirely and point the model at your own files.config.yaml the first time, so there is nothing to set up:python3 train.py read data/train --save --weights-dir weights \
--held-out data/val --sample-every 10
python3 serve.py --port 8080 # then open http://127.0.0.1:8080
The run writes a sample log, redraws its graphs as it goes, and checkpoints every few minutes. It is meant to be left alone for days.
python3 -m minagi.store weights # what the model is right now
python3 -m corpora # every corpus target
python3 -m corpora all --only wikipedia stories # rebuild particular lanes
python3 -m corpora expand # .bin -> the text files read
python3 train.py read --help # every knob the reader has
python3 train.py stream --steps 140000 --lr 2e-4 # the packed-corpus path
python3 train.py ponder-probe --ckpt weights # depth against difficulty
Every tool takes --ckpt weights - the directory is the model, and there are no .pt files to keep track of.
A fresh model starts small and grows into its shape. The context window begins at model.context_start and extends one character at a time, but only when the model is still getting something out of the far end of the window it already has. The expert pool begins at pool.experts and grows from there.
This means the first hours of a run look nothing like the rest of it. Loss falls fast, the pool churns, the window is short, and the learning-rate controller has not gathered enough evaluations to act. None of that is a problem to fix.
Nothing rolls back on its own. A run saves to weights/ every five minutes, at every held-out check and when it stops, so even a crash costs at most a few minutes of reading. To keep an earlier state, copy the directory.
minagi/ the model. no command lines here.
config.py reading config.yaml, which building and training both use
precision.py what the model computes in, and how moments are stored
tokenizer.py bytes in, bytes out - 256 values plus structural markers
model.py the transformer: RMSNorm, rotary positions, SwiGLU, flash attention
decode.py how a character is chosen, without a random number generator
ingest.py turning a pile of files into something to read
pool.py the expert pool, and the rules by which it grows and shrinks
paged.py the same pool spread over disk, RAM and VRAM
recur.py latent recurrence with adaptive depth
stream.py reading a corpus behind a KV cache, one chunk at a time
lanes.py how the reading is shared between subjects
store.py the weights directory, which IS the model
optim.py how much of a gradient is signal
muon.py the optimiser: Muon for weight matrices, AdamW for the rest
plasticity.py the learning rate, governed by held-out loss
governor.py the same controller, wherever the model learns
heldout.py the level a held-out check reports at
live.py serving a model that is being trained underneath
report.py the model reading statistics off its own weights
create.py writing a fresh weights directory from config.yaml
train.py read | stream | ponder-probe
serve.py local web UI
config.yaml the settings worth changing
corpora/ python3 -m corpora all - the whole corpus, downloaded and made
memory/ the project's history, kept for agents
weights/ one file per expert. this directory is the model.
weights/ is written on the first run and data/ by corpora; neither is in
the repository. Everything else above is.
memory/ is the project's history: every change, the tests that were run and what
they found, what worked and what did not, and the corrections made to how the run
was measured while it trained. It is kept mostly to preserve that history, for an
agent picking the project up at any point, so it is written for an agent to read
rather than for a person.
weights/
manifest.json what exists, its shape, and where it came from
core.npz embeddings, attention, norms, adapter, halting head
routers.npz the gate, and the router: one row per expert per site
optim.npz the optimiser's state for the trunk and the routers
experts/ one file per expert: w1, w3, w2 and its own optimiser state
e00000.npz ...
Training resumes from it - weights, optimiser state and step count - and saves into it every five minutes and at every held-out check, so the directory is the model as it last stood. Writes are atomic: every file is written to a .tmp and renamed, so an interrupted save cannot leave a half-written weight behind.
The directory is written on the first run.
Byte level - vocabulary 265: the 256 byte values plus 9 structural markers (<think>…</think> scratchpad, <user>/<bot> turns, <g> for games, and end-of-text). Context 4,096.
| body | RMSNorm, RoPE, SwiGLU, flash attention via scaled_dot_product_attention |
| depth | 3 distinct blocks, up to 26 block-applications per character |
| recurrence | one weight-shared block applied up to 24 times; the latent is never decoded |
| halting | PonderNet - each character halts independently, so hard ones get more depth |
| routing | top-8 experts per block-application, chosen per character |
| paging | 32 experts resident on the card; the rest live on disk |
The parameter count moves, because the pool grows and prunes itself while training. python3 -m minagi.store weights prints what it is now. At step 3,713,481:
core 8.27M embeddings, attention, norms, adapter, halting head
routers 0.22M one row per expert at each call site, depth embedding, gates
experts 1333.8M 424 x 3.15M each (3 x 512 x 2048)
----------------------
total 1342.3M
VRAM is set by the card's 32 slots, not by the pool. Only 32 experts are resident at a time - about 109M parameters of the 1342M - which is why the pool can keep growing on an 8 GB card. Per byte the model activates about 345M parameters - two prelude blocks, then attention and top-8 of the resident experts on each recurrent step, counted at the 12.8 steps training samples its depth around (a character may take up to 24) - so by the 6ND rule it costs the same per byte as a dense 345M byte-level transformer, not a 1342M one. That is the figure the scaling chart in Benchmarks is drawn against.
This project was assisted by "Claude Opus" 5 and 5.5 models. The model did implemented most of code of this project, verified and debugged it when it was necessary. The model was searching for published papers related to the problems that the project were trying to solve, build tests and experiments, and help with brainstorming the complex problems that arose along the way. The animations, graphs and other media you see here are all done by Claude as well form the real data traces. While I myself provided main ideas, steering, intuition, rejections when thing went in a wrong direction, code monitoring and verification, as well as decisions and strong opinions of how everything should be wired together and work in principle. Documentation was written in tandem.
Everyone is welcome to contribute to this project in whatever way suits them, with or without AI. I only ask that you show you care about what you contribute enough by writing the PR description yourself first, in your own words, and only then add AI-written technical details if they are needed. I want to see your intent and what you are trying to achieve. As the maintainer, I reserve the right to decline a contribution, including when I cannot understand what you are trying to do or I do not think the contribution fits the project. Obviously, ill intended PRs are going to be refused as well. For anything large, please open a discussion first, so we can agree on the direction before you put the work in. Big PRs without a clear justifications for a large changes are going to be refused as well.
You are always welcome to fork the project, and that may even be the better way to adapt it to your own needs. I keep an eye on active forks, and when one has an idea worth borrowing, this project may adopt it, with credit, even without a direct merge, creating some sort of soft cross-pollination.
PyTorch does the arithmetic, NumPy holds the weights on disk, and Matplotlib draws every graph.
The parts the model is built out of:
Outrageously Large Neural Networks: The Sparsely-Gated Mixture-of-Experts Layer - Shazeer et al., 2017. The entire expert pool, and the load-balancing auxiliary loss.
Switch Transformers - Fedus et al., 2021. The capacity-based batched dispatch, which is what lets the pool run as three matrix multiplies.
PonderNet: Learning to Ponder - Banino et al., 2021. The adaptive depth mechanism.
RoFormer: Rotary Position Embedding - Su et al., 2021. Why the context window can grow by continued training.
GLU Variants Improve Transformer - Shazeer, 2020. SwiGLU.
Root Mean Square Layer Normalization - Zhang & Sennrich, 2019.
FlashAttention - Dao et al., 2022. Reached through PyTorch's scaled_dot_product_attention.
Decoupled Weight Decay Regularization - Loshchilov & Hutter, 2017. AdamW.
Training Deep Nets with Sublinear Memory Cost - Chen et al., 2016. Gradient checkpointing, which on 8 GB is not optional.
Block-Recurrent Transformers - Hutchins et al., 2022. Carrying a recurrent state across blocks.
ZeRO-Offload - Ren et al., 2021, and ZeRO-Infinity - Rajbhandari et al., 2021. Training a model larger than the GPU's memory, by offloading to CPU memory and disk.
Dynamic Mixture of Experts Against Severe Distribution Shifts - Kim et al., 2025. Adds experts to a mixture of experts while it trains, which is how this model's pool grows.
Training Compute-Optimal Large Language Models - Hoffmann et al., 2022. Chinchilla: the compute-optimal balance of parameters and training data.
The Pile - Gao et al., 2020. Bits per UTF-8 byte, chosen there for invariance to tokenisation.
Transformer-XL - Dai et al., 2019, and Compressive Transformers - Rae et al., 2019. The character-level benchmarks to aim at.
An Empirical Model of Large-Batch Training - McCandlish et al., 2018. The gradient noise scale.
The AdEMAMix Optimizer - Pagliardini et al., 2024. Tried as the trunk's optimiser; at the paper's settings AdamW did better here, so it was removed.
A Contrastive Framework for Neural Text Generation — Su et al., 2022. Contrastive search, implemented as an alternative decoder. The default path does not use it, but the idea that degeneration is a property of the decoding rule rather than of the weights is what led to the adaptation trace that replaced it.
Muon — Keller Jordan, 2024. Orthogonalised momentum. The run's optimiser for every weight matrix since 3.19B characters, applied as in Muon is Scalable for LLM Training (Liu et al., 2025): from the same weights and 30M characters of the same text, it ended 0.0039 nats lower on held-out than AdamW.
TinyLlama: An Open-Source Small Language Model — Zhang et al., 2024. 1.1B parameters on three trillion tokens, sixteen A100s for ninety days. The closest published analogue to a small team training a small model from scratch.
MEGABYTE: Predicting Million-byte Sequences with Multiscale Transformers — Yu et al., 2023. 1.000 bits per byte on PG19 after reading 80 billion bytes, and one of the published byte-level points on the scaling chart.
MambaByte: Token-free Selective State Space Model — Wang et al., 2024. 0.883 bits per byte on PG19 from its 972M model, after 75 billion bytes - the best of the published points on the chart.
General-purpose, long-context autoregressive modeling with Perceiver AR — Hawthorne et al., 2022. 1.104 bits per byte on PG19, the third published point.
Gemma 3 Technical Report — Gemma Team, 2025. The 1B model reads two trillion tokens and holds a 32k context.
SmolLM2: When Smol Goes Big — Allal et al., 2025. 1.7B on eleven trillion tokens, with a detailed account of the data work.
Pythia: A Suite for Analyzing Large Language Models Across Training and Scaling — Biderman et al., 2023. Publishes the GPU-hours per model size: 4,830 A100-hours for the 1B.
Llama 3.2 model card — Meta, 2024. 370k H100-hours for the 1B, though it is pruned and distilled from larger models rather than trained from scratch, so it is not a like-for-like number.
Qwen3.5-0.8B — Qwen Team, 2026. Smaller than this model and holds a 262k context, by making three quarters of its layers linear-attention.
Transformer-XL: Attentive Language Models Beyond a Fixed-Length Context — Dai et al., 2019. 0.99 bits per character on enwik8 and 1.08 on text8, from 277M parameters.
Compressive Transformers for Long-Range Sequence Modelling — Rae et al., 2019. 0.97 on enwik8; the next marker after Transformer-XL. It is also the paper that introduced PG19, the out-of-distribution test used here.
Transformer Math 101 — Anthony, Biderman & Schoelkopf, 2023. C = 6ND, and the bytes-per-parameter arithmetic that says what a training checkpoint must weigh.
The Smol Training Playbook — Hugging Face, 2025. Reports 161,280 GPU-hours of ablations against 276,480 for the main run.
lm-evaluation-harness — EleutherAI. The standard suite, not used here yet: at this scale HellaSwag, ARC and the rest score at chance.
Why Does the Effective Context Length of LLMs Fall Short? — An et al., 2024. Models use less of their context than they are given, which is why the 4,096-character window here is reported as a setting rather than as a capability.
The corpus: TinyStories, OpenHermes-2.5, OpenThoughts-114k and the Lichess open database. Wikipedia and the source-code portion come from public dumps and public repositories.
Infinite test-time scaling | Talk at MIT - mostly about prefix-sliding approach for "infinite" context. While interesting, I am pretty sure it is vastly inferior to "context with full attention for immediate memory + carry latent for short-term memory (basically LSTM) + weights update for long-term memory" approach.
SGD for batch-1 training - proposal for using SGD for batch-1 training, as it might be just as affective as AdamW at this bach size. This will allow to cut VRAM utilization almost in half giving spare memory for something else. Definitely going to be tested in the future.
If you use this project in your research or work, please cite it as:
@software{Borsky_mini_AGI_2026,
author = {Borsky, Alexey},
month = {9},
title = {{mini-AGI: A Continually Learning Byte-Level Language Model}},
url = {https://github.com/volotat/mini-AGI},
version = {1.0.0},
year = {2026}
}