Machine learning in the browser, on WebGPU,
straight from Hugging Face.

Kiln (kiln-webgpu) runs language, vision and speech models on the user's GPU, loading the original safetensors and GGUF files: no ONNX conversion, no server. It speaks transformers.js's API, and adds output that always matches your schema, LoRA adapters you switch in milliseconds, retrieval, and one LLM for many tasks.

npm install kiln-webgpu
4.8×
faster LLM decoding than transformers.js
(SmolLM2-135M, q4, same GPU)
24
pipeline tasks, transformers.js's
names and output shapes
241 KB
gzipped, worker included;
no WASM runtime to download

Quick start

import { load } from "kiln-webgpu";

const llm = await load("Qwen/Qwen2.5-0.5B-Instruct");
for await (const text of llm.chat([{ role: "user", content: "Write a haiku about kilns." }])) {
  document.body.append(text);
}

The same model as a transformers.js pipeline:

import { pipeline } from "kiln-webgpu";

const generator = await pipeline("text-generation", "Qwen/Qwen2.5-0.5B-Instruct");
const [{ generated_text }] = await generator([{ role: "user", content: "Hello!" }], { max_new_tokens: 64 });

Why Kiln

No conversion step

Loads the repo as published: safetensors, pytorch_model.bin or a GGUF file. New fine-tunes and llama.cpp quantizations work the day they appear.

Output that always parses

JSON Schema, regex and grammars are enforced token by token, for text and image prompts alike: read an invoice into your shape, every time.

Conversations get cheaper

Earlier turns are reused across calls and page reloads; draft tokens speed decoding up. A follow-up prefills only what is new.

LoRA adapters in milliseconds

Load a base model once and switch PEFT adapters per call with a GPU copy.

Retrieval in one library

Chunking, embeddings, search and grounded answers with cited passages; the passages' prompt prefix is cached.

One model, many tasks

Classification with your own labels (real probabilities), extraction, NER and QA from a single LLM download.

Checked, not claimed

Outputs are compared with Python transformers and transformers.js on the same inputs; the numbers are published.

Small

One ES module with its worker inside, from a CDN or any bundler. WebGPU where available, a multithreaded CPU fallback where not.

What it runs

AreaModelsTasks
LanguageLlama, Mistral, Qwen2/3, SmolLM, Granite 3 and 4, Gemma 3; safetensors or GGUFchat, completion, tools, structured output, LoRA, text-generation
Text encodersBERT, DistilBERT, RoBERTa, MiniLM, BGEembeddings, classification, NER, QA, fill-mask, zero-shot
Seq2seqBART, T5 / Flan-T5, Marian, M2M100 / NLLBsummarization, translation, text2text
SpeechWhisper, wav2vec2, HuBERT, SpeechT5, MMS-VITS, Kokorospeech recognition with timestamps, audio classification, text-to-speech
VisionViT, DeiT, DINOv2, CLIP, ResNet, ConvNeXt, DETR, YOLOS, OWL-ViT / OWLv2, SegFormer, Depth Anything, RMBG, Swin2SRclassification, detection, zero-shot detection, segmentation, depth, background removal, upscaling
MultimodalGemma 3, SmolVLM, Florence-2, Donut, ViT-GPT2chat about images, captions, OCR, document QA

Requires a browser with WebGPU (Chrome, Edge, Safari 26 and later, Firefox 141 and later on Windows) for full speed; elsewhere Kiln runs on the CPU.