mrkeyoor.com_
Thu 05 Nov 00:01 UTC
LLM Toolsevaluationupdated 26 Oct 2026

train-llm-from-scratch review

Train LLM From Scratch is an educational PyTorch repository for following a language model from pretraining through supervised fine-tuning, reward modeling, DPO, PPO and GRPO. The current README documents both a classic Transformer and a modern architecture, plus a laptop CPU track with its own BPE tokenizer. Our recorded execution covers an older commit, not those newer additions.

+155stars / 7d
Verdict

Train LLM From Scratch is worth considering for learning how a shared model backbone supports different training objectives. CPU-only readers now have a documented starting path, so a GPU is no longer a blanket entry requirement. Our 20 September 2026 run at b995104 recorded a successful install and pytest output reporting 17 passes, but it predates the laptop track and the reported checkpoint fix. Start with the current tiny track or smoke configuration, measure it locally, and verify checkpoint reloads before committing to a larger training run.

We ran it

Lab card: what happened when we ran train-llm-from-scratchScreenshot of train-llm-from-scratch (fareedkhan-dev.github.io/train-llm-from-scratch)
Install✓ · 111s150 packages · 8363 MB
Build✓ · 1s
Tests✓ · 42s17 passed · 0 failed of 17 (pytest)
Known vulns0(pip-audit)
Repo186 files~6,998 lines of source · 6.7 MB · 1 CI workflows · tests dir

Answers from our run

Does train-llm-from-scratch build from source?

Dependencies installed in 111 seconds (150 packages), and the build succeeded in 1 seconds. We cloned commit b995104 into a clean Debian container with 3 CPUs and no project-specific setup.

Do train-llm-from-scratch's tests pass?

Yes. The project's own test command finished in 42 seconds and reported 17 passed, 0 failed (pytest).

Does train-llm-from-scratch have known vulnerabilities in its dependencies?

pip-audit found none in the dependency tree at the time of our run.

Who should not use train-llm-from-scratch?

Readers expecting a verified recipe for training a competitive commercial assistant: our recorded run does not establish model quality or large-scale training performance.

What are the alternatives to train-llm-from-scratch?

nanoGPT, LLMs from Scratch. Train LLM From Scratch is worth considering for learning how a shared model backbone supports different training objectives.

Setup3/5The September 2026 install succeeded; the current README documents a CPU route, whose installation footprint and training behavior we have not measured.
Docs4/5The supplied README explains prerequisites, staged objectives, file locations and configuration paths. Its full instructions were not independently executed.
Community2/5Issues 36 and 38 show maintainer responses and closure on 2 October 2026. Adoption and typical support responsiveness remain unmeasured.
Maturity3/5The older pytest output reports 17 passes, and the maintainer reports a later checkpoint fix. Current distributed training and model quality remain unverified.

Who it’s for

Students with basic object-oriented programming, neural-network and PyTorch knowledge who want to connect model code with training objectives.
Developers who want to read educational implementations of pretraining and post-training in one repository.
Laptop users willing to try the current README's tiny CPU track and measure its behavior on their own hardware.
GPU users prepared to manage larger datasets, training configurations and checkpoints.

Who it’s NOT for

Readers expecting a verified recipe for training a competitive commercial assistant: our recorded run does not establish model quality or large-scale training performance.
Beginners seeking an introduction to Python before working with neural networks.
Users expecting every configuration to fit on a laptop: the README distinguishes the tiny CPU track from larger GPU models.
Teams requiring independently validated current distributed-training and checkpoint behavior. Our older run does not verify the subsequent checkpoint fix.

Setup reality

In our recorded run on 20 September 2026 at commit b995104cff1dd488cdcc1517bc284649d9252d88, the install step succeeded in about 111 seconds. The recorded dependency footprint was 150 packages and 8,363 MB. These are historical environment measurements, not minimum requirements for the current CPU track.

The harness marked its build step successful after 781 ms, rounded to 1 second. Its stored build output is empty, so this does not establish a particular artifact or installed command. The pytest step took 41.507 seconds, rounded to 42 seconds; pytest's own output reported "17 passed in 38.66s". The retained summary records zero failures, skips and errors. Complete-log reconciliation and exhaustive unique test coverage were not verified.

The recorded sandbox had 3 CPUs and 8 GB of RAM, using ghcr.io/astral-sh/uv:python3.12-bookworm. The install output identifies Python 3.12.12. The pip-audit record has an advisory total of 0, but its scanned-package coverage is unknown. This is not proof of security.

For current setup, the README documents an editable install and optional training, UI and documentation extras. On Linux without an NVIDIA GPU, it recommends installing the CPU PyTorch wheel first because the default Linux wheel bundles CUDA. It also documents separate legacy Python configuration and newer JSON configuration paths. We have not measured the current CPU installation's size or executed its laptop training path.

A laptop starting point, with older execution evidence

Train LLM From Scratch now documents a CPU route from raw text to a small story-generating model. That changes who can start the course. It does not turn our older sandbox results into a test of the current route.

The repository's main teaching thread remains useful: follow a Transformer through pretraining, supervised fine-tuning, reward modeling, preference optimization and reinforcement learning. The README links explanations to source files and describes reusing the backbone while changing the data, losses and attached heads. Choose it if you want to understand those connections in PyTorch and already know the prerequisites.

What the current README offers

The laptop section describes a 369K-parameter modern model trained on TinyStories with a 4,096-token BPE tokenizer implemented in the repository. The author reports about ten minutes for the overall path and about five minutes for training on a laptop CPU. Those are upstream reports, not timings from our sandbox, and the supplied extract does not specify the laptop hardware.

