Lyra is a 326M-parameter language model trained on one RTX 3060 Ti, with a ledger of the nine bugs along the way
A from-scratch transformer trained on 6.4 billion tokens in about a week on an 8 GB card. The most useful file in the repo is the list of what went wrong.
Lyra-326M is a decoder-only transformer that luka0x12 pretrained from scratch on 6.4 billion tokens using a single RTX 3060 Ti with 8 GB of memory. Plenty of people train small models. Fewer write down every mistake, and this repo’s architecture notes include a numbered list of nine.
How it works
The model has 24 layers at width 1,024, 16 attention heads, a 1,024-token context and a 16,384-entry SentencePiece vocabulary. That comes to 326,160,384 parameters with the output head tied to the input embeddings.
Fitting that on 8 GB took some care. Training ran in bf16 with fp32 master weights and activation checkpointing. Each optimizer step accumulated 8 passes of 4 sequences, or 32,768 tokens, for 195,312 steps. The data was 70 percent FineWeb-Edu, 20 percent Cosmopedia v2 and 10 percent Python-Edu. The author reports about 10,000 tokens per second, roughly 178 hours of pretraining and about 57 kWh of electricity.
A second stage fine-tuned on about 78,000 chat examples, with the loss counted only on the assistant’s tokens.
The ledger
The architecture notes list the bugs. A few are worth knowing before your own run.
The dashboard showed a loss of about 35 while validation sat near 4.4. The model was fine. The display summed eight losses per step and divided by one.
The only checkpoint was saved when validation improved. During a flat stretch it went stale, and a resume loaded it and threw away about 10 hours of work. The fix was a second checkpoint that always saves.
Tokenizing into Python lists cost about 36 bytes per integer and crashed a 32 GB machine at 645 million tokens. Writing int32 chunks straight to disk fixed it.
Validation drew new random windows every time, so the number moved even when the model did not. Fixing the seeds made it comparable.
Others include a compile mode that broke under gradient accumulation, a checkpoint that ended up on the GPU twice, and chat markers that were quietly tokenized as plain text.
What we do not know
The README reports a final validation loss of 2.32 nats and nothing else. There is no benchmark and no comparison with any other model, so the repo tells you how the model was built, not how good it is. The README also notes that at 1.5 billion tokens the base model put the capital of France in Luxembourg, which it describes as an expected stage of training.
Try it yourself
The code is Apache 2.0. The README says base and instruct weights are on Hugging Face under CC BY-NC 4.0, non-commercial because of the chat data used, and that running them needs PyTorch, sentencepiece, safetensors and numpy. Hugging Face was unreachable from our build machine, so we have not seen the weight files.
We have not run the model or the training code. This is based on the README and the architecture notes.