Find your next open-source project

Search by name, purpose, or keyword, or paste a GitHub URL. Start with / to search agent skills (e.g. /pdf)

A 326M-parameter decoder-only Transformer trained from scratch on one 8 GB GPU, with full pretraining, SFT, and chat code.

1,190
124
Python
Apache-2.0
1 day old
+1,022 stars in 24h

Project Overview

Lyra-326M is a 326M-parameter decoder-only Transformer trained from scratch on 6.4B tokens using a single RTX 3060 Ti (8 GB VRAM). The repository is a full training and inference pipeline, not just a model card: it contains the custom GPT architecture, a streaming data builder, the pretraining loop, the SFT loop, export tooling, and a terminal chat interface (Lyra repository).

The base model was pretrained for 195,312 steps on FineWeb-Edu (70%), Cosmopedia v2 (20%), and Python-Edu (10%), reaching a validation loss of 2.32 nats (perplexity 10.19). A supervised fine-tuning stage (~78k examples) taught question answering, refusals, and shorter responses. The author reports ~180 hours of wall-clock time and ~57 kWh on one consumer GPU.

It suits people who want a small, end-to-end LLM training codebase to study or adapt, and users who just want to run a compact instruct model locally. A detailed architecture writeup and a ledger of nine bugs encountered during the build are in docs/architecture.md.

Quick Start

The README's local path does not train the model; it downloads the instruct weights and runs chat. The supplied commands are:

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

Note that this clones the Hugging Face model repository, not the GitHub code repository, so the code files under Lyra/ (including chat.py) are not part of that clone unless the model repo also includes them. To use the GitHub implementation, clone the GitHub repository, place the downloaded weights from Lyra-326M-Instruct or Lyra-326M-base where the scripts expect them, install the same dependencies, and run python chat.py from the code checkout. The base model can instead be exercised with generate.py or pretrain_test.py.

The scripts are Python and target a PyTorch environment; training is hardware-bound, while chat is the lightweight path.

Constraints and Licensing

The code is Apache-2.0, but the model weights are CC-BY-NC-4.0 because the SFT mixture includes DailyDialog (CC BY-NC-SA 4.0) and non-commercial Tulu-3 subsets. Commercial use of the weights is therefore not permitted. The custom 1,000-example lyra_sft.jsonl identity dataset is released under CC0. Running training requires an 8 GB-class GPU and substantial time; the reported pretraining run took about 180 hours on one RTX 3060 Ti, so reproducing it is a multi-day effort. The repository does not specify full dependency versions or a Windows/Linux support matrix.

HotRepo's Take

The project appeared in HotRepo's new-project snapshot for 2026-12-03 with 103 stars gained and 13 forks, plus a small Show HN thread (3 points, 1 comment) where a commenter compared it to Hugging Face's Smol models (HN discussion, comparison comment). There is no GitHub daily-rank record yet, and the growth data covers a single observation window, so it is too early to read a trend from it. What stands out is the unusually complete pipeline for a consumer-GPU training project: architecture, data streaming, pretraining, SFT, and export code are all in one small repository, with a failure ledger that documents concrete training-pipeline bugs rather than only the final loss numbers.

Written by AI from the project's public information and HotRepo's records, updated . The project's own docs are the source of truth.

Hacker News

Show HN: I trained a 326M language model from scratch on one RTX 3060 Ti
▲ 3 · 2 comments · December 2, 2026

You might also like

  1. jingyaogong/minimindAn open-source, from-scratch PyTorch LLM training pipeline with a ~64M model and full pretrain-to-RL stages for learners on a single GPU.Python65,623
  2. logitcai/tinybrainA from-scratch Chinese-first small language model project with an open dataset, tokenizer and full pretraining-to-RL pipeline in PyTorch.Python137
  3. Ssbullock/pcb-layout-llmA fine-tuned 32B model that plans PCB grouping and routing strategy for KiCad boards before placement and routing.Python104
  4. n4ze3m/tiny-vocaA tiny English text-to-speech model with two voices that runs on CPU or in the browser.Python790
  5. Betelgeuse-AI/BetelgeuseA C++/CUDA llama.cpp fork that streams MoE experts from NVMe to run large models on a 12 GB RTX 3060.C++111