AI Hero Club
← Course Overview

LEARNING PLAN/ Intermediate

Transformer in Practice

Calculate attention by hand, then implement, train, and validate a complete character-level Transformer.

Start with a question, derive the mechanism, then test your implementation with new inputs.

Transformer Field Course Cover
12 Chapter / Same full itemSection Learning Recommendations 28 HoursSeparate exercise and project reserved 20 hours

Times are author estimates that include derivation and practice. They have not been measured with learners; work through the sections at your own pace.

WHAT YOU WILL BUILD

What will you build to demonstrate understanding?

  • Deference conditions from mission definition, cross-entropy and attention gradient
  • Full decoding model for achieving multi-heading, absolute position, pre-LN and GELU
  • Complete full parameter training, effective token rating, check point exact recovery and cache generation
  • Use numeric contrasts, malfunctions, digestion of the same version as independent document acceptance
What should you know before starting?
  • Could create Python functions, lists, dictionaries and run local programs
  • Acquainted with basic calculations of limited probability, vector and matrix; specific usage of the course
  • Knows the meaning of one-dimensional guides; multiple inverse steps are derived from each of the instructions

Use the prerequisites to choose a starting point. You can read freely and return to earlier lessons whenever you need them.

THE LEARNING ROUTE

A clear path, one step at a time.

Marked Complete by You0 / 12

Saved in this browser only. Marking a lesson complete does not mean the project has passed verification.

01

Definitions and Expressions

Creates a common interface between predictive objects, probability, embedding and attention.

01

From Prediction Tasks to Data Contracts

Given “春风”, how do we build inputs and targets that predict the next character and the end of the text, rather than copy the current character?

120 minutes ↗
02

From Probabilities to Vector Representations

How do real-valued scores become probabilities and a loss, and how do embedding gradients accumulate when a character appears more than once?

120 minutes ↗
03

Work Through Attention Step by Step

How do two positions use Q, K and V to compute a readout and propagate errors back through all three projections?

120 minutes ↗
04

Causality, Multiple Heads and Position

How does attention exclude future tokens while multiple heads and positions distinguish the same character in different contexts?

120 minutes ↗
02

Construct and Learn

Connects to the complete decoder, leads to a gradient and saves a reversible training state.

05

From Residual Connections to a Complete Decoder Block

How do normalization, residual connections and a feed-forward network form a complete decoder block with checkable gradient paths?

120 minutes ↗
06

Backpropagation and Optimization

How does a scalar loss produce gradients throughout the computation graph and become one AdamW update?

120 minutes ↗
07

Implement a Trainable Decoder

How do embeddings, stacked blocks and an output head become a model, and how do we detect unregistered parameters or inconsistent targets?

120 minutes ↗
08

Training, Data and Reproducible Recovery

After an interruption, how do we restore the model, optimizer, sampling and random state so that the next update is identical?

120 minutes ↗
03

Evaluation and delivery

Comparative evaluation, generation and extension mechanisms to deliver the same version of projects.

09

Evaluation: What Has the Model Actually Learned?

When validation loss falls, how do we rule out test leakage, incorrect denominators and mismatched ablations?

150 minutes ↗
10

Generation and Caching with the Same Model

How does the same model generate one token at a time, and how do we verify that cached and full-prefix computation agree?

150 minutes ↗
11

Architecture and Cost: Toward Modern Implementations

When using RoPE, GQA or online softmax, which changes optimize the same function and which change the model itself?

180 minutes ↗
12

Final Project: Deliver a Reproducible Transformer

Given only the project archive, how can someone independently reproduce training, recovery, evaluation and generation for the same build?

240 minutes ↗

BUILD / TEST / TRANSFER

Runable Character Transformer Experimental Station

Starting with original documents and random weights, self-decoding models and complete training chains are achieved; evaluation, cache generation and location are completed with the same checkpoint and source code, data inventory, original results and failure reports are submitted.

Runtime Requirements
Python 3.12 and PyTorch 2.6.0 are recommended. A CPU is sufficient; see the project README for installation instructions.

Download the Project ↓

Read the README after extracting the archive, then follow its environment and run instructions. Reference implementations and learning tasks are provided separately.

Project Checklist

This is a personal checklist, not an automatic grade. Keep your inputs, results, failures and reproduction commands.