Schema der Matrizenmultiplikation: Eine 3×3-Matrix A und eine 3×3-Matrix B werden miteinander multipliziert. Eine hervorgehobene Zeile aus A und eine hervorgehobene Spalte aus B zeigen, wie ihre Elemente paarweise multipliziert und dann summiert werden, um eine einzelne Zelle der Ergebnismatrix C zu erzeugen.

Matrix Multiplication

Matrix multiplication is a computational operation in which two rectangular tables of numbers – so-called matrices – are combined according to a fixed scheme. In AI, it is the most common and most computationally intensive operation of all: almost every step in a neural network boils down to matrix multiplication.

A matrix is a rectangular table of numbers, for example four rows and four columns. Matrix multiplication is the procedure by which two such tables are combined into a third. The result is again a matrix. The rule here: each cell of the result is produced by multiplying an entire row of the first table with an entire column of the second table element by element and adding up the products. This sounds unassuming, but it is the computational core of modern AI systems. Without matrix multiplication there would be no language models, no image recognition systems, and no AI chips in today’s sense.

The role of matrix multiplication in neural networks

A neural network – the computational model behind modern AI systems – consists of many layers. Each layer stores its learned capabilities in a matrix of millions or billions of numbers, the so-called weights. When the network processes an input, for example a sentence or an image, this input is likewise represented as a matrix. The actual computation in each layer is then almost always: input matrix times weight matrix.

In a large language model like GPT-4, this happens dozens of times per generated word, for each user simultaneously. Matrix multiplication accounts for over 90 percent of the total computation time. Anyone wanting to reduce the runtime or cost of an AI model almost inevitably has to start here.

How the calculation works – and why it is so demanding

A concrete example: you multiply two matrices of size 1000 × 1000. The result also has 1000 × 1000 cells, i.e. one million entries. For each of these cells you need 1000 multiplications and 999 additions. In total, that is around one billion individual computational operations – for two medium-sized matrices, just once.

The decisive advantage over many other computational tasks: all these billions of operations are completely independent of one another. You don’t have to wait until one cell is finished before computing the next. This allows genuine parallel processing. This is exactly what graphics processors (GPUs) and specialized AI chips are designed for: they carry out thousands of such operations simultaneously.

A common misconception is to equate matrix multiplication with ordinary multiplication. For normal numbers it holds that: A times B is the same as B times A. For matrices this is false. The order matters, and the result can differ completely. Moreover, matrix multiplication is only possible at all if the number of columns of the first matrix matches the number of rows of the second.

Matmul in chips, benchmarks, and AI news

In the tech press, the term often appears in abbreviated form: “Matmul” is the short form of Matrix Multiplication and can be found in product descriptions from Nvidia, Google, and Apple. When a chip manufacturer states that its new processor delivers “X teraflops for AI workloads,” they almost always mean: that many trillions of computational operations per second for matrix multiplication.

Google’s AI chips, the so-called TPUs (Tensor Processing Units), were built from the ground up for exactly this one task. Apple’s Neural Engine in iPhones and Macs is likewise, at its core, a specialized matmul accelerator. Whenever a manufacturer talks about “AI acceleration,” the underlying question is almost always: how fast can the chip perform matrix multiplications?

Another context in which the term comes up is efficiency debates. Researchers are working to replace matrix multiplication with more economical methods or at least to simplify it. One method is quantization: instead of storing numbers with 32-bit precision, 8 or even 4 bits are often sufficient. This reduces memory requirements and makes the multiplication faster – at the cost of a slight inaccuracy that in practice is often barely noticeable.

Related Products

Latest News

Subscribe free. Unsubscribe the second it sucks.

High-signal news across AI, business, UX, and tech. Every morning.