Keras 3.0's Major Speed Boost Over Keras 2

Keras 3.0 consistently outperforms Keras 2 across all benchmarked models, with substantial speed increases including a remarkable 380% boost for SegmentAnything inference, over 150% for StableDiffusion training, and over 100% for BERT training, even when using the TensorFlow backend.

The top 3

  1. Keras 3.0's Benchmark Speed Gains: Up to 380% Faster: Keras 3.0 significantly outperforms Keras 2, with benchmarks showing a remarkable 380% speed boost for SegmentAnything inference, over 150% for StableDiffusion training, and more than 100% for BERT training throughput, even when using the TensorFlow backend.
  2. Core Optimizations Driving Keras 3.0's Performance Edge: The speed boost in Keras 3.0 stems from several architectural enhancements, including default Just-In-Time (JIT) compilation via XLA on GPUs, a redesigned `fit()` loop optimized for JAX's JIT, and a unified `keras.ops` layer that leverages native backend operations and specialized features like Flash Attention.
  3. Backend Performance Race: JAX Often Leads, But No Single Winner: Keras 3.0's multi-backend flexibility means performance varies significantly by model and chosen backend; while JAX often delivers the best training and inference performance on GPU, TPU, and CPU, non-XLA TensorFlow can sometimes be faster on GPU, demonstrating that no single backend consistently outperforms the others.

Sources

Open the full topic