← Latest papers
💻 computer science

Transformers as Generic Deep Neural Networks: Exact Compilation, the Cost of Removing Activation–Activation Products, and Multi-Agent Attention Clustering

This paper demonstrates that Transformer blocks can be exactly compiled into generic deep neural networks using a minimal set of operations, thereby eliminating the need for specialized hardware while enabling efficient multi-agent attention clustering and unbiased tail-mass estimation that outperforms standard top-kk dropping.

Original authors: Sergey Salishev, Zeev Volkovich, Oleg Granichin

Published 2026-11-17
📖 6 min read🧠 Deep dive

Original authors: Sergey Salishev, Zeev Volkovich, Oleg Granichin

Original paper licensed under CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). ✨ This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

In the modern landscape of artificial intelligence, a specific type of computer program known as a Transformer has become the dominant force behind everything from image recognition to language translation. These programs are built from layers of mathematical operations that process information in a highly structured way. For years, the hardware engineers who build the chips powering these programs have treated Transformers as a special, unique category. Because these programs rely on specific, complex steps to calculate how different parts of a sentence or image relate to one another, chip designers have created dedicated, custom-built circuits just to handle those steps. They also developed special methods to shrink the programs down to run on smaller devices, assuming the standard tools used for other types of neural networks would not work. The prevailing belief was that the unique math of Transformers required unique hardware, separating them from the general-purpose deep neural networks that had been the standard for decades.

A team of researchers from St. Petersburg University and Braude College of Engineering has challenged this separation, proving that the special hardware is not actually necessary. They demonstrated that every single block of a Transformer can be translated, or compiled, into a generic deep neural network without losing any precision. The key to this translation lies in how the program handles multiplication. In a standard Transformer, the program often multiplies two changing values together at the same time. The researchers showed that if you remove this specific type of multiplication, the program becomes much slower and requires significantly more computational effort, essentially forcing the computer to do extra work to achieve the same result. However, they also found that if the hardware simply adds one common operation—the ability to multiply two changing values together element by element—the entire Transformer can run on a standard, generic chip with no extra cost in speed or accuracy. This discovery means that the specialized circuits built for Transformers are not a fundamental requirement of the math, but rather a workaround for a missing capability in current hardware.

The researchers tested this idea by taking three different, pre-trained models—one for identifying animals in images, one for enhancing the resolution of pictures, and one for predicting the next word in a sentence—and converting them into these generic networks. When they kept all the data points, the converted models performed exactly as well as the original ones, matching their accuracy to the last decimal point. This confirmed that the translation was mathematically perfect. The study then looked at what happens when the hardware lacks the ability to multiply two changing values directly. In this scenario, the computer must use a more complicated method involving squaring numbers and adding them together to simulate the multiplication. The researchers proved that this method forces the computer to perform a massive number of extra calculations. For a standard image with a few hundred pixels, this "strict" method required the computer to evaluate a specific mathematical function over sixteen million times per image, whereas the method that allows direct multiplication required only about half a million evaluations. This difference explains why current specialized chips are so much faster; they are built to handle the direct multiplication that the researchers identified as the missing link.

The paper also explored a way to make these programs faster by ignoring the least important parts of the calculation, a technique known as top-k attention. In a Transformer, the program calculates a score for every possible relationship between words or pixels, but often only a few of these scores are truly important. The researchers showed that if the program keeps only the top scores and discards the rest, it can save a tremendous amount of memory and time. However, simply throwing away the discarded scores introduces an error. To fix this, they developed a method to estimate the total weight of the discarded information and add it back in as a small, uniform correction. They proved mathematically that this correction provides the most accurate possible estimate of the missing information. When they tested this on their converted models, the version that used this correction performed significantly better than the version that simply dropped the data. On the image classification task, the corrected model with only sixteen important connections performed as well as the uncorrected model with thirty-two connections, effectively doubling the efficiency without sacrificing accuracy.

The researchers also discovered that these programs naturally group similar inputs together. When a program processes a cluster of similar images or words, the important connections tend to be the same for the whole group. By identifying these groups first, the program can decide which connections to keep before it even calculates the scores, further reducing the workload. This behavior mirrors how flocks of birds move, where each bird follows a fixed number of its nearest neighbors. The researchers showed that the mathematical step used in their attention mechanism is identical to the step used in models that describe how birds flock. This connection suggests that the same efficient, generic hardware that runs these neural networks could also power autonomous robots or drones that need to make decisions in real-time based on their surroundings.

Ultimately, the work provides a clear path forward for hardware designers. The study proves that to run these powerful programs efficiently, a chip does not need a dedicated Transformer unit. Instead, it only needs to include the ability to multiply two changing values together element by element, a feature that is already present in many existing chips designed for other tasks. By adding this single capability, engineers can run the most advanced artificial intelligence models on standard, generic hardware with the same speed and precision as specialized chips. The researchers confirmed this by simulating the performance on a graphics card, showing that the generic approach was only slightly slower than the specialized one, while the approach that tried to avoid multiplication entirely was significantly slower. The findings suggest that the future of artificial intelligence hardware may not require a proliferation of special-purpose chips, but rather a return to a simpler, more universal design that can handle the full range of modern AI tasks with equal ease.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →