Building an NPU accelerator for my Mac
What I learned from training a model across my Mac and an FPGA, and how I started to pay more attention to how I sent data between them.
Starting this project, my goal was to build a small accelerator that could help my Mac train a model in less time. But the bigger challenge turned out to be getting useful work done when the two devices spent so much time waiting on the cable to share information between one another.
I trained a CIFAR-10 model using my Mac and a Nexys A7-100T FPGA connected over a 4 Mbaud UART link. Moving more of the training onto the board cut traffic over the cable by about 30%, and letting the Mac work on the next batch while the FPGA was busy gave a 2.5× median speedup over running those same steps one after another.[1]
This project came to mind after a post I saw on Twitter a few weeks ago about a magnetic SSD that could expand the storage on a Mac. Ever since, I’ve wondered whether I could attach a small box to my laptop and have it help train a model, essentially programming my very own NPU add-on.
This mockup by @flowersslop captures the kind of thing I was trying to build: a small box you plug into your laptop for extra compute. It imagines an inference device; I wanted to try the idea with training.
“imagine”
For this project, I used a Nexys A7-100T FPGA board[2] connected to my Mac over a 4 Mbaud UART[3] link. Once I started, though, I realized I’d seriously underestimated how much time the two devices would spend communicating.
Of course, I knew this setup wouldn’t come close to NVLink, but I still thought it would be at least somewhat efficient. It was spending enough time moving data back and forth that I ended up changing the project’s focus. I wanted to see how much training I could get done with the connection I already had, and how much of that waiting I could avoid.
What runs where
I trained on CIFAR-10: tiny images in ten classes, like cats, cars, and airplanes.[4] Before getting into the cable problem, here are the three pieces I was moving data between:
- The CNN[5] on my Mac scans an image for patterns and condenses what it finds into 64 numbers, called features.
- The FPGA projection is a pair of trainable layers that transforms those features. The full image model stays on the Mac.
- The final classifier, also on the Mac, uses the board’s output to predict which class the image belongs to.
To let the projection learn on its own, I give it an auxiliary head: a small extra prediction branch that compares its scores with the known label. That error tells the projection how to change its weights.[6] The animation shows where this feedback goes, and why it doesn’t have to cross the cable.
- The Mac’s CNN slides learned filters across the image, then pools and quantizes the resulting maps into 64 features.
- The Mac sends these features and the known class label to the FPGA over UART.
- Two layers on the board transform the features and save their output before updating any weights.
- The auxiliary head compares class scores with the target and supplies local feedback to update itself and the projection.
- The saved output returns to the Mac’s final classifier, which learns independently. The CNN also has its own prediction head, allowing it to work ahead.
One less trip
In my first version, that auxiliary head lived on the Mac. Every time the FPGA needed to update the projection, it had to send its output across the cable and wait for the Mac to calculate and return the update signal. This meant that the board was sitting idle while it waited for the Mac (even though the calculations were fast, the cable was slow).
So, I moved the auxiliary head onto the FPGA so it could calculate the same training error itself to limit the data transfer as much as possible. The Mac could then send the features and their targets together, giving the board everything it needed to finish the update.
Try switching the head’s location below to see which transfers change.
Head on Mac: two dependent exchanges; 6,144 tensor bytes per full batch.
Head on FPGA: one dependent exchange; 4,416 tensor bytes per full batch.
The 28.125% payload reduction becomes about 30% in measured UART traffic, including protocol and polling.
For a full batch of 32 images, this changed what I had to send:
- Instead of sending back a 2,048-byte update signal calculated on the Mac, I could send 320 bytes of targets with the features.
- The total tensor payload fell from 6,144 to 4,416 bytes, even though I kept the feature width and numerical precision the same.
What surprised me was that this made the FPGA do more work. Its measured board time rose from about 13.1 to 15.4 ms per update, yet the complete sequential block call fell from 38.3 to 31.1 ms. Doing the calculation on the board took less extra time than asking the Mac to do it.
Working ahead
After removing that exchange, I still had a Mac sitting around while the FPGA worked. Since the CNN has its own training objective, it didn’t need the current projection update to finish before starting the next batch. I changed the schedule to take advantage of that:
- A worker handles the FPGA call for the current batch.
- While that call is running, the Mac trains the CNN on the next batch.
- When the FPGA’s result comes back, the Mac uses it to train the final classifier, keeping the updates within each part of the model in order.
I did have to be careful about when I evaluated the model, though. If the Mac had taken an extra step, I could accidentally compare different model states and mistake that for a speedup. Before evaluating each checkpoint, I waited for the worker and finished the queued work.
You can replay three recorded runs from the same session below to see the difference. Each processed 2,024 images over 64 updates, so the faster version is finishing the same amount of work.
Head on Mac, sequential: 4.624 seconds.
Head on FPGA, sequential: 4.245 seconds.
Head on FPGA with overlap: 2.263 seconds.
Did it help?
To see whether these changes helped over a full training run, I tried the head on each device, both with and without overlap. I repeated those four combinations across three seeds, stopping at a 60% validation accuracy target. Within each seed, all four versions reached the same selected model state and predictions, with a median test accuracy of 60.56% across the seeds.
The two changes helped in different ways:
- Moving the head cut measured traffic by about 30%, although it wasn’t faster in every sequential run.
- Working ahead gave the larger time saving, with median paired speedups of about 2.2× when the head was on the Mac and 2.5× when it was on the FPGA.
Making the cable wait
Once that was working, I wanted to know what would happen if each exchange took even longer. I kept the cable at 4 Mbaud and added a delay before each dependent exchange, so the version with the head on the Mac paid that delay twice per update and the FPGA version paid it once.
With overlap, paired head-residency speedup rose from 1.196× at native latency to 1.397×, 1.627×, and 1.734× at 5, 20, and 50 ms of added handoff cost.
These measurements come from 96 short hardware cases across three seeds and two run orders. Selecting zero added delay still includes the real UART cost.
Where this fits
This project builds on the low-communication training ideas explored in DiLoCo and MuLoCo. They helped shape the question I was asking: how much useful learning can happen before the devices need to talk again?
DiLoCo gives each worker a replica of the model. Each replica trains on its own data for many steps using AdamW, then the workers combine their weight changes through an outer optimizer using Nesterov momentum.[7] MuLoCo keeps that framework and uses Muon for the inner optimizer’s hidden-layer matrix updates, while retaining AdamW for other parameters. It studies how that choice affects learning when updates are combined infrequently.[8]
Here, the Mac and FPGA hold different pieces of one model. Features, targets, and projection outputs still cross the cable every batch. Giving the modules their own learning signals lets the FPGA update its projection without waiting for the final classifier’s gradients. Moving the auxiliary head onto the board removes one dependent exchange, and overlapping batches lets the Mac work during the remaining wait. I’m changing what crosses the link and when each device can work, rather than periodically combining replicas’ weight updates.
The module-level learning is more directly related to Decoupled Greedy Learning, which also trains parts of a network with local objectives. My experiment explores head placement and scheduling on this particular Mac–FPGA link.
Final thoughts
I’m glad I kept working within this constraint of tight communication, because it made me think much harder about what actually needed to cross the cable. Data transfer was something I’d never really thought about, so this was a really fun project to build up from and fully appreciate how fast data can move in our hardware today. This project started out as trying to make my own NPU so that I could make training more robust with MPS (Apple’s GPU acceleration) integration. I’m incredibly grateful I encountered the challenges I did, though, because it made this project much more fun.
And the final thing I want to get to, which I know you’ve probably all been wondering about: yes, I know this isn’t a practical way to speed up training on a laptop. Adding more cables or connection points, or just using a faster link, would have been a much more sensible thing to try (and a much easier fix). But then again, where’s the fun in that? :)
I want to also thank Ishaan Ranjan, Raghav Senthil Kumar, and Vignesh Nagarajan for their valuable advice and support.
Sources & code
Sources for the walkthrough and the measurements above:
- [1]Code and experiment recordsMy implementation and measurements, including the traffic and training-time results.↩
- [2]Nexys A7 FPGA boardDigilent · Hardware specifications and interfaces.↩
- [3]UART: A Hardware Communication ProtocolAnalog Devices · An introduction to the serial link.↩
- [4]CIFAR-10 datasetKrizhevsky, Nair & Hinton · The images and labels used here.↩
- [5]Convolutional Neural NetworksStanford CS231n · Filters, feature maps, and pooling.↩
- [6]Decoupled Greedy Learning of CNNsBelilovsky, Eickenberg & Oyallon · ICML 2020. Background on training modules with local objectives.↩
- [7]DiLoCo: Distributed Low-Communication Training of Language ModelsDouillard et al. · 2023. An influence on this project’s communication-focused approach: replicas take many local steps before combining weight updates.↩
- [8]MuLoCo: Muon is a Practical Inner Optimizer for DiLoCoThérien, Huang, Defazio, Rish & Belilovsky · 2025; revised 2026. An influence on this project’s thinking about local computation and communication, using Muon within the DiLoCo framework.↩
