Mobile and NAS Backbones

Split one 3 by 3 convolution into a per-channel filter and a 1 by 1 mix, and it needs 7.9 times fewer multiply-adds. That one split, then a search that times each design on a real phone, is how vision fits in your pocket.

Count the cost of seeing, then cut it. The tools: a split convolution, inverted residuals, cheap attention, a search graded by a stopwatch, one scaling dial and 8-bit weights.

Switch between Standard and Separable. Each coloured cell is one multiply-add for one output pixel. Then grow the channels and the kernel. Then we build, piece by piece, every block of MobileNetV1 to V4 and EfficientNet.

You need a rough idea of a convolution (a small filter slides over an image) and a little Python. We build the rest from zero.

Built on the papers: MobileNetV1, MobileNetV2, MnasNet, MobileNetV3, EfficientNet and MobileNetV4. Every number from a paper names its table.

Count the multiply-adds

64

Exact counts for one layer with a 56 by 56 output, bias ignored. The cost formulas and the "8 to 9 times less computation" figure are from the MobileNetV1 paper (Section 3.1).

Chapter 0

Ten Milliseconds, or You Drop the Frame

Turn a model's multiply-adds into milliseconds and see which models keep up with a camera

You build a camera app. It runs a vision model on every frame to blur the background. The preview runs at 30 frames per second, so each frame has 33 ms. A slower model makes the app skip frames, and the preview stutters.

Count a model's cost in multiply-adds (MACs): one input times one weight, added to a running sum. A convolution layer does millions of them. Some papers count FLOPs instead, where one MAC is two operations, so check which one a paper means.

How fast does a phone do MACs? The MobileNetV3 paper times its models on one big core of a Pixel 1 (Table 3). MobileNetV2 does 300 million MACs in 64 ms. MobileNetV3-Large does 219 million in 51 ms. Both work out to about 4.5 billion MACs per second.

Now the worked number. ResNet-50 needs about 3.8 billion MACs per image, as its paper counts them. At 4.5 billion per second that is 3.8 / 4.5 = 0.84 s per frame. The app gets about 1 frame per second, not 30. No code tweak closes a gap of 25 times. The model itself must change.

Run a model on one second of video

Each tick is a camera frame. Each yellow block is one run of the model. Green ticks get a result; the app drops the red ones. Pick a model and a frame rate.

MAC counts: ResNet-50 3.8 billion (its paper), MobileNetV1 569 million (its Table 8), MobileNetV2 300, V3-Large 219, V3-Small 56 million (MobileNetV3, Table 3). Time is MACs divided by 4.5 billion per second, a rough rule from the Pixel 1 rows of that table. It is only a first guess: Chapter 6 shows where it breaks.

Read the failure as three parts. The symptom is a preview that stutters and a phone that gets warm. The measurement is the model's time on the target phone, one image at a time, the median of many runs. The fix is a backbone built for the phone, which is the rest of this lesson.

The road

  1. Depthwise separable: split one convolution into two cheap ones (the instrument at the top).
  2. Inverted residual: widen only where the work is cheap.
  3. SE and hard-swish: cheap attention over channels and a cheap activation.
  4. Latency-aware search: let a phone's stopwatch grade each design.
  5. Compound scaling: grow depth, width and resolution with one dial.
  6. FLOPs are not milliseconds: why memory traffic breaks the count.
  7. The frontier: pick a model for your budget on your phone.
  8. INT8: store every weight in 8 bits.
  9. Field guide: numbers, code, checklist and links.
A phone core does about 4.5 billion MACs per second. A model needs 900 million MACs per frame. About how many frames per second can it process?

Chapter 1

Split One Convolution Into Two

Count where a convolution's multiply-adds go, then take out the expensive part

Take a 3 by 3 convolution with 64 channels in, 64 out and a 56 by 56 output map. Each output value reads a 3 by 3 patch in all 64 input channels. So the layer does two jobs at once: it filters in space and it mixes channels.

Name the sizes: a K by K kernel, Cin input channels, Cout output channels, an H by W output map.

Say it aloud

M-standard equals K times K, times C-in, times C-out, times H times W.

Mstd
M-standard the multiply-adds of one standard convolution layer, for one image.
K · K
K times K the cells of the kernel: 9 for a 3 by 3 kernel.
Cin
C-in the number of input channels each output reads.
Cout
C-out the number of output channels, one filter each.
H · W
H times W the pixels of the output map.
In plain words

One output value needs K times K times C-in MACs. There are C-out times H times W output values. Multiply the two.

With numbers

K = 3, C-in = C-out = 64, H = W = 56: 9 × 64 × 64 × 3,136 = 115,605,504 MACs, about 115.6 million for one layer.

MobileNetV1 splits the two jobs. This is a depthwise separable convolution. First a depthwise convolution gives each input channel its own K by K filter, so it filters in space but mixes nothing. Then a pointwise convolution, a 1 by 1 convolution, mixes the channels at each pixel.

Say it aloud

M-separable equals K times K times C-in times H times W, plus C-in times C-out times H times W.

Msep
M-separable the multiply-adds of the depthwise layer plus the pointwise layer.
K·K·Cin·H·W
the depthwise term one K by K filter per input channel, at every pixel. No C-out in it.
Cin·Cout·H·W
the pointwise term a 1 by 1 mix of all C-in channels into each of C-out, at every pixel. No K in it.
In plain words

The depthwise step pays for space but not for output channels. The pointwise step pays for output channels but not for space. Add the two.

With numbers

Same layer: 9 × 64 × 3,136 = 1,806,336 plus 64 × 64 × 3,136 = 12,845,056. Total 14,651,392 MACs, about 14.7 million.

Divide one count by the other and most factors cancel.

Say it aloud

M-separable over M-standard equals one over C-out, plus one over K squared.

Msep / Mstd
the cost ratio what share of the standard cost the split layer pays.
1/Cout
one over C-out the depthwise share. It shrinks as the layer gets wider.
1/K2
one over K squared the pointwise share: 1/9 for a 3 by 3 kernel.
In plain words

For a wide layer, 1/C-out is tiny, so the split costs about 1/K-squared of the original. With a 3 by 3 kernel that is about one ninth.

With numbers

C-out = 64, K = 3: 1/64 + 1/9 = 0.0156 + 0.1111 = 0.1267, so 7.9 times fewer MACs. At C-out = 1,024 it is 8.9 times. The MobileNetV1 paper says "8 to 9 times".

Rebuild MobileNetV1 both ways

Each bar is one of the 13 conv layers of MobileNetV1. Blue is a standard 3 by 3 conv; purple and warm are depthwise plus pointwise. Switch and compare.

Layer shapes from MobileNetV1, Table 1. Our exact counts give 568.7 million MACs and 4.21 million weights for the network; the paper reports 569 million and 4.2 million. Accuracy (70.6% separable, 71.7% standard) is the paper's Table 4.

In PyTorch, depthwise is one argument: groups=C_in. Forget it and the symptom is a "mobile" layer that runs no faster. Measure the weights: nn.Conv2d(64, 64, 3) holds 36,864, while with groups=64 it holds 576. The fix is the argument.

pythonimport torch.nn as nn

def separable(c_in, c_out, k=3):
    return nn.Sequential(
        nn.Conv2d(c_in, c_in, k, padding=k // 2, groups=c_in),  # depthwise: one filter per channel
        nn.BatchNorm2d(c_in), nn.ReLU6(),
        nn.Conv2d(c_in, c_out, 1),                              # pointwise: mix channels
        nn.BatchNorm2d(c_out), nn.ReLU6())
A layer has K = 3 and Cout = 128. About how many times fewer MACs does the separable version need?

Chapter 2

Narrow, Wide, Narrow: the Inverted Residual

Widen the tensor only where the work is cheap, and keep the skip tensor narrow

MobileNetV1 is a flat stack. Deep networks train better with a skip connection: the block adds its input to its output. ResNet's bottleneck block goes wide, narrow, wide, and its skip joins the two wide ends. That keeps a fat tensor in memory across the block.

MobileNetV2 turns it around. Its inverted residual block starts narrow and works in three steps:

  1. A 1 by 1 conv expands the channels by an expansion factor t, usually 6.
  2. A 3 by 3 depthwise conv filters the wide tensor. Depthwise work is cheap, so width costs little here.
  3. A 1 by 1 conv projects back to few channels, with no activation after it.

The skip joins the two narrow ends. Name the sizes: Cin channels in, Cout out, factor t, kernel K, output map H by W.

Say it aloud

M-i-r equals H times W, times t times C-in, times the sum of C-in, K squared and C-out.

Mir
M-i-r the multiply-adds of one inverted residual block (stride 1).
H · W
H times W the pixels of the map.
t · Cin
t times C-in the width of the middle tensor.
Cin
C-in the expand step: each middle channel mixes C-in inputs.
K2
K squared the depthwise step: K squared MACs per middle channel.
Cout
C-out the project step: each middle channel feeds C-out outputs.
In plain words

Every pixel of the wide middle tensor pays three bills: C-in to make it, K squared to filter it, C-out to project it. Multiply by the middle width and the pixels.

With numbers

C-in = C-out = 24, t = 6, K = 3, 28 by 28: 784 × 144 × (24 + 9 + 24) = 6,435,072 MACs. The skip stores 24 × 784 = 18,816 values. The wide tensor has 112,896, six times more, and never crosses the block.

This is the paper's own count of the block's cost.

Grow the middle of the block

The three boxes are the tensors: narrow in, wide middle, narrow out. The arc on top is the skip. Drag t and watch where the cost goes.

6

Exact counts for a 24-channel block on a 28 by 28 map. t = 6 is the paper's choice for all its main experiments.

Why no activation after the projection? A ReLU sets every negative value to zero. In a wide tensor, a value lost in one channel survives in others. In a narrow one there is no spare copy. The paper calls the activation-free projection a linear bottleneck and says it "prevents non-linearities from destroying too much information".

Squeeze a spiral through a ReLU

A 2-D spiral goes up to n channels by a random matrix, through a ReLU, then back to 2-D. Red points lost information. Raise n.

3

The idea follows MobileNetV2, Figure 1. Our toy recovers each point from its channels that stayed positive; a point with fewer than two such channels cannot be recovered. The matrix is random, so the exact share is illustrative.

The failure: a ReLU left after the projection. The symptom is lower accuracy than the paper with the same shapes. Measure it by training both versions on a small subset. The fix is to delete that one activation.

Why does the MobileNetV2 block put its skip on the narrow ends and drop the ReLU after the projection?

Chapter 3

Turn Channels Up and Down: SE and Hard-Swish

Add a per-image volume knob for each channel, and swap an expensive activation for a cheap copy

A photo of a dog should make a "fur" channel loud and a "sky" channel quiet. A convolution cannot do that: it treats every image the same way. MobileNetV3 adds a squeeze-and-excitation (SE) block, which sets a volume for each channel from the image itself. It runs in three steps:

  1. Squeeze. Average each channel over all its pixels. C channels become a list of C numbers.
  2. Excite. Two small fully connected layers (C to C/r to C, then a sigmoid) turn the list into C gates between 0 and 1.
  3. Scale. Multiply each channel's whole map by its gate.

SE is cheap because it works on a list of C numbers, not on the map. Its two layers cost 2 × C × C/r MACs. With C = 128 and r = 4 that is 8,192 MACs, against millions for one convolution. MobileNetV3 sets the middle size to a quarter of the block's expanded width.

The second change is the activation. Swish, x times sigmoid of x, trains better than ReLU. But a sigmoid needs an exponential, which is slow on a phone. Write ReLU6 for a ReLU that also stops at 6. MobileNetV3 builds a copy of swish from it:

Say it aloud

h-swish of x equals x times ReLU-six of x plus three, divided by six.

h-swish(x)
h-swish of x the activation's output for one value.
x
x one input value, any real number.
ReLU6(x + 3)
ReLU-six of x plus three shift x up by 3, then clamp it between 0 and 6.
/ 6
divided by six turns the clamp into a gate from 0 to 1, a straight-line copy of the sigmoid.
In plain words

Add 3 to x, clamp to between 0 and 6, divide by 6. That gives a gate from 0 to 1. Multiply x by its gate. No exponential anywhere.

With numbers

x = 1: 1 × 4 / 6 = 0.667, while swish gives 0.731. x = 4: the gate is full, so the output is 4, while swish gives 3.928. The largest gap anywhere is 0.142, at x = −3.

Compare swish and its cheap copy

Grey is ReLU, pink is swish, warm is hard-swish. Drag x and read the three outputs.

1.0

The h-swish formula is from MobileNetV3, Section 5.2. The paper uses it only in the second half of the network, where its gain is largest.

The failure: an activation the chip cannot run fast. The symptom is a layer with few MACs that takes a large share of the time. Measure it with a per-layer profile on the phone. The fix is a piecewise-linear copy such as h-swish.

An SE block sits on a 256-channel tensor with r = 4. How many MACs do its two small layers cost?

Chapter 4

Let the Phone Grade the Design: MnasNet

Fold accuracy and measured latency into one reward, and let a search climb it

Each layer can pick a kernel size, an expansion factor and SE or not. Over twenty layers that is far too many networks to try by hand. Neural architecture search (NAS) lets an algorithm propose networks, train each one briefly and keep the best. MnasNet's change was the grade: it ran each candidate on a real Pixel 1 phone and timed it.

A search needs one number to climb. Name the parts. ACC is a candidate's accuracy. LAT is its measured latency. T is the target latency. w is a small negative weight that sets how much each extra millisecond hurts.

Say it aloud

R equals ACC times LAT over T, all to the power w.

R
R the reward of one candidate network. Higher is better.
ACC
ACC its accuracy, as a fraction: 0.752 for 75.2%.
LAT
LAT its measured latency on the phone, in ms.
T
T the target latency: 75 ms in MnasNet.
w
w the weight: alpha if LAT is at or under T, beta if it is over. MnasNet uses minus 0.07 for both.
In plain words

Divide the latency LAT by the target T. Raise it to the small negative power w, which gives a factor a little above 1 if fast and a little below 1 if slow. Multiply ACC by that factor.

With numbers

MnasNet-A1: ACC = 0.752, LAT = 78 ms, T = 75 ms. 78/75 = 1.04, and 1.04 to the minus 0.07 is 0.997, so R = 0.750. The 3 ms overshoot costs almost nothing.

Where does minus 0.07 come from? The authors saw that doubling latency usually buys about 5% more accuracy, relative. Two such models should get equal reward: 1.05 × 2w = 1. So w = −ln 1.05 / ln 2 = −0.0704. Set alpha = 0 and beta = −1 instead and you get a hard limit: no bonus under T, a steep penalty over it.

Score models the MnasNet way

Dots are real models: latency across, accuracy up. The curves are equal-reward lines. Pick soft or hard, move the target T, and see who wins.

75 ms

Accuracy and Pixel 1 latency of nine models from MobileNetV3, Table 3. The reward and its constants are from MnasNet, Section 3. Ranking these finished models is our illustration; the search used the reward on candidates it trained.

MnasNet-A1 reached 75.2% top-1 at 78 ms on a Pixel 1: 1.8 times faster than MobileNetV2, with 0.5 points more accuracy. MobileNetV3 reused this search, with w = −0.15 for its small models, where accuracy moves faster with latency.

The failure: a winner for the wrong chip. The symptom is a searched model that is fast on a Pixel and slow on your device. Measure the top candidates on your device. The fix is to search again with your device's latencies.

With a hard limit (α = 0, β = −1) and T = 75 ms, a model has ACC = 0.75 and LAT = 150 ms. What is its reward?

Chapter 5

One Dial for Depth, Width and Resolution

Grow a good small network in balance, so that each step of the dial doubles the cost

You have a good small network and twice the compute. Where do you spend it? Add layers (depth), add channels (width), or feed bigger images (resolution)? EfficientNet's answer is all three, in fixed proportions. This is compound scaling.

The three knobs cost different amounts. Twice the layers is twice the FLOPs. Twice the channels is four times the FLOPs, because a layer's cost has Cin times Cout. Twice the image side is also four times, because the cost has H times W.

Name the parts. φ (phi) is the dial. Depth grows by α (alpha) per step, width by β (beta) and resolution by γ (gamma). F0 is the small network's FLOPs.

Say it aloud

F of phi equals F-zero times alpha times beta squared times gamma squared, all to the power phi.

F(φ)
F of phi the FLOPs of the network after phi steps of the dial.
F0
F-zero the FLOPs of the base network, EfficientNet-B0.
α
alpha depth growth per step: 1.2. Cost grows with depth once.
β2
beta squared width growth per step is 1.1, and cost grows with its square.
γ2
gamma squared resolution growth per step is 1.15, and cost grows with its square.
φ
phi the dial: how many steps of growth you buy.
In plain words

One step multiplies depth by alpha, width by beta and resolution by gamma. The cost of one step is alpha times beta squared times gamma squared. The paper picks the three so that this is about 2, so each step about doubles F.

With numbers

1.2 × 1.21 × 1.3225 = 1.92. At φ = 3: depth ×1.73, width ×1.33, resolution ×1.52 (224 to 341 pixels), and F grows by 1.923 = 7.1.

Spend one FLOP budget four ways

The square is the input image. Each column is a layer; its height is the width in channels. Turn the dial, then spend the same budget on one knob only.

2.0

α = 1.2, β = 1.1, γ = 1.15 and the 224-pixel B0 input are from the EfficientNet paper (the input size from its Table 1). One-knob versions use the same FLOPs; the drawing is a schematic, not the real layer list.

The base network, B0, came from a MnasNet-style search with one change. It graded candidates by FLOPs, with a 400 million target, not by phone latency. B0 has 5.3 million weights, 0.39 billion FLOPs and 77.1% top-1. B7 has 66 million, 37 billion and 84.3% (EfficientNet, Table 2). 37 / 0.39 = 95, close to 1.927 = 96.

The failure: one knob only. The symptom is a model that keeps getting slower while accuracy stalls. Measure accuracy against FLOPs for each knob; the paper's Figure 3 shows each single knob gaining less and less. The fix is to scale all three together.

Why do width and resolution appear squared in α · β2 · γ2 ≈ 2?

Chapter 6

FLOPs Are Not Milliseconds

See why a layer with few multiply-adds can still be slow, and why searches use a stopwatch

Chapter 0 turned MACs into time with one rate, 4.5 billion per second. Test it on MobileNetV3-Small: 56 million MACs predicts 12.5 ms. The paper measured 15.8 ms on the same phone, 26% slower. MobileNetV2 runs 4.7 million MACs per ms; V3-Small runs only 3.5 (Table 3).

The missing cost is memory. A layer must read its input and weights and write its output. A layer's time is about the larger of its compute time and its memory time. The ratio of MACs to bytes moved is the layer's arithmetic intensity. Low intensity means the chip waits for data.

Worked example, with 8-bit values on a 56 by 56 map with 128 channels:

LayerMACsBytes movedMACs per byte
Depthwise 3 by 33,612,672803,9684.5
Pointwise 128 to 12851,380,224819,20062.7

Both layers move about the same bytes. The pointwise layer does 14 times more work with them.

Time two layers on a toy chip

For each layer, the warm bar is compute time and the yellow bar is memory time. The longer one sets the layer's time. Drag the bandwidth.

5 GB/s

An illustrative chip that does 50 billion MACs per second. The layer sizes and byte counts are exact; real chips add caches and fixed costs per layer.

At 5 GB/s the depthwise layer does 6.6% of the pair's MACs but takes 13.5% of its time. So a search should not trust FLOPs. Hardware-aware searches time each candidate block once on the target chip and store it in a latency table. The search then adds up table entries, which is fast and honest.

MobileNetV4 searches over one flexible block, the Universal Inverted Bottleneck (UIB). It has two optional depthwise convs, one before the expansion and one in the middle:

VariantDepthwise before expansionDepthwise in the middle
Inverted Bottlenecknoyes
ConvNext-likeyesno
Extra Depthwiseyesyes
Feed-forwardnono

The search picks a variant per layer for each chip. The paper reports MobileNetV4 models that are mostly on the best trade-off across phone CPUs, DSPs, GPUs and accelerators. Its largest hybrid reaches 87% top-1 in 3.8 ms on a Pixel 8 EdgeTPU.

The failure: cutting FLOPs and gaining little. The symptom is a model with half the FLOPs that runs 10% faster. Measure each layer's time on the phone. The fix is to rank designs by measured time.

A depthwise layer has 7% of a block's MACs but 15% of its time. What is the most likely reason?

Chapter 7

Pick a Point on the Frontier

Plot every model by latency and accuracy, and choose the best one that fits your budget

A leaderboard sorted by accuracy hides the other axis. Plot each model as a point: latency across, accuracy up. A model is dominated if some other model is at least as fast and at least as accurate, and better in one. The models that are not dominated form the Pareto frontier, the upper-left edge of the cloud.

Choosing a model is then two steps:

  1. Draw a line at your latency budget, on your phone.
  2. Take the most accurate frontier model left of the line.

Choose a model for your budget

Green dots are on the frontier; grey dots are dominated. Pick a phone, drag the budget, and tap any dot to read it.

50 ms

All nine models, accuracies and latencies (single-core, float) are from MobileNetV3, Table 3, which measured them under one setup. Mixing latencies from different papers would compare different setups.

Read the Pixel 1 numbers. MobileNetV3-Large 1.0 runs in 51 ms at 75.2%. MnasNet-A1 has the same accuracy at 71 ms, so V3-Large 1.0 dominates it. MobileNetV2 1.0 is slower and less accurate than V3-Large 1.0, so V3-Large dominates it too. Four models form the frontier: V3-Small 0.75, V3-Small 1.0, V3-Large 0.75 and V3-Large 1.0.

In this table the frontier is the same on all three phones. The gaps are not. Going from V3-Large 1.0 to 0.75 costs 1.9 points. It saves 12 ms on a Pixel 1 (51 to 39) but only 4 ms on a Pixel 3 (44 to 40). Across unlike chips, such as a CPU and an accelerator, the frontier itself can change. That is why MobileNetV4 reports results per chip.

The failure: picking row one of the leaderboard. The symptom is a model that misses the frame budget on the target phone. Measure every candidate on that phone. The fix is the two steps above.

Your budget is 45 ms on a Pixel 1. Which model from the table do you ship?

Chapter 8

Snap Every Weight to Eight Bits

Store weights as small integers on a ladder, and count the error of each snap

A trained model stores each weight as a 32-bit float. Quantization stores it as an 8-bit integer instead. That is 4 times less memory to store and to move, and phone chips have fast integer units. MobileNetV3-Large's 5.4 million weights drop from 21.6 MB to 5.4 MB.

Think of a ladder with 256 rungs. Name the parts. x is a float weight. s is the scale, the gap between two rungs. z is the zero point, the integer that stands for 0.0. q is the integer you store.

Say it aloud

q equals round of x over s, plus z.

q
q the stored 8-bit integer, from −127 to 127 here.
round
round go to the nearest whole number: the snap to a rung.
x
x the original float weight.
s
s the scale: the float size of one rung.
z
z the zero point: 0 for a range centred on zero.
In plain words

Divide x by the rung size s, round to the nearest rung, add the zero point z. To read the weight back, take s times q minus z.

With numbers

Weights in [−1, 1], so s = 1/127 = 0.00787 and z = 0. For x = 0.42: 0.42 / 0.00787 = 53.34, so q = 53. Back: 53 × 0.00787 = 0.4173. The error is 0.0027, a third of a rung; it can never pass half a rung, 0.0039.

Small values suffer most. x = 0.005 snaps to q = 1, which reads back as 0.0079. The error, 0.0029, is more than half the value itself.

Snap a weight tensor to a ladder

The curve is a bell of float weights. The bars are the rungs they snap to. Lower the bits and watch the rungs spread.

8 bits

An illustrative bell of weights with range [−1, 1] and a symmetric ladder. Model size uses MobileNetV3-Large's 5.4 million weights (Table 3).

There are two ways to quantize:

MethodWhat it doesCost
Post-training (PTQ)Quantize a trained model; pick each scale from a few hundred calibration images.Minutes, no training.
Quantization-aware (QAT)Round during training, so the weights learn to sit near rungs.A training run.

Mobile blocks suit this. MobileNetV2 uses ReLU6 for its robustness at low precision: activations stay inside [0, 6], so the quantizer knows their range. The failure: one scale for a whole depthwise layer. The symptom is a large drop after PTQ. Measure the error layer by layer. The fix is one scale per channel, or QAT.

Weights span [−1, 1], quantized to −127 to 127 with z = 0. Which integer stores x = 0.42?

Chapter 9

Field Guide

Keep the numbers, the checklist and the code in one place

A mobile backbone computes a useful function in the fewest measured milliseconds on one chip. Each idea cuts a different bill. The split cuts MACs. The inverted block cuts stored memory. SE and h-swish buy accuracy cheaply. The search grades by time, compound scaling spends a budget in balance, and INT8 cuts bytes.

ModelKey ideaTop-1CostLatency
MobileNetV1 (2017)Depthwise separable conv70.6%569 M MACs113 ms, Pixel 1
MobileNetV2 (2018)Inverted residual, linear bottleneck72.0%300 M MACs75 ms, Pixel 1
MnasNet-A1 (2018)Search graded by phone latency75.2%312 M MACs78 ms, Pixel 1
MobileNetV3-Large (2019)SE, h-swish, searched75.2%219 M MACs51 ms, Pixel 1
EfficientNet-B0 (2019)Search by FLOPs, then compound scaling77.1%0.39 B FLOPsnot in its main table
MobileNetV4 (2024)UIB block, per-chip search87% (Hybrid-Large)see the paper3.8 ms, Pixel 8 EdgeTPU

Sources: V1 from its Table 8, with its latency from MobileNetV2 Table 4. V2 from its Table 4, MnasNet from its Table 1, V3 from its Table 3. EfficientNet from its Table 2, V4 from its abstract. The latencies come from different papers and setups, so compare within one paper only.

Checklist before you ship a backbone

  1. Set the budget in ms, on the target device, at batch size 1.
  2. Count MACs per layer, then time each layer. Trust the time.
  3. Check every depthwise layer has groups=C_in.
  4. Leave the projection of each inverted block linear.
  5. Choose from the frontier at your budget, not the top of a leaderboard.
  6. Quantize to INT8; if accuracy drops, use per-channel scales or QAT.
pythonimport math

def std_macs(k, ci, co, h, w): return k * k * ci * co * h * w            # Ch 1
def sep_macs(k, ci, co, h, w): return k * k * ci * h * w + ci * co * h * w
def ir_macs(ci, t, co, k, h, w): return h * w * t * ci * (ci + k * k + co)   # Ch 2
def h_swish(x): return x * min(max(x + 3, 0), 6) / 6                        # Ch 3
def mnas_reward(acc, lat, T, a=-0.07, b=-0.07):                         # Ch 4
    return acc * (lat / T) ** (a if lat <= T else b)
def compound(phi, a=1.2, b=1.1, g=1.15):                              # Ch 5: depth, width, res, FLOPs
    return a ** phi, b ** phi, g ** phi, (a * b * b * g * g) ** phi
def quantize(x, s, z=0): return max(-127, min(127, round(x / s) + z))        # Ch 8

print(std_macs(3, 64, 64, 56, 56) / sep_macs(3, 64, 64, 56, 56))  # 7.89
print(ir_macs(24, 6, 24, 3, 28, 28))                                 # 6435072
print(round(mnas_reward(0.752, 78, 75), 4))                            # 0.7499
print(quantize(0.42, 1 / 127))                                      # 53

Keep going

The papers: MobileNetV1, MobileNetV2, MnasNet, MobileNetV3, EfficientNet, Squeeze-and-Excitation and MobileNetV4.

The takeaway. Count the multiply-adds to design, time the phone to decide. A model is a point on a latency and accuracy plane, and every idea here moves that point up and to the left.
You halve a model's MACs by making its 1 by 1 layers narrower, but it runs only 10% faster on the phone. What do you check first?

Now press Teach and explain, from memory, why the split layer costs about one ninth of the full one. Then go back to the cells at the top and try K = 7.

Mobile and NAS Backbones
Read the MobileNetV3 paper · On to NAS I · Back to Gleams