What actually runs: a measurement study of language model placement and decode speed on the Apple Neural Engine
Through a rigorous measurement study of language model placement and decode speed on the Apple Neural Engine, the author demonstrates that computational expression and weight encoding, rather than model architecture alone, dictate accelerator residency and performance, leading to a design procedure that prioritizes encoding efficiency to achieve significantly smaller and faster ternary models.
Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
Imagine a smartphone trying to understand a conversation. To do this, it must run a massive digital brain, a language model, right on the device. For this to work smoothly, the phone needs to use a special, ultra-fast processor built just for this kind of thinking, rather than its general-purpose main brain. The challenge is that this special processor is picky; it will only run certain types of calculations, and it refuses to run others, even if those others are mathematically identical. For years, developers have tried to guess which calculations will work and how to make them fast, often relying on rules of thumb that turn out to be wrong. They have assumed that if a model is small enough, it will run on the fast processor, or that making the numbers smaller will always help. But no one had actually watched the processor to see what it was really doing, or to measure exactly how the size of the model and the way its numbers are stored changed its speed.
A researcher named Shahir M A decided to stop guessing and start watching. Using an Apple computer with an M1 chip, they built a series of experiments to see exactly what happens when a language model tries to run on the phone's special processor, known as the Neural Engine. They did not just look at what the software said it would do; they measured the actual electricity and data moving through the chip to see what was really happening. They tested dozens of different ways to build the same mathematical operation, trained real models of different sizes, and changed how the numbers inside those models were stored, ranging from standard precision to very compressed, low-precision formats. Their goal was simple: to find out what actually gets a model onto the fast processor and how fast it can speak once it gets there.
The first thing they discovered was that the processor does not care about what a calculation means, only how it is written. They found that if you write a specific type of normalization—a step that helps the model keep its numbers stable—in one way, the processor accepts it immediately and runs it at full speed. But if you write the exact same mathematical step using a different, slightly more complicated set of instructions, the processor refuses to touch it and forces the phone to use its slower, general-purpose brain instead. It is as if the processor speaks a specific dialect of math; if you use the right dialect, it listens, but if you use a different one, even if the meaning is the same, it walks away. This means that the way a developer writes the code is just as important as the math itself.
The second, and perhaps most surprising, finding was that the size of the model is not the only thing that decides if it can run on the fast processor. The researchers found that a model with about twenty-six million parameters, written in standard precision, was too small to run on the special processor at all. It was forced to run on the slow brain, taking over a second to generate each word. However, when they took that exact same model and compressed the numbers inside it to use fewer bits, the processor suddenly accepted it. The compressed version ran on the fast processor and generated words in less than a second. In fact, for smaller models, compressing the numbers was the only way to get them onto the fast processor at all. The processor had a hidden rule: it would not run small models unless they were compressed. This flipped the common assumption that bigger models are always the ones that need the fast processor; here, the small ones needed the compression to get in the door.
Once the model was inside the fast processor, the speed was determined almost entirely by how much data had to be moved, not by how complex the math was. The researchers measured the flow of data and found that for every word the model generated, it had to stream the entire set of its weights—the numbers that make up its knowledge—through the processor. This happened for every single word, no matter how long the conversation went on. Because of this, the speed was directly tied to how many bits were in those weights. A model with compressed, low-precision numbers moved much less data and was therefore much faster. They found that a model using two-bit numbers was nearly three times faster than a model using standard numbers, simply because it had to move less data. The type of math the model used, such as whether it focused more on attention or on convolution, mattered very little for speed once the model was already running on the processor. The only thing that mattered was the size of the data being moved.
The researchers concluded that the best way to build a language model for a phone is to start with the compression, not the size. Instead of building a large model and then trying to shrink it, one should choose the most compressed format possible first, and then spend the available memory budget on adding more parameters. They found that a model with twenty-five million parameters, using a specific type of compressed math, could fit into just ten megabytes of space and generate words in about six-tenths of a millisecond. This was nearly ten times smaller and three times faster than the standard, uncompressed models that developers usually start with. The study showed that the path to a fast, on-device language model is not about making the model bigger or more complex, but about choosing the right way to write the math and the right way to store the numbers. By measuring the actual flow of data, they proved that the key to speed is not just having a fast processor, but knowing exactly how to feed it.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.