Back to paper library
arXiv 2021Efficient modelsPaper notes

PP-LCNet

Exploring the Boundaries of Speed

Original paper

PP-LCNet: A Lightweight CPU Convolutional Neural Network

Paper authors

Cheng Cui · Tingquan Gao · Shengyu Wei …

Show all 13 authors

Cheng Cui · Tingquan Gao · Shengyu Wei · Yuning Du · Ruoyu Guo · Shuilong Dong · Bin Lu · Ying Zhou · Xueying Lv · Qiwen Liu · Xiaoguang Hu · Dianhai Yu · Yanjun Ma

Publication
Publication venue not yet verified
First submitted to arXiv
arXiv:2109.15099
Cite this paper · BibTeX

The citation identifies the linked source version. It cites the original paper and its authors.

@misc{lightweightpplcnet2021,
  title = {{PP-LCNet: A Lightweight CPU Convolutional Neural Network}},
  author = {Cheng Cui and Tingquan Gao and Shengyu Wei and Yuning Du and Ruoyu Guo and Shuilong Dong and Bin Lu and Ying Zhou and Xueying Lv and Qiwen Liu and Xiaoguang Hu and Dianhai Yu and Yanjun Ma},
  year = {2021},
  eprint = {2109.15099},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2109.15099}
}
On this page

In the race for lightweight models, several main directions have emerged:

  • Optimizing parameter count to reduce model size.
  • Optimizing computation (FLOPs) to lower computational requirements and improve model speed.
  • Optimizing inference time.

Wait, what?

Isn't optimizing parameter count and computation the same as optimizing inference time?

Most people would think that reducing parameter count and computation would naturally lead to faster inference times.

  • The answer is: Not necessarily!

Here's a simple example:

  • Residual connections in ResNet.
  • Inception modules in GoogLeNet.
  • Shared parameters between different modules.

Branches, tensor movement and synchronization can change latency even at equal parameter counts or arithmetic costs. Weight sharing itself does not necessarily add latency; it makes parameter count a less direct measure of execution cost.

This paper does not go deeply into that issue, though. We can return to it when we come across other related papers.

Problem Definition

This paper aims to address a few key issues:

  1. How to enhance feature representation without increasing latency?
  2. What are the key factors in improving the accuracy of lightweight models on CPUs?
  3. How to effectively combine different strategies to design lightweight models on CPUs?

Solution

Model Architecture

Cui et al., PP-LCNet, arXiv:2109.15099v1, Figure 2Source: PP-LCNet paper, Figure 2. Dashed boxes mark optional modules; the main path shows the change from 3×3 to tail 5×5 blocks and the 1280-dimensional projection after GAP.

The authors propose several strategies to address the above issues.

  1. DepthSepConv

    The authors use DepthSepConv from MobileNetV1 as the basic block. This approach avoids using shortcuts and concatenations, thereby improving computational efficiency.

    The authors favor a simple sequential structure for their small-model and CPU setting.

    The relevant optimization is for DepthSepConv in the Intel CPU MKLDNN library. In the authors' tests, it runs faster than inverted or ShuffleNet blocks.

  2. HSwish

    ReLU is simple, but neither the fastest implementation nor the best accuracy is guaranteed across all runtimes and tasks.

    Other activations include Swish, Mish, and GELU; whether they help depends on the model and runtime.

    The authors take HSwish from MobileNetV3. In this paper's ablation it improves accuracy with a small latency increase when added on its own.

  1. SEBlock

    This module comes from the following paper:

    This module also helped SENet win the 2017 ImageNet challenge.

    However, on Intel CPUs, this module increases inference time, so the authors simplified it by placing it only at the network's end.

    The experiments show a useful accuracy–latency trade-off, not a complete absence of extra runtime cost.

  2. Large Kernel Convolutions

    In MixNet, the authors analyzed the impact of different kernel sizes on network performance and ultimately mixed different kernel sizes within the same network layer.

    However, this mixing reduces inference speed, so the authors use one kernel size per layer and reserve 5×5 kernels mainly for the network's later blocks.

    Replacing 3x3 convolutions with 5x5 convolutions at the network's end improved model accuracy.

  3. Additional Fully Connected Layer

    After global average pooling and before classification, the authors add a 1×1 convolution with 1280 output channels. On a 1×1 feature map this is equivalent to a fully connected layer, increasing capacity at a modest latency cost.

Discussion

Experimental Results

Cui et al., arXiv:2109.15099v1, Figure 1Source: PP-LCNet paper, Figure 1. The horizontal axis gives milliseconds in the specified Intel CPU setting, not FLOPs or phone speed.
Cui et al., arXiv:2109.15099v1, Table 3Source: PP-LCNet paper, Table 3. Accuracy, parameter count and FLOPs vary across rows, so read them together with latency.

The authors conducted experiments on the ImageNet-1k dataset, which includes 1.28 million training images and 50,000 validation images across 1,000 categories.

  • Training Configuration:

    • Used SGD (stochastic gradient descent) as the optimizer, with a momentum of 0.9 and weight decay of 3e-5 (4e-5 for larger models).
    • Batch size of 2048, with an initial learning rate of 0.8, adjusted using a cosine annealing schedule.
    • The entire training process includes 360 epochs with 5 linear warm-up epochs.
    • Image preprocessing involved random cropping to 224×224 pixels and random horizontal flipping.
  • Evaluation Phase:

    • During evaluation, images were first resized along the short edge to 256 pixels, followed by center cropping to 224×224 pixels.
  • Accuracy Enhancement Techniques:

    • Using the SSLD distillation method significantly improved PP-LCNet's accuracy. Those results are in paper Table 2; the pictured Table 3 compares unstarred models without that distillation.

Latency was measured on an Intel Xeon Gold 6148 with MKLDNN, 10 threads and batch size 1. For example, PP-LCNet-1x reaches 71.32% top-1 at 2.46 ms, while MobileNetV2-1x reaches 72.15% at 4.26 ms. PP-LCNet is about 1.73 times as fast here, with 0.83 percentage points lower accuracy. Accuracy, parameters and FLOPs are not identical across these rows. These are not phone measurements.

Ablation Studies

Cui et al., arXiv:2109.15099v1, Table 9Source: PP-LCNet paper, Table 9. The rows add strategies in sequence; they are not five independent one-factor additions to BaseNet.

Reading down the table, BaseNet gives 55.58%/1.61 ms; H-Swish changes this to 58.18%/1.66 ms, the larger kernel to 59.09%/1.70 ms, and SE to 59.91%/1.85 ms. The final 1×1 convolution reaches 62.50%/2.05 ms before dropout and 63.14%/2.05 ms with dropout. The full configuration gains 7.56 percentage points while latency rises 0.44 ms, about 27%. “Almost no latency increase” fits some steps, not the full sequence.

  1. SE Module (Squeeze-and-Excitation):

    • The SE module enhances the model's attention to relationships between channels, thereby improving model accuracy.
    • In Table 7, adding SE only to the final two blocks gives 63.14%/2.05 ms; adding it to every block gives 64.27%/3.80 ms.

    Therefore, PP-LCNet prioritizes adding SE modules in the last two blocks to balance inference speed and accuracy.

  2. Use of Large Kernels:

    • While large kernels (such as 5×5) can improve accuracy, they are not suitable for adding to all positions in the network.
    • In Table 8, tail placement gives 63.14%/2.05 ms; using 5×5 kernels throughout gives 63.22%/2.08 ms. Tail placement gives a better accuracy–latency balance here.

    Thus, specific layers use 5×5 depthwise convolutions, while other layers retain 3×3 kernels.

  3. Combined Effect of Different Techniques:

    • H-Swish and large kernels can enhance performance with minimal impact on inference time.
    • Adding SE modules appropriately further enhances performance.
    • The 1280-channel 1×1 layer after global average pooling (GAP) reaches 62.50%/2.05 ms.
    • Adding dropout then reaches 63.14%/2.05 ms.

Conclusion

The authors study lightweight networks on Intel CPUs, seeking more accuracy for a limited increase in latency. Table 9 shows that the full configuration has a measurable runtime cost.

Through extensive experiments and method optimization, they proposed a network architecture that performs well on various visual tasks, particularly excelling in the balance of accuracy and speed.