一个交互式、分步进行的网页应用,通过本地可运行的代码,从模式匹配到从头训练一个Transformer,完整展示了大语言模型的整个流程。

Stars

393

7 天增长

暂无数据

Fork 数

105

开放 Issue

0

开源协议

暂无数据

最近更新

2026-07-21

AI 仓库情报摘要
FR-AI / ANALYSIS

为什么值得关注

它不依赖任何机器学习库,从零构建了BPE分词器、Word2Vec嵌入和完整的解码器-only Transformer,让LLM的内部工作原理变得透明且易于学习。

适合谁使用

  • 对LLM内部机制感兴趣的程序员
  • 需要动手实践学习深度学习的学生
  • 寻找交互式演示讲解NLP概念的教育工作者
  • 希望本地训练小模型进行实验的爱好者

典型使用场景

  • 通过交互式演示学习LLM的完整生命周期
  • 教学反向传播、分词和Transformer机制
  • 原型设计小规模模型并可视化训练过程
  • 对比ELIZA式模式匹配与神经网络方法

项目优势

  • 覆盖从简单模式匹配到完整Transformer的完整流程
  • 所有核心实现均从零编写,无黑盒机器学习库
  • SSE流式传输提供训练和分词过程的实时可视化
  • 每个部分引用经典论文,将代码与研究基础紧密结合

使用前须知

  • 需要本地安装Node 20+和pnpm,无法直接在浏览器中使用
  • 训练仅限CPU,对于较大数据集或实验可能速度较慢
  • 无预训练权重或部署指南,纯教育演示用途

README 快速开始

How LLMs Work

An interactive app that walks through every stage of the LLM pipeline — from pattern matching to training a transformer from scratch — with working code you can run locally.

Stack

  • Hono — server, JSX rendering, and client components
  • Vite — dev server + bundling

Setup

Requires pnpm and Node.js 20+.

pnpm install
pnpm dev

If pnpm reports ignored build scripts, run:

pnpm approve-builds

Select esbuild with Space, press Enter, then rerun pnpm install.

Sections

1. Simple Chat — Pattern Matching

The simplest possible "AI": an ELIZA-style chatbot that responds with if-statements, streamed word by word via SSE. Same plumbing as ChatGPT, zero intelligence.

2. XOR Neural Net — Backpropagation

Trains a neural network live. A single-layer perceptron fails on XOR (proving Minsky/Papert right). A multi-layer network succeeds via backpropagation — the same algorithm every neural network uses today.

3. Basic Tokenizer — BPE From Scratch

A from-scratch BPE implementation that trains on your input text. Watch merge steps animate as the algorithm builds a vocabulary from characters to words.

项目描述

An interactive app that walks through every stage of the LLM pipeline, from pattern matching to training a transformer from scratch, with working code you can run locally.

相关仓库与替代方案

根据分类、Topic 和编程语言匹配的相似项目。

TanStack
精选
TanStack GitHub avatar

router

TanStack Router is a type-safe, data-driven React router with built-in caching, prefetching, and nested layouts, while TanStack Start extends it into a full-stack SSR framework.

Web 开发前端框架
14,861
vercel-labs
精选
vercel-labs GitHub avatar

scriptc

scriptc compiles ordinary TypeScript into small, fast native executables without needing Node.js, V8, or any JavaScript runtime in the binary.

开发者工具代码质量与构建
1,985
Jakubantalik
精选
Jakubantalik GitHub avatar

thinking-orbs

A React component library that renders six hand-tuned animated thought orb loading indicators on a plain 2D canvas, with two purpose-tuned sizes and automatic theme detection for AI and agent UIs.

AI 与机器学习AI 智能体
1,191