Cradle
Under a brass lamp in a night workshop, a small electrical transformer sleeps in a wooden cradle, its red power cord unplugged.

Let’s Build a Transformer!

Cradle

A transformer, built one piece at a time in C#.

Explore the series

The series

4 of 18 lessons published

Start here · Prologue

Prologue: Getting the cradle ready

Set up the tools, build the starting program, and check the dependencies we’ll use in the first lesson.

Published ·

Latest: Softmax

  1. The cradle Published ·

    Run our first kernel on the GPU.

    Read lesson
  2. Buffers and shapes Published ·

    Give the data a shape we can work with.

    Read lesson
  3. Matrix multiplication Published ·

    Build the operation at the heart of the model.

    Read lesson
  4. Softmax Published ·

    Turn scores into a stable distribution.

    Read lesson
View the full series

The approach

One program. Room to grow.

We begin with a kernel running on the GPU. Each lesson adds an operation we can inspect and test, until the same C# program loads model weights and generates text.

About the project