Building your own Shakespearean GPT - a ChatGPT like model: Live with the R&D Team

15 Mar 2023 · 47 min
46:55

A live tutorial demonstrating how to train a small, Shakespeare-style GPT (decoder-only transformer) in the Wolfram Language. The presenter covers tokenization of Shakespeare plays, building a vocabulary (~30k tokens from ~100k lines), token and positional embeddings, masked multi-head causal self-attention, residual connections, layer normalization, dropout, feed-forward layers, and assembling a transformer with 4 attention blocks, embedding size 128, and 4 heads. Training used cross-entropy loss with Adam, trained for 3 epochs on CPU with batch size 16 (10% validation split); training took ~1h20m. The talk also shows sampling strategies (greedy, temperature, top-k), discusses improvements (byte-pair / subword tokenization, larger models, GPUs), and compares outputs to OpenAI GPT-3/4 via an OpenAI Wolfram link.

Questions this video answers

About 100,000 play lines (~8 MB stored in a Wolfram Cloud object).

About 30,000 distinct tokens.

Embedding size 128 with 4 attention heads (key dim = 32).

Four attention blocks; trained for 3 epochs (rounds).

Batch size 16, validation split 10% (~10,000 lines), optimizer Adam, training on CPU took ~1 hour 20 minutes for 3 epochs.

Chapters

More from Guy

34:01
youtube.com

Alexis Nikole Nelson | Happy Snacking, Don't Die! | Talks at Google

3d ago
34:12
youtube.com

Cheryl Strauss Einhorn | The Human Edge: Smarter Decisions in the Age of AI | Talks at Google

2w ago
33:03
youtube.com

Olajuwon Ajanaku | Eastside Golf | Talks at Google

2w ago
38:23
youtube.com

Ethan Kross | Chatter | Talks at Google

1mo ago
22:30
youtube.com

Rachel Glennerster | Innovation and the Center for Global Development | Talks at Google

2mo ago
41:07
youtube.com

Rebecca Winthrop | Rethinking the Purpose of Education in the Age of AI | Talks at Google

2mo ago
40:54
youtube.com

Dr. Robert Wachter | A Giant Leap: How AI Is Transforming Healthcare... | Talks at Google

3mo ago
youtube.com

Leo Ku | From Passion to Profession | Talks at Google

3mo ago
youtube.com

Dr. Deepika Chopra | The Power of Real Optimism | Talks at Google

4mo ago
youtube.com

Jeff Kinney | Diary of a Wimpy Kid: Partypooper | Talks at Google

5mo ago
youtube.com

Susie Wolff | Driven | Talks at Google

5mo ago
See all content