Running LLMs in the Browser with Three.js
Ben Houston's Website
Three-LLM runs several small language models locally in the browser by converting each model’s inference graph into Three.js TSL WebGPU compute shaders and loading Hugging Face checkpoints directly.
Why it matters
Three-LLM runs GPT-2, SmolLM2, Qwen, and Phi models locally in the browser by converting inference graphs into Three.js TSL compute shaders on WebGPU. The project uses Three.js/WebGPU’s compute features to drive ordered GPU dispatches and token generation through a tight GPU–JavaScript loop.