luka0x12

Lyra: Train and Run a 326M Decoder-Only Transformer

Lyra-326M is a decoder-only Transformer trained from scratch on 6.4B tokens, with pretraining, fine-tuning, and terminal inference code. It suits people studying or adapting small language models, but its instruct weights are non-commercial and the project is very new.

NewPythonApache-2.0LLMMachine LearningTerminal
View on GitHub Compare
Stars
560
Forks
61
Last commit
today
Contributors
2
Releases, 12 months
0

Our take

Newless than six months old

Health score

34/100

How it is scored
Activity
34
Community
37
Issues
21
Pull requests
42
  • Fewer contributors than 85% of the projects we track

Lyra is a useful learning and experimentation project, but its newness and concentrated maintenance make it a poor choice for production reliance.

Good fit if

  • You want to inspect or adapt a complete small-model training and SFT pipeline.
  • You can use the instruct weights for non-commercial purposes under their CC-BY-NC-4.0 license.
  • You are comfortable with a very new project whose recent activity comes mostly from one contributor.

Look elsewhere if

  • You need a mature project with a release history, CI, or an established test suite.
  • You need commercially usable instruct weights.
  • You need a supported production inference service rather than a terminal chat tool and model code.
All health signals
Last commit2026-12-03 (today)
Commits, last 90 days12
Releases, last 12 months0
Contributors2 (top contributor: 58% of commits)
Issues closed, last 90 days0
Pull requests merged, last 90 days1
Project age1 days

Checked on 2026-12-04 with the GitHub API.

Overview

Lyra is a 326M-parameter decoder-only Transformer trained from scratch on 6.4B tokens. The repository provides the pipeline for streaming data, pretraining, supervised fine-tuning, and chatting with the resulting models in a terminal. The project reports training on a single NVIDIA RTX 3060 Ti, while users can download the base or instruct weights from Hugging Face rather than train their own.

Its value is as a compact, end-to-end example of building and running a language model under limited hardware constraints. It is aimed at learners and experimenters who want to inspect the training process, not teams seeking a mature, broadly supported inference service.

Key Features

  • Custom decoder-only GPT architecture with RMSNorm, SwiGLU, QK-norm, and residual scaling.
  • Streaming pretraining data builder with crash-safe handling and zero-copy memory mapping.
  • Pretraining loop with a terminal dashboard and VRAM management.
  • SFT data preparation and training, including assistant-only loss masking and length-bucketed batches.
  • Terminal chat interface with live context gauges, plus one-shot text generation for the base model.
  • Export tooling for safetensors and a technical architecture write-up with a failure ledger.

Use Cases

  • A student or hobbyist can study how a small decoder-only model is trained and fine-tuned from scratch.
  • A researcher can use the code as a starting point for experiments with data mixtures, model architecture, or SFT.
  • A developer with compatible hardware can try the downloadable instruct model through the included terminal chat interface.
  • An educator can demonstrate practical training constraints and debugging lessons from a single-GPU project.

What you need

Detected in the repository

  • Python (main language on GitHub)

License in plain words

Apache-2.0permissive

  • Commercial use: yes
  • Modify and redistribute: yes
  • You must keep: the license, the NOTICE file and a note of your changes
  • Share your changes: no
  • Includes an explicit patent grant from the contributors:

A summary, not legal advice: the LICENSE file is what applies.

Getting Started

To use the instruct model, follow the repository's Hugging Face-based setup:

git clone https://huggingface.co/luka0x12/Lyra-326M-Instruct
cd Lyra-326M-Instruct
pip install torch sentencepiece safetensors numpy
python chat.py

See the GitHub repository for training details and documentation.

Alternatives

  • Qwen3: Qwen3 offers open-weight models for inference and fine-tuning rather than a small model training-from-scratch project.
  • Qwen: Qwen provides pretrained model checkpoints and workflows for inference and adaptation, rather than Lyra’s from-scratch training focus.
ProjectLanguageLicenseStarsStatus
LyraPythonApache-2.0560New
Qwen3Python–27.7kQuiet
QwenPythonApache-2.021.9kQuiet

Considerations

The project is less than six months old and has no releases yet. Recent commits show active development, but only two contributors are recorded and most contributions come from one person; issue closure data is not yet available. The repository also reports no CI or tests, so adopters should validate changes and behavior themselves.

Training was performed on an RTX 3060 Ti with 8 GB of VRAM and took about 180 hours. The README's local-use instructions focus on downloading weights, but do not specify a general hardware requirement for inference. Licensing differs by artifact: code is Apache-2.0, the custom identity dataset is CC0, and the weights are CC-BY-NC-4.0. The README says the SFT mixture includes datasets with non-commercial restrictions, so the final weights are not suitable for commercial products.

Found this useful?

Share it with someone who would like Lyra.