The larger data paths still use OpenAI's tiktoken with r50k_base. The laptop path trains its own tokenizer, so it is inaccurate to describe the whole repository as relying exclusively on an external tokenizer. PyTorch still supplies the underlying tensor and differentiation machinery.

The current README also describes a modern model with rotary positions, RMSNorm, SwiGLU, grouped-query or latent attention, an optional mixture of experts and a KV cache. Its documented classic configurations include approximately 13M, 77M and 406M parameters. These are configuration examples, not the smallest models now available. Larger training runs still require hardware planning; the README's CPU starting point does not establish that its GPU configurations fit on a laptop.

What our recorded run establishes

Our run took place on 20 September 2026 at commit b995104cff1dd488cdcc1517bc284649d9252d88, whose recorded commit date is 17 August 2026. The sandbox configuration was 3 CPUs and 8 GB of RAM with the Python 3.12 Bookworm image; the install output identifies Python 3.12.12.

The install step succeeded in 111.447 seconds. The dependency record lists 150 packages and an 8,363 MB footprint. The harness marked the build step successful in 781 ms, but retained no build output. That status alone does not prove that a particular package artifact or installed CLI was checked.

The pytest step completed in 41.507 seconds. Its output reported "17 passed in 38.66s"; the harness rounds the step duration to 42 seconds. These are different timing scopes. The parser summary records 17 passed and zero failed, skipped or errored tests, but the retained record does not establish exhaustive unique coverage or which workloads each test exercised.

The checkout record lists 186 files, approximately 6,998 source lines and 6.7 MB of repository data. These counts describe that checkout. They should not be used as current repository totals.

The pip-audit record reports an advisory total of 0. Scanned-package coverage is unknown, and the dependency count cannot fill that gap. No model-quality evaluation, full training workload, installed-binary check or current CPU-track benchmark is established by this record.

Two reported problems have since been closed

Issue 38 requested a CPU-friendly learning path. The maintainer closed it as completed in #42 on 2 October 2026 and pointed to the laptop track, larger student presets, a local benchmark script and the student guide. The current README describes that track. CPU-only readers should therefore no longer be excluded from the audience.

Issue 36 reported checkpoint-key mismatches involving torch.compile and DDP prefixes. It was also closed as completed in #42 on 2 October 2026. The maintainer says checkpoints are now saved from the unwrapped model, older nested prefixes load, and missing parameters cause an error. The comment also names a compiled-model checkpoint test. These are upstream implementation and verification claims; our September run does not validate the fix.

For a training project, checking checkpoint reloads under your intended settings remains a useful next step. Save a small run, reload it in a fresh process and check that the expected parameters and output are preserved before spending more compute.

How to choose a learning route

Use this repository when the connection between pretraining and post-training is the reason you are reading. Start with the documented laptop track if you lack a GPU, or a smoke configuration when checking a stage. Treat the author's training times as reference points and measure your own machine before selecting a larger preset.

LLMs from Scratch offers a different teaching structure: it is the official companion to Sebastian Raschka's book, with chapter code and exercises. Its README says the main chapters run on conventional laptops. Choose it when that guided sequence suits you better.

nanoGPT remains relevant as a compact historical GPT implementation, but its README's November 2025 notice calls it deprecated and points readers toward nanochat. Its older claims of active development should not override that notice.

How the ratings work

These are editorial assessments of the supplied evidence, not benchmarks. The scale is 1 for substantial documented obstacles, 2 for limited evidence or unresolved suitability, 3 for a usable path with material qualifications, 4 for strong documented support within the review's scope, and 5 for comprehensive support corroborated by execution within that scope. Missing evidence lowers confidence; it does not prove a product defect.

Setup receives 3/5 because the older installation succeeded and the current README supplies a CPU route, while current installation size and training behavior remain unmeasured. Documentation receives 4/5 for its prerequisites, staged explanations, file references and distinct setup paths; we have not executed all its instructions. Community receives 2/5 because the supplied issues show maintainer responses and completed work, but do not establish broad adoption or typical support responsiveness. Maturity receives 3/5 because the older pytest result and reported checkpoint repair provide useful evidence without validating current training quality or distributed operation.

The supplied docs workflow builds and publishes the documentation. It does not establish the full current CI configuration. Likewise, an August checkout date, an old star count or a previously small issue queue cannot establish the repository's current maintenance state.

Alternatives

ProjectWhat it isPick it when
nanoGPT gh↗A GPT training and fine-tuning repository whose README now labels it deprecated.Choose it for studying its compact historical training loop and model definition. Its November 2025 notice directs new users toward nanochat; do not choose it on the assumption that it remains the maintainer's current recommendation.
LLMs from ScratchThe official code companion to Sebastian Raschka's Build a Large Language Model (From Scratch), covering GPT-like model development, pretraining and fine-tuning.Choose it when you want a book-led sequence with chapter exercises. Its README says the main-chapter code is designed for conventional laptops without specialized hardware; that is the author's scope statement, not our benchmark.

What people are saying

  1. [github-trending] FareedKhan-dev/train-llm-from-scratch

Sources

  1. Train LLM From Scratch README
  2. Issue 36: compiled DDP checkpoint prefix leakage
  3. Issue 38: request for a CPU-friendly student path
  4. Documentation publishing workflow

More llm tools reviews

nanochat · FreeToken · ironclaw · infinity · Claude-Code-Game-Studios · OmniRoute · the whole board →