Build LLM from Scratch thumbnail 1
Build LLM from Scratch thumbnail 2
Build LLM from Scratch

Build LLM from Scratch

A deep-dive technical journey into the architecture, mechanics, and implementation of Large Language Models, from tokenization to the transformer attention mechanism.

View course on Vizuara
InstructorDr. Sreedath Panat
FormatInteractive Lecture & Lab
Sessions8 Modules
AudienceAI/GenAI Minor Students
Course Description

This course provides a robust foundation in constructing LLMs from the ground up. Students will explore the historical evolution of models, understand the mechanics of token prediction, and implement core components like Byte Pair Encoding and attention mechanisms.

Through a blend of theoretical lectures and hands-on Google Colab exercises, learners will gain practical experience in building and interpreting the neural architectures that power modern generative AI.

Learning Outcomes

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

Prerequisites
Course Sessions
Module 1
01

Foundations of LLMs

An introduction to the course, covering the basics of LLM mechanics, scaling laws, and the concept of next-token prediction.

Includes orientation and initial probability distribution exercises.

Core Topics

  • LLM Evolution
  • Scaling Laws
  • Emergent Properties
  • Next-Token Prediction

Resources & Assignments

Lecture VideoLesson NotesColab: Token Prediction
Module 2
02

Tokenization & Encoding

Deep dive into how text is converted into numerical data, focusing on word-based tokenization and Byte Pair Encoding (BPE).

Hands-on implementation of tokenizers.

Core Topics

  • Tokenization
  • Word-based Tokenization
  • Byte Pair Encoding (BPE)

Resources & Assignments

Lecture VideoLesson NotesColab: Build a Tokenizer
Module 3
03

Data Pipelines & Embeddings

Learning how to prepare data for training, including creating input-target pairs and implementing token embeddings.

Focus on the data preparation pipeline.

Core Topics

  • Input-Target Pairs
  • Token Embeddings
  • Data Pipeline Architecture

Resources & Assignments

Lecture VideoLesson NotesColab: Token Embedding
Module 4
04

Positional Encodings

Understanding the necessity of positional information in transformer models and how to implement positional encodings.

Bridge between data preparation and attention.

Core Topics

  • Positional Encoding
  • Sequence Order Representation

Resources & Assignments

Lecture VideoLesson Notes
Module 5
05

The Attention Mechanism

Exploring the core of the transformer architecture: self-attention and multi-head attention.

Mathematical derivation and coding implementation.

Core Topics

  • Self-Attention
  • Multi-Head Attention
  • Attention Mathematics

Resources & Assignments

Lecture VideoLesson NotesColab: Self Attention
Assessments

Tokenization Project

Build and test a custom word-based tokenizer and BPE implementation.

Attention Mechanism Lab

Implement self-attention from scratch using NumPy/PyTorch in a Colab notebook.

Capstone Project

A final project demonstrating the integration of tokenization, embedding, and attention modules to form a basic LLM pipeline.