Section650

Writing

TopicAI
Reading6 min

Machine Learning Frameworks: Then, Now and How to Choose

scikit-learn for tabular data, PyTorch or Keras 3 for deep learning, Spark when the data is already there, and a hosted model when a general one does the job. What changed since my original list, and how to choose.

By Ka Lun Chan · AI / Engineering judgment

Which machine learning framework should you use?

For classical machine learning on tabular data, start with scikit-learn. For deep learning, PyTorch is the default most new work targets, with Keras 3 as a higher-level option that runs on JAX, PyTorch or TensorFlow. If the job is a language task a general model already handles, you may not need to train anything: call a hosted model and spend the effort on evaluation.

I first wrote this on my old blog. This version keeps the four frameworks I picked then and updates what changed, which turned out to be quite a lot.

My definition hasn’t changed. A machine learning framework lets developers build machine learning models easily and quickly, so you’re not writing the math, the optimizers and the data plumbing yourself. What changed is which frameworks are worth learning, and how many teams need to train a model at all. If you want the basics of what a model is before choosing a tool, start with what machine learning is and how it works.

What happened to Amazon Machine Learning, TensorFlow, scikit-learn and Spark MLlib?

Amazon Machine Learning is gone for new users, and AWS points to SageMaker AI instead. TensorFlow is still maintained, but much of the new deep learning work has moved to PyTorch. scikit-learn is still the default for classical ML. Spark MLlib is still useful at scale, through its DataFrame API.

Amazon Machine Learning. When I first wrote this, it offered visualization tools and wizards that walked you through building a model without learning the algorithms. AWS now says it is no longer updating the service or accepting new users, and directs people to Amazon SageMaker AI. SageMaker AI is a different kind of product: a managed platform for building, training and deploying models, aimed at people who already know what they’re training.

TensorFlow. Google Brain built it for internal use and Google open-sourced it under the Apache 2.0 license. My original description said nodes in the graph are mathematical operations and edges are the tensors passed between them. That was how you wrote TensorFlow back then. TensorFlow 2 runs eagerly by default, operation by operation like ordinary Python, and builds a graph only when you wrap a function in tf.function. Most people now meet TensorFlow through Keras, which is what the beginner quickstart uses.

scikit-learn. I described it as a free Python library focused on classification, regression, clustering, dimensionality reduction, model selection and preprocessing. All still true. Its FAQ says deep learning is out of scope, and GPU support is limited to some estimators through an experimental Array API mode. Tree models, which do a lot of the work on tabular data, aren’t among them. For most business data in rows and columns, that’s rarely the bottleneck. scikit-learn sits on NumPy and SciPy, which I cover in NumPy and SciPy.

Apache Spark MLlib. Spark is still a popular open-source platform for large-scale data processing, and still suits iterative machine learning on big datasets. The part to know is that the original RDD-based spark.mllib API has been in maintenance mode for a long time. It gets bug fixes and no new features. The DataFrame-based spark.ml package is the primary API, and that’s the one new code should use.

Which frameworks would I add to the list now?

PyTorch, JAX, Keras 3 and Hugging Face Transformers. PyTorch is where most deep learning work happens, JAX matters for compiled accelerator code, Keras 3 sits on top of either, and Transformers is how most teams get pretrained models.

  • PyTorch is now governed by the PyTorch Foundation, hosted by the Linux Foundation, which also hosts projects such as vLLM, DeepSpeed and Ray. The clearest sign of its position is that Hugging Face Transformers now works with PyTorch and no other backend.
  • JAX describes itself as a Python library for accelerator-oriented array computation and program transformation. It feels like NumPy, then adds compilation and automatic differentiation. Most application teams use it through a higher-level library.
  • Keras 3 runs on JAX, PyTorch or TensorFlow. You pick the backend before importing Keras and can’t change it afterwards in the same process.
  • Hugging Face Transformers gives you pretrained models for text, vision, audio and multimodal tasks, for inference and for training. Starting from a pretrained model is usually cheaper and faster than training your own from scratch.

How do you choose a machine learning framework?

Start from the shape of your data and the problem. Tabular data goes to scikit-learn. Images, audio and text you train on go to PyTorch or Keras. Data already in a Spark cluster stays in Spark. A language task a general model already does well goes to a hosted API first.

