← back

How LLMs work for Web Devs: GPT in 600 lines of Vanilla JS - Ishan Anand

8.2K views · Jul 13, 2025 · 101:33 min · Watch on YouTube ↗
Takeaway

Web devs can fully internalize transformer mechanics by reading and debugging a single-file GPT-2 implementation in their own browser.

Summary

  • Ishan Anand teaches GPT-2 internals via a 600-line vanilla JavaScript implementation that runs entirely in the browser using IndexedDB-loaded weights (~1.5GB).
  • Predecessor was 'Spreadsheets Are All You Need'—GPT-2 small implemented in Excel; this talk is the JS port aimed at frontend/full-stack devs without ML background.
  • Walks through tokenization, embeddings, attention, and the autoregressive next-token loop using analogies; you can set `debugger` and step through a transformer in DevTools.
  • Background needed: matrix multiplication and basic JS—no Python, no React, no calculus required.
llm-internalseducationjavascript
Original description
Don't be intimidated. Modern AI can feel like magic, but underneath the hood are principles that web developers can understand, even if you don't have a machine learning background. In this workshop, we'll explore a complete GPT-2 inference implementation built entirely in Vanilla JS. This JavaScript translation of the popular "Spreadsheets-are-all-you-need" approach will let you debug and step through a real LLM line by line without the overhead of learning a new language, framework, or even IDE.

All the major LLMs, including ChatGPT, Claude, DeepSeek, and Llama, inherit from GPT-2's architecture, making this exploration a solid foundation to understand modern AI systems and comprehend the latest research.

While we won't have time to cover everything, you'll gain the essential knowledge to understand the key concepts that matter when building with LLMs, including how they:

- Convert raw text into meaningful tokens
- Represent semantic meaning through vector embeddings
- Train neural networks through gradient descent
- Generate text with sampling algorithms like top-k, top-p, and temperature

This intense but beginner-friendly workshop is designed specifically for web developers diving into ML and AI for the first time. It’s your "missing AI degree" in just two hours. You'll walk away with an intuitive mental model of how Transformers work that you can apply immediately to your own LLM-powered projects.

About Ishan Anand
Ishan Anand is an AI consultant and technology executive specializing in Generative AI and LLMs. He created "Spreadsheets-are-all-you-need," an innovative course that demystifies large language models by implementing GPT-2 entirely in Excel. As the former CTO and co-founder of Layer0 (acquired by Edgio), and most recently Vice-President of Product Management for Edgio, he's led teams in developing cutting-edge solutions in web performance, edge computing, and AI/ML for enterprise web applications. Ishan brings deep technical expertise from his dual B.S. degrees in Mathematics and EECS from MIT, combined with a unique ability to make advanced technology accessible to broader audiences.

Recorded at the AI Engineer World's Fair in San Francisco. Stay up to date on our upcoming events and content by joining our newsletter here: https://www.ai.engineer/newsletter

Timestamps
00:00 Introduction to the Talk and Conference
01:24 Mission: Breaking Clark's Third Law (Demystifying LLMs)
02:45 Overview of the "Spreadsheets are All You Need" Approach
04:14 Today's Approach: Vanilla JavaScript Implementation
04:47 Background Needed for the Workshop
05:22 Key Resources for the Workshop
05:50 Simplified GPT-2 Diagram as a Roadmap
07:07 Quick Tour of the JavaScript Implementation of GPT-2
12:20 Understanding Large Language Models (LLMs)
17:47 Tokenization: Splitting Text into Subword Units
33:12 Embeddings: Token and Position Embeddings
56:51 Attention Mechanism
01:02:57 Multi-Layer Perceptron (MLP) and Backpropagation
01:16:07 Iteration: Refining Predictions Across Blocks
01:17:49 Language Head: Turning Embeddings Back into Tokens
01:23:18 Chat GPT vs. GPT-2: Key Innovations
01:31:37 Summary and Conclusion
01:35:13 Q&A Session