# TensorFlow.js

> Source: https://aiwiki.ai/wiki/tensorflow_js
> Updated: 2026-10-28
> Fact-checked: 2026-11-05
> Categories: Developer Tools, Google, Software Development
> License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) - attribute to "AI Wiki (aiwiki.ai)"
> Cite as: AI Wiki. "TensorFlow.js." aiwiki.ai, 28 Oct 2026. https://aiwiki.ai/wiki/tensorflow_js
> From AI Wiki (https://aiwiki.ai), the free encyclopedia of artificial intelligence. Reuse freely with attribution.

**TensorFlow.js** (often abbreviated **TFJS**) is an open-source [JavaScript](https://aiwiki.ai/wiki/javascript) library developed by [Google](https://aiwiki.ai/wiki/google) for defining, training, and running [machine learning](https://aiwiki.ai/wiki/machine_learning) models entirely in the web browser, in [Node.js](https://www.tensorflow.org/js/guide/nodejs), and on mobile through React Native. It was announced on March 30, 2018 at the TensorFlow Developer Summit as the successor to the earlier deeplearn.js library, and it is the JavaScript member of the broader [TensorFlow](https://aiwiki.ai/wiki/tensorflow) ecosystem, exposing APIs that mirror the Python TensorFlow and [Keras](https://aiwiki.ai/wiki/keras) interfaces.[1][2] Because computation runs on the user's own device, the official launch post states that "all data stays on the client, making TensorFlow.js useful for low-latency inference, as well as for privacy preserving applications."[1]

<figure class="w-40">
<img src="/images/wd-2026-10-28-tensorflow_js-logo-ba33a5ec4e02-tile.png" alt="TensorFlow logo" width="480" height="509" />
<figcaption>TensorFlow logo. Source: <a href="https://commons.wikimedia.org/wiki/File:Tensorflow_logo.svg">Wikimedia Commons</a>, <a href="https://commons.wikimedia.org/wiki/File:Tensorflow_logo.svg#Licensing">Public domain</a>.</figcaption>
</figure>

Google describes the library as "an open-source library you can use to define, train, and run [machine learning models](https://aiwiki.ai/wiki/model) entirely in the browser, using JavaScript and a high-level [layers API](https://aiwiki.ai/wiki/layers_api_tf_layers)."[1] It is distributed under the Apache 2.0 license and published as the npm package `@tensorflow/tfjs`, with separate packages for individual backends, the model converter, the layers API, and platform adapters. The companion academic paper, presented at MLSys 2019, summarises its purpose: "TensorFlow.js is a library for building and executing machine learning algorithms in JavaScript. TensorFlow.js models run in a web browser and in the Node.js environment."[3]

## What is TensorFlow.js used for?

TensorFlow.js is a library for defining tensors, building [neural network](https://aiwiki.ai/wiki/neural_network)s, training them with [automatic differentiation](https://aiwiki.ai/wiki/automatic_differentiation), and running inference in JavaScript runtimes. Its design goals, set out in the foundational MLSys 2019 paper by Smilkov, Thorat et al., were to bring ML to JavaScript developers with little or no ML experience while letting experienced ML users migrate their work to JavaScript, which required wide functionality and an API spanning several levels of abstraction; as a young library, missing functionality was prioritised over performance.[3] The official documentation frames three core workflows: importing a pre-trained TensorFlow or Keras model for inference, retraining an imported model with [transfer learning](https://aiwiki.ai/wiki/transfer_learning), and authoring and training new models directly in the browser.[1]

The library targets four main runtimes:

1. The web browser, where models can run on the user's GPU through WebGL or WebGPU, on the CPU through plain JavaScript, or through compiled [WebAssembly](https://aiwiki.ai/wiki/webassembly) (WASM) kernels.
2. Node.js servers, where bindings to the native TensorFlow C library provide the same speed as Python TensorFlow on CPU and CUDA GPUs.
3. React Native applications, where an `expo-gl` adapter exposes the device GPU.
4. Other JavaScript hosts such as Electron desktops and edge runtimes that ship a browser engine.

In each case the developer writes the same TensorFlow.js code; the library selects the fastest available backend at startup.

<figure class="embedvideo">
<iframe src="https://www.youtube-nocookie.com/embed/iH9CS-QYmZs" title="TensorFlow.js: ML for the web and beyond (TF Dev Summit '20)"></iframe>
<figcaption>"TensorFlow.js: ML for the web and beyond (TF Dev Summit '20)", official video from TensorFlow, published March 18, 2020. <a href="https://www.youtube.com/watch?v=iH9CS-QYmZs">Watch on YouTube</a>.</figcaption>
</figure>

## When was TensorFlow.js released?

TensorFlow.js was announced on March 30, 2018, but its lineage starts roughly seven months earlier with deeplearn.js. The table below summarises the major milestones.

| Date | Milestone |
|---|---|
| August 11, 2017 | deeplearn.js, a WebGL-accelerated JavaScript ML library, announced by [Google](https://aiwiki.ai/wiki/google)'s PAIR team[5] |
| March 30, 2018 | TensorFlow.js launched at the TensorFlow Developer Summit; deeplearn.js renamed TensorFlow.js Core[1] |
| 2018 | Node.js bindings (`@tensorflow/tfjs-node`, `@tensorflow/tfjs-node-gpu`) released |
| February 2020 | React Native adapter (`@tensorflow/tfjs-react-native`) released |
| March 2020 | [WebAssembly](https://aiwiki.ai/wiki/webassembly) (WASM) backend introduced |
| September 2, 2020 | WASM backend gains SIMD and multithreading in v2.3.0, up to 10x faster[4] |
| May 17, 2021 | MoveNet pose-detection model and new pose API released[6] |
| May 2, 2023 | Chrome 113 ships WebGPU by default; TensorFlow.js already supports WebGPU-optimized versions of most operators[7] |
| September 4, 2024 | [Google](https://aiwiki.ai/wiki/google) rebrands TensorFlow Lite as LiteRT[8] |
| October 21, 2024 | Version 4.22.0 of the umbrella `@tensorflow/tfjs` package released[9] |
| July 9, 2026 | Google formally introduces LiteRT.js, its Web AI runtime for `.tflite` models, describing it as an evolution from TensorFlow.js for that use[24] |

### Deeplearn.js (2017)

The direct predecessor of TensorFlow.js was **deeplearn.js**, a WebGL-accelerated JavaScript library announced by Google researchers Daniel Smilkov and Nikhil Thorat on August 11, 2017.[5] Smilkov and Thorat were members of Google's PAIR (People + AI Research) initiative, which had previously produced the [TensorFlow Playground](https://aiwiki.ai/wiki/tensorflow_playground), an interactive in-browser visualisation of small neural networks. Deeplearn.js generalised the techniques used in the Playground into a full library: tensors stored as WebGL textures, fragment shaders implementing element-wise and matrix operations, and an API modelled on TensorFlow and NumPy, with a delayed execution model for training and an immediate ([eager](https://aiwiki.ai/wiki/eager_execution)-style) execution model for inference, plus full backpropagation.[5]

Deeplearn.js was aimed at visual demos and education. Early projects shipped in deeplearn.js included style transfer, image-to-image translation, and an in-browser implementation of SqueezeNet. Although the library was popular, it lacked official ties to TensorFlow's Python ecosystem, and its API diverged from the Keras conventions familiar to most ML practitioners.

### Launch as TensorFlow.js (2018)

On March 30, 2018, Google relaunched deeplearn.js as **TensorFlow.js** at the TensorFlow Developer Summit.[1] The relaunch added a Keras-compatible Layers API on top of the existing low-level Core API, plus a converter that imports TensorFlow [SavedModel](https://aiwiki.ai/wiki/savedmodel) and Keras HDF5 files, and renamed deeplearn.js itself to TensorFlow.js Core. The summit talk by Smilkov and Thorat featured a live demo of training a PAC-MAN controller from a webcam feed, showing that the browser could now do real [backpropagation](https://aiwiki.ai/wiki/backpropagation), not just inference.[1]

The launch also introduced the Emoji Scavenger Hunt mobile demo, which used the device camera to detect real-world objects matching emoji prompts. Both demos ran entirely in the browser, with no server-side ML. As the launch post put it, "running machine learning programs entirely client-side in the browser unlocks new opportunities, like interactive ML!"[1]

### Continued development (2018 to 2024)

After the launch, TensorFlow.js development tracked the broader TensorFlow release cadence and added several major capabilities:

- **Node.js bindings (2018):** the `@tensorflow/tfjs-node` and `@tensorflow/tfjs-node-gpu` packages exposed native TensorFlow C++ kernels to JavaScript on servers, with optional CUDA acceleration on NVIDIA GPUs.
- **React Native adapter (February 2020):** the `@tensorflow/tfjs-react-native` package brought GPU-accelerated TFJS to mobile apps via Expo's `expo-gl` and `expo-gl-cpp`.
- **WebAssembly backend (March 2020):** a WASM backend compiled the [XNNPACK](https://github.com/google/XNNPACK) kernel library to WebAssembly, giving CPU inference a large speedup over plain JavaScript. With SIMD (from version 2.1.0) and multithreading (from version 2.3.0, September 2020), the WASM backend became up to 10x faster than its earlier plain-WASM build.[4]
- **WebGPU by default in Chrome (2023):** Google Chrome shipped WebGPU by default in Chrome 113 on May 2, 2023, at which point TensorFlow.js already supported WebGPU-optimized versions of most operators through its WebGPU backend, which uses compute shaders rather than the older fragment-shader trick used by the WebGL backend.[7]
- **WebGPU stabilisation (2024):** the WebGPU backend matured through 2024 alongside Chromium's WebGPU API, with continued kernel coverage and benchmark improvements.
- **Version 4.22.0 (October 21, 2024):** still the latest stable release of the main `@tensorflow/tfjs` umbrella package as of November 2026 (a 4.23.0 release candidate was published in January 2025), with [TypeScript](https://aiwiki.ai/wiki/typescript) as the dominant source language for the project.[9]

In parallel, Google's broader on-device ML stack evolved. The team rebranded TensorFlow Lite as **LiteRT** on September 4, 2024; its FAQ said TensorFlow.js would not change and "will continue to function independently as part of the Tensorflow codebase."[8] On July 9, 2026 Google formally introduced LiteRT.js, a Web AI runtime for LiteRT (`.tflite`) models that it describes as "a powerful evolution from TensorFlow.js for executing .tflite models" and that can be used inside existing TensorFlow.js pipelines.[24]

## Architecture

TensorFlow.js is structured as a small core library plus optional backend modules and higher-level APIs. The pieces fit together in three layers.

### Core API

The **Core API** (`@tensorflow/tfjs-core`) provides low-level tensor operations, similar to [NumPy](https://aiwiki.ai/wiki/numpy) with automatic differentiation added on top. Tensors are immutable and typed; ops include `tf.matMul`, `tf.conv2d`, `tf.add`, `tf.softmax`, and several hundred others. Eager execution is the default, meaning each op runs immediately when called. Automatic differentiation is provided through `tf.grad` and `tf.variableGrads`, allowing custom training loops and gradient-based optimisation outside the high-level API.

The Core API also exposes memory management primitives. Because WebGL textures live outside the JavaScript garbage collector, developers wrap operations in `tf.tidy()` to release intermediate tensors automatically, or call `dispose()` manually on long-lived tensors.

### Layers API

The **Layers API** (`@tensorflow/tfjs-layers`) is a Keras-compatible high-level API for building, training, and saving neural networks. It supports `tf.sequential()` for stacked-layer models and `tf.model()` for arbitrary directed graphs, plus `model.compile`, `model.fit`, `model.evaluate`, and `model.predict` matching Python Keras conventions. Layers include dense, convolutional, recurrent (LSTM, GRU), normalisation, dropout, and embedding variants. Models written with the Layers API can be saved as a `model.json` topology file plus binary weight shards, then loaded in any TFJS environment.

### Backends

A **backend** is a TensorFlow.js plugin that implements the actual numeric kernels. The library can be initialised with a specific backend or it will pick the fastest available one. The table below summarises the main backends and where each is used.

| Backend | Runtime | Acceleration | Typical use |
|---|---|---|---|
| WebGL | Browser | GPU via WebGL 2.0 fragment shaders | Default browser backend; best for medium and large CNNs |
| WebGPU | Browser | GPU via WebGPU compute shaders | Newer browsers; targets best-of-class performance |
| WASM | Browser, Node.js | CPU via compiled XNNPACK kernels with SIMD and threads | Small or quantised models; fallback when GPU is unavailable |
| CPU (Plain JS) | Browser, Node.js | Pure [JavaScript](https://aiwiki.ai/wiki/javascript) | Universal fallback; slow but always available |
| Node.js (CPU) | Node.js | Native TensorFlow C++ kernels | Server-side training and inference |
| Node.js (GPU) | Node.js | Native TensorFlow C++ + [CUDA](https://aiwiki.ai/wiki/cuda) | Server-side training on NVIDIA GPUs |
| React Native | Mobile | GPU via `expo-gl` (WebGL) | iOS and Android apps |

#### WebGL backend

The **WebGL** backend is the original GPU path inherited from deeplearn.js. Tensors are stored as WebGL textures and ops are implemented as fragment shaders that read input textures and write output textures. The MLSys 2019 paper reports the WebGL backend as two orders of magnitude faster than the plain JS CPU backend.[3] Shader programs are compiled lazily on first use and cached, so warm-up cost is paid once per shape.

#### WebGPU backend

The **WebGPU** backend uses the newer WebGPU API, which exposes compute shaders and explicit GPU memory management instead of repurposing the graphics pipeline. The package `@tensorflow/tfjs-backend-webgpu` requires a browser with WebGPU enabled. WebGPU shipped in Chrome 113 on May 2, 2023, and the Chrome team reported "more than three times improvements in machine learning model inferences" relative to WebGL for the same workloads.[7] 

#### WASM backend

The **WASM** backend (`@tensorflow/tfjs-backend-wasm`) compiles Google's XNNPACK kernel library to WebAssembly. With TensorFlow.js 2.3.0 (September 2, 2020), the WASM backend could use both SIMD vector instructions (supported since 2.1.0) and multithreading; Google engineers reported that SIMD delivers a 1.7x to 4.5x speedup over plain WASM, multithreading adds a further 1.8x to 2.9x, and together they make the backend up to 10x faster than before.[4] The benchmark models cited were BlazeFace (about 0.1 million parameters and roughly 20 million multiply-add operations) and MobileNet V2 (about 3.5 million parameters and roughly 300 million multiply-add operations).[4] WASM is on par with or faster than WebGL for small models such as MediaPipe BlazeFace and FaceMesh because it avoids the fixed overhead of compiling shaders. For medium and large CNNs like [MobileNet](https://aiwiki.ai/wiki/mobilenet) and BodyPix, WebGL is generally 2x to 4x faster than WASM.

#### CPU backend

The **CPU** backend is a pure JavaScript implementation, included as a universal fallback when neither WebGL, WebGPU, nor WASM is available. It is slow but works in any JavaScript host.

#### Node.js backend

The **Node.js** backends bind directly to TensorFlow's C++ runtime through Node native add-ons. The CPU package is `@tensorflow/tfjs-node`; the GPU package is `@tensorflow/tfjs-node-gpu` and requires a CUDA-capable NVIDIA GPU and the matching CUDA toolkit. On Node, performance is comparable to Python TensorFlow because both frontends drive the same C++ kernels.

## Capabilities

### Can you train models in the browser with TensorFlow.js?

Yes. TensorFlow.js supports full backpropagation in the browser, which is unusual for a JavaScript ML library and was the headline capability of the March 2018 launch. This enables several patterns that would otherwise require a backend server:

- **Transfer learning** on a frozen backbone such as MobileNet, with a small classifier head trained on user-supplied images.
- **[Federated learning](https://aiwiki.ai/wiki/federated_learning)**, where each client trains locally and only sends gradient updates to a server.
- **On-device personalisation** of recommendation models, gesture detectors, or text predictors using the user's own data without uploading it.

The Layers API exposes the standard `model.fit` workflow, and the Core API exposes `tf.grad` and `tf.variableGrads` for custom training loops.

### Inference

Most real applications load a pretrained model and run inference. TensorFlow.js loads models from a `model.json` file (containing the topology and weight manifest) plus one or more `.bin` shards (containing the weights). The `tf.loadGraphModel` function loads converted TensorFlow SavedModels, and `tf.loadLayersModel` loads converted Keras models or models saved from the TFJS Layers API.

### How do you convert a Python TensorFlow or Keras model to TensorFlow.js?

The **tfjs-converter** is a Python command-line tool, installed via `pip install tensorflowjs`, that converts existing models to the TensorFlow.js web format. Supported source formats include:

| Source format | TFJS loader |
|---|---|
| TensorFlow [SavedModel](https://aiwiki.ai/wiki/savedmodel) | `tf.loadGraphModel` |
| Keras HDF5 (`.h5`) | `tf.loadLayersModel` |
| TensorFlow Hub modules | `tf.loadGraphModel` |
| [PyTorch](https://aiwiki.ai/wiki/pytorch) (indirectly: export to ONNX, convert to a TensorFlow SavedModel, then convert) | `tf.loadGraphModel` |

The converter writes a directory containing `model.json` and sharded weight files, with shards typically capped at 4 MB each so they cache well in browsers.

## What pre-trained models does TensorFlow.js offer?

Google maintains a separate repository, `tensorflow/tfjs-models`, of [pre-trained model](https://aiwiki.ai/wiki/pre-trained_model)s published as npm packages under the `@tensorflow-models/*` scope. The most commonly used models are listed below.

| Model | Task | Notes |
|---|---|---|
| **MoveNet** | Single-person [pose estimation](https://aiwiki.ai/wiki/pose_estimation) | 17 keypoints; 30+ fps on most modern devices; Lightning and Thunder variants[6] |
| **PoseNet** | Multi-person [pose estimation](https://aiwiki.ai/wiki/pose_estimation) | Older single- and multi-pose model; superseded by MoveNet for single-pose use |
| **BodyPix** | Person and body-part segmentation | 24-part segmentation; used for backgrounds and AR effects |
| **HandPose** | Hand landmark detection | 21 keypoints per hand; predicts handedness |
| **Face Landmarks Detection** | Face mesh and attention | Builds on [MediaPipe](https://aiwiki.ai/wiki/mediapipe) Face Mesh |
| **Face Detection** | Face bounding-box detection | Lightweight detector for camera streams |
| **[MobileNet](https://aiwiki.ai/wiki/mobilenet)** | [Image classification](https://aiwiki.ai/wiki/image_classification) | [ImageNet](https://aiwiki.ai/wiki/imagenet) labels; small enough to fit in a few megabytes |
| **COCO-SSD** | [Object detection](https://aiwiki.ai/wiki/object_detection) | Single Shot MultiBox Detector trained on COCO |
| **Universal Sentence Encoder** | Text embeddings | 512-dimensional sentence embeddings for similarity and classification |
| **Speech Commands** | Keyword spotting | Recognises a small set of voice commands from microphone audio |
| **KNN Classifier** | Nearest-neighbour classifier | Used as a head for [transfer learning](https://aiwiki.ai/wiki/transfer_learning) on top of [MobileNet](https://aiwiki.ai/wiki/mobilenet) features |
| **Toxicity** | Toxic comment classification | Multi-label classifier for offensive language |

MoveNet, released on May 17, 2021, is the flagship pose model: it detects 17 body keypoints, ships in a latency-optimised Lightning variant and an accuracy-optimised Thunder variant, and runs faster than real time (30+ fps) on most modern desktops, laptops, and phones.[6]

In addition, **Magenta.js** (`@magenta/music`) is a JavaScript port of Google's Magenta research library for music and art generation. It uses TensorFlow.js for GPU-accelerated inference and ships browser-compatible implementations of MusicVAE ([variational autoencoder](https://aiwiki.ai/wiki/variational_autoencoder) for melodies, drums, and trios), MusicRNN (LSTM-based MelodyRNN, DrumsRNN, ImprovRNN, PerformanceRNN), and GANSynth (GAN-based audio synthesis). Most Magenta.js models can run inside a Web Worker; GANSynth and Onsets and Frames need direct access to the page's `AudioContext` to synthesise audio.

## Common use cases

TensorFlow.js is used for tasks that benefit from running models close to the user. The most common categories are:

- **Interactive in-browser ML demos**, such as Google's Teachable Machine, which lets non-programmers train an image, audio, or pose classifier from webcam samples and export it for use in TensorFlow.js, TensorFlow Lite, or full TensorFlow.
- **Client-side image and video processing** for video calls and creative tools, including background blur, virtual backgrounds, body-part masks, and AR filters layered on top of camera streams.
- **Edge inference for privacy**, where sensitive data such as health images, personal text, or biometric signals never leaves the device. This is closely related to broader [edge AI](https://aiwiki.ai/wiki/edge_ai) and [edge computing](https://aiwiki.ai/wiki/edge_computing) trends in machine learning.
- **Educational tools** like the TensorFlow Playground and Distill articles, which use small TFJS models to illustrate [gradient descent](https://aiwiki.ai/wiki/gradient_descent), [activation function](https://aiwiki.ai/wiki/activation_function)s, and other ML concepts in the browser.
- **Real-time pose, face, and gesture recognition** for AR overlays, fitness apps, and accessibility input. MoveNet suits this because it runs faster than real time (30+ fps) on most modern devices.[6]
- **Web-based games and creative tools**, including procedural music generators and webcam-controlled experiences such as the original PAC-MAN demo.
- **Hybrid offline-first apps** that run inference locally when the network is unavailable and synchronise results once it returns.

## Performance characteristics

The practical performance of TensorFlow.js depends heavily on the chosen backend, the model architecture, and the device. Some rough numbers, drawn from the TensorFlow.js team's own benchmarks and blog posts:

- **WebGL versus CPU:** the WebGL backend has been measured at roughly 100x faster than the plain JS CPU backend on typical CNNs. In the official platform guide's benchmark (TensorFlow.js 1.5.2, Chrome on a 2018 MacBook Pro), MobileNet v2 took 37 ms on WebGL versus 923.6 ms on the plain JS backend.[12]
- **WebGL versus WASM:** for medium and large CNNs (MobileNet, BodyPix, PoseNet), WebGL is generally 2x to 4x faster than WASM. For very small models such as MediaPipe BlazeFace and FaceMesh, WASM can match or beat WebGL because it avoids shader-compilation overhead.
- **WASM versus plain JS:** the WASM launch post measured the (pre-SIMD) WASM backend at 10x to 30x faster than the plain JS backend across its models,[16] and SIMD plus multithreading later made it up to 10x faster again.[4] In a 2020 W3C workshop talk, the team put the WASM speedup over plain JS for MobileNet at 3x to 11x across devices.[23]
- **WebGPU versus WebGL:** the Chrome team said at launch that WebGPU brings "more than three times improvements in machine learning model inferences" compared with WebGL.[7]
- **Mobile browsers:** performance varies widely by device GPU. iOS Safari historically had stricter WebGL limits than desktop Chrome, which sometimes forces fallback to WASM.
- **Node.js with native bindings:** because `tfjs-node` and `tfjs-node-gpu` call the same C++ kernels as Python TensorFlow, performance is comparable to native Python TensorFlow on the same hardware.

Memory bandwidth is often the bottleneck for the WebGL backend rather than floating-point throughput, because each op fetches input textures and writes output textures rather than fusing kernels the way a native CUDA implementation would.

## How does TensorFlow.js compare with other browser ML libraries?

A number of JavaScript libraries target client-side ML, with different trade-offs in vendor support, model formats, and focus.

| Library | Vendor | Year | Backends | Model formats | Focus |
|---|---|---|---|---|---|
| **TensorFlow.js** | [Google](https://aiwiki.ai/wiki/google) | 2018 | WebGL, WebGPU, WASM, CPU, Node native | TFJS, [SavedModel](https://aiwiki.ai/wiki/savedmodel) via converter, [Keras](https://aiwiki.ai/wiki/keras) `.h5` | General-purpose ML in browser, Node, and React Native |
| **ONNX Runtime Web** | [Microsoft](https://aiwiki.ai/wiki/microsoft) | 2021 | WebGL, WebGPU, WebNN, WASM | ONNX | Cross-framework inference; pairs with [PyTorch](https://aiwiki.ai/wiki/pytorch) via ONNX export |
| **Transformers.js** | [Hugging Face](https://aiwiki.ai/wiki/hugging_face) | 2023 | Built on ONNX Runtime Web (WebGPU, WASM) | ONNX-converted Hugging Face models | NLP and vision pipelines mirroring Python `transformers` |
| **ml5.js** | NYU ITP / community | 2018 | Built on TensorFlow.js | TFJS-compatible models | Friendly API for artists and educators |
| **brain.js** | Community | 2015 | CPU, WebGL via gpu.js | Internal | Simple feed-forward and recurrent networks |
| **ConvNetJS** | [Andrej Karpathy](https://aiwiki.ai/wiki/andrej_karpathy) | 2014 | CPU only | Internal | Educational; pre-deeplearn.js era |
| **Synaptic** | Community | 2014 | CPU only | Internal | Architecture-free recurrent networks |
| **LiteRT.js** | [Google](https://aiwiki.ai/wiki/google) | 2025 | WebGPU, WASM, WebNN | LiteRT (`.tflite`) | Browser path for the [TensorFlow Lite (LiteRT)](https://aiwiki.ai/wiki/tensorflow_lite) ecosystem |

Transformers.js and ONNX Runtime Web have taken much of the LLM and transformer-inference traffic that might otherwise have gone to TensorFlow.js, in part because most large open-weight models are released first as [PyTorch](https://aiwiki.ai/wiki/pytorch) checkpoints and exported to ONNX rather than to the TFJS native format. TensorFlow.js remains the more natural choice for projects that already live in the TensorFlow or Keras ecosystem, for in-browser training, and for the rich tfjs-models pretrained library.

## Notable applications

- **Teachable Machine** (`teachablemachine.withgoogle.com`): Google's no-code in-browser tool for training image, sound, and pose classifiers. The current version supports three input types (images and videos, sounds, body positions). All training happens locally; the tool exports models for use in TensorFlow.js, TensorFlow Lite, or full TensorFlow.
- **PoseNet and MoveNet demos**: Google has released several real-time pose tracking demos using TensorFlow.js, including dance, fitness, and accessibility applications.
- **Magenta.js music tools**: browser-based music sketches such as Latent Loops, Beat Blender, and Tone Transfer use Magenta.js and TFJS to run generative music models without a server.
- **AR filters and TikTok-style web filters**: many web-based filter pipelines run BodyPix or Face Landmarks Detection through TFJS to compose effects on top of camera streams.
- **In-browser [reinforcement learning](https://aiwiki.ai/wiki/reinforcement_learning) demos**: TensorFlow.js has been used to run small Atari-style RL agents and policy-gradient demos that train in front of the user.
- **Body language and ergonomics analysis tools**: posture-tracking webapps use MoveNet and BodyPix to give feedback during exercise or office work without sending video to a server.

## What are the limitations of TensorFlow.js?

TensorFlow.js is constrained by the browser sandbox more than by anything intrinsic to its design.

- **Memory limits.** Browsers cap the amount of memory a tab can use, often around 2 GB on desktop and much less on mobile. WebGL further caps the maximum texture size, which limits the largest activations a model can hold.
- **Single JavaScript thread.** Without Web Workers or the WASM backend's threadpool, all computation runs on the page's main thread, which makes the UI sluggish during heavy training.
- **GPU access is constrained.** WebGL and WebGPU expose less of the underlying GPU than native CUDA does. Features such as fused kernels, persistent kernel launches, and [tensor core](https://aiwiki.ai/wiki/tensor_core)s are not directly accessible.
- **First-load model size.** Models in the 10 MB to 50 MB range are practical for fast first-load over the network, with weight shards cached by the browser. Multi-hundred-megabyte models load slowly on first visit.
- **LLM-scale models.** TensorFlow.js is not the typical choice for in-browser [large language model](https://aiwiki.ai/wiki/large_language_model)s. Most browser LLM demos use Transformers.js on top of ONNX Runtime Web, with quantised weights and WebGPU compute shaders.
- **Cross-browser quirks.** WebGL behaviour varies between Chrome, Firefox, and Safari; WebGPU support is still uneven across mobile browsers, especially on iOS.
- **Native TensorFlow gaps.** The kernel coverage of the WebGL and WebGPU backends lags behind TensorFlow's native C++ kernels, so some operations from imported SavedModels fall back to the CPU.

## Recent developments (2023 to 2026)

- **WebGPU backend.** Chrome 113 shipped WebGPU by default in May 2023, when TensorFlow.js already supported WebGPU-optimized versions of most operators.[7]
- **Transformer support.** TensorFlow.js has improved support for transformer architectures, but [Hugging Face](https://aiwiki.ai/wiki/hugging_face)'s Transformers.js has emerged as a popular alternative for browser LLM and transformer inference, often built on ONNX Runtime Web instead of TFJS.
- **LiteRT.js.** Google rebranded TensorFlow Lite as LiteRT on September 4, 2024,[8] and on July 9, 2026 formally introduced LiteRT.js, a Web AI runtime for `.tflite` models that it describes as an evolution from TensorFlow.js for that use, contrasting it with TensorFlow.js's "less performant JavaScript-based kernels."[24]
- **Slower release cadence.** As of November 2026, version 4.22.0 (October 2024) remains the latest stable release of `@tensorflow/tfjs`, with only a 4.23.0 release candidate since (January 2025), and commits to the `tensorflow/tfjs` repository have been sparse since mid-2025.[9][10]

## Integration

TensorFlow.js is framework-agnostic and works with React, Vue, Angular, Svelte, and vanilla JavaScript. Two installation paths are common:

- **NPM:** `npm install @tensorflow/tfjs` adds the umbrella package, which includes the Core API, Layers API, default browser backends (WebGL, CPU), and the Data and Vis utilities. Specific backends can be installed separately, for example `@tensorflow/tfjs-backend-webgpu` or `@tensorflow/tfjs-backend-wasm`.
- **CDN:** loading `<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs"></script>` from a CDN gives a `window.tf` global without a build step, which is convenient for prototyping.

The library is written in TypeScript and ships its own type definitions, so editors can autocomplete [tensor shape](https://aiwiki.ai/wiki/tensor_shape)s and op names. Tree-shaking is supported when importing only the kernels and ops a project uses.

## License and governance

TensorFlow.js is released under the Apache 2.0 license, the same license as the rest of the TensorFlow ecosystem. The project is governed by Google with significant external contributions; the source lives at `github.com/tensorflow/tfjs`. Pre-trained models live in the parallel `tensorflow/tfjs-models` repository, also under Apache 2.0.

## References

1. TensorFlow Blog. "Introducing TensorFlow.js: Machine Learning in JavaScript." March 30, 2018. https://blog.tensorflow.org/2018/03/introducing-tensorflowjs-machine-learning-javascript.html
2. TensorFlow.js Official Site. https://www.tensorflow.org/js
3. Smilkov, Daniel, Nikhil Thorat, et al. "TensorFlow.js: Machine Learning for the Web and Beyond." Proceedings of MLSys 2019, pp. 309-321. arXiv:1901.05350. https://arxiv.org/abs/1901.05350
4. Yuan, Ann, and Marat Dukhan. "Supercharging the TensorFlow.js WebAssembly backend with SIMD and multi-threading." TensorFlow Blog, September 2, 2020. https://blog.tensorflow.org/2020/09/supercharging-tensorflowjs-webassembly.html
5. Google Research Blog. "Harness the Power of Machine Learning in Your Browser with deeplearn.js." August 11, 2017. https://research.google/blog/harness-the-power-of-machine-learning-in-your-browser-with-deeplearnjs/
6. TensorFlow Blog. "Next-Generation Pose Detection with MoveNet and TensorFlow.js." May 17, 2021. https://blog.tensorflow.org/2021/05/next-generation-pose-detection-with-movenet-and-tensorflowjs.html
7. Beaufort, François, and Corentin Wallez. "Chrome ships WebGPU." Chrome for Developers Blog, April 6, 2023. https://developer.chrome.com/blog/webgpu-release
8. Google Developers Blog. "TensorFlow Lite is now LiteRT." September 4, 2024. https://developers.googleblog.com/en/tensorflow-lite-is-now-litert/
9. TensorFlow.js Releases. "tfjs v4.22.0." GitHub, October 21, 2024. https://github.com/tensorflow/tfjs/releases
10. TensorFlow.js GitHub Repository. https://github.com/tensorflow/tfjs
11. TensorFlow.js Models GitHub Repository. https://github.com/tensorflow/tfjs-models
12. TensorFlow.js Guide: Platform and Environment. https://www.tensorflow.org/js/guide/platform_environment
13. TensorFlow.js Guide: Models and Layers. https://www.tensorflow.org/js/guide/models_and_layers
14. TensorFlow.js Guide: Node.js. https://www.tensorflow.org/js/guide/nodejs
15. TensorFlow.js Guide: Model Conversion. https://www.tensorflow.org/js/guide/conversion
16. TensorFlow Blog. "Introducing the WebAssembly backend for TensorFlow.js." March 2020. https://blog.tensorflow.org/2020/03/introducing-webassembly-backend-for-tensorflow-js.html
17. TensorFlow Blog. "TensorFlow.js for React Native is here!" February 2020. https://blog.tensorflow.org/2020/02/tensorflowjs-for-react-native-is-here.html
18. Magenta.js Documentation. https://magenta.github.io/magenta-js/music/
19. Magenta.js GitHub Repository. https://github.com/magenta/magenta-js
20. Teachable Machine. https://teachablemachine.withgoogle.com/
21. Hugging Face Transformers.js Documentation. https://huggingface.co/docs/transformers.js/index
22. ONNX Runtime Web Documentation. https://onnxruntime.ai/docs/tutorials/web/
23. W3C Workshop on Web and Machine Learning: "Fast client-side ML with TensorFlow.js." 2020. https://www.w3.org/2020/06/machine-learning-workshop/talks/fast_client_side_ml_with_tensorflow_js.html
24. Google Developers Blog. "LiteRT.js, Google's high performance Web AI Inference." July 9, 2026. https://developers.googleblog.com/litertjs-googles-high-performance-web-ai-inference/

