One backbone that is Pareto-optimal across phones, DSPs, GPUs, and Apple/Pixel accelerators — built from a new search-space primitive (the Universal Inverted Bottleneck) and a mobile-friendly attention block (Mobile MQA), wired together by two-phase hardware-aware NAS. The Hybrid-Large model reaches ~87% ImageNet-1K top-1 at a few milliseconds on a Pixel EdgeTPU.
You ship a single photo-classifier model in an app that runs on a billion phones. One user has a flagship with a Pixel EdgeTPU, another has a mid-range phone where the model falls back to the CPU, a third has a chip with a fixed-point Hexagon DSP, and a fourth is on an iPhone with the Apple Neural Engine. You measure latency on all four. The same model that is fast on the EdgeTPU is slow on the DSP, and the model your colleague tuned for the DSP is mediocre on the GPU. There is no single architecture that is best everywhere — or so everyone assumed.
That is the problem MobileNetV4 (MNv4) attacks. The paper's claim is bold: with the right building blocks, you can design a family of models that sit on or near the latency/accuracy Pareto frontier on every mobile accelerator simultaneously — "mostly Pareto-optimal across the mobile ecosystem." Not one model per device; one design philosophy that generalizes.
Why was this hard before? Earlier MobileNets were tuned implicitly for one cost model. The original inverted bottleneck (IB) from MobileNetV2 was optimized when the bottleneck was memory bandwidth on CPUs. But an EdgeTPU is a systolic-array matrix engine: it loves big dense 1×1 convolutions (matrix multiplies) and is starved by depthwise convolutions, which have almost no arithmetic to amortize their memory traffic. A DSP, by contrast, is the opposite. A block that is cheap on one is expensive on the other.
Each accelerator weights operations differently. Drag the slider to change how "depthwise-heavy" a block is, and watch the latency bars for four device types diverge — there is no single block that wins everywhere. This is exactly why one fixed search space failed.
MNv4's answer has three moving parts, and the rest of this lesson builds each one:
Let's make the cost intuition rigorous first — because every design choice in the paper is a response to the roofline.
Before we can understand why MNv4's blocks are shaped the way they are, we need the right cost model. FLOPs alone lie. The honest model is the roofline: a layer's achievable speed is capped by whichever runs out first — the chip's arithmetic throughput, or its memory bandwidth.
Define two quantities for a layer:
Their ratio is the operational intensity:
A chip has a peak compute rate P (ops/s) and a peak bandwidth B (bytes/s). The roofline says the attainable rate for this layer is:
If I is large, the layer is compute-bound (you saturate the math units). If I is small, it is memory-bound (you saturate the bus and the math units idle). The crossover happens at the ridge point I* = P / B. Below I*, adding more FLOPs is nearly free — you have spare math. Above I*, more FLOPs cost time.
Take a feature map of H = W = 28, C = 128 channels. Compare two layers a mobile network uses constantly.
(a) A 1×1 (pointwise) conv mixing 128 → 128 channels. Per output pixel it does C·C = 128·128 = 16,384 multiply-adds, over H·W = 784 pixels:
Memory: weights = 128·128 = 16,384 values; activations in/out ≈ 2·784·128 = 200,704 values. At 1 byte/value (int8): Q ≈ 217,088 bytes. So
(b) A 3×3 depthwise conv on the same map. Each channel is convolved independently, so per output pixel it does only 3·3 = 9 MACs per channel:
Memory: weights = 128·9 = 1,152 values; activations ≈ 2·784·128 = 200,704 values. Q ≈ 201,856 bytes.
The depthwise conv has 14× fewer FLOPs than the 1×1 conv — and yet its operational intensity is 13× lower. On a Pixel EdgeTPU the ridge point I* is high (it is a matrix engine with enormous P), so the depthwise layer sits deep in the memory-bound regime and runs at a tiny fraction of peak. The 1×1 conv, despite its larger FLOP count, runs near peak. The cheap-looking layer is the slow one. That single inversion of intuition explains most of MNv4.
Log-log roofline. The slanted line is the memory bound (slope = bandwidth), the flat line is the compute bound. Drag the ridge point I* (different chips have different ridge points). Watch how the 1×1 conv and the depthwise conv fall on different sides — and how moving I* (changing chip) flips which one is bottlenecked.
To understand MNv4's new block we first need the one it extends: the inverted bottleneck (IB) from MobileNetV2. The name is a deliberate joke. A classic ResNet bottleneck goes wide → narrow → wide; the inverted bottleneck goes narrow → wide → narrow. Why invert it?
The block takes an input with C channels and:
Plus a residual add when input and output shapes match. The genius is that the expensive spatial work (the depthwise conv) happens in the wide expanded space where it is most expressive, while the data that travels between blocks is kept narrow — small to store and to move. The block is "fat in the middle, thin at the ends."
Let C = 64, e = 4 (so eC = 256), k = 3, stride 1, H = W = 28, C' = 64.
Expand 1×1: 28·28·(64·256) = 784·16,384 = 12,845,056 MACs.
Depthwise 3×3: 28·28·(256·9) = 784·2,304 = 1,806,336 MACs.
Project 1×1: 28·28·(256·64) = 784·16,384 = 12,845,056 MACs.
Total ≈ 27.5M MACs, of which the two 1×1 convs are ~93%. The depthwise — the part that does the actual spatial reasoning — is only ~7% of the FLOPs but, per Chapter 1, can be a much larger fraction of the latency on a matrix engine. Notice the asymmetry: the block's expressiveness comes from the cheap part, its FLOPs from the expensive parts, and its latency from a chip-dependent mix.
Click "Next Stage" to walk the tensor through expand → depthwise → project. The bar shows the channel width at each point — narrow at the ends, wide in the middle. Adjust the expansion ratio to see the middle balloon.
One more crucial detail: the linear bottleneck. MobileNetV2 removed the activation after the final projection. The argument: a ReLU on a low-dimensional tensor destroys information (it zeroes out roughly half of each narrow vector, and there is no redundant width to recover it). In the wide expanded space ReLU is fine — there is plenty of room — but on the narrow output you keep it linear to preserve the manifold. MNv4 inherits this.
Here is the paper's central architectural contribution. The inverted bottleneck has exactly one depthwise conv, in a fixed position (after the expansion). Other strong blocks place depthwise convs elsewhere — a ConvNext block puts a large-kernel depthwise first. Each is good for different chips and stages. Instead of committing to one, MNv4 builds a superset with two optional depthwise convolutions and lets the search decide which to keep.
The UIB block, in order:
start_dw ∈ {on, off}. ConvNext-style spatial mixing in the narrow space.mid_dw ∈ {on, off}. This is the classic IB depthwise. Carries the stride if the block downsamples.Two binary switches give four named instantiations — a single primitive that covers the whole zoo:
| start_dw | mid_dw | Name | What it is |
|---|---|---|---|
| off | on | IB (Inverted Bottleneck) | The classic MobileNetV2 block |
| on | off | ConvNext-like | Depthwise first, then expand/project |
| on | on | ExtraDW | Both depthwise convs — MNv4's signature block |
| off | off | FFN (FeedForward) | Two stacked 1×1 convs — pure channel mixing, no spatial |
The ExtraDW instantiation (both depthwise convs on) is the new and surprisingly powerful member. Why does adding a second depthwise help?
Input [28, 28, 64], e = 4 (eC = 256), C' = 64, k = 3, stride 1. Compare MAC cost (the always-on 1×1 convs are shared by all four):
| Config | Start DW MACs | Mid DW MACs | 1×1 MACs (both) | Total |
|---|---|---|---|---|
| FFN | 0 | 0 | 25.69M | 25.69M |
| IB | 0 | 28·28·256·9 = 1.81M | 25.69M | 27.50M |
| ConvNext-like | 28·28·64·9 = 0.45M | 0 | 25.69M | 26.14M |
| ExtraDW | 0.45M | 1.81M | 25.69M | 27.95M |
The four configs differ by at most ~9% in FLOPs — they are nearly interchangeable on a FLOP budget — but they place spatial mixing very differently and therefore land in different spots on each chip's roofline. That is the point: the search has cheap freedom to choose where the receptive field comes from. Note the start-DW is 4× cheaper than the mid-DW here because it runs on 64 channels instead of the expanded 256.
Toggle the two optional depthwise convs. The pipeline redraws and the block's name updates to IB / ConvNext-like / ExtraDW / FFN. The effective receptive field and FLOP estimate update live.
One more subtlety the paper handles carefully: stride placement. When a UIB block downsamples (stride 2), the stride lives on whichever depthwise conv is present (preferring the mid-DW), keeping the 1×1 convs at full resolution-independent matmul shapes. If both depthwise convs are off (FFN config), the block cannot downsample on its own — the search simply won't place an FFN where a stride is required.
Convolutions have a local receptive field. To reach genuinely global context (helpful for the largest, highest-accuracy MNv4 models) you want attention. But standard multi-head attention is brutal on mobile: it is memory-bound (low operational intensity, per Chapter 1) and its keys/values blow up memory traffic. MNv4 introduces Mobile MQA, an attention block engineered around the roofline.
Start from standard attention on a feature map flattened to N = H·W tokens of dimension d:
In multi-head attention (MHA) with h heads, each head has its own Q, K, and V projections. Keys and values therefore cost h separate [N, dh] tensors. The K and V tensors dominate the memory traffic, and on a mobile accelerator that traffic — not the matmul FLOPs — is the bottleneck.
MQA (Shazeer 2019) keeps h separate query heads but uses a single shared key and a single shared value across all heads:
This collapses the K/V memory from h projections to 1. The query is still per-head (cheap to compute, the part that gives heads their diversity), but the expensive-to-move K and V are shared. On-device this is a large win precisely because the bottleneck was K/V traffic, not query FLOPs. The paper reports MQA gives a substantial speedup on mobile accelerators with negligible accuracy loss versus MHA.
Even one K and one V over all N = H·W positions is a lot when the feature map is large. Mobile MQA adds an optional spatial-reduction: downsample the keys and values (a stride-s depthwise conv, typically s = 2) before the attention, so K and V have N/s² rows while the queries keep full resolution N. The attention matrix shrinks from N×N to N×(N/s²):
Queries still attend globally (every position gets a global receptive field), but to a coarser summary of the scene. For classification this is nearly lossless — fine detail is already captured by the convolutional stages; attention only needs the global gist.
Take a 14×14 feature map, so N = 196, with h = 8 heads and dh = 32, spatial reduction s = 2 (so N/s² = 49).
K/V tensor sizes:
Attention matrix size: MHA computes h·N·N = 8·196·196 = 307,328 scores; MQA+SR computes h·N·(N/4) = 8·196·49 = 76,832 — a 4× shrink in the score matrix too. The combined effect: a global-context block whose cost is dominated by the small per-head query matmuls, with the memory-heavy K/V slashed by ~32×. That is what makes attention viable on a phone.
Left: standard MHA — every head carries its own K and V (lots of memory). Middle: MQA — heads share one K and one V. Right: spatial reduction shrinks K/V further. Drag the head count and SR factor; the K/V memory bar and the score-matrix size update live.
In MNv4 the attention is added only in the deepest, lowest-resolution stages (where N is small, so even attention is affordable) and only in the Hybrid variants. The pure-conv variants skip it entirely — many accelerators run convolution far better than attention, so for those targets a conv-only model is on the frontier. This is the universality philosophy again: attention is one tool offered to the search, not a mandate.
We now have a rich search space: a stack of UIB blocks, each with two depthwise switches, kernel sizes, expansion ratios, and channel counts, plus optional Mobile MQA in the deep stages. The combinatorics are enormous. MNv4 searches it with two-phase neural architecture search guided by measured on-device latency.
Why two phases? A flat search over everything at once is sample-inefficient: the search wastes most of its budget on architectures that are the wrong overall size. MNv4 factorizes the decision:
The objective is a Pareto search: maximize accuracy subject to a latency target measured by actually running each candidate on the device (or a calibrated latency model of it), not by a FLOP proxy. Per Chapter 1, FLOPs and latency disagree on mobile chips, so a FLOP-guided search would systematically pick the wrong blocks.
Suppose the space has M macro configurations and, for each, F micro configurations per block over B blocks (so FB micro choices). A flat search faces M·FB joint candidates. The two-phase scheme first explores ~M macro candidates (with a fixed cheap block), picks the best skeleton, then explores micro choices around that one skeleton — roughly M + FB work instead of M·FB. With M ≈ 1000 and FB ≈ 106, that is ~106 evaluations instead of ~109. The factorization is a multiplicative-to-additive saving — the same trick as separating concerns in any large search.
Phase 1 picks the macro skeleton (stage depths, widths) — shown as the column heights. Phase 2 then colors each block by its discovered UIB type. Click "Run Phase 1" then "Run Phase 2" to watch the search resolve coarse-to-fine. Notice attention (purple) only appears in the deep, low-resolution stages.
Measuring every candidate on real hardware is slow, so NAS systems build a latency lookup table / cost model: benchmark each primitive (a UIB of a given config, kernel, width, resolution) once on the device, store the measured latency, and estimate a whole network as the sum of its blocks. This makes the inner loop a fast table lookup — which is exactly the "latency/accuracy lookup" we build in the Chapter 8 explorer and the second Code Lab. MNv4 also designs for robustness: it seeks architectures that are good across several target devices, not overfit to one latency table, which is what produces the universal frontier.
A great architecture is only half of a great model — the training recipe matters as much. MNv4's largest model (Hybrid-Large) reaches ~87% ImageNet-1K top-1, and a big chunk of that final accuracy comes from knowledge distillation, plus a refined data-augmentation and regularization recipe.
A large, accurate teacher network produces soft probability vectors over the 1000 classes. The small student (the MNv4 model) is trained to match the teacher's softened distribution, not just the hard one-hot label. With temperature T, the teacher's softened probabilities are:
where z are the teacher logits. The student's loss blends a hard-label cross-entropy with a soft-target term that pulls the student's softened distribution qT toward the teacher's:
The T² factor rescales the soft-target gradients (which shrink like 1/T²) so they stay comparable to the hard-label term as you raise the temperature. The dark knowledge idea: the teacher's "wrong" probabilities carry information — that a cat image looks 8% like a lynx and 0.001% like a truck tells the student about class geometry that a one-hot label never could.
A mobile-sized student has limited capacity. Hard labels give it one bit of supervision per example ("this is class 7"). Soft targets give it a full 1000-dimensional gradient signal per example — a much richer training set without any new data. Empirically this is worth several points of top-1 for compact models, which is why the headline ~87% figure relies on it. MNv4 also uses an offline-generated set of teacher predictions so distillation is cheap to run at scale.
A one-hot hard label vs the teacher's softened distribution at temperature T. Drag T: at T=1 the teacher is sharp (close to one-hot, little extra info); raising T reveals the "dark knowledge" — the relative probabilities of the runner-up classes the student learns from.
| Ingredient | Role |
|---|---|
| Knowledge distillation | Soft teacher targets — the single biggest accuracy lever for the small students |
| Strong augmentation (RandAugment, mixup/CutMix) | Regularizes; lets long training schedules avoid overfit |
| EMA of weights | A smoothed weight average used at evaluation — a cheap accuracy bump |
| Long schedules + cosine LR | Compact models need many epochs to converge fully |
| Resolution scaling | Larger input resolutions for larger models trade latency for accuracy along the frontier |
The headline result is the Pareto frontier: across a suite of mobile accelerators — Pixel CPU, Pixel EdgeTPU, Samsung/Qualcomm-class GPUs and Hexagon DSPs, and Apple Neural Engine — the MNv4 family sits on or near the best achievable accuracy at each latency. No single competitor backbone matches it on all targets simultaneously; MNv4 is described as "mostly Pareto-optimal across the mobile ecosystem." The Hybrid-Large model reaches around 87% ImageNet-1K top-1, with hybrid models running in the low-single-digit milliseconds on a Pixel EdgeTPU.
The family spans Small / Medium / Large, each in a Conv (pure UIB) and a Hybrid (UIB + Mobile MQA in the deep stages) form. Conv variants win on chips that run attention poorly; Hybrid variants squeeze out the top accuracy where attention is affordable.
A schematic of the latency vs accuracy plane on one accelerator. The MNv4 frontier dominates a prior baseline family — at any latency budget, MNv4 reaches higher accuracy, and at any accuracy, lower latency. Drag the latency budget to read off the best model at that budget.
| Ablation | Finding |
|---|---|
| Remove UIB (fix to plain IB) | Frontier moves down/right — ExtraDW and the per-stage flexibility account for a meaningful efficiency gain on most targets |
| MHA → MQA in attention | Large on-device speedup (K/V traffic collapses) at negligible accuracy cost — confirms attention was memory-bound |
| Add spatial reduction to K/V | Further latency cut on large maps with near-zero accuracy loss for classification |
| Remove distillation | Top-1 drops several points — recipe is not optional for the headline numbers |
| FLOP-guided vs latency-guided NAS | FLOP-guided picks worse blocks on matrix-engine targets — measured latency is essential |
Two networks A and B with the same accuracy but different latency: B dominates if it is faster. A whole family Pareto-dominates another if, for every accuracy level, it offers a lower-latency model (and vice versa). Formally, family F dominates family G when for each model g in G there exists f in F with accuracy(f) ≥ accuracy(g) and latency(f) ≤ latency(g), strictly on at least one axis. MNv4's claim is precisely this kind of dominance — replicated across many devices, which is the part nobody had achieved before.
This is the payoff. You are now the NAS. Configure a small stack of UIB blocks — choose each block's type (IB / ConvNext / ExtraDW / FFN), kernel size, and whether the deepest block uses Mobile MQA — and the explorer estimates accuracy contribution and latency on four different accelerators from a lookup table, exactly as the hardware-aware search does in its inner loop. Watch how the best configuration differs by target chip.
The estimate combines the per-primitive latency table (Chapter 5) with a roofline weighting (Chapter 1): on the matrix-engine EdgeTPU, depthwise convs are penalized, so ExtraDW costs more latency; on the DSP/CPU they are cheap, so ExtraDW is nearly free accuracy. Mobile MQA adds global context (accuracy) but is only affordable in the deep, low-resolution block. Try to find the configuration on the frontier for each device — you will discover the search's lesson: the best block assignment is device-dependent.
Pick the target chip, set each of three blocks' UIB type and kernel, and toggle Mobile MQA on the deepest block. The bars show estimated latency on the selected chip and an accuracy score; the dot shows where your design lands on the frontier. Re-pick the chip and watch the optimal choices change.
The second Code Lab below implements the engine behind this explorer: a latency lookup that sums per-block measured costs and returns the accuracy/latency pair a NAS would read off. That is the literal inner loop of hardware-aware search — and the thing that makes the whole approach tractable.
MNv4 is a strong, practical result, but it is honest about its boundaries — and placing it among neighboring ideas is the best way to remember it.
| Concept | One-line takeaway |
|---|---|
| The problem | One backbone that is near-Pareto-optimal on many mobile chips at once, despite their opposite cost models |
| Roofline | rate = min(P, I·B); depthwise convs have low operational intensity → memory-bound on matrix engines |
| Inverted bottleneck | narrow→wide→narrow; cheap depthwise mixing in the wide space, narrow data between blocks; linear projection |
| UIB | two optional depthwise convs (start + middle) around the 1×1 expand/project → IB / ConvNext / ExtraDW / FFN |
| ExtraDW | both depthwise convs on; larger receptive field, spatial mixing in narrow and wide spaces; MNv4's signature |
| Mobile MQA | shared K/V across heads (MQA) + optional spatial reduction of K/V; attacks memory-bound attention |
| Two-phase NAS | coarse macro skeleton, then fine per-block UIB choices; objective = accuracy under measured on-device latency |
| Distillation | soft teacher targets (dark knowledge), T² gradient rescaling; several points of top-1 for the small students |
| Result | MNv4 family near the frontier on CPU/EdgeTPU/GPU/DSP/ANE; Hybrid-Large ≈ 87% ImageNet-1K top-1 |