Kiln
JavaScript library that runs language, vision and speech models in the browser on WebGPU directly from original Hugging Face weights.
At a Glance
Kiln (kiln-webgpu) is a JavaScript library for running ML models in the browser on WebGPU, released under the MIT license.
Engagement
Available On
Listed Nov 2026
About Kiln
Kiln (kiln-webgpu) is an open-source, MIT-licensed JavaScript library by Erdem Ozkan that runs language, vision and speech models entirely in the browser. It loads a model's own safetensors, pytorch_model.bin or GGUF files from the Hugging Face Hub or a custom server, with no ONNX conversion and no inference server. It uses transformers.js-style API names, so existing code can move over by changing the import and model id.
What It Is
Kiln is a browser-side ML inference library. Each supported model family is implemented as WebGPU kernels rather than running an exported ONNX graph, which is what allows original weights and GGUF files to load directly. Models run in a worker and stream text back so the page does not block. Where WebGPU is unavailable, Kiln falls back to CPU (WASM SIMD), more slowly. Prompts, images and audio stay on the user's device.
Tasks and Models
The README and site list chat and text generation, embeddings, classification, NER, question answering, translation, summarization, speech recognition with timestamps, text-to-speech, image classification, object detection, segmentation, depth estimation, background removal, captioning, OCR and document question answering. Supported families include Llama, Mistral, Qwen, SmolLM, Granite, Gemma 3, BERT variants, T5, Whisper, CLIP, DETR, Florence-2 and others.
LLM Features
For language models, Kiln can constrain output to a JSON schema, regex, grammar or list of choices, including for image prompts. It also supports tool calls, LoRA adapter switching per call, a retrieval helper with chunking, embeddings, search and cited answers, and prompt caching across calls and page reloads. Downloads are cached in the browser, resume if interrupted and can load offline.
Setup Path
Install with npm install kiln-webgpu or import from a CDN as a single ES module (241 KB gzipped, worker included). WebGPU is available in current Chrome, Edge, Safari 26+ and Firefox 141+ on Windows. The project publishes benchmarks against transformers.js and notes where Kiln is slower, such as loading already-cached models. Because architectures are implemented individually, its supported list is shorter than transformers.js's. Model weights keep their publishers' licenses; the default RMBG-1.4 background-removal model is non-commercial only.
Community Discussions
Be the first to start a conversation about Kiln
Share your experience with Kiln, ask questions, or help others learn from your insights.
Pricing
Open Source (MIT)
Kiln (kiln-webgpu) is a JavaScript library for running ML models in the browser on WebGPU, released under the MIT license.
- MIT-licensed code, no runtime dependencies
- Runs language, vision and speech models in the browser on WebGPU, with a CPU fallback
- Structured output, LoRA adapters, retrieval and prompt caching
- Model weights are not bundled and keep their publishers' terms
- Default background-removal model RMBG-1.4 is licensed for non-commercial use only
Capabilities
Key Features
- Loads original safetensors, pytorch_model.bin and GGUF files with no ONNX conversion
- transformers.js-compatible API (pipeline, AutoTokenizer, AutoModel, TextStreamer)
- WebGPU inference with CPU fallback
- Structured output via JSON schema, regex, grammar or choices
- Tool calls and LoRA adapter switching
- Built-in retrieval helper with cited answers
- Prompt caching across calls and reloads
- Speech recognition and text-to-speech
- Vision tasks including detection, segmentation, depth and background removal
- Browser caching with resumable downloads and offline loading
- Custom endpoint for mirrors or self-hosted models
- 241 KB gzipped single ES module with worker
