Re: Further response (1/2)
Thank you for your prompt response. We are glad to clarify the inference efficiency of BiDM.
> Q10: Thank you for the authors' response. My concerns regarding **Q1, Q2, Q4, Q5, Q6, Q8** have been satisfactorily addressed. Nonetheless, I remain uncertain about the deployment efficiency, particularly given that practical inference speeds often diverge from theoretical operations per second (OPs). The dynamic *min-max* operations, despite their minimal theoretical OPs, may introduce substantial latency in practical deployment, especially with smaller model sizes where matrix multiplications are less significant. I am keen to know if there are effective tools available to verify this.
In BiDM, there are no dynamic *min-max* operations; instead, our design involves only basic arithmetic operations such as convolution, matrix multiplication, addition and summation, and matrix dot multiplication. Additionally, as stated in Eq.(9) of our manuscript and in our response to `Q3`, the operators in BiDM behave the same as those in XNOR-Net[1] during inference, which corresponds to Eq.(11) in the XNOR-Net's original paper.
Following your suggestion, we expand upon the inference process described in `Eq.(9)` and provide a detailed explanation and testing. Since the divisor involved in calculating the mean of $ A^{1,h,w} $ from $ I^{c,h,w} $ (i.e., the channel dimension $ c $) can be integrated into $ k^{1,1,3,3} $ in advance, resulting in $ k'^{1,1,3,3} = \frac{k^{1,1,3,3}}{c} $. Additionally, $ \alpha^{n,1,1,1} $ derived from $ W^{n,c,h,w} $ can also be computed ahead of inference. Therefore, the actual operations involved during inference are as follows:
[FP] Original full-precision convolution:
- (0) Perform convolution between full-precision $I_f^{c=448,w=32,h=32}$ and full-precision $W_f^{n=448,c=448,w=32,h=32}$ to obtain the full-precision output $O_f^{448,32,32}$.
[XNOR-Net/BiDM] The inference process for XNOR-Net/BiDM involves the following 6 steps:
- Sign operation:
- (1) Compute $I_b^{448,32,32} = \text{sign}(I_f^{448,32,32})$.
- Binary operation:
- (2) Perform convolution between the binary $I_b^{448,32,32}$ and the binary $W_b^{448,448,3,3}$ to obtain the full-precision output $O_f^{448,32,32}$.
- Full-precision operations:
- (3) Sum the full-precision $I_f^{448,32,32}$ across channels to obtain $A^{1,32,32}$.
- (4) Perform convolution between full-precision $A^{1,32,32}$ and $k'^{1,1,3,3}$ to obtain $O_1^{1,32,32}$.
- (5) Pointwise multiply $O_f^{448,32,32}$ by $O_1^{1,32,32}$ to obtain the full-precision output $O_2^{448,32,32}$
- (6) Pointwise multiply $O_2^{448,32,32}$ by $\alpha^{448,1,1}$ to obtain the final full-precision output $O^{448,32,32}$
We utilized the general deployment library Larq[2] on a Qualcomm Snapdragon 855 Plus to test the actual runtime efficiency of the aforementioned single convolution. The runtime results for a single inference are summarized in the table below. Due to limitations of the deployment library and hardware, Baseline achieved a 9.97x speedup, while XNOR-Net/BiDM achieved an 8.07x speedup. Besides, the improvement in generation performance brought by BiDM is even more significant, and we believe that it could achieve better acceleration results in a more optimized environment.
| | (0) | (1)+(2) | (3) | (4) | (5) | (6) | Runtime($\mu s$/convolution) | FID$\downarrow$ |
| :--------------: | :------: | :-----: | :----: | :----: | :--: | :--: | ---------------------------: | --------------: |
| FP | 176371.0 | | | | | | 176371.0 | 2.99 |
| Baseline(DoReFa) | | 17695.2 | | | | 4.3 | 17699.5 | 188.30 |
| XNOR-Net / BiDM | | 17695.2 | 2948.8 | 1133.3 | 83.2 | 4.3 | 21864.8 | 22.74 |
[1] Rastegari et al. Xnor-net: Imagenet classification using binary convolutional neural networks. ECCV 2016
[2] "LarQ". https://github.com/larq/larq