Multiply-Accumulate Operations (MACs) are the fundamental arithmetic computations at the core of neural network inference and training, each consisting of a multiplication followed by an addition. They serve as a hardware-agnostic metric for estimating the computational cost, or FLOPs (Floating Point Operations), of a model, with one MAC typically counted as two FLOPs. This count is crucial for hardware-aware model design, directly correlating with inference latency and energy consumption on target silicon like NPUs (Neural Processing Units) or mobile CPUs.
Glossary
Multiply-Accumulate Operations (MACs)

What is Multiply-Accumulate Operations (MACs)?
A fundamental metric for quantifying the computational workload of neural networks, independent of specific hardware.
In practice, MAC counts are derived from a model's architecture—most densely in convolutional and fully connected layers. Engineers use MAC estimates during Design Space Exploration (DSE) to compare model efficiency, guide model compression via pruning or quantization, and ensure designs meet the constraints of edge AI deployment. While a critical proxy, MACs alone do not capture memory access costs, which are often the true bottleneck, as analyzed by performance models like the Roofline Model.
Key Characteristics of MACs
Multiply-Accumulate (MAC) operations are the atomic computations of neural networks. Understanding their properties is essential for hardware-aware model design and performance estimation.
Fundamental Neural Network Building Block
A Multiply-Accumulate (MAC) operation computes a = a + (b * c), where the product of two operands is added to an accumulator. This is the core computation in fully connected (dense) layers, convolutional layers, and attention mechanisms. The total number of MACs in a model, often reported as FLOPs (Floating Point Operations), serves as a hardware-agnostic proxy for computational cost and energy consumption, guiding architecture selection for target hardware.
Hardware Performance Bottleneck
The throughput of MAC units defines a processor's peak theoretical performance, measured in GMACs/sec or TOPS (Tera Operations Per Second). However, real-world performance is often limited by the memory wall—the time and energy cost of moving operands (weights, activations) from memory to the compute unit. Efficient model design focuses on increasing operational intensity (MACs per byte of data moved) to approach the hardware's compute roof, as visualized by the Roofline Model.
Precision and Quantization
MACs are performed at a specific numerical precision, which directly impacts model size, speed, and power.
- Training: Typically uses FP32 or BF16 for gradient stability.
- Inference: Often uses lower precision like INT8 or FP16 via quantization to reduce memory bandwidth and leverage faster integer or mixed-precision hardware (e.g., Tensor Cores, NPUs).
- Quantization-Aware Training (QAT) simulates low-precision MACs during training to maintain accuracy, whereas Post-Training Quantization (PTQ) calibrates a pre-trained model.
Sparsity and Conditional Computation
Not all MACs are equally important. Exploiting sparsity is key to efficiency.
- Weight Sparsity: Many model weights are near zero after pruning. Skipping these MACs can save compute.
- Activation Sparsity: Functions like ReLU generate zeros, creating dynamic sparsity.
- Conditional Execution: Architectures like Mixture of Experts (MoE) or Early Exit Networks activate only a subset of model parameters per input, performing a sparse subset of total possible MACs. Hardware must support sparse computation and efficient sparsity encoding (e.g., CSR format) to realize these gains.
Compiler & Hardware Optimizations
Modern ML compilers transform high-level model graphs into highly optimized sequences of hardware MAC instructions.
- Operator Fusion: Combines consecutive ops (e.g., Conv + BatchNorm + ReLU) into a single kernel, reducing intermediate memory writes and increasing MAC density.
- Kernel Auto-Tuning: Searches for optimal tile sizes and loop orders to maximize MAC throughput on specific hardware (used by TVM, TensorRT).
- Memory Hierarchy Management: Strategies like tiling orchestrate data movement between DRAM, caches, and registers to keep MAC units fed, minimizing stalls.
MACs vs. Model Quality Trade-off
In hardware-aware design, MAC count is a primary optimization target, but not in isolation. The goal is to find architectures on the Pareto frontier of accuracy vs. MACs. Techniques include:
- Efficient Layer Designs: Using depthwise separable convolutions over standard convolutions drastically reduces MACs.
- Neural Architecture Search (NAS): Automatically explores the design space for models that maximize accuracy under a MAC budget.
- Knowledge Distillation: Trains a low-MAC student model to mimic a high-accuracy teacher model, preserving performance with fewer computations.
How Multiply-Accumulate Operations Work
Multiply-Accumulate Operations are the atomic computations of neural network inference, forming the basis for measuring computational cost.
A Multiply-Accumulate Operation is a fundamental computation that performs a multiplication followed by an addition to a running sum, expressed as a = a + (b * c). In neural networks, this pattern is ubiquitous in linear layers and convolutions, where weights are multiplied by activations and summed. The total number of MACs in a model serves as a hardware-agnostic proxy for its computational complexity and energy consumption, directly informing hardware-aware design.
Hardware accelerators like NPUs and Tensor Cores are optimized to execute massive arrays of MACs in parallel. The efficiency of these units defines a system's peak theoretical performance, often visualized using the Roofline Model. When designing models for edge deployment, engineers minimize MAC counts through techniques like depthwise separable convolutions and pruning to stay within the memory bandwidth and compute constraints of target silicon, a core practice in TinyML.
MACs Calculation Examples for Common Layers
Formulas for calculating Multiply-Accumulate Operations (MACs) for standard neural network layers, assuming a batch size of 1. MACs are a hardware-agnostic metric for computational cost.
| Layer Type | Key Parameters | MACs Formula | Example Calculation | Notes |
|---|---|---|---|---|
Standard Convolution (Conv2D) | Input: (H_in, W_in, C_in), Kernel: (K_h, K_w), Output Channels: C_out, Stride: S, Padding: P | C_out * H_out * W_out * C_in * K_h * K_w | Input: 224x224x3, Kernel: 3x3, C_out: 64, Stride: 1, Padding: 'same' → H_out=W_out=224 → 64 * 224 * 224 * 3 * 3 * 3 = ~173M MACs | Dominant cost. 'same' padding implies H_out = H_in / S (rounded up). |
Depthwise Separable Convolution | Input: (H_in, W_in, C_in), Kernel: (K_h, K_w), Output Channels: C_out | (H_out * W_out * C_in * K_h * K_w) + (H_out * W_out * C_in * C_out) | Input: 224x224x32, Kernel: 3x3, C_out: 64 → DW: 2242243233 ≈ 14.5M MACs; PW: 22422432*64 ≈ 103M MACs; Total: ~117M MACs | Factorizes standard conv into Depthwise (DW) + Pointwise (PW) conv. Significant MACs reduction vs. standard conv. |
Fully Connected (Linear/Dense) | Input Features: F_in, Output Features: F_out | F_in * F_out | F_in: 1024, F_out: 4096 → 1024 * 4096 = ~4.2M MACs | Also counts as MACs. Often a bottleneck in MLPs and transformer FFN layers. |
Multi-Head Self-Attention (Transformer) | Sequence Length: L, Embedding Dim: D, Number of Heads: H | 4 * L^2 * D + 2 * L * D^2 | L: 256, D: 768, H: 12 → Term1: 4256^2768 ≈ 201M MACs; Term2: 2256768^2 ≈ 302M MACs; Total: ~503M MACs | Approximation. Term1 is attention score calc (QK^T). Term2 is projection layers. Complexity is O(L^2). |
Batch Normalization | Spatial Dimensions: H, W, Channels: C | 2 * H * W * C | Feature map: 28x28x256 → 2 * 28 * 28 * 256 = ~401k MACs | Inference: fused into preceding conv. Counts as MACs if computed separately (mean subtraction, scaling). |
Average/Max Pooling | Input: (H_in, W_in, C), Pool Size: (P_h, P_w) | H_out * W_out * C * P_h * P_w (Average Pooling only) | Input: 28x28x128, Pool: 2x2, Stride: 2 → H_out=14, W_out=14 → 141412822 = ~100k MACs (Avg Pool) | Max Pooling uses comparisons, not multiplies, so often considered 0 MACs. Average Pooling involves divisions. |
Pointwise Convolution (1x1 Conv) | Input: (H, W, C_in), Output Channels: C_out | H * W * C_in * C_out | Input: 56x56x256, C_out: 512 → 56 * 56 * 256 * 512 = ~411M MACs | Heavy cost due to channel interaction. Core of 'bottleneck' blocks and pointwise stage in depthwise separable conv. |
Grouped Convolution | Input: (H_in, W_in, C_in), Kernel: (K_h, K_w), C_out, Groups: G | (C_out / G) * H_out * W_out * (C_in / G) * K_h * K_w * G | Input: 112x112x128, Kernel: 3x3, C_out: 128, Groups: 32 → (128/32)112112*(128/32)3332 = 1121121283*3 = ~14.4M MACs | Reduces connections between input/output channels. G=1 is standard conv. G=C_in is depthwise conv. |
Frequently Asked Questions
Essential questions about Multiply-Accumulate Operations (MACs), the fundamental unit of computation in neural networks and a critical metric for hardware-aware model design.
A Multiply-Accumulate Operation (MAC) is the fundamental arithmetic computation at the core of neural network inference, consisting of a multiplication followed by an addition to an accumulator register. It is expressed as a = a + (b * c), where the product of two operands (b and c) is added to a running sum (a). This operation is the primary workload for matrix multiplications and convolutions, which dominate the compute in deep learning models. As a hardware-agnostic metric, the total number of MACs required to process an input through a model provides a first-order estimate of its computational cost, directly influencing latency and energy consumption on target hardware.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
Multiply-Accumulate Operations are the fundamental building block of neural network inference. Understanding related concepts is crucial for hardware-aware design.
Floating-Point Operations (FLOPs)
A broader metric for computational cost that counts all floating-point operations (additions, multiplications, divisions). MACs are a specific subset of FLOPs. One MAC equals two FLOPs (one multiply, one add). FLOPs are often used for theoretical peak performance of hardware, while MACs are a more precise measure for neural network inference workloads.
Operational Intensity
A key metric in the Roofline Model, defined as the ratio of operations (e.g., MACs) to bytes of data moved from memory. It determines whether a kernel is compute-bound or memory-bound.
- Low Intensity: Performance limited by memory bandwidth.
- High Intensity: Performance limited by peak compute (MAC/s). Hardware-aware design aims to increase operational intensity through techniques like operator fusion and optimal data layout to maximize hardware utilization.
Tensor Cores
Specialized hardware units in modern NVIDIA GPUs designed to perform mixed-precision matrix multiply-accumulate operations at extremely high throughput. They execute the fundamental GEMM (General Matrix Multiply) operation, which is dense with MACs. Using Tensor Cores requires:
- Data in supported formats (e.g., FP16, BF16, INT8, INT4).
- Specific matrix dimensions (multiples of 8 or 16).
- Compiler/runtime support (e.g., via TensorRT or cuBLAS).
Neural Processing Unit (NPU)
A specialized microprocessor designed explicitly to accelerate neural network computations. Its architecture is optimized for the high-volume, parallel MAC operations found in AI workloads. Key features include:
- Systolic arrays or other dense MAC engines.
- Dedicated on-chip memory hierarchies for weights and activations.
- Support for low-precision data types (INT8, INT4).
- Compiler stacks (like TVM) that map neural network graphs to the NPU's execution units.
Depthwise Separable Convolution
An efficient convolutional layer that drastically reduces MAC count compared to a standard convolution. It factorizes the operation into two stages:
- Depthwise Convolution: A single filter per input channel (spatial filtering).
- Pointwise Convolution: A 1x1 convolution across channels (channel mixing). This design, central to architectures like MobileNet, can reduce MACs by an order of magnitude while maintaining competitive accuracy, making it a cornerstone of hardware-aware model design for edge devices.
Roofline Model
An analytical performance model used to bound the achievable performance of a computational kernel. It plots performance (e.g., in MACs/second) against operational intensity. The model reveals two ceilings:
- Memory-Bound Roof: Limited by DRAM bandwidth.
- Compute-Bound Roof: Limited by peak MAC throughput (e.g., of Tensor Cores or an NPU). A kernel's performance is plotted on this chart, showing how close it is to hardware limits and whether optimization efforts should focus on reducing memory access or improving compute utilization.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us