Build Large Language Models (LLMs) from Scratch thumbnail 1
Build Large Language Models (LLMs) from Scratch

Build Large Language Models (LLMs) from Scratch

Master the architecture and implementation of Large Language Models by building your own from the ground up, covering everything from tokenization to instruction finetuning.

View course on Vizuara
InstructorVizuara Expert Team
FormatSelf-Paced Video & Code
Sessions8 Modules
AudienceAI Engineers & Developers
Course Description

This comprehensive course takes you deep into the mechanics of modern AI. Instead of just using APIs, you will learn to code the fundamental components of LLMs, including attention mechanisms, transformer blocks, and training loops.

Through 53 hands-on lessons, you will gain a practical understanding of how GPT-style models are architected, trained, and finetuned for specific tasks.

Learning Outcomes

By the end of this course, you will be able to:

Prerequisites
Course Sessions
Module 1
01

Foundations & Tokenization

Introduction to the LLM landscape and the essential first step of converting text into numerical data.

Focuses on Byte Pair Encoding and custom tokenizer implementation.

Core Topics

  • What are LLMs?
  • GPT Tokenizer
  • Byte Pair Encoding
  • Coding a Tokenizer

Resources & Assignments

Lecture VideoCodeAssignment
Module 2
02

The Attention Mechanism

Deep dive into the core engine of transformers: the self-attention mechanism.

Hands-on coding of keys, queries, and values.

Core Topics

  • Self-Attention
  • Causal Self-Attention
  • Multi-head Attention
  • Simplified Attention

Resources & Assignments

Lecture VideoColabCode
Module 3
03

Transformer Architecture

Assembling the building blocks of the transformer model.

Covers normalization, activation functions, and residual connections.

Core Topics

  • Transformer Blocks
  • GeLU Activation
  • Layer Normalization
  • Positional Embeddings

Resources & Assignments

Lecture VideoCode
Module 4
04

Model Implementation

Coding a functional GPT-2 style model from scratch.

Focuses on parameter management and model architecture.

Core Topics

  • Coding GPT-2
  • 124M Parameter Model
  • Weight Loading
  • Architecture Overview

Resources & Assignments

Lecture VideoGitHub Repo
Module 5
05

Pretraining & Sampling

Setting up the training loop and controlling model generation.

Covers loss functions and sampling strategies.

Core Topics

  • Pretraining Loop
  • Loss Functions
  • Top-k Sampling
  • Temperature Scaling

Resources & Assignments

Lecture VideoColabAssignment
Module 6
06

Instruction Finetuning

Adapting pretrained models to follow instructions.

Includes data loading and training loop implementation.

Core Topics

  • Finetuning Intro
  • Instruction Training Loop
  • Data Loaders
  • Batching

Resources & Assignments

Lecture VideoCode
Module 7
07

Classification & Evaluation

Using finetuned LLMs for practical classification tasks.

Building a spam classifier as a capstone project.

Core Topics

  • Classification Finetuning
  • Spam Classifier
  • Model Evaluation
  • Ollama Integration

Resources & Assignments

Lecture VideoProjectDataset
Module 8
08

Review & Synthesis

Consolidating knowledge and final project wrap-up.

High-level summary of the entire pipeline.

Core Topics

  • 20-minute Summary
  • Pipeline Review
  • Final Project Review

Resources & Assignments

Lecture VideoProject
Assessments

Tokenizer Implementation

Build a functional Byte Pair Encoder from scratch.

Attention Mechanism Lab

Implement multi-head self-attention using PyTorch.

Spam Classifier Project

Finetune a transformer model to classify text and evaluate its performance.