2026-11-26 15:39 UTC

Kiln.js launches browser-side WebGPU inference with author-reported 2.2× median speedup

state: seedheat: mediumuncertainty: mediumrelevance: highwebgpu browser-inference inference-performanceErdem Ozkan

What is this?

Erdem Ozkan’s Kiln.js is an MIT-licensed JavaScript library, available as `kiln-webgpu` and from a CDN, for running language, vision and speech models in the browser. Its GitHub documentation says it loads original model files—including safetensors, PyTorch weights and GGUF—without an ONNX conversion or inference server, using WebGPU where available and a slower CPU fallback otherwise. Ozkan reports a 2.2× median speedup over transformers.js across 31 task/model pairs, measured in Chrome on one Intel Mac with integrated graphics; the documentation also reports about 307 tokens per second for SmolLM2-135M on an Apple M3. These are project-reported results, not independently verified here. The project says it implements model families itself, so its supported architecture coverage is shorter than transformers.js’s. The release was promoted on Show HN on 13 November 2026.

Why it matters

Kiln could make it easier for web developers to put small-model inference directly in a page, without operating an inference server or converting model files. That offers a path to more private, offline-capable and potentially lower-server-cost AI features, while making users’ own device hardware part of the deployment infrastructure. Its performance advantage is promising but rests on the author’s limited benchmark setup; browser support, device variation, model downloads and narrower architecture coverage matter for real deployments.

Current assessment

New: Ozkan has released Kiln.js, a browser-side WebGPU inference library with a transformers.js-style API, available through npm/CDN and under the MIT license. The project says it can load original weights from Hugging Face or a custom server, quantize during loading, cache models for offline use, and support tasks spanning text, vision and speech. It also advertises structured outputs, tool calls, LoRA adapters and retrieval helpers. The project’s stated design runs prompts and inputs on-device; WebGPU is required for full speed, with CPU/WASM SIMD fallback. Availability is established by the supplied project README and its Show HN post, but the breadth and reliability of practical model support have not been independently assessed here. Performance evidence is the author’s own comparison: 31 task/model pairs, all faster end-to-end in the reported test, with a 2.2× median; measurements were three warm calls in Chrome on an Intel Mac with Iris Plus 650 graphics. The author also reports roughly 307 tokens/s for SmolLM2-135M on an M3. The project acknowledges slower cached-model loading, larger downloads for some 4-bit models, and slower full masked-LM logits. Because Kiln hand-implements model families as WebGPU kernels, its supported architecture list is shorter than transformers.js’s. If the speed and compatibility claims hold across more devices and workloads, Kiln could lower the friction and server costs of distributing small AI features through ordinary web pages, while shifting compute and some infrastructure burden to users’ devices. The supplied web results do not provide independent confirmation or adoption evidence; treat benchmark performance and broad practical utility as open questions, not prerequisites for recognizing the release.

Measured heat

now 0 pts/hpeak 6 pts/hcomments 0/hpeers p10momentum: steady2 platformsage 330h
points/hour across evidence · reading as of 2026-11-27 02:23:58.509736+11:00 · deterministic, not a model opinion

How the heat travelled

11-12 21:22 (minted)⭐ origin echo-reconstructedKiln.js is an MIT-licensed JavaScript library for running models in the browser on WebGPU from their original weights, with a transformers.j
Erdem Ozkan on github (echo) · attributed from hn.story.50474384 · published time unknown
—
11-12 21:15first on hacker news · published · lag ?Show HN: Kiln – A WebGPU alternative to transformers.js, 2.2× faster (median)
serdemozkan
—
11-12 21:15amplified on hacker news 👑hn.story.50474384
serdemozkan
peak 5 · 0 comments · 100% of case engagement
11-12 21:20our radar first saw it · lag ?discovery anchor: hn.story.50474384—
pace: p13 vs 2096 stories at the 168h mark (now 330h old) — behind adobe-max-ai-agents-creative-tools-mcp (0.5x)

Evidence (2) — ⭐ canonical anchor

sourceobjectauthorscorecomments
🟧 hnShow HN: Kiln – A WebGPU alternative to transformers.js, 2.2× faster (median)
Retrieved article excerpt

Open article · Retrieved 2026-11-12T21:22:14.643821+00:00

# [Kiln.js](https://github.com/erdemozkan/kiln/blob/main/docs/media/logo.svg#gh-light-mode-only) [Kiln.js](https://github.com/erdemozkan/kiln/blob/main/docs/media/logo-dark.svg#gh-dark-mode-only)

**Run AI models in the browser on WebGPU, straight from their original weights.**

