Apple's M1 is up to 3.6x as fast at training machine learning models
Tags: datascience, machinelearning, architecture
Published: 2020-12-16 18:24:22

### As compared to the the Intel-based 13" Macbook Pro.

A few weeks ago, Apple released its first custom-designed silicon chip for the Mac, [the M1](https://www.apple.com/mac/m1/). There have been [several](https://arstechnica.com/gadgets/2020/11/hands-on-with-the-apple-m1-a-seriously-fast-x86-competitor/) [impressive](https://www.tomshardware.com/news/Apple-M1-Chip-Everything-We-Know) [benchmarks](https://lemire.me/blog/2020/12/13/arm-macbook-vs-intel-macbook-a-simd-benchmark/) around its performance relative to its Intel-based predecessors, but we were interested in putting it through its paces on a machine learning (and, specifically, a computer vision) workload.

While Apple [announced support for TensorFlow](https://blog.tensorflow.org/2020/11/accelerating-tensorflow-performance-on-mac.html) training on the M1, the toolchain isn't quite ready yet. With some effort, we were able to [get Jupyter notebooks running on Apple Silicon](https://blog.roboflow.com/how-to-run-jupyter-notebooks-on-a-mac-m1/), for example, but the [pre-release version of TensorFlow for Mac](https://github.com/apple/tensorflow_macos) wasn't ready for primetime just yet (notably SciPy is not yet compatible with the M1 which is required for [TensorFlow's Object Detection API](https://blog.roboflow.com/train-a-tensorflow2-object-detection-model/)).

Instead, we used [Apple's Create ML](https://blog.roboflow.com/createml) to perform our benchmarks. This should be a fair comparison of the relative performance you will be able to expect for training machine learning models once the compatibility quirks are eventually sorted out in a few months. _(Presumably, Apple has already done the work in optimizing Create ML for both for their Intel and M1 devices.)_

Unfortunately, since Create ML is not compatible with NVIDIA chips, it still doesn't give us a good head-to-head comparison between the new M1 and the 3090 or 2080ti for example (Apple claims 11 trillion operations per second on the M1's neural engine vs. NVIDIA's claim of 14.2 TOPS on the 2080ti).

As you decide whether or not to purchase the new M1 laptop – [which just got a "surprise price cut"](https://www.creativebloq.com/news/macbook-m1-december-sales) – we set out to estimate how well the Apple M1 laptop performs against their previous generation machines' Intel CPUs and AMD Radeon GPUs. Is it worth it?

> TL;DR: if you're looking to tackle machine learning and computer vision problems on your Mac, the Apple M1 may be worth the upgrade once the software you require is compatible but it's not yet ready to replace a discrete GPU.

<figure class="kg-card kg-image-card kg-card-hascaption">![](https://blog.roboflow.com/content/images/2020/12/unpackaging-macbook.gif)

<figcaption>Unboxing my new MacBook M1.</figcaption>

</figure>

## The Test Machines

We used three recent MacBook Pro machines to do our comparison:

*   MacBook Pro 13-inch (November 2020) M1 integrated system on a chip with 8GB memory. $1,499
*   MacBook Pro 13-inch (May 2020) 1.4 GHz Quad-Core Intel Core i5 with 16GB memory and Intel Iris Plus Graphics 645 (1536MB graphics memory). $1,699
*   MacBook Pro 16-inch (2019) 2.4 GHz 8-Core Intel Core i9 with 64GB memory and AMD Radeon Pro 5500M (8GB graphics memory). $3,899

## Test Methodology

To compare performance, we used [Create ML](https://developer.apple.com/machine-learning/create-ml/) to tackle a [no code object recognition](https://www.youtube.com/watch?v=kBn7Cd8Z8yE) problem. (Want to recreate this? [We've written out the steps here](https://blog.roboflow.com/createml/).)

*   We used the [121,444 image Microsoft COCO object detection dataset](https://public.roboflow.com/object-detection/microsoft-coco-subset).
*   We used [Roboflow](https://app.roboflow.com/) to export data in [Create ML format](https://roboflow.com/formats/createml-json).
*   We used Create ML to fit a [YOLOv2 object detection model](https://paperswithcode.com/method/yolov2) over 5,000 [epochs](https://blog.roboflow.com/glossary/#:~:text=Epochs) with a [batch size](https://blog.roboflow.com/glossary/#:~:text=Batch%20size) of 32.

<figure class="kg-card kg-image-card kg-card-hascaption">![](https://blog.roboflow.com/content/images/2020/12/image-10.png)

<figcaption>Screenshot of Create ML with hyperparameters selected.</figcaption>

</figure>

*   We monitored this on all three computers for the full 5,000 iterations/epochs.

<figure class="kg-card kg-image-card kg-card-hascaption">![A white loss function on a black graph.](https://blog.roboflow.com/content/images/2020/12/image-11.png)

<figcaption>Loss function for the YOLOv2 object detection model on the COCO 2017 dataset.</figcaption>

</figure>

Based on the model's performance, we probably aren't ready to deploy it to the wild yet. (If you want to see how to [deploy your model, watch this video](https://www.youtube.com/watch?v=kBn7Cd8Z8yE).) However, 5,000 iterations is enough for us to get a good sense of how the two systems perform against each other.

On this object detection task in Create ML, **the 13" Apple M1-powered Macbook Pro performed significantly better than the 13" Intel Core i5 but underperformed the 15" i9 with its discrete Radeon Pro 5500M GPU**.

*   The Intel Core i5 took 542 minutes to run through 5,000 iterations (CPU training).
*   The Apple M1 took 149 minutes  to do the same (8% GPU utilization).
*   The Intel Core i9 with Radeon Pro took 70 minutes (100% GPU utilization).

Notably, training was unable to take advantage of the integrated Intel Iris graphics card to accelerate training but it was able to partially utilize the integrated graphics card on the M1\. This is quite impressive for a system on a chip.

Unfortunately, while the AMD Radeon was able to reach full 100% utilization on the 15" Macbook Pro, the 13" M1 never made it above 10% utilization. Despite being faster on paper, it still needs more software improvements to capitalize on its hardware. Apple is continuing to actively work on this with [their TensorFlow port](https://github.com/apple/tensorflow_macos) and [their ML Compute framework](https://developer.apple.com/documentation/mlcompute).

### The Verdict: Based on this benchmark, the Apple M1 is 3.64 times as fast as the Intel Core i5 but is not fully utilizing its GPU and, thus, underperforms the i9 with discrete graphics.  

It looks like there are still significant software optimizations for Apple to make in Create ML to fully take advantage of the raw power present in the M1\. It should eventually be able to fully utilize its GPU during just like the i9 was. At which point it would likely handily outperform it.

There are plenty of things to consider when purchasing a new laptop; fitting an object detection model with Create ML is only one. But when pitting these two laptops purchased in 2020 against each other on this task, the Apple M1 appears to be a promising architecture that should be superior as the software is updated to take advantage of it. But, for now, I plan to hold off while things are ironed out.

---

Go through the whole process of training and deploying a Create ML model to your iPhone via [our YouTube](https://bit.ly/rf-yt-sub).