Skip to content

Building an LLM in JS

The from-scratch guide to building large language models in Node.js and TypeScript.

Learn how large language models actually work by building one from scratch in Node.js and TypeScript.

No black boxes

Nothing is hidden behind a library call. You build every layer yourself, from tokenizer to training loop, so you understand exactly how it works.

From scratch

Tokenizer, dataset/dataloader, attention, transformer block, GPT, and the training loop built up chapter by chapter.

Runnable

Every chapter has a runnable entry point in the @node-llm/chapters package.

Interactive

Soon

Live WebGPU demos from the @node-llm/playground package are embedded throughout.