[npm version](https://www.npmjs.com/package/kiln-webgpu)
[CI status](https://github.com/erdemozkan/kiln/actions/workflows/ci.yml)
[MIT license](https://camo.githubusercontent.com/983d4359659e5a2c96c77d98d5ef94b6b62d718a4a78082edf59726cc3a1903f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e)
[Runs on WebGPU](https://camo.githubusercontent.com/e71e2235782bd6ccff75987208f3973ed539048b7f2d753057782442200d2ce4/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f72756e732532306f6e2d5765624750552d303035613963)
[241 KB gzipped](https://camo.githubusercontent.com/3677cf93820b02a182cbf2c5c1687afc6494dcd6453eaf7397614ee04b6eaa3d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f73697a652d3234312532304b42253230677a69707065642d386132626532)
[Written in TypeScript](https://camo.githubusercontent.com/99ad2f578c4c86707b6bfade8f9bd0ca267c4077d87e4c6abf07f31c00b345d5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f547970655363726970742d3331373863363f6c6f676f3d74797065736372697074266c6f676f436f6c6f723d7768697465)

Kiln is a JavaScript library that runs language, vision and speech models entirely in the browser.
It reads a model's own files (safetensors, `pytorch_model.bin` or GGUF) from the Hugging Face Hub
or from your own server, so there is no ONNX export, no compile step and no inference server. It uses transformers.js's API names, so
most existing code moves over by changing the import and the model id.

[The Kiln playground downloading SmolLM2-135M with a progress bar, then answering a question on the GPU](https://github.com/erdemozkan/kiln/blob/main/docs/media/demo.gif)

## Features

- **Original weights, no conversion.** Point at a model's repo on the Hugging Face Hub or a single `.gguf` file. Kiln quantizes to 4-bit or 8-bit while loading, so one repo serves every precision.
- **Not tied to the Hub.** Pass `endpoint` to load the same files from a mirror or your own static server, including models you trained yourself.
- **A familiar API.** `pipeline`, `AutoTokenizer`, `AutoModel` and `TextStreamer` with transformers.js's option names and output shapes.
- **Many tasks.** Chat and text generation, embeddings, classification, NER, question answering, translation, summarization, speech recognition, text-to-speech, image classification, object detection, segmentation, depth, background removal, and image or document questions.
- **Structured output.** Constrain any LLM's reply to a JSON schema, a regex, a grammar or a list of choices.
- **More for LLMs.** Tool calls, LoRA adapters, a retrieval helper, and prompt caching across calls and reloads.
- **Loads once.** Downloads are cached in the browser, resume if interrupted, and cached models load offline.
- **Stays out of the way.** Models run in a worker and stream text back; the page never blocks.
- **Small.** One 241 KB (gzipped) ES module that also works straight from a CDN, with a CPU fallback where there is no WebGPU.

## Principles

- **Original weights.** A model loads from the files its authors published. No conversion step sits between you and the model.
- **Correct before fast.** Every model is checked against transformers.js or Python on the same inputs. A speed-up that changes the output isn't one.
- **Modest hardware first.** The benchmarks are measured on a 2017 laptop with integrated graphics, because that is the kind of machine Kiln was built to put back to work.
- **Honest numbers.** The benchmarks list where Kiln is slower, not only where it wins.
- **Small footprint.** One 241 KB file with its worker inside, no runtime dependencies and no WASM runtime to download.
- **Nothing leaves the browser.** Models run on the user's own device. Prompts, images and audio are never sent to a server.

## Prerequisites

- **A browser with WebGPU** for full speed: current Chrome or Edge, Safari 26 or newer, or Firefox 141 or newer on Windows. Without WebGPU, Kiln runs on the CPU (WASM SIMD), more slowly.
- **Nothing to install** when importing from a CDN. With a bundler, any setup that handles ES modules works (Vite, webpack 5 and others).
- **Node 22.12 or newer** only if you build this repository yourself.

## Quickstart

Install it:

```
npm install kiln-webgpu
```

Or import it with no install and no bundler:

```
<script type="module">
  import { pipeline } from "https://cdn.jsdelivr.net/npm/[email protected]";
</script>
```

The latest build from `main` is also served from this repository's site, at `https://erdemozkan.github.io/kiln/kiln-webgpu.js`.

Chat with a model, using the transformers.js-style pipeline:

```
import { pipeline } from "kiln-webgpu";

const generator = await pipeline("text-generation", "HuggingFaceTB/SmolLM2-135M-Instruct", {
  dtype: "q4",
  progress_callback: (p) => console.log(p.status, p.file ?? "", p.progress ?? ""),
});
const [out] = await generator([{ role: "user", content: "Hi!" }], { max_new_tokens: 128 });
console.log(out.generated_text.at(-1).content);
```

Or stream the reply with Kiln's own API:

```
import { load } from "kiln-webgpu";

const llm = await load("HuggingFaceTB/SmolLM2-135M-Instruct", {
  onProgress: (p) => (bar.value = p.loaded / p.total), // drives a <progress> element
});
for await (const text of llm.chat([{ role: "user", content: "Hi!" }])) output.append(text);
```

Other tasks work the same way:

```
const embed = await pipeline("feature-extraction", "sentence-transformers/all-MiniLM-L6-v2");
const vectors = await embed(["Hello world", "Hi"], { pooling: "mean", normalize: true });

const transcribe = await pipeline("automatic-speech-recognition", "openai/whisper-tiny.en");
const { text } = await transcribe("speech.wav");
```

To try the playground from the animation above:

```
git clone https://github.com/erdemozkan/kiln.git && cd kiln && npm install && npm run dev
```

## Benchmarks

Kiln against transformers.js in the same browser on the same machine, on the same inputs. Across 31 task and model pairs, Kiln was faster end to end on every one, with a median speed-up of 2.2×.

[Bar chart: Kiln is 1.1 to 11.8 times faster than transformers.js on 31 task and model pairs](https://github.com/erdemozkan/kiln/blob/main/docs/media/benchmarks.svg)

Measured on an Intel Mac with integrated graphics (Iris Plus 650) in Chrome; times are the median of three warm calls. On an Apple M3, Kiln decodes SmolLM2-135M at about 307 tokens per second.

Where Kiln is slower: loading a model that is already cached, download size for 4-bit models (transformers.js's ONNX repos ship pre-quantized files), and full masked-LM logits through `AutoModelForMaskedLM`. Outputs were checked against transformers.js or Python on every model; the [technical notes](https://github.com/erdemozkan/kiln/blob/main/docs/technical-notes.md) have each comparison.

## The story behind Kiln

The idea came when I heard Sam Altman saying “quite terrible to have everybody have a bunch of the world’s limited supply of DRAM sitting in their own computer… being used 5% of the time” in a [podcast](https://finance.yahoo.com/technology/ai/articles/quite-terrible-sam-altman-says-184500058.html). It made me think of my retired 2017 MacBook Pro, an i7 with 16 GB of RAM, doing nothing in a drawer.

I wanted to put it back to work, and I wanted that to be as easy as opening a web page: no installs, no servers, only a browser. I also wanted other developers like me to be able to use the idle memory and processing power of their own devices for small AI tasks just as easily.

So Kiln was born from one idea: don't kill the potential of the hardware we already own. I studied where transformers.js falls short and focused on making models run well on modest, everyday devices, anything that can open a browser with WebGPU.

## About

Kiln implements each model family itself, as WebGPU kernels, instead of running an exported ONNX graph. That is what lets it load original weights and GGUF files, and it is also why its list of supported architectures is shorter than transformers.js's.

- **Guide and API:** [package README](https://github.com/erdemozkan/kiln/blob/main/packages/kiln-webgpu/README.md)
- **Docs site, examples and migration guide:** in [`site/`](https://github.com/erdemozkan/kiln/blob/main/site); `npm run dev:site` serves it locally
- **Design, measurements and per-model notes:** [technical notes](https://github.com/erdemozkan/kiln/blob/main/docs/technical-notes.md)
- **Changes:** [CHANGELOG](https://github.com/erdemozkan/kiln/blob/main/CHANGELOG.md)

## Contributing

Contributions are welcome. Kiln supports a model family only once someone has implemented it, so the most useful help is telling us which models you need: [open an issue](https://github.com/erdemozkan/kiln/issues) for a model, a bug or an idea.

To work on the code you need Node 22.12 or newer:

```
npm install
npm test
npm run typecheck
npm run dev
```

`npm run dev` serves the playground at `http://localhost:5173`. The [technical notes](https://github.com/erdemozkan/kiln/blob/main/docs/technical-notes.md) explain the design and how each model was checked, and the [future features plan](https://github.com/erdemozkan/kiln/blob/main/docs/future-features-plan.md) lists what is planned next. A change that affects a model's output should come with a comparison against a reference, the same way the existing models were checked.

## License

Kiln's code is [MIT licensed](https://github.com/erdemozkan/kiln/blob/main/LICENSE). It has no runtime dependencies.

Model weights are not bundled and keep their publishers' terms: check a model's card before shipping it. The default background-removal model, RMBG-1.4, is licensed for non-commercial use only.

Made in New York with 🧡 by Erdem Ozkan
serdemozkan50
🟧 echo.github ⭐Kiln.js is an MIT-licensed JavaScript library for running models in the browser on WebGPU from their original weights, with a transformers.jErdem Ozkan——

Interpretation history

Decision trace