AI news
AI model reviews
AI tools
How-to guides
Our staffAboutContact

What is a software framework for AI? A 2026 guide to PyTorch, TensorFlow and more

A software framework for AI handles the maths of building and training models. Here's how frameworks work, the main options now, and how to pick one.

Computer monitor displaying lines of source code
Photo: Radowan Nakif Rehan on Unsplash

A software framework for AI is a ready-made code foundation, such as PyTorch, TensorFlow or JAX, that handles the heavy maths of building, training and running AI models so you don't write it from scratch. You describe the model; the framework computes gradients, moves data onto GPUs and saves the result. For most people starting now, I'd pick PyTorch, though the right answer depends on what you're building.

The word "framework" also gets used for AI governance rulebooks like NIST's, which is a different thing entirely. I'll cover both, because search results mix them up constantly.

A software framework for AI: the layers under your code

An AI framework sits between your Python code and the hardware. At the bottom are GPU drivers and math libraries such as NVIDIA's CUDA. Above that, the framework provides tensors (multi-dimensional arrays), a library of operations on them, and automatic differentiation, usually shortened to autograd. On top sit higher-level tools for layers, optimisers, data loading and checkpoints.

Autograd is the part that earns its keep. Training a neural network means nudging every weight in the direction that reduces error, which needs the derivative of the loss with respect to each weight. The framework records each operation as you run it and works those derivatives out for you.

Here's a worked example with real numbers. Take a small network for handwritten digits: 784 inputs (a 28 by 28 pixel image), one hidden layer of 128 units, and 10 outputs.

  • Input to hidden layer: 784 × 128 weights plus 128 biases = 100,480 parameters.
  • Hidden layer to output: 128 × 10 weights plus 10 biases = 1,290 parameters.
  • Total: 101,770 parameters, each needing a gradient on every training step.

Over 5 passes through the 60,000 training images in batches of 32, that's about 9,375 update steps. Without a framework, you'd derive and code the gradient formulas yourself, then write the GPU code to run them fast. In PyTorch or Keras the whole model, training loop included, fits in roughly 15 lines (the TensorFlow homepage shows almost exactly this model as its quickstart). That gap is why almost nobody trains models without one.

The same structure scales up. A large language model has billions of parameters instead of about a hundred thousand, but the framework's job doesn't change: track the operations, compute the gradients, spread the work across devices.

Real examples: the main AI frameworks now

"AI framework" now covers several layers of tooling. The table groups the common ones by the job they do; version numbers are the current releases on PyPI.

FrameworkLayerCurrent versionTypical use
PyTorchDeep learning core2.15.0Research, LLM training, most new models
TensorFlowDeep learning core2.22.0Existing production systems, mobile and browser (TensorFlow.js)
JAXDeep learning core0.12.1Large-scale training on Google TPUs, numerical research
KerasHigh-level API3.15.1Quick model building on JAX, TensorFlow or PyTorch
scikit-learnClassic machine learning1.9.1Regression, classification and clustering on tabular data
TransformersModel library5.24.1Loading and fine-tuning pretrained models
LangChainLLM application1.5.2Chaining model calls, tools and retrieval into apps and agents

A few details from that list tell you where things are heading. Hugging Face's Transformers library, home to more than a million model checkpoints, now lists Python 3.11+ and PyTorch 2.6+ as its requirements; TensorFlow isn't mentioned in its install steps. Keras 3 went the other way and became multi-backend, so the same Keras code runs on JAX, TensorFlow or PyTorch.

PyTorch also covers more than one project now. The PyTorch Foundation became an umbrella organisation in 2025 and took in vLLM and DeepSpeed in May, then Ray in September. It shipped four PyTorch releases that year, 2.6 through 2.9.

The top layer, LLM application frameworks, is the newest and moves fastest. If that's your interest, our roundup of AI agent frameworks updates tracks what's changed recently.

Benefits and limitations

The benefits are mostly about time and correctness. Autograd removes a whole class of maths bugs. Hardware support comes built in, so the same code runs on a laptop CPU or a cluster of GPUs with a few changed lines. And because millions of people use the same tools, you'll find tutorials, pretrained weights and answers to most error messages.

Frameworks also give you a shared format. A model trained in PyTorch can be loaded by inference engines such as vLLM, which is why picking a mainstream framework matters more than picking a clever one.

Failure modes

The abstractions leak. When training goes wrong (loss turns into NaN, memory runs out, a GPU sits at 30% use), you have to understand what the framework is doing underneath, and error messages from compiled kernels can be cryptic.

Version churn is the second problem. PyTorch alone put out four releases in 2025, and libraries built on top pin specific versions, so a project can break because one dependency updated. I'd lock versions in every serious project from day one.

Switching costs are real too. Moving a large codebase from TensorFlow to PyTorch can take months, so whatever you pick tends to stick. And higher-level LLM frameworks add another layer that can hide what your prompts and model calls are actually doing, which makes debugging and cost tracking harder. I think a lot of small apps would be easier to maintain calling a model API directly.

Software frameworks vs AI governance frameworks

If you landed here looking for AI operational governance, you probably want a different kind of framework. The best-known one is the NIST AI Risk Management Framework, released on January 26, 2023 and intended for voluntary use. It's a set of practices for managing risks from AI systems, not code. NIST added a generative AI profile in July 2024, and the framework is currently being revised as part of the White House AI Action Plan.

Operational governance is the day-to-day side: who approves a model for production, how it's monitored, what gets logged and when it's retired. Software frameworks help here only indirectly (by making experiments reproducible, for instance). Our guide on how to implement AI governance covers the process side, and our overview of AI regulation covers the laws.

Picking a framework: a decision guide

Match the framework to the problem, not to what's trending on social media. This is the guide I'd hand a new team:

If you're...Start withReason
Predicting from spreadsheet-style datascikit-learnDeep learning is usually overkill for tabular data
Learning deep learning or doing researchPyTorchMost tutorials, papers and pretrained models use it
Fine-tuning an open modelTransformers on PyTorchPretrained weights and training scripts ready to use
Training very large models on TPUsJAXBuilt for Google's hardware and large-scale parallelism
Maintaining an existing TensorFlow systemTensorFlowRewriting working code rarely pays off
Building a chatbot or agent on a hosted modelA model API, then LangChain if neededYou may not need a training framework at all

A few practical rules sit behind that table. Check which framework your target model was released in, because converting weights is avoidable work. Look at what your deployment target supports: phones, browsers and edge devices have their own runtimes. And if you're working with images, our explainer on computer vision in AI covers the model types you'll meet; for training data, see what an AI dataset is.

The next year for AI frameworks

My guess is that consolidation around PyTorch continues. The foundation now hosts training (DeepSpeed), inference (vLLM) and distributed compute (Ray) under one roof, and Transformers' PyTorch-only install path points the same way. TensorFlow won't disappear, since it runs a great deal of production code, but I doubt many new projects will start on it.

The faster change is probably higher up. LLM application and agent frameworks are young, their APIs shift often, and I'd expect some to merge or fade. On the governance side, a revised NIST AI RMF should give companies a clearer checklist, though NIST hasn't given a release date.

FAQ

Which AI framework is best?

There's no single best one. PyTorch is the safest default for deep learning and LLM work because most new models and tutorials use it. scikit-learn suits tabular data, JAX suits large TPU training, and TensorFlow mainly makes sense for existing systems. Pick by your task, hardware and the models you'll reuse.

What is a software framework for AI used for?

It's used to build, train and run machine learning models. The framework supplies tensors, automatic gradients, GPU support and ready-made layers, so you write the model design and training logic rather than low-level maths and hardware code.

Is TensorFlow still worth learning?

For maintaining existing production systems, yes, and TensorFlow.js still matters for browser apps. For a first framework, I'd learn PyTorch, since Hugging Face Transformers and most research code now target it. Keras 3 lets you write code once and run it on either backend.

What's the difference between a library and a framework?

You call a library when you need it; a framework sets the structure and calls your code. In AI the line is blurry. PyTorch behaves a lot like a library, while Keras and LangChain impose more structure on how you organise a project.

Keep reading