← all repositories
keras-team/keras

Keras 3: pick your fighter (JAX, PyTorch, or TensorFlow)

The familiar high-level API now runs on three major backends, letting you swap execution engines without rewriting model code.

64.1k stars Python ML FrameworksLanguage Models
keras
Velocity · 7d
+16
★ / day
Trend
steady
star history

What it does Keras 3 is a deep learning framework that abstracts model building and training across JAX, TensorFlow, PyTorch, and OpenVINO (inference-only). You write Keras code once, set an environment variable or config flag, and run it on your backend of choice. It covers the usual suspects: CV, NLP, audio, timeseries, recommenders.

The interesting bit The real maneuver is backend-agnostic custom components. A Keras model or layer can drop into native PyTorch Modules, JAX functions, or TensorFlow loops without translation layers. That means you can keep the ergonomic Keras API for model definition but still hand-write a JAX training loop when you need fine-grained control. The README claims 20–350% speedups by picking the fastest backend per architecture, with benchmarks linked.

Key highlights

  • Swap backends via KERAS_BACKEND env var or ~/.keras/keras.json; must be set before import keras
  • Intended drop-in replacement for tf.keras when using TensorFlow backend (update .keras save format)
  • Models consume tf.data.Dataset, PyTorch DataLoader, or presumably anything you wrap — backend doesn’t dictate data pipeline
  • OpenVINO backend is inference-only via model.predict()
  • GPU support requires separate per-backend CUDA requirements files; README recommends isolated environments to avoid version conflicts

Caveats

  • Backend choice is locked at import time; no runtime switching
  • Windows officially unsupported natively; WSL2 recommended
  • Custom tf.keras components (custom layers, train_step()) need manual conversion to backend-agnostic form, though README says “usually possible in just a few minutes”

Verdict Worth a look if you’re tired of framework lock-in but don’t want to abandon high-level APIs. PyTorch and JAX users who envied Keras’s ergonomics get a clear entry point; pure TensorFlow shops already using tf.keras can treat this as a gradual migration path. If you’re deeply invested in one backend’s native ecosystem and never look elsewhere, the abstraction may not pay its rent.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.