Fig. 636-1 Machine learning frameworks: what each is best for, and the catch
FrameworkBest forThe catch
scikit-learnClassical ML on tabular data: classification, regression, clustering, preprocessing, model selectionDeep learning is out of scope, and GPU support is limited
PyTorchDeep learning, research code, fine-tuning open modelsYou write more of the training loop and the serving path yourself
Keras 3A high-level deep learning API with JAX, PyTorch or TensorFlow underneathThe backend is fixed when Keras is imported, and backend-specific code ties you to one
TensorFlowExisting TensorFlow systems and its deployment toolingFewer new open models target it, and Transformers no longer supports it
JAXArray programs that need compilation, automatic differentiation and acceleratorsA lower-level, functional style; you usually add a library on top
Spark MLlib (spark.ml)Training on data that already lives in Spark and is too big for one machineCluster overhead; use the DataFrame API, since spark.mllib only gets bug fixes
Hugging Face TransformersPretrained text, vision, audio and multimodal modelsPyTorch only, and big models need real GPU memory
Amazon SageMaker AIManaged training and hosting on AWSYou still need to know ML; the console doesn’t replace that
Hosted foundation-model APILanguage tasks a general model already handles wellPer-call cost, provider limits and output you have to evaluate

A few rules I’d apply before the table:

  1. Try the simplest model first. A logistic regression or gradient-boosted trees on clean features gives you a baseline, and sometimes it’s the answer.
  2. Pick a framework your team can debug, and one your deployment path already supports. A model that only runs in a notebook is a demo.
  3. Use pretrained models before training from scratch. The weights already encode work you’d struggle to repeat.
  4. Keep the data and evaluation code framework-agnostic where you can, so switching frameworks later is a rewrite of one layer.

The scikit-learn baseline is short. The pipeline keeps preprocessing and the model together, which also prevents test data leaking into the scaler:

scikit-learn: a baseline classifier with a pipeline
from sklearn.datasets import load_breast_cancer
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import train_test_split
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import StandardScaler

X, y = load_breast_cancer(return_X_y=True)
X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=0)

# Scaling and the model travel together, so test data can't leak into the scaler
pipe = make_pipeline(StandardScaler(), LogisticRegression())
pipe.fit(X_train, y_train)
print(pipe.score(X_test, y_test))

If the baseline isn’t good enough and the data suits a neural network, Keras 3 lets you write the model once and choose the backend with an environment variable:

Keras 3: choosing a backend
import os
os.environ["KERAS_BACKEND"] = "jax"  # or "torch" or "tensorflow", set before importing keras

import keras

model = keras.Sequential([
    keras.Input(shape=(30,)),
    keras.layers.Dense(64, activation="relu"),
    keras.layers.Dense(1, activation="sigmoid"),
])
model.compile(optimizer="adam", loss="binary_crossentropy", metrics=["accuracy"])

Python is the common thread through every option here. If you’re deciding between languages for the service around the model, I compared two of them in Python or Go.

Do you still need a framework if you call a hosted model?

Often not for the model itself. For summarizing, extracting, classifying text or answering questions, many teams now call a hosted foundation model instead of training one. The engineering work moves to evaluation, cost, reliability and security.

Services such as Amazon Bedrock give you API access to foundation models from several providers. That removes the training step, and it’s the closest thing today to what Amazon Machine Learning promised: useful predictions without building the model. The difference is that someone else trained a very general model, and you’re responsible for proving it does your specific job.

That responsibility is real engineering. You need test cases that reflect your data, a way to catch regressions when the provider updates the model, limits on what the model can do, and a budget for every call. I wrote about that work in what it takes to make an AI system reliable. A classical model in scikit-learn is still cheaper, faster and easier to explain for a lot of structured prediction, so a hosted model shouldn’t be the automatic choice.

Sources

Checked in November against the AWS documentation for Amazon Machine Learning, SageMaker AI and Bedrock, the TensorFlow, Keras, PyTorch, JAX, scikit-learn and Spark documentation, the PyTorch Foundation page and the Hugging Face Transformers documentation. The decision table and the recommendations are mine.

Short answers

Which machine learning framework should I learn first?

scikit-learn, if your data is in rows and columns. It covers classification, regression, clustering, preprocessing and model selection with one consistent API. Move to PyTorch or Keras 3 when you need deep learning for images, audio or text.

Is Amazon Machine Learning still available?

No. AWS says it is no longer updating Amazon Machine Learning or accepting new users, and points to Amazon SageMaker AI for building, training and deploying models. For calling foundation models through an API, AWS offers Amazon Bedrock.

Should I use TensorFlow or PyTorch?

For new deep learning work, PyTorch is the safer default. Hugging Face Transformers now works with PyTorch only. Keras 3 lets you write high-level code that runs on JAX, PyTorch or TensorFlow, and TensorFlow still makes sense for systems already built on it.

Do I need a machine learning framework if I use a hosted model?

Often not for the model itself. For many language tasks, calling a hosted foundation model replaces training. The work moves to evaluation, cost, reliability and security, and a classical model is still cheaper for a lot of structured prediction.

Start with a baseline

Before choosing a framework, write down what a good prediction looks like and build the simplest model that could make it. That baseline tells you whether you need deep learning, a hosted model or neither.

Tell me what you’re building