Show HN: Building an LLM from Scratch in TypeScript
A TypeScript guide shows how to build a GPT-style language model from scratch in Node.js.
A Show HN project is a chapter-by-chapter guide to building a large language model in Node.js and TypeScript without using a black-box framework. It covers the dataset and dataloader, attention, a transformer block, a GPT-style model, and the training loop. Runnable code is published in the @node-llm/chapters package, with interactive WebGPU demos from @node-llm/playground described as coming soon.
- Builds dataset loading, attention, transformer blocks, GPT, and training
- Each chapter has a runnable entry point on GitHub
- WebGPU demos from a playground package are planned
Full article91 words · extracted from book.humanexperiences.io · click to collapse

The from-scratch guide to building large language models in NodeJS and TypeScript.
Learn how large language models actually work by building one from scratch in Node.js and TypeScript.
No black boxes
We’ll build every layer, from attention mechanisms to the training loop.
From scratch
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, all on
GitHub.
Interactive
Soon
Live WebGPU demos from the @node-llm/playground package are embedded throughout.
Text extracted automatically; images, tables and formatting may be missing. Original: https://book.humanexperiences.io/