TopGit
GitHub Repo Review

Keras 3: the multi-backend deep learning framework

KTopGit review image for keras-team/keras
Review by Topgit.dev for keras-team/keras, with GitHub repository stats and README context.
Quick verdict

Keras 3 does one thing well: it lets you write a model once and run it on JAX, TensorFlow, or PyTorch without touching the training loop. The catch is you pick a backend before importing the package, and mixing in backend-specific code defeats the purpose. For teams already on tf.keras, upgrading is close to a rename; for a PyTorch shop chasing JAX's speed, it's the honest way in.

Stars
★ 64.3k
Forks
⑂ 19.8k
Contributors
👥 1.5k
Language
Python
License
Apache-2.0
Topic
AI Tools
Updated
Sep 2026
Homepage
GitHub

What is Keras 3?

Keras 3 is a multi-backend deep learning framework that runs the same Python API on top of JAX, TensorFlow, or PyTorch, with an inference-only OpenVINO backend for deployment. Earlier Keras versions shipped bundled inside TensorFlow as tf.keras, tied to that one engine; Keras 3 splits the API from the execution engine so the backend is a choice per project, not a fixed dependency.

Key features of Keras 3

  • Runs unmodified on JAX, TensorFlow, or PyTorch — set KERAS_BACKEND (env var or ~/.keras/keras.json) before importing keras, and the same model code executes on whichever engine you picked.
  • Custom layers, models, and metrics written against the Keras API can drop into a raw training loop written in native TF, JAX, or PyTorch.
  • Accepts tf.data.Dataset pipelines or PyTorch DataLoaders as input regardless of which backend is active.
  • Ships a .keras model save format the README positions as the successor to the older TensorFlow SavedModel path for tf.keras users.
  • OpenVINO backend for inference-only deployment, separate from the three training-capable backends.
  • Existing tf.keras models without custom components run on JAX or PyTorch with no code changes; ones with a custom train_step or custom layers usually need a small backend-agnostic rewrite.
How this repository's GitHub stars have grown over time. Source: star-history.com.View the star history

Installing Keras 3 and choosing a backend

Install Keras 3 from PyPI with `pip install keras --upgrade`, then add one backend package on top: `tensorflow`, `jax`, or `torch`. The OpenVINO backend installs separately and only covers inference, not training. Keras 2 is still available, packaged separately as `tf-keras`, if you're not ready to move. Keras 3 supports Linux and macOS directly; on Windows, the README points to WSL2. Minimum backend versions per the compatibility table: TensorFlow 2.16.1, JAX 0.4.20, PyTorch 2.1.0, OpenVINO 2026.2.0. Building from source: install `requirements.txt`, run `python pip_build.py --install` from the repo root, and run `./shell/api_gen.sh` if your PR touches the `keras_export` public APIs. For GPU support, the plain `requirements.txt` only pulls CPU wheels — you need the backend-specific `requirements-{backend}-cuda.txt` file, and the README recommends a separate environment per backend (its example uses `conda create -n keras-jax python=3.10`) to avoid CUDA version conflicts between backends.

Writing backend-agnostic code with Keras 3

Set the backend before you import anything: export `KERAS_BACKEND=jax` (or `tensorflow`/`torch`) in your shell, or edit the `backend` key in `~/.keras/keras.json`. In a notebook like Colab, set `os.environ["KERAS_BACKEND"]` before the `import keras` line. Once imported, the backend is locked for that process. If you're moving an existing tf.keras project, the README calls Keras 3 a drop-in replacement on the TensorFlow backend: switch `model.save()` calls to the `.keras` format and the rest should work unchanged. A model with no custom layers or custom train_step often runs on JAX or PyTorch immediately with zero code changes; one with custom components usually needs a short rewrite to a backend-agnostic form, which the README describes as normally taking a few minutes rather than a rearchitecture. Data loading isn't backend-locked either — the same model can consume a tf.data.Dataset pipeline or a PyTorch DataLoader, regardless of which of the three training backends is active.

Strengths

  • Backend switching is a one-line env var or config change, not a rewrite, once a model avoids custom train_step or custom layer code.
  • Same model code trains on tf.data.Dataset pipelines or PyTorch DataLoaders — no need to standardize on one data-loading library.
  • tf.keras projects that stick to the standard layer set convert with essentially a version bump, per the README.
  • Custom Keras components can be dropped into a raw TensorFlow, JAX, or PyTorch training loop instead of Keras's own fit() call, for teams that want low-level control without giving up the layer API.

Known limitations of Keras 3

  • The backend has to be set before the first import keras (via KERAS_BACKEND or ~/.keras/keras.json) and stays fixed for that process — no running TensorFlow and JAX side by side in the same script.
  • OpenVINO only covers model.predict() inference — you still need TensorFlow, JAX, or PyTorch to actually train a model.
  • Custom train_step implementations or custom layers from an existing tf.keras project aren't automatically portable — converting them to run on another backend is a manual step, not a flag you flip.
  • GPU installs require picking the right requirements-{backend}-cuda.txt file and, per the README, a separate environment per backend to avoid CUDA conflicts — real setup friction if you want more than one backend's GPU stack installed at once.

Alternatives to Keras 3

Frequently asked questions

What backends does Keras 3 support?

Keras 3 runs on four backends: TensorFlow, JAX, and PyTorch for full training, plus OpenVINO for inference-only workloads. You choose one per process by setting the KERAS_BACKEND environment variable or editing the ~/.keras/keras.json config file, and the choice has to happen before you import the keras package.

Can I use my existing tf.keras code with Keras 3?

Existing tf.keras code is meant to work with Keras 3 as a drop-in replacement as long as you stay on the TensorFlow backend, per the README — just make sure model.save() calls use the newer .keras format. Models without custom layers or a custom train_step can also run on the JAX or PyTorch backend right away.

How do I switch between TensorFlow, JAX, and PyTorch backends in Keras 3?

Switching backends in Keras 3 means setting the KERAS_BACKEND environment variable, or the backend key in ~/.keras/keras.json, to `tensorflow`, `jax`, or `torch` before you import the keras package — the backend can't change again once the package is imported in that process.

Is Keras 3 production-ready and stable?

Keras 3 ships as a stable release with a documented backend-compatibility table (minimum TensorFlow 2.16.1, JAX 0.4.20, PyTorch 2.1.0, OpenVINO 2026.2.0), and the README positions it as a drop-in replacement for the production tf.keras path on the TensorFlow backend. Stability on JAX or PyTorch depends on whether your model uses only standard Keras components.

How does Keras 3 performance compare to native TensorFlow or PyTorch?

Keras 3's README claims performance gains between 20% and 350% relative to other frameworks, depending on which backend you pick for a given model architecture — often JAX, per the README's linked benchmark page. Actual gains vary by model and backend, so treat that benchmark page as the place to check for your specific architecture.

What is the license for Keras 3?

Keras 3 is released under the Apache-2.0 license, a permissive open-source license that allows commercial use, modification, and redistribution as long as you keep the license notice and don't imply endorsement by the Keras project. The GitHub repository lists Apache-2.0 as its only license.

The problem it solves

A model built with tf.keras only runs on TensorFlow's engine, and a model built with native PyTorch or Flax/JAX only runs on that engine — so a team that picks TensorFlow early and later wants JAX's training speed, or vice versa, ends up rewriting the model-building code, not just the training script. Keras 3 exists to decouple the layer and model API from the execution engine so that rewrite isn't necessary.

Best use cases

  • Migrating an existing tf.keras project off TensorFlow lock-in without a full rewrite.
  • Prototyping on PyTorch's eager execution, then moving the same model to JAX for a faster training run.
  • Building a single codebase for vision, NLP, audio, or timeseries models that still has to run on backend-specific infrastructure.
  • Deploying trained models for inference only via the OpenVINO backend.

Who should try it — and who should skip

Try Keras 3 if you already write tf.keras-style code and want the option to train on JAX or PyTorch without maintaining three separate model definitions, or if you're picking a first deep learning framework and want to defer the TensorFlow-vs-PyTorch decision. Skip it if your team has deep, framework-specific code already built around raw PyTorch modules or JAX's functional style — Keras's layer and model abstraction sits on top of that and adds a translation layer you may not need. Also skip it for anything beyond inference on OpenVINO, since that backend can't train.

Related repositories

Source & attribution

Based on the keras-team/keras GitHub repository, including its README and backend-compatibility documentation.

GitHub data · last synced Aug 14, 2026Reviewed by Henry
Back to TopGit

Curious whether keras is right for you?

Let ChatGPT, Claude, or Perplexity look into it — click below and see what AI actually says about keras.

GitHub