Transformers.js
A strong pick. 1st of 7 machine learning in JavaScript.
Transformers.js is Hugging Face's library for running pretrained ONNX models on the device. It runs in the browser on WebGPU or WASM, and in Node, Bun and Deno, and covers text, vision, audio and LLM tasks. It is the broadest, most actively maintained general-purpose choice in this category today, and the one to start with unless you only need LLM chat (WebLLM, node-llama-cpp) or ready-made vision tasks (MediaPipe).
Best for: JS/TS developers who want to run Hugging Face models for embeddings, classification, speech, vision or small LLMs locally in the browser or Node with a pipeline API.
Scores
Overall8.4
How strongly do we recommend it for a new project today?
Claude Opus 5.5: 8.0, likely 7.0 to 9.0
It is the strongest general-purpose pick for on-device ML in JS. It has the broadest model coverage, active funded maintenance, a modern WebGPU runtime and fast-growing use. TensorFlow.js and brain.js have stalled, and WebLLM and node-llama-cpp serve only LLMs. LLM decode speed and the heavy Node install keep it short of a clear 9.
- peers: TensorFlow.js had 1 commit last year; brain.js had none.
- huggingface.co/blog/transformersjs-v4: v4 rewrite with broad architecture support.
- zenvanriel.com/ai-engineer-blog/transformers-js-vs-web-llm-which-is-faster: WebLLM is faster for chat-style LLMs.
GPT-6.2 Sol: 8.7, likely 7.6 to 9.5
Transformers.js is my first choice for a new JavaScript project that needs several kinds of local inference. The typed API, model catalog, active maintenance, and Firefox deployment carry the most weight. WebLLM is a strong option for browser-only chat, and node-llama-cpp is a better fit for a Node.js app built around GGUF models. Device-dependent performance and model compatibility keep the recommendation below a category-wide default.
- github.com/huggingface/transformers.js/releases: Recent stable releases expand model support, browser coverage, and documentation.
- blog.mozilla.org/firefox/firefox-ai/speeding-up-firefox-local-ai-runtime: Confirms production use alongside the need for backend tuning in Firefox.
- webllm.mlc.ai/docs/user/get_started.html: Documents WebLLM's browser chat API and WebGPU requirement.
- node-llama-cpp.withcat.ai/guide: Documents local GGUF model support in Node.js.
- github.com/huggingface/transformers.js/issues/1836: Shows a device-specific limit on the current stable release.
Needed by many4.3
How many developers need a tool for this job?
Claude Opus 5.5: 5.0, likely 4.0 to 6.0
Running ML on the device is a growing but still minority need among JS developers. Local embeddings for search and RAG widen the group. Within the category, Transformers.js covers the most task types on both browser and server runtimes, so it is broad for its niche.
- web.dev/learn/ai/client-side?hl=en: Google frames client-side AI as one option in the web stack.
- arxiv.org/html/2605.20706: Reports about 41,600 compatible models for Transformers.js against about 400 for WebLLM.
GPT-6.2 Sol: 3.5, likely 2.3 to 4.8
On-device ML is a clear niche. In the 2025 State of JavaScript survey, 242 of 10,926 respondents to the use-case question reported using JavaScript for machine learning. Browser and Node.js support give Transformers.js a broad remit within that niche, and the survey leaves room for developers who describe their work as web development.
- 2025.stateofjs.com/en-US/usage: Measures self-reported JavaScript use cases, including machine learning.
- github.com/huggingface/transformers.js/releases/tag/4.0.0: Documents browser and Node.js support and a wide model catalog.
Helps a lot8.3
How well does it do the job for those who need it?
Claude Opus 5.5: 8.0, likely 7.0 to 9.0
It has the widest task and model coverage in the category, a simple pipeline API, types, and a v4 WebGPU runtime with real speedups. LLM decoding speed trails WebLLM and newer engines such as Kiln. Large Node installs and cold-start costs are clear limits.
- huggingface.co/blog/transformersjs-v4: v4 WebGPU runtime, about 200 architectures, about 4x BERT speedup, ModelRegistry API.
- newreleases.io/project/github/huggingface/transformers.js/release/4.3.0: v4.3 added structured output and Safari WebGPU.
- zenvanriel.com/ai-engineer-blog/transformers-js-vs-web-llm-which-is-faster: WebLLM is often faster for LLM text generation.
- sitepoint.com/optimizing-transformers-js-production: Cold-start and memory issues seen in production.
- hackerNews top: Show HN: Kiln claims 2.2x faster than Transformers.js on WebGPU.
GPT-6.2 Sol: 8.6, likely 7.4 to 9.5
Version 4.3.2 covers embeddings, chat, speech, and vision through a common API. The types and runnable examples give coding agents a clear starting point for standard tasks. An independent MiniLM test found WebAssembly faster than WebGPU on one laptop, and a user reported iOS Safari crashes with longer prompts. Performance and error handling still depend heavily on the model, backend, and device.
- github.com/huggingface/transformers.js/releases/tag/4.3.2: Confirms stable model support, device discovery, and a model-download error fix.
- huggingface.co/docs/transformers.js/main/en/index: Documents task coverage, quantization, and example integrations.
- npm hasTypes: The package ships TypeScript declarations.
- github.com/delcenjo/browser-runtimes-bench: Independent MiniLM benchmark compares WebAssembly and WebGPU on one laptop.
- github.com/huggingface/transformers.js/issues/1836: A user reproduced long-prompt crashes on iOS Safari with 4.3.2.
Holds up over time8.2
Will it still be a good choice in two years?
Claude Opus 5.5: 8.0, likely 7.0 to 9.0
Hugging Face funds it. It had 172 commits and 8 releases last year, the latest in late October 2026, plus a major v4 rewrite with the ONNX Runtime team. It still rests on a small core team led by its creator. The move from v3 to v4 and from @xenova to @huggingface caused some migration churn.
- github commitsLastYear: 172 commits, 8 releases, 87 contributors.
- github latestRelease: 4.3.2 published 2026-10-28.
- github.com/huggingface/transformers.js/releases: Steady release cadence through v4.x.
GPT-6.2 Sol: 8.4, likely 7.1 to 9.4
The project recorded 172 commits and eight releases in the last year, and two Hugging Face maintainers have cut GitHub releases. One recent model-download fix reached a stable release nine days after the pull request opened. The small release team and v4's substantial runtime changes leave some uncertainty about upgrade effort and support across devices.
- github commitsLastYear, releasesLastYear, latestRelease, and pushedAt: Shows sustained activity and a recent stable patch.
- linkedin.com/pulse/one-year-hugging-face-nico-martin-flzje: A maintainer describes two staff members working on the library at Hugging Face.
- github.com/huggingface/transformers.js/releases: Shows two GitHub release authors and a major WebGPU backend rewrite.
- github.com/huggingface/transformers.js/pull/1804: A community fix received same-day review and merged within a week.
Used widely7.4
How many use it, and is that growing?
Claude Opus 5.5: 8.0, likely 7.0 to 9.0
Downloads went from 0.67M to 19.4M per 4 weeks, a ratio of about 29x against a median of 4.1. Part of that comes from the migration off @xenova/transformers and from being a dependency of other tools, so direct choice is lower than the raw count suggests. It has 16k stars and steady HN and Bluesky attention, and the dependents count is missing because the package is scoped.
- npm downloadsLast4Weeks: 19.4M now against 671k a year ago.
- medianDownloadsRatio: Median ratio is 4.1; this project is about 29x.
- github stars: 16,439 stars.
- bluesky posts: 14 posts, on par with WebLLM's 15.
GPT-6.2 Sol: 6.7, likely 5.0 to 8.1
Four-week npm downloads rose from 671,493 to 19.4 million, up 28.9× against the catalog median of 4.1×. That is the second-fastest growth among the listed projects, and Bluesky attention is close to WebLLM's. npm search shows about 1,550 dependent packages, while ecosyste.ms has no count for the package. Build servers and transitive installs blur the number of direct choices, and GitHub stars cover the full repository, including related packages.
- npm downloadsLast4Weeks, npm downloadsSame4WeeksYearAgo, medianDownloadsRatio, and peers: Shows 28.9× growth, behind only node-llama-cpp in this group.
- github stars, bluesky posts, peers, and dependents: Shows 16,439 stars, 14 Bluesky posts versus WebLLM's 15, and no ecosyste.ms count.
- npmjs.com/search?q=keywords%3Atransformers: Indexed npm results list roughly 1,550 dependent packages.
- huggingface.co/blog/transformersjs-v4: Documents the switch to a repository shared by several packages.
Vouched for7.5
Who stands behind it being good?
Claude Opus 5.5: 7.0, likely 6.0 to 8.0
Firefox ships a vendored copy for its local ML features. Hugging Face backs it, and the ONNX Runtime team co-developed the v4 runtime. Independent guides from Intel, web.dev, SitePoint and an arXiv benchmark treat it as the reference browser ML library. Survey data on satisfaction is thin.
- searchfox.org/mozilla-central/source/toolkit/components/ml/vendor/transformers/gecko.patch: Mozilla vendors Transformers.js in Firefox.
- intel.com/content/www/us/en/developer/articles/technical/web-developers-guide-to-in-browser-llms.html: Intel guide covers it as a main option.
- simonwillison.net/tags/transformers-js: Repeated independent write-ups.
GPT-6.2 Sol: 7.9, likely 6.7 to 9.0
Mozilla ships Transformers.js in Firefox for PDF alt text and smart tab grouping, using its own native ONNX backend. Continue includes it as a local embeddings provider in VS Code. Independent benchmarks and developer reports add evidence for embeddings, classification, and transcription, with limited coverage across devices and little survey evidence about satisfaction.
- blog.mozilla.org/firefox/firefox-ai/speeding-up-firefox-local-ai-runtime: Mozilla describes shipped features and its switch to native ONNX Runtime.
- github.com/continuedev/continue/blob/main/core/config/yaml/loadYaml.ts: Continue adds Transformers.js to its VS Code embeddings providers.
- github.com/delcenjo/browser-runtimes-bench: Publishes the setup and results for an independent browser embedding comparison.
- reddit.com/r/LocalLLaMA/comments/1lw6jz5/transformersjs_vs_webllm: A user favored Transformers.js for classification and transcription and WebLLM for chat.
Safe7.2
How safe is it to depend on?
Claude Opus 5.5: 7.0, likely 6.0 to 8.0
It has no advisories, an Apache-2.0 licence and 5 direct dependencies. The bundle has no Scorecard data. In Node, onnxruntime-node brings a large native binary footprint, and models are fetched from remote hubs at runtime, which widens the attack surface.
- advisories total: 0 advisories.
- npm dependencies: 5 direct dependencies.
- scorecard: No Scorecard data.
- npmjs.com/package/onnxruntime-node: onnxruntime-node is about 218 MB unpacked and installs CUDA binaries by default.
GPT-6.2 Sol: 7.4, likely 5.9 to 8.6
The package uses the permissive Apache-2.0 license, and OSV lists zero direct advisories. Its five direct dependencies include ONNX Runtime, a development build of the web runtime, and the native image library sharp. GitHub shows a verified release commit and no repository security policy. OpenSSF Scorecard data, npm publishing provenance, and the number of authorized npm publishers remain unverified.
- npm license, npm dependencies, advisories, and scorecard: Apache-2.0, five direct dependencies, zero OSV advisories, and no Scorecard result.
- github.com/huggingface/transformers.js/blob/4.3.2/packages/transformers/package.json: The stable package pins a development build of onnxruntime-web and lists sharp.
- github.com/huggingface/transformers.js/releases/tag/4.3.2: GitHub shows a verified signature on the release commit.
- github.com/huggingface/transformers.js/security: GitHub detects no repository security policy and lists no published advisories.
Good
- It works with thousands of ready-converted models on the Hugging Face Hub, across about 200 architectures, through one pipeline() API that mirrors Python Transformers.
- The v4 WebGPU runtime was built with the ONNX Runtime team and gives about 4x faster BERT embeddings, with a WASM fallback.
- The same code runs in browsers, Node, Bun and Deno, and v4.3 added WebGPU on Safari 26+, structured output and tool calling.
- Hugging Face employs the maintainers, who ship releases often, and it ships with TypeScript types.
Bad
- In Node it pulls in onnxruntime-node, which is over 200 MB and can break serverless size limits.
- For autoregressive LLM chat, WebLLM and newer WebGPU engines are often faster.
- Cold start is slow because models must be downloaded and warmed up, and users report memory spikes and UI freezes unless inference runs in a worker.
- Custom models need an ONNX export that matches the library's expectations, and mismatched onnxruntime versions cause crashes.
The numbers
- npm downloads, 4 weeks
- 19M ×29 in a year
- GitHub stars
- 16k
- Commits, 12 months
- 172
- npm version
- 4.3.2 Oct 2026
- Versions, 12 months
- 8
- Advisories, 24 months
- 0 of 0 ever
- OpenSSF Scorecard
- None
- Licence
- Apache-2.0
Read on 21 November 2026 from GitHub (huggingface/transformers.js), npm (@huggingface/transformers), OSV and the OpenSSF Scorecard.
Machine learning in JavaScript
- 8.4Transformers.js
- 7.8MediaPipe Tasks
- 7.1node-llama-cpp
- 6.8WebLLM
- 6.6Tesseract.js
- 4.5TensorFlow.js
- 2.7brain.js