PyTorch vs TensorFlow used to be a close call. Going into 2027 it is not. PyTorch is where new deep learning work happens: it shipped eight releases in 2026, it is the only backend of Hugging Face Transformers v5, and Google itself now recommends Keras 3, JAX or PyTorch for new generative AI projects. TensorFlow still runs a lot of production systems and its mobile runtime, now called LiteRT, is very much alive, but the core framework has moved to a maintenance footing.
That does not make TensorFlow worthless, and it does not mean every team should migrate tomorrow. This comparison looks at seven differences that matter when you choose, with release data I pulled from PyPI and commit history I counted from each project’s Git repository. It ends with a decision guide for each kind of reader.

Key takeaways
- For new projects in 2027, choose PyTorch unless you have a specific reason not to.
- In March 2026 Google said TensorFlow will focus on security fixes, critical bugs and dependency updates, and pointed new generative AI work to Keras 3, JAX and PyTorch.
- PyTorch published eight releases in 2026 up to version 2.15. TensorFlow published one, version 2.21.
- Hugging Face Transformers v5 (December 2025) uses PyTorch as its sole backend and is sunsetting TensorFlow and Flax support.
- TensorFlow still makes sense for existing TF systems, TF Serving and TFX pipelines. For on-device inference, LiteRT now converts PyTorch and JAX models too.
PyTorch vs TensorFlow: the short answer
For learning, research or anything built around large language models, use PyTorch. Teams with a working TensorFlow system do not need to rewrite it, but should plan new components with the move in mind. And if you like the Keras API, use Keras 3, which runs on top of PyTorch, JAX or TensorFlow.
| You are… | Choose | Main reason |
|---|---|---|
| Learning deep learning in 2027 | PyTorch | most courses and open models use it |
| Doing research | PyTorch (or JAX) | fastest moving, nearly all new code releases |
| Building on open LLMs | PyTorch | Hugging Face Transformers v5 is PyTorch-only |
| Maintaining a TensorFlow production system | stay, plan gradually | TF still gets security and critical fixes |
| Shipping models to phones and edge devices | LiteRT, with any framework | LiteRT converts PyTorch and JAX models |
| Training at very large scale on TPUs | JAX | Google’s own large models and tooling centre on it |
| Wanting a high-level API with backend choice | Keras 3 | one code base, three backends |
A short history of PyTorch vs TensorFlow
| Year | PyTorch | TensorFlow and Google |
|---|---|---|
| 2015 | TensorFlow open-sourced by Google | |
| 2016 | PyTorch released by Facebook AI Research | |
| 2018 | JAX released | |
| 2019 | TensorFlow 2.0 adopts eager execution and Keras as its main API | |
| 2022 | PyTorch moves to the Linux Foundation’s new PyTorch Foundation | |
| 2023 | PyTorch 2.0 introduces torch.compile | Keras 3 launches with JAX, PyTorch and TensorFlow backends |
| 2025 | Hugging Face Transformers v5 goes PyTorch-only | |
| 2026 | releases every two months, 2.10 to 2.15 | TensorFlow 2.21 and a shift to maintenance; TF Lite becomes LiteRT |
TensorFlow came first and dominated early industry use. It was built around static computation graphs, which made deployment efficient but debugging painful. PyTorch arrived with “define by run” eager execution: the model is ordinary Python code, so you can print values and step through it in a debugger. Researchers moved to it quickly, and the models they published pulled practitioners along.
TensorFlow 2.0 in 2019 adopted eager execution and Keras to close the gap, but by then the research community had settled on PyTorch. In September 2022, Meta moved PyTorch to the PyTorch Foundation under the Linux Foundation, with AMD, AWS, Google Cloud, Meta, Microsoft Azure and NVIDIA as founding members.
Difference 1: where each framework is heading
On 6 March 2026, Google published What’s new in TensorFlow 2.21. Alongside the release notes, it said that going forward the team “will exclusively focus on” three things:
- security and critical bug fixes
- dependency updates, including new Python releases
- review of critical community bug fixes
That commitment covers TensorFlow and its ecosystem libraries, from tf.data and TensorFlow Serving to TFX and TensorBoard. For new work in generative AI, the post recommends “exploring our latest updates for Keras 3, JAX, and PyTorch.”
PyTorch went the other way in 2026. Its 2.10 release notes announced a faster cadence: one release every two months instead of one a quarter. The project delivered on it.
| Signal | PyTorch | TensorFlow |
|---|---|---|
| Stated direction | active feature development | security, critical fixes, dependency updates |
| Release cadence in 2026 | every two months | one feature release (2.21, March 2026) |
| Latest version (November 2026) | 2.15.0, 28 October 2026 | 2.21.0, 6 March 2026 |
| Governance | PyTorch Foundation (Linux Foundation) | |
| Recommended by Google for new GenAI work | yes, alongside Keras 3 and JAX | not named |
Difference 2: PyTorch vs TensorFlow release activity

I pulled every final release of each package from the PyPI JSON API and counted them by year. Pre-releases are excluded; patch releases are included.
| Package | 2022 | 2023 | 2024 | 2025 | 2026 (to November) |
|---|---|---|---|---|---|
| torch (PyTorch) | 6 | 5 | 9 | 6 | 8 |
| tensorflow | 20 | 9 | 6 | 4 | 1 |
| jax | 30 | 22 | 15 | 13 | 13 |
| keras | 4 | 7 | 16 | 11 | 10 |
TensorFlow’s count has fallen every year, from 20 releases in 2022 (many of them patch releases across several supported versions) to a single release in 2026. PyTorch published 2.10, 2.11, 2.12, 2.13, 2.14 and 2.15 in 2026, plus two patch releases.
Release counts are a rough signal. A mature library could ship rarely and still be healthy. Combined with Google’s own statement, though, they point the same way.
What the commit history shows (and does not)
I also counted commits in each repository from November 2024 to October 2026, excluding automated accounts such as merge bots and internal sync accounts.
| Repository | Human commits, Nov 2024 to Oct 2025 | Nov 2025 to Oct 2026 | Distinct human authors (last 12 months) |
|---|---|---|---|
| pytorch/pytorch | 13,412 | 15,973 | 1,656 |
| tensorflow/tensorflow | 9,007 | 11,342 | 754 |
| jax-ml/jax | 5,344 | 5,899 | 336 |
| keras-team/keras | 670 | 1,170 | 180 |
The TensorFlow number needs a warning. Its repository also hosts shared compiler and runtime code, including XLA, which JAX and other projects depend on. In the last 12 months, 41% of TensorFlow’s human commits had XLA, HLO, GPU, MLIR or related terms in their subject line. A busy TensorFlow repository does not mean busy development of the TensorFlow Python API. PyTorch’s own counts include its compiler stack too, but that work serves PyTorch users directly.
Difference 3: the PyTorch vs TensorFlow ecosystem gap
The ecosystem decides how much you build yourself. Most open models now arrive as PyTorch code and weights.
The clearest signal came in December 2025, when Hugging Face released Transformers v5 and said it was “sunsetting our Flax/TensorFlow support in favor of focusing on PyTorch as the sole backend.” Transformers is the library most people use to load open models, with over 400 model architectures and more than 750,000 compatible checkpoints on the Hugging Face Hub, according to that post.

| Stage | PyTorch ecosystem | TensorFlow ecosystem |
|---|---|---|
| Models and libraries | Hugging Face Transformers, Diffusers, timm, torchvision | Keras applications, TF Hub (legacy), Keras Hub |
| Training at scale | FSDP, DeepSpeed, Megatron-style libraries | tf.distribute, TPU support |
| Compilation | torch.compile, torch.export | XLA (also used by JAX) |
| Serving | vLLM, SGLang, NVIDIA Triton | TensorFlow Serving |
| Pipelines | many general MLOps tools | TFX |
| On-device | ExecuTorch, LiteRT conversion | LiteRT (formerly TF Lite), TensorFlow.js |
Large language model serving in particular has consolidated on PyTorch-based engines. If your project involves fine-tuning or serving an open LLM, the tools you will reach for assume PyTorch.
Difference 4: how the code feels

The image above puts the same small classifier side by side: a PyTorch training loop and a Keras model with fit(). Neither needs much code. The difference is style.
- PyTorch is explicit. You write the training loop: forward pass, loss, backward pass, optimiser step. It takes a little more code, and nothing is hidden.
- Keras is declarative. You describe the model and call fit(). It is shorter for standard problems and hides the loop unless you override it.
- Debugging feels similar now that both run eagerly by default, but PyTorch errors usually point straight at your own Python line.
- Compiling for speed: PyTorch adds torch.compile(model) as a one-line opt-in. TensorFlow uses tf.function and XLA, which can change behaviour in ways that surprise newcomers.
Since Keras 3, the Keras style no longer ties you to TensorFlow. The same Keras code can run on PyTorch by setting one environment variable before import:
import os
os.environ["KERAS_BACKEND"] = "torch" # or "jax" or "tensorflow"
import keras
model = keras.Sequential([keras.layers.Dense(64, activation="relu"), keras.layers.Dense(10)])
That makes “Keras vs PyTorch” a question of API taste, separate from “TensorFlow vs PyTorch”.
Difference 5: PyTorch vs TensorFlow in production
Deployment used to be TensorFlow’s strongest argument. TensorFlow Serving and TFX covered the server side, and TF Lite covered phones. That argument has weakened in three ways.
- PyTorch closed the gap. torch.export produces a portable graph of a model, and TorchScript, the older approach, was deprecated in PyTorch 2.10 in favour of it. ExecuTorch targets mobile and edge devices.
- On-device inference became framework-neutral. TF Lite is now LiteRT and is developed separately. Google describes it as converting models from PyTorch and JAX. Google reports LiteRT GPU performance 1.4 times faster than TF Lite, plus new NPU acceleration.
- LLM serving moved elsewhere. The engines people use to serve open language models are PyTorch-native.
TensorFlow Serving and TFX still work and still get security fixes. If your company runs them reliably today, they will keep running. The risk is long term: new hardware and new model types will arrive in PyTorch first.
Hardware support
PyTorch’s 2026 releases show how much of the hardware work now lands there first:
- PyTorch 2.10 added Python 3.14 support for torch.compile and expanded Intel GPU support.
- PyTorch 2.14 (September 2026) added Python 3.15 wheels, ROCm 7.14 builds for AMD GPUs, native graph capture on Intel XPU, faster linear algebra on Apple Silicon and compiler targets for NVIDIA’s Rubin generation, according to its release blog.
- PyTorch 2.15 (October 2026) rewrote its NCCL backend to recover from failing GPUs in large training jobs, with 3,117 commits from 583 contributors, as DevClass reported.
TensorFlow keeps strong TPU support, but Google’s own large-scale TPU work increasingly runs through JAX.
Difference 6: learning resources and jobs
Learners should follow the materials. Most current courses and books teach PyTorch, often alongside Keras:
| Resource | Framework |
|---|---|
| Géron, Hands-On Machine Learning with Scikit-Learn and PyTorch (O’Reilly, October 2025) | PyTorch (earlier editions used TensorFlow) |
| Chollet and Watson, Deep Learning with Python, third edition (Manning, September 2025) | Keras 3, with JAX, PyTorch and TensorFlow primers |
| Karpathy, Neural Networks: Zero to Hero | PyTorch |
| Hugging Face courses | PyTorch-first |
Géron’s switch from TensorFlow to PyTorch in his long-running textbook is a good summary of where teaching has gone.
On jobs, I did not find a recent, well-sourced count of postings by framework, so I will not quote one. In practice, job descriptions for research and generative AI roles overwhelmingly mention PyTorch, while roles maintaining established recommendation, ranking or mobile systems still list TensorFlow. Knowing PyTorch well and being able to read TensorFlow code covers almost every case.
Difference 7: JAX, the third option
Any honest PyTorch vs TensorFlow comparison in 2027 has to mention JAX. JAX is Google’s array library with automatic differentiation and XLA compilation. It feels like NumPy with superpowers: you write pure functions and transform them with grad, jit and vmap.
| PyTorch | TensorFlow | JAX | |
|---|---|---|---|
| Style | object-oriented modules, eager | Keras models or low-level graphs | pure functions and transforms |
| Strength | ecosystem, flexibility, LLM tooling | mature production stack, legacy systems | large-scale TPU training, research on new methods |
| Learning curve | gentle | moderate | steeper (functional style) |
| Releases in 2026 | 8 | 1 | 13 |
| Best for | almost everyone | maintaining existing TF systems | teams on TPUs or with a functional bent |
JAX shipped 13 releases in 2026 and is the main framework for Google’s own large models. It is a strong choice if you train on TPUs or want fine control over compilation. For most learners and most companies, PyTorch is still the easier default, and Keras 3 lets you try JAX without rewriting models.
Licences, governance and long-term risk
Both frameworks are free and open source, so licence cost is not the issue. Who steers each project, and how much risk that creates for a long-lived system, is.
| PyTorch | TensorFlow | JAX | Keras 3 | |
|---|---|---|---|---|
| Licence | BSD-style | Apache 2.0 | Apache 2.0 | Apache 2.0 |
| Steward | PyTorch Foundation (Linux Foundation) | Google, as an open project | ||
| Funding base | many member companies | one company | one company | one company |
PyTorch’s foundation model spreads control across hardware makers and cloud providers, which matters when you bet a product on a framework for five or more years. TensorFlow depends on Google’s priorities, and the March 2026 announcement shows those priorities have moved to JAX, Keras 3 and LiteRT.
For a team choosing in the PyTorch vs TensorFlow decision today, the practical risk is not that TensorFlow stops working. It is that new GPUs, new data types and new model architectures arrive late or not at all, and that hiring people who want to work on it gets harder over time.
PyTorch vs TensorFlow by use case
The general answer is PyTorch, but the details vary by field. Here is how the PyTorch vs TensorFlow choice plays out for common kinds of work in 2027.
| Use case | Default choice | Notes |
|---|---|---|
| Large language models and chat | PyTorch | open models, fine-tuning libraries and serving engines all assume it |
| Image generation | PyTorch | diffusion and flow-matching libraries are PyTorch-first |
| Computer vision research | PyTorch | most new vision papers release PyTorch code |
| Classic vision in production | either | existing TensorFlow systems are fine to keep |
| Recommendation systems | either | many large TF systems exist; new builds lean PyTorch |
| Mobile and embedded | LiteRT or ExecuTorch | train in any framework, convert for the device |
| Large-scale TPU training | JAX | TensorFlow is no longer Google’s focus here |
| Tabular data | often neither | gradient boosting usually beats deep learning on tables |
The last row is worth repeating. For spreadsheet-style data, a gradient boosting library is often the better tool, as our XGBoost vs LightGBM vs CatBoost benchmark shows. The framework debate only matters once you have decided a neural network is the right model.
PyTorch vs TensorFlow performance: what matters
Benchmarks claiming one framework is faster than the other are common, and most are not worth much. Both call the same vendor libraries for the heavy maths on NVIDIA GPUs. What changes the speed of your training job is usually something else:
- Compilation. torch.compile in PyTorch and XLA in TensorFlow or JAX fuse operations and cut overhead. Turning compilation on often matters more than which framework you use.
- Precision. Training in 16-bit formats, and in 8-bit or 4-bit formats on new hardware, changes throughput far more than framework choice.
- The input pipeline. A slow data loader starves the GPU in either framework. Profile it before blaming the model.
- Batch size and memory use. Fitting a bigger batch, or using activation checkpointing, changes utilisation.
- Hardware support. New accelerators and data types usually get PyTorch support first, as the 2026 release notes show.
So the honest PyTorch vs TensorFlow speed answer is: comparable on equal settings, with PyTorch getting new hardware features sooner. Profile your own model before deciding anything on speed alone.
PyTorch vs TensorFlow migration: how to move in stages
If you maintain TensorFlow code and want to move, do it in stages rather than a big rewrite.

- Freeze and document the current model, its preprocessing and a fixed evaluation set with expected outputs.
- Move high-level Keras code to Keras 3 first. Switch the backend to PyTorch and check the evaluation set gives matching results.
- Rewrite custom layers and training loops in PyTorch one component at a time, testing each against the TensorFlow output on the same inputs.
- Replace the data pipeline. tf.data code usually maps to a PyTorch Dataset and DataLoader, or to a framework-neutral loader.
- Choose the new serving path (torch.export, an inference server, or LiteRT for devices) and run both systems in parallel before switching traffic.
- Retire TensorFlow dependencies once nothing imports them.
Keep the old model as a reference until the new one matches it on your evaluation set. Small differences in default initialisation, padding or numerical precision can shift results, so compare the outputs themselves as well as the accuracy.
FAQ
Should I learn PyTorch or TensorFlow in 2027?
Learn PyTorch. It is what most courses and open models use, and Google itself recommends Keras 3, JAX or PyTorch for new generative AI work. Once you know PyTorch, reading TensorFlow code takes a few days.
Is TensorFlow being discontinued?
Google has not announced an end date. In March 2026 it said TensorFlow would focus exclusively on security and critical bug fixes, dependency updates such as new Python versions, and critical community fixes. That is maintenance mode: existing systems keep working, while Google’s new feature work goes to Keras 3 and JAX, plus LiteRT for devices.
Is PyTorch faster than TensorFlow?
Neither is faster across the board. With compilation enabled (torch.compile in PyTorch, XLA in TensorFlow or JAX), performance on common models is broadly comparable and depends on the model and hardware. Choose on ecosystem and support, then optimise.
Can I use Keras with PyTorch?
Yes. Keras 3 can use PyTorch as its backend, as well as JAX or TensorFlow. Set the KERAS_BACKEND environment variable to torch before importing Keras, and the same model code runs on PyTorch.
Which framework is better for mobile apps?
For on-device inference, use LiteRT (formerly TensorFlow Lite) or ExecuTorch. LiteRT now converts models from PyTorch and JAX as well as TensorFlow, so the training framework no longer locks you into a mobile runtime.
The verdict for 2027
The PyTorch vs TensorFlow question has an answer now. PyTorch is the default for new deep learning work, backed by a neutral foundation and the open-model ecosystem, with a release every two months. TensorFlow is a stable platform for systems already built on it, with security support but little new development, and its on-device runtime lives on as LiteRT. JAX is the specialist’s choice, and Keras 3 lets you keep a friendly API on top of whichever backend you pick.
To see what to learn after picking a framework, read the deep learning roadmap for 2027. To see PyTorch-era architectures in action, start with our transformer architecture guide.


