PyTorch vs TensorFlow: Which Should Beginners Learn?
Updated
01At a glance
| PyTorch | TensorFlow (with Keras) | |
|---|---|---|
| Made by | Meta originally; now governed by the PyTorch Foundation (Linux Foundation) | |
| Feel when coding | Plain Python: you write the training loop, debug with print and pdb | High-level Keras API (model.fit) plus lower-level TF; more abstraction |
| Research | The clear default in papers and open-source model code | Small and shrinking share of new research code |
| Hugging Face | Transformers v5 is PyTorch-only; nearly all new open models ship PyTorch weights | TensorFlow support is being sunset in Transformers v5 |
| Mobile / edge | ExecuTorch (1.0 released Oct 2025) | LiteRT (formerly TensorFlow Lite), mature on Android |
| Browser | Usually via ONNX Runtime Web | TensorFlow.js |
| Serving | vLLM for LLMs, NVIDIA Triton, ONNX Runtime, or a simple FastAPI service | TF Serving, still maintained and widely deployed |
| Best for beginners? | Yes, for most people | Only if your course, job or target deployment needs it |
02Why PyTorch won the beginner question
PyTorch feels like normal Python. Tensors behave like NumPy arrays, the model is a Python class, and the training loop is a for loop you can read line by line. When something breaks, the error points at your line. That makes it a better teaching tool: you see forward pass, loss, backward pass and optimiser step explicitly instead of hiding them in one call.
The bigger reason is the ecosystem. Research groups moved to PyTorch around 2018–2019, and the open-model world followed. An AssemblyAI analysis of Hugging Face and Papers with Code data found that in 2023 about 92% of models on Hugging Face were PyTorch-exclusive, and roughly 70% of new paper implementations in a recent quarter used PyTorch against about 4% for TensorFlow. In December 2025, Hugging Face released the first Transformers v5 candidate with PyTorch as the sole backend and announced it is sunsetting TensorFlow and Flax support. If you want to read a new paper's code or fine-tune an open LLM, you will meet PyTorch.
03Where TensorFlow still makes sense
TensorFlow is not dead; it is a mature production system with a smaller share of new projects. Honest reasons to learn it:
- On-device ML on Android. TensorFlow Lite was renamed LiteRT in 2024 and is now part of Google AI Edge. It is widely used in Android apps, and TensorFlow 2.20 moved on-device work out of
tf.liteinto the separate LiteRT project. PyTorch's answer, ExecuTorch, reached 1.0 in October 2025 and is catching up. - Existing production systems. Many companies have TensorFlow models in production behind TF Serving. Someone has to maintain and migrate them.
- ML in the browser. TensorFlow.js remains one of the easiest ways to run a model in a web page.
- Your syllabus or team uses it. Some university courses and older books still teach TensorFlow/Keras. Learn what you are graded on, then add PyTorch.
04Keras 3 changes the old argument
Keras used to mean “the easy TensorFlow API”. Keras 3 is a rewrite that runs on JAX, TensorFlow or PyTorch (plus OpenVINO for inference), selected with one environment variable. A Keras 3 model can even be used as a PyTorch module. So if you like the model.fit() style, you can have it without committing to TensorFlow. For a complete beginner, Keras is a gentle way to train a first network; for anything beyond that, you will still want to understand a raw PyTorch training loop.
05Where JAX fits
JAX is Google's NumPy-like library with automatic differentiation and XLA compilation, strongest on TPUs and large-scale training. Google DeepMind has used it widely for its research since around 2020, and libraries like Flax and Optax are built on it. It is excellent, but it uses a functional style (no hidden state, explicit random keys) that confuses beginners. Treat JAX as a later, optional skill if you head into research or work at a TPU-heavy company.
06Choose PyTorch if… / Choose TensorFlow if…
Choose PyTorch if…
- You are learning deep learning for the first time.
- You want to work with LLMs, Hugging Face models, fine-tuning (LoRA, QLoRA) or research code.
- You are aiming for ML engineer, AI engineer or research roles at product companies.
Choose TensorFlow if…
- You are building Android or embedded features and your team standardises on Google AI Edge tools.
- You are joining or maintaining a team whose models already run on TensorFlow and TF Serving.
- Your course or exam is taught in TensorFlow; learn it for that, then pick up PyTorch.
07Switching between them
The ideas transfer completely: tensors, autograd, layers, losses, optimisers, data loaders. Once you can train a CNN and fine-tune a transformer in one framework, the other takes days to weeks to read comfortably, mostly spent learning API names. Going from Keras to PyTorch, the main adjustment is writing your own training loop (or using a light wrapper like PyTorch Lightning). Going from PyTorch to TensorFlow, learn Keras 3 first and use lower-level TensorFlow only when you need it. For moving trained models between them, ONNX is the usual bridge.
08A learning path
- Get classical ML down first with scikit-learn; see machine learning vs deep learning for why.
- Follow the PyTorch section of the Machine Learning roadmap: tensors, autograd,
nn.Module, datasets and data loaders, then a full training loop with validation. - Build two projects: an image classifier and a small text model. Our AIML project ideas list has options at each level.
- Then go into transformers and fine-tuning in the AI Engineer roadmap (PyTorch, NLP & Transformers, Fine-tuning & Alignment sections).
09Frequently asked questions
Is TensorFlow dead in 2026?
No. Google still releases TensorFlow, TF Serving is widely deployed, and LiteRT (formerly TensorFlow Lite) is a major on-device runtime. But most new research, open models and LLM tooling use PyTorch, so TensorFlow's share of new projects is small.
Should I learn both PyTorch and TensorFlow?
Not at the start. Learn PyTorch well, then pick up TensorFlow or Keras only when a job, course or deployment target needs it. The concepts carry over, so the second framework is much faster to learn.
Is Keras easier than PyTorch?
For training a first simple model, yes: model.fit() hides the training loop. Keras 3 can run on PyTorch as a backend, so starting with Keras does not lock you into TensorFlow. You should still learn to write a PyTorch training loop yourself.
Which do companies in India use?
Both appear in job postings. Newer AI and LLM teams mostly use PyTorch, while TensorFlow shows up more in older production systems and mobile work. Check current postings on our jobs board to see what employers you care about ask for.
Do I need PyTorch to build LLM apps?
Not to call an LLM API. You need it when you fine-tune or run open models yourself, which is where PyTorch and Hugging Face come in.
- Hugging Face: Transformers v5 announcement (Dec 2025)
- AssemblyAI: PyTorch vs TensorFlow (Hugging Face and Papers with Code data, 2023 update)
- The Gradient: The State of Machine Learning Frameworks in 2019
- Keras: Introducing Keras 3
- Google Developers Blog: TensorFlow Lite is now LiteRT (Sept 2024)
- TensorFlow Blog: What's new in TensorFlow 2.20 (Aug 2025)
- PyTorch Blog: Introducing ExecuTorch 1.0
- Google DeepMind: Using JAX to accelerate our research (2020)