Skip to content
Mini LLM From Scratch

Pipeline

From raw text to a trained model

A structured training loop connects data loading, the forward pass, loss computation, and optimization into a repeatable process.

  1. Stage 01

    Raw text

    The starting corpus used to train and evaluate the model.

  2. Stage 02

    Tokenizer

    Converts text into vocabulary IDs the model can consume.

  3. Stage 03

    Batching

    Groups sequences into batches for efficient training steps.

  4. Stage 04

    Forward pass

    Runs a batch through the Transformer to produce next-token predictions.

  5. Stage 05

    Loss computation

    Compares predictions against the real next tokens.

  6. Stage 06

    Backpropagation & optimizer step

    Updates model weights to reduce the loss.

  7. Stage 07

    Checkpointing

    Saves model state so training can resume or be evaluated later.