KerasFormers: A Deep Dive into the Pure Keras 3 Cross-Framework Pretrained Transformer Model Library

KerasFormers delivers pretrained Transformers in pure Keras 3 that run on JAX, PyTorch, and TensorFlow.
KerasFormers is a new library offering pretrained Transformer models written entirely in Keras 3, enabling developers to run the same model code across JAX, PyTorch, and TensorFlow backends without modification. Built on Keras 3's multi-backend architecture, it eliminates framework lock-in, simplifies migration, and provides deployment flexibility—letting teams train on one backend and serve on another.
A "Write Once, Run Anywhere" Transformer Library
In today's deeply fragmented deep learning framework landscape, developers are often forced to choose between PyTorch, TensorFlow, and JAX—a choice that frequently means rewriting code, switching ecosystems, and migrating models. KerasFormers, which recently climbed to #8 on Product Hunt (earning 73 upvotes), aims to solve this pain point.
According to its official positioning, KerasFormers is "a collection of pretrained models built into Keras 3," with a core value proposition: pretrained Transformer models written in pure Keras 3 that can run simultaneously on JAX, PyTorch, and TensorFlow backends.

The Transformer referenced here is the deep learning architecture proposed by a Google team in their 2017 paper Attention Is All You Need. Its core innovation—the Self-Attention mechanism—allows models to attend to all positions in the input simultaneously when processing sequential data, overcoming the sequential dependency bottleneck of traditional RNN/LSTM architectures. Today, Transformers serve as the foundational architecture behind virtually all cutting-edge AI models including GPT, BERT, and Vision Transformer—their importance cannot be overstated.
This means developers only need to write model code once, then freely switch the underlying compute engine based on deployment environment, performance requirements, or team tech stack—without restructuring the higher-level logic. This is precisely the key capability unlocked by Keras 3's "multi-backend" architecture, and KerasFormers applies it to the Transformer—today's most dominant model architecture.
Keras 3 Multi-Backend Architecture: The Technical Foundation for Cross-Framework Execution
Why Multi-Backend Capability Matters So Much
To understand KerasFormers' value, you must first understand the architectural innovation of Keras 3.
Keras dates back to 2015, created by François Chollet, originally as a high-level neural network API supporting both Theano and TensorFlow as backends. In 2019, Keras was officially integrated as TensorFlow's high-level API (tf.keras), becoming deeply coupled with TensorFlow. Keras 3, released in late 2023, underwent an architectural rewrite that returned to the multi-backend design philosophy—a shift marking Keras's strategic pivot from single-framework binding back to framework-agnostic positioning.
Traditionally, Keras was tightly bound to TensorFlow. Keras 3 abstracts backends into pluggable components—the same Keras code can seamlessly switch between JAX, PyTorch, and TensorFlow.
JAX is a numerical computing library developed by Google, achieving high-performance computation through the XLA (Accelerated Linear Algebra) compiler. JAX's core features include automatic differentiation (arbitrary-order derivatives via the grad function), JIT compilation (just-in-time compilation of Python functions into optimized machine code), automatic vectorization (vmap), and native TPU support. Its functional programming paradigm excels in large-scale distributed training and has been widely adopted by top research teams like DeepMind. PyTorch, with its dynamic computation graphs and intuitive debugging experience, has become the mainstream choice in the research community, while TensorFlow boasts the most mature ecosystem for industrial-grade deployment (TensorFlow Serving, TensorFlow Lite, etc.).
This design delivers several direct benefits:
- Framework-agnostic model definition: Teams don't need to compromise model design for a particular framework's ecosystem.
- Leveraging each backend's strengths: Use JAX for training speed (with XLA compilation and TPU clusters), then switch to TensorFlow Serving for mature serving capabilities during deployment.
- Dramatically reduced migration costs: Moving from PyTorch to JAX no longer requires rewriting the entire training pipeline.
KerasFormers' Position in the Ecosystem
KerasFormers is built on top of Keras 3's multi-backend foundation, focusing specifically on providing ready-to-use pretrained Transformer models. For developers, this eliminates the tedious work of implementing attention mechanisms, positional encoding, layer normalization, and other components from scratch—delivering verified model weights and architectures that run across frameworks out of the box.
The project was built by developer Gitesh Chawda and is categorized under tags including "Developer Tools," "Artificial Intelligence," "GitHub," and "Tech"—clearly targeting machine learning engineers and researchers.
What KerasFormers Means for Developers
Eliminating Deep Learning Framework Lock-in
Framework lock-in has long been a hidden cost in AI engineering. Once a team accumulates substantial code assets on a particular framework, switching costs skyrocket.
This lock-in extends beyond code-level migration overhead to encompass team skill sets, CI/CD pipelines, model serialization formats (such as PyTorch's .pt vs. TensorFlow's SavedModel), deployment infrastructure, and a cascade of upstream and downstream dependencies. For example, a team deeply invested in PyTorch that wants to migrate to JAX for TPU training advantages might need to rewrite data loading pipelines, training loops, distributed strategies, model checkpoint saving, and nearly every other component—often requiring months of effort.
KerasFormers, through Keras 3's abstraction layer, minimizes this lock-in risk—your Transformer models no longer depend on any single backend.
An Ideal Choice for Education and Rapid Experimentation
For teaching, prototype validation, and rapid experimentation scenarios, pure Keras 3 implementations are typically more concise and readable than native code from lower-level frameworks. KerasFormers enables learners to understand how Transformers work under a unified high-level API—including how multi-head attention computes Query/Key/Value, how positional encoding injects sequence order information, and how residual connections and layer normalization stabilize deep network training—without getting bogged down in implementation differences across frameworks.
Deployment Flexibility in Production
In production environments, "which framework for training" and "which framework for inference" are often two independent decisions. Being able to freely choose the inference backend after training provides additional room for performance optimization and hardware adaptation (TPU, GPU, CPU). For example, a research team might use JAX to complete large-scale pretraining on TPU Pods, then seamlessly switch the same model to the TensorFlow backend for TensorFlow Lite quantized deployment on mobile devices, or switch to the PyTorch backend to leverage TorchScript for server-side inference optimization.
Limitations Analysis and Future Outlook
As an emerging project, KerasFormers is still in its early stages (with only 1 comment on Product Hunt). Its model coverage breadth, community activity, and competitive standing against mature ecosystems like Hugging Face Transformers all require time to prove.
Compared to Hugging Face's massive model library and community (hosting over 500,000 models as of 2024), KerasFormers' differentiated advantage lies in true cross-framework portability. Notably, while Hugging Face Transformers also claims to support PyTorch, TensorFlow, and JAX, its approach involves writing separate model code for each framework (e.g., modeling_bert.py for PyTorch, modeling_tf_bert.py for TensorFlow), rather than truly running a single codebase across backends. This means there can be implementation differences between framework versions, feature parity gaps, and unsynchronized bug fixes. KerasFormers, through Keras 3's unified abstraction, fundamentally avoids this problem—the same code is the code running on all backends. This is also the key to whether it can establish a foothold in the crowded pretrained model space.
For teams already using Keras 3, or those seeking to maintain technical flexibility in multi-framework environments, KerasFormers is worth adding to your technology radar for ongoing observation. It represents a pragmatic engineering philosophy: rather than debating which framework is best, build an abstraction layer that eliminates the need to choose.
Related articles

Reverse Engineering in Practice: Identifying the Mersenne Twister Algorithm in a 15-Year-Old Game
A developer identified a hidden Mersenne Twister implementation in a 15-year-old game binary via magic constants. Learn the algorithm's traits, reverse engineering methods, and security implications.

Cash Back Captain: Optimizing Credit Card Cash Back Combinations with Mathematical Models
Cash Back Captain is a math-based credit card cash back optimizer that analyzes your spending habits to recommend the best 1-3 card combo, free from affiliate marketing bias.

Speko: A Unified Routing Platform for Voice AI — Building the OpenRouter for Speech
Speko, a YC S26 startup, positions itself as the OpenRouter for voice AI. Its unified API aggregates multiple speech providers for STT, TTS, and more, reducing integration costs and vendor lock-in.