{"notes":[{"id":"lightweight/mobilenet-v4","category":"lightweight","legacyPath":"lightweight/2404-mobilenet-v4","legacySlug":"2404-mobilenet-v4","legacyPaths":[],"title":"MobileNet-V4","subtitle":"Five Years of Evolution","author":"Z. Yuan","paperDate":"2024-04-16","publishedOn":"2024-06-29","paperTitle":"MobileNetV4 -- Universal Models for the Mobile Ecosystem","paperUrl":"https://arxiv.org/abs/2404.10518","bibliography":{"title":"MobileNetV4 -- Universal Models for the Mobile Ecosystem","authors":["Danfeng Qin","Chas Leichner","Manolis Delakis","Marco Fornoni","Shixin Luo","Fan Yang","Weijun Wang","Colby Banbury","Chengxi Ye","Berkin Akin","Vaibhav Aggarwal","Tenghui Zhu","Daniele Moro","Andrew Howard"],"url":"https://arxiv.org/abs/2404.10518","pdfUrl":"https://arxiv.org/pdf/2404.10518","codeUrl":null,"preprint":{"id":"2404.10518","submittedOn":"2024-04-16","url":"https://arxiv.org/abs/2404.10518"},"publication":{"venue":"ECCV","year":2024,"kind":"conference","url":"https://doi.org/10.1007/978-3-031-73661-2_5"},"citation":"@misc{lightweightmobilenetv42024,\n  title = {{MobileNetV4 -- Universal Models for the Mobile Ecosystem}},\n  author = {Danfeng Qin and Chas Leichner and Manolis Delakis and Marco Fornoni and Shixin Luo and Fan Yang and Weijun Wang and Colby Banbury and Chengxi Ye and Berkin Akin and Vaibhav Aggarwal and Tenghui Zhu and Daniele Moro and Andrew Howard},\n  year = {2024},\n  eprint = {2404.10518},\n  archivePrefix = {arXiv},\n  url = {https://arxiv.org/abs/2404.10518}\n}\n","citationPath":"/content/papers/citations/lightweight/mobilenet-v4.e846766e9e65.bib"},"thumbnail":{"src":"/content/papers/assets/0a44fc5e9bc8cbe6aa067e68dcc4a12271a4a731e2b7af226ea0e0308ea2fd66.jpg","width":1324,"height":504},"locale":"en","path":"/content/papers/en/lightweight/mobilenet-v4.8e7a70b81ed0.md","headings":[{"id":"defining-the-problem","text":"Defining the Problem","depth":2},{"id":"hybrid-attention","text":"Hybrid Attention","depth":3},{"id":"efficient-attention","text":"Efficient Attention","depth":3},{"id":"various-convolutional-network-architectures","text":"Various Convolutional Network Architectures","depth":3},{"id":"solving-the-problem","text":"Solving the Problem","depth":2},{"id":"network-architecture","text":"Network Architecture","depth":3},{"id":"mobile-mqa","text":"Mobile MQA","depth":3},{"id":"cross-device-optimization","text":"Cross-Device Optimization","depth":3},{"id":"discussion","text":"Discussion","depth":2},{"id":"imagenet-experimental-results","text":"ImageNet Experimental Results","depth":3},{"id":"effectiveness-of-mqa","text":"Effectiveness of MQA","depth":3},{"id":"mnv4-conv-s","text":"MNv4-Conv-S","depth":3},{"id":"conclusion","text":"Conclusion","depth":2}],"anchorAliases":{},"guide":null,"relatedReading":[{"id":"lightweight/mobilenet-v3","relation":"background","topic":"Efficient convolution on mobile devices"}]},{"id":"lightweight/mobilenet-v3","category":"lightweight","legacyPath":"lightweight/1905-mobilenet-v3","legacySlug":"1905-mobilenet-v3","legacyPaths":[],"title":"MobileNet-V3","subtitle":"Custom Architecture Search","author":"Z. Yuan","paperDate":"2019-05-06","publishedOn":"2024-06-29","paperTitle":"Searching for MobileNetV3","paperUrl":"https://arxiv.org/abs/1905.02244","bibliography":{"title":"Searching for MobileNetV3","authors":["Andrew Howard","Mark Sandler","Grace Chu","Liang-Chieh Chen","Bo Chen","Mingxing Tan","Weijun Wang","Yukun Zhu","Ruoming Pang","Vijay Vasudevan","Quoc V. Le","Hartwig Adam"],"url":"https://arxiv.org/abs/1905.02244","pdfUrl":"https://arxiv.org/pdf/1905.02244","codeUrl":null,"preprint":{"id":"1905.02244","submittedOn":"2019-05-06","url":"https://arxiv.org/abs/1905.02244"},"publication":{"venue":"ICCV","year":2019,"kind":"conference","url":"https://arxiv.org/abs/1905.02244"},"citation":"@misc{lightweightmobilenetv32019,\n  title = {{Searching for MobileNetV3}},\n  author = {Andrew Howard and Mark Sandler and Grace Chu and Liang-Chieh Chen and Bo Chen and Mingxing Tan and Weijun Wang and Yukun Zhu and Ruoming Pang and Vijay Vasudevan and Quoc V. Le and Hartwig Adam},\n  year = {2019},\n  eprint = {1905.02244},\n  archivePrefix = {arXiv},\n  url = {https://arxiv.org/abs/1905.02244}\n}\n","citationPath":"/content/papers/citations/lightweight/mobilenet-v3.78d376f40aa4.bib"},"thumbnail":{"src":"/content/papers/assets/09d4bf8776407cb2ac13bc206505f30314b21d2459add8129ffcb929d11ec1bf.jpg","width":1552,"height":588},"locale":"en","path":"/content/papers/en/lightweight/mobilenet-v3.8acef79bee0c.md","headings":[{"id":"defining-the-problem","text":"Defining the Problem","depth":2},{"id":"solving-the-problem","text":"Solving the Problem","depth":2},{"id":"from-the-mobilenetv2-block-to-v3","text":"From the MobileNetV2 Block to V3","depth":3},{"id":"search-first-then-tune-each-layer","text":"Search First, Then Tune Each Layer","depth":3},{"id":"redesigning-the-tail-and-the-stem","text":"Redesigning the Tail and the Stem","depth":3},{"id":"where-is-hard-swish-used","text":"Where Is Hard-Swish Used?","depth":3},{"id":"layer-by-layer-large-and-small-designs","text":"Layer-by-Layer Large and Small Designs","depth":3},{"id":"discussion","text":"Discussion","depth":2},{"id":"imagenet-accuracy-and-device-latency","text":"ImageNet: Accuracy and Device Latency","depth":3},{"id":"development-path-and-downstream-tasks","text":"Development Path and Downstream Tasks","depth":3},{"id":"conclusion","text":"Conclusion","depth":2}],"anchorAliases":{"mobilenet-v2-module":"from-the-mobilenetv2-block-to-v3","mobilenet-v3-module":"from-the-mobilenetv2-block-to-v3","neural-architecture-search":"search-first-then-tune-each-layer","network-tail-modifications":"redesigning-the-tail-and-the-stem","reducing-initial-filters":"redesigning-the-tail-and-the-stem","non-linear-activation-functions":"where-is-hard-swish-used","network-architecture-large":"layer-by-layer-large-and-small-designs","network-architecture-small":"layer-by-layer-large-and-small-designs","imagenet-experiment-results":"imagenet-accuracy-and-device-latency","mobile-device-evaluation":"imagenet-accuracy-and-device-latency","optimization-record":"development-path-and-downstream-tasks"},"guide":null,"relatedReading":[{"id":"lightweight/mobilenet-v2","relation":"background","topic":"Efficient convolution on mobile devices"},{"id":"lightweight/mobilenet-v4","relation":"next","topic":"Efficient convolution on mobile devices"},{"id":"lightweight/senet","relation":"comparison","topic":"Channel attention in lightweight networks"}]}],"text":"Almost five years have passed since the release of MobileNetV3.\n\nDuring this time, the academic community has made significant progress with new network architectures and the application of multi-head attention mechanisms.\n\n## Defining the Problem\n\nThese new tools invite a practical question: can we put new convolution blocks and attention into MobileNet while keeping both accuracy and latency competitive across different phone chips? FLOPs alone cannot answer it; memory traffic, operator support and the inference runtime also affect latency.\n\nFirstly, recent trends in attention mechanisms have led to two primary approaches:\n\n### Hybrid Attention\n\nThis approach focuses on combining the strengths of CNNs and Transformers, making attention mechanisms more suitable for lightweight networks.\n\nNotable works include:\n\n- [**[21.08] Mobile-Former: Bridging MobileNet and Transformer**](https://arxiv.org/abs/2108.05895)\n- [**[21.10] MobileViT: Light-weight, General-purpose, and Mobile-friendly Vision Transformer**](https://arxiv.org/abs/2110.02178)\n- [**[23.03] FastViT: A Fast Hybrid Vision Transformer using Structural Reparameterization**](https://arxiv.org/abs/2303.14189)\n\n### Efficient Attention\n\nThis approach improves MHSA efficiency by reducing the number of key/value tokens or using linear attention. Both can reduce cost, but not every method below changes quadratic complexity to linear complexity.\n\nKey papers include:\n\n- [**[21.07] CMT: Convolutional Neural Networks Meet Vision Transformers**](https://arxiv.org/abs/2107.06263)\n- [**[22.05] EfficientViT: Multi-Scale Linear Attention for High-Resolution Dense Prediction**](https://arxiv.org/abs/2205.14756)\n- [**[22.06] Separable Self-attention for Mobile Vision Transformers**](https://arxiv.org/abs/2206.02680)\n- [**[22.07] Next-ViT: Next Generation Vision Transformer for Efficient Deployment in Realistic Industrial Scenarios**](https://arxiv.org/abs/2207.05501)\n- [**[22.12] Rethinking Vision Transformers for MobileNet Size and Speed**](https://arxiv.org/abs/2212.08059)\n\n### Various Convolutional Network Architectures\n\nBeyond attention mechanisms, there are other architecture design studies worth considering:\n\n- [**[22.01] ConvNeXt: Making Convolutions Great Again**](/blog/papers/classic-cnns/convnext)\n\nThese serve as valuable references.\n\n## Solving the Problem\n\n### Network Architecture\n\n![Paper Figure 4: the two optional depthwise convolutions of UIB and its four configurations, with Fused IB shown separately](/content/papers/assets/0a44fc5e9bc8cbe6aa067e68dcc4a12271a4a731e2b7af226ea0e0308ea2fd66.jpg)\n\n*Paper [Figure 4](https://arxiv.org/html/2404.10518): orange marks depthwise convolutions, blue marks 1×1 pointwise convolutions, and Alternative Fused IB is a separate block on the right.*\n\nThe authors first extended the inverted bottleneck (IB) from MobileNet-V2.\n\nIn the diagram, the `Inverted Bottleneck` is the basic structure of MobileNet-V2, which you are likely familiar with.\n\nLook at UIB on the left. Its 1×1 channel expansion and projection remain; the depthwise convolution **before** expansion and the one **after** expansion are optional independently. NAS selects their presence and kernel sizes, trading spatial mixing against cost.\n\nThis enables four different combinations:\n\n1. Both selected: Extra DW\n2. First DW selected: spatial mixing before expansion, yielding a ConvNeXt-like structure without reproducing all of its normalization and activation choices\n3. Middle DW selected: Original IB\n4. Neither selected: two pointwise convolutions with activation and normalization in between, like an FFN\n\nThis flexible module is termed `UIB` (Universal Inverted Bottleneck) in the paper.\n\nThe four options are not inserted uniformly throughout the network. The Conv-S configuration below selects ExtraDW where resolution drops, then uses IB and a ConvNeXt-like block at 14×14. In the separate Table 1 searches, the UIB search reaches 83.3% top-1 at 2.68 ms on a Pixel 8 EdgeTPU, while an IB-only search reaches 82.3% at 2.61 ms. This supports an accuracy gain in that setting; latency does not improve at the same time.\n\n\n> [!NOTE]\n> \n> Besides `UIB`, the paper uses `Alternative Fused IB` in the network stem. It is separate from UIB's four configurations. A FusedIB consists of a $k\\times k$ Conv2D followed by a 1×1 Conv2D. The initial search-space rule is:\n> \n> - Fixed initial layers: begin with a 3×3, stride-2 `Conv2D` to reduce resolution, followed by NAS-selected `FusedIB` blocks in the second stage.\n\n\n### Mobile MQA\n\nAfter designing the convolutional network architecture, the authors introduced Mobile MQA, a module based on Multi-Query Attention (MQA).\n\nThis structure originates from:\n\n- [**[19.11] MQA: Sharing Key-Value**](/blog/papers/transformers/mqa)\n\nIf you recall the basic structure of attention mechanisms, they consist of Query, Key, and Value.\n\nIn multi-head attention, each head has its own Query, Key, and Value.\n\nThe main idea here is that each head has a different Query but shares the same Key and Value.\n\nSharing keys and values reduces projection cost and memory bandwidth demand. Accuracy is evaluated empirically. The design is especially useful when the number of tokens in a batch is small relative to feature dimensionality.\n\nMobile inference often uses batch size 1, with attention in low-resolution, high-channel-count stages, making this a relevant operating regime.\n\n\n> [!TIP]\n> \n> The authors claim to be the first to apply MQA in lightweight networks.\n\n\nUnlike text-based attention mechanisms, this one is applied to images.\n\nThus, the authors also referenced another paper:\n\n- [**[21.02] PVT: Spatial-Reduction Attention**](/blog/papers/vision-transformers/pvt)\n\nSpatial-Reduction Attention (SRA) reduces key/value resolution while retaining query resolution.\n\nMobile MQA combines shared keys and values with asymmetric spatial reduction. Queries retain their resolution; keys and values use a stride-2 3×3 depthwise convolution where reduction is needed and an identity mapping elsewhere. In the paper's Table 3 experiment at a 16×16 stage, queries keep 256 positions while keys and values fall to 8×8, or 64 positions. S23 GPU latency changes from 7.4 to 5.9 ms and top-1 from 80.77% to 80.71%, a 0.06-point drop. This whole-model Hybrid-M comparison is distinct from the MHSA/MQA ablation in Table 2 below. Calling the method simply “replacing PVT pooling with convolution” is misleading because PVT versions also differ in their spatial reduction.\n\n\n> [!TIP]\n> \n> The paper lists almost ten worthwhile papers to read, which we'll compile later... so busy.\n\n\n### Cross-Device Optimization\n\nThe core goal is a useful accuracy/latency trade-off across devices. NAS first selects coarse widths and convolution choices, then searches whether to use each optional UIB depthwise convolution and which kernel size to choose. This makes candidate architectures easier to evaluate than searching all options in one pass.\n\n\n> [!TIP]\n> \n> In previous MobileNet-V3 research, optimization was only done for the Pixel series.\n\n\nDuring the experiments, the authors gathered several key insights:\n\n1. **Multi-path efficiency issues**:\n   - Group convolutions and similar multi-path designs, despite having lower FLOPs counts, can be less efficient because of memory access complexity.\n2. **Hardware support is crucial**:\n   - Advanced modules like Squeeze and Excite (SE), GELU, and LayerNorm were poorly supported on the DSPs evaluated in the paper.\n   - LayerNorm lags behind BatchNorm under those deployment conditions.\n   - SE can also be a latency bottleneck on accelerators; these observations are specific to the tested hardware and software.\n3. **The power of simplicity**:\n   - Simple modules like ReLU, Conv2D, DW-Conv2D, and BatchNorm are well-supported on mobile devices.\n\nThe NAS search space therefore favors widely supported standard operators and UIB. The authors first select Conv backbones, then interleave Mobile MQA in later stages to build Hybrid variants. Attention is not built into every UIB.\n\n## Discussion\n\n### ImageNet Experimental Results\n\n![Paper Figure 1: ImageNet top-1 accuracy against latency across six mobile hardware and runtime targets](/content/papers/assets/e2b50d7f395aa9f86d6aa98f7c3ee17c348f14742d7aa8cef15713742e90c302.jpg)\n\n*Paper [Figure 1](https://arxiv.org/html/2404.10518): each panel plots latency on a different device against ImageNet-1k top-1; circles are Conv and squares are Hybrid. Compare models within one panel before drawing conclusions about speed.*\n\n![Paper Table 6: classification top-1, parameters, MACs and device latency; imported image is a crop](/content/papers/assets/d87f449b7f3e57fef813041f8950e5f66a8fb4bb1b9a63030295fd64c2d8f488.jpg)\n\n*Paper [Table 6](https://arxiv.org/html/2404.10518): `-` means no measurement and `Failed` means the platform did not support that model.*\n\n\n> [!NOTE]\n> \n> MobileNetV1, V2 and V3 were retrained with updated recipes; their top-1 scores rise by about 3.4, 1.4 and 0.3 percentage points over the original papers. The MNv4 classification numbers in Table 6 use ImageNet-1k training alone and exclude the later extra-data distillation results.\n\n\nMNv4 models mostly lie on or near the accuracy/latency Pareto frontier of the tested hardware. Compatibility still has limits: Hybrid models were incompatible with the tested DSP, and the CoreML chart excludes Hybrid models because a corresponding PyTorch MQA implementation was unavailable. The CPU, DSP and EdgeTPU measurements use INT8 TFLite, mobile GPUs use FP16, and the iPhone 13 uses FP16 CoreML. Absolute milliseconds across devices are not measurements under one common runtime.\n\n1. **Named models on the same device**: MNv4-Conv-S scores 73.8% top-1 and takes 2.4 ms on the Pixel 6 CPU. Retrained MobileNetV2 scores 73.4% and takes 5.0 ms. At similar accuracy, MNv4 is about 2.1 times faster on that CPU, while both take 0.7 ms on the Pixel 8 EdgeTPU.\n2. **Medium-sized models**: MNv4-Conv-M scores 79.9% and takes 11.4 ms on Pixel 6 CPU, 4.1 ms on S23 GPU and 1.1 ms on iPhone 13 CoreML. Similarly accurate FastViT-S12 scores 79.8% and takes 83.0, 47.0 and 1.6 ms, respectively. Ratios depend on the particular model and runtime.\n3. **Missing comparisons**: Hybrid-M scores 80.7%, but Table 6 marks its Pixel 4 DSP entry `Failed` and iPhone 13 CoreML entry `-`. FastViT's DSP entries also say `Failed`. EfficientViT has S23 GPU and CoreML measurements but no CPU or EdgeTPU results in this table. Results from other devices cannot fill these gaps or prove every Hybrid variant works everywhere.\n\nThe authors note that MNv4's success is due to the use of UIB blocks, enhanced NAS recipes, and carefully designed search spaces.\n\nIts value lies in using measurements across platforms during design, rather than guaranteeing optimal performance on every device. The table reports a median statistic over repeated runs on each device, not a prediction for untested phones.\n\n### Effectiveness of MQA\n\n![Paper Table 2: Conv-L base model with three added MHSA or MQA blocks, including accuracy, cost and device latency](/content/papers/assets/ae2c0f40c8ee170aa9f87a7e196567dafe36c0f2689b34c62e9f78313f8f956a.jpg)\n\n*Paper [Table 2](https://arxiv.org/html/2404.10518): the latency percentages in the last row apply to the added attention blocks after subtracting the base model.*\n\nExperiments confirmed the advantages of MQA in hybrid models.\n\nThe percentages concern three added attention blocks after subtracting the Conv-L base model. Against MHSA, MQA reduces **attention-only** latency by 84.2%, 39.0% and 41.1% on Pixel 7 EdgeTPU, Pixel 8 EdgeTPU and S23 GPU, respectively. Top-1 changes from 85.27% to 85.24%, a 0.03-point drop.\n\nThe 28.6% MAC and 25.5% parameter reductions likewise concern only the added attention component. For the complete model, Table 2 lists **6.7G→6.5G MACs** and **36.0M→34.7M parameters**. On the S23 GPU, whole-model latency falls from 16.46 to 15.10 ms, a reduction of about 8.3%. Mobile MQA also rearranges Einsum tensor indices to avoid unnecessary transposes; that implementation optimization should not be conflated with the isolated effect of sharing keys and values.\n\n### MNv4-Conv-S\n\nThe five named models in the main results table are **MNv4-Conv-S, Conv-M, Conv-L, Hybrid-M, and Hybrid-L**. MNv4-Conv-S is the smallest. The table below describes only this Conv model with a 224×224 input; it is not the layer-by-layer specification of the other four.\n\nFor other model architectures, please refer to the paper directly.\n\n![Paper Table 11: MNv4-Conv-S inputs, UIB variants, two DW kernels, expansion and output channels](/content/papers/assets/ad96a57f57f8d6ab0d345098bad8eebafb746202674a2ab71b7a34211044a125.jpg)\n\n*Paper [Table 11](https://arxiv.org/html/2404.10518): a 224²×3 input passes through Conv2D and two FusedIB blocks to 28²×64, then ExtraDW to 14²×96 and eventually 7²×128 before the classifier. `DW K1/K2` are the two optional UIB positions described above.*\n\n\n> [!TIP]\n> \n> The paper also reports results with **extra data and distillation**, separate from ImageNet-only Table 6. Hybrid-L scores 83.4% in Table 6 and 86.6% with the paper's distillation in Table 9. The abstract's 87.0% additionally uses JFT pretraining; the 3.8 ms Pixel 8 EdgeTPU latency is a measurement of that architecture.\n\n\n## Conclusion\n\nThis model family brings measurements across several mobile hardware platforms into the design process.\n\nUIB lets the search choose two sites for spatial mixing, while Mobile MQA uses shared keys and values and optional spatial reduction in later stages. With NAS and measurements across devices, several MNv4 configurations approach the Pareto frontier of the evaluated hardware. The Conv/Hybrid variant, training data and platform support still matter.\n\n\n> [!TIP]\n> \n> Pareto Optimality is a concept from economics and engineering that describes an optimal state where no party's situation can improve without at least one party's situation worsening. The concept is associated with Italian scholar Vilfredo Pareto. Here it means that, among the evaluated models, no other model is both more accurate and faster.\n\n\n＊\n\nIn past development experiences, every new lightweight model required extensive testing on various phones...\n\n- Not to see which is best, but to see which phones have issues.\n\nFor example, the `FastViT` architecture drew attention in 2023, yet its latency away from the iPhone is striking. Table 6 offers a checkable example: FastViT-S12 takes 1.6 ms on iPhone 13 CoreML and 83.0 ms on Pixel 6 CPU; MNv4-Conv-M, at about the same 79.9% top-1, takes 1.1 and 11.4 ms. Absolute times across devices are not directly comparable, but candidate rankings within each device are worth checking.\n\nWe appreciate Google testing this round for us, giving us a useful starting point. Deployment still requires testing on our own target devices and runtimes.\n","imageSizes":{"/content/papers/assets/0a44fc5e9bc8cbe6aa067e68dcc4a12271a4a731e2b7af226ea0e0308ea2fd66.jpg":{"width":1324,"height":504},"/content/papers/assets/e2b50d7f395aa9f86d6aa98f7c3ee17c348f14742d7aa8cef15713742e90c302.jpg":{"width":1224,"height":708},"/content/papers/assets/d87f449b7f3e57fef813041f8950e5f66a8fb4bb1b9a63030295fd64c2d8f488.jpg":{"width":1224,"height":908},"/content/papers/assets/ae2c0f40c8ee170aa9f87a7e196567dafe36c0f2689b34c62e9f78313f8f956a.jpg":{"width":1224,"height":336},"/content/papers/assets/ad96a57f57f8d6ab0d345098bad8eebafb746202674a2ab71b7a34211044a125.jpg":{"width":1224,"height":996}}}
