---
title: "BiFSMN: Binary Neural Network for Keyword Spotting"
authors:
  - "Haotong Qin"
  - "Xudong Ma"
  - "Yifu Ding"
  - "Xiaoyang Li"
  - "Yang Zhang"
  - "Yao Tian"
  - "Zejun Ma"
  - "Jie Luo"
  - "Xianglong Liu"
doi: "10.24963/ijcai.2022/603"
url: "https://ijcai.org/proceedings/2022/603"
pdf: "https://ijcai.org/proceedings/2022/0603.pdf"
venue: "Proceedings of the Thirty-First International Joint Conference on Artificial Intelligence"
year: 2022
pages: "4346-4352"
track: "Main Track"
keywords:
  - "Natural Language Processing: Speech"
  - "Machine Learning: Convolutional Networks"
---

# BiFSMN: Binary Neural Network for Keyword Spotting

Haotong Qin, Xudong Ma, Yifu Ding, Xiaoyang Li, Yang Zhang, Yao Tian, Zejun Ma, Jie Luo, Xianglong Liu

*Proceedings of the Thirty-First International Joint Conference on Artificial Intelligence*, pages 4346-4352. DOI: [10.24963/ijcai.2022/603](https://doi.org/10.24963/ijcai.2022/603)

## Abstract

The deep neural networks, such as the Deep-FSMN, have been widely studied for keyword spotting (KWS) applications. However, computational resources for these networks are significantly constrained since they usually run on-call on edge devices. In this paper, we present BiFSMN, an accurate and extreme-efficient binary neural network for KWS. We first construct a High-frequency Enhancement Distillation scheme for the binarization-aware training, which emphasizes the high-frequency information from the full-precision network's representation that is more crucial for the optimization of the binarized network. Then, to allow the instant and adaptive accuracy-efficiency trade-offs at runtime, we also propose a Thinnable Binarization Architecture to further liberate the acceleration potential of the binarized network from the topology perspective. Moreover, we implement a Fast Bitwise Computation Kernel for BiFSMN on ARMv8 devices which fully utilizes registers and increases instruction throughput to push the limit of deployment efficiency. Extensive experiments show that BiFSMN outperforms existing binarization methods by convincing margins on various datasets and is even comparable with the full-precision counterpart (e.g., less than 3% drop on Speech Commands V1-12). We highlight that benefiting from the thinnable architecture and the optimized 1-bit implementation, BiFSMN can achieve an impressive 22.3x speedup and 15.5x storage-saving on real-world edge hardware.

## Full text

## 1 Introduction

With the advent of deep neural networks that process speech, great success has been achieved on speech tasks, such as the Deep Feedforward Sequential Memory Networks (DFSMN) [Zhang et al., 2018]. And the deep neural networks for keyword spotting (KWS) are becoming more widely studied for real-world applications on the Internet of Things devices [Chen et al., 2014; Zhang et al., 2015; Ren et al., 2020], which enables users to activate devices by speaking keywords or specific phrases, while keeping the device sleeping when inactive. However, such networks are usually deployed on edge devices with limited computation and power while running on-call to wait for any possible speech, which makes the resources for KWS always seriously constrained. To address the challenge, novel algorithms, such as cFSMN [Chen et al., 2018], DC-CNN [Zhang et al., 2017], and BC-ResNet [Kim et al., 2021], have been proposed for efficient deep learning speedup and memory footprint reduction, they still rely on expensive floating-point operations.

∗ equal contribution † corresponding author

With the most aggressive bit-width, model binarization [Rastegari et al., 2016; Qin et al., 2022] emerges as one of the most promising quantization approaches to compress networks for better computational and storage-usage efficiency. Binary neural networks leverage (1) compact binarized parameters that take limited storage and (2) highly efficient bitwise operations far less costly than their floatingpoint counterparts. However, although the model binarization community has progressed, binarizing the network for KWS

plication of 1-bit parameters, the representation space of the binarized network is extremely limited and hard to optimize. The direct usage of existing binarization methods severely damages the accuracy of binarized models. Second, existing architectures for KWS have fixed model scales and topologies, which cannot adaptively balance the resource budgets at runtime. Moreover, existing deployment frameworks are far from reaching the theoretical upper limit of acceleration for the binarized network when implemented on real-world hardware.

This paper presents a Binarized Feedforward Sequential Memory Network (BiFSMN), which emerges as a successful practice of binary network for KWS application (see the overview in Figure 1), with accurate prediction, lightweight computation, and efficient deployment. BiFSMN is built based on the binarization of D-FSMN, which is a pure feedforward structure. First, we construct a High-frequency Enhancement Distillation (HED) scheme for binarizationaware training, which emphasizes high-frequency information of the full-precision teacher's representation via wavelet transform that is more crucial for the optimization of the binarized network. Second, to enable adaptive accuracyefficiency trade-offs at runtime, we propose a Thinnable Binarization Architecture (TBA) to build various depths (such as [1.0, 0.5, 0.25]×), which further liberates the acceleration potential of the binarized network from the topology perspective to satisfy the different resource constraints. Moreover, we also provide an efficient Fast Bitwise Computation Kernel (FBCK) for BiFSMN on ARMv8 devices. On real-world hardware, the implementation of the BiFSMN using FBCK enjoys impressively faster inference than that using the existing binarization frameworks.

Figure 1: Overview of our BiFSMN, which applies High-frequency Enhancement Distillation (HED) to emphasize significant features and Thinnable Binarized Architecture (TBA) to balance accuracy-efficiency trade-offs, and is implemented by Fast Bitwise Computation Kernel (FBCK) for efficient deployment on real-world devices.

![Image](https://ijcai.org/proceedings/2022/fulltext/603/image_000000_a68a97caf04e9f731375eacd65dd13ebdb13033b625063dde10f87e1515fe75c.png)

Our BiFSMN is the first binary neural network specialized for KWS. Extensive experiments on Google Speech Commands V1 and V2 datasets (12, 20, and 35 classification tasks) show that our BiFSMN completely outperforms existing binarization methods and is even almost accurate on par with the full-precision counterpart, e.g., BiFSMN just drops within 3% on Speech Commands V1-12. Besides, we highlight that the efficient implementation makes our BiFSMN easy deployment and fast inference in real-world devices: in actual evaluation on edge ARM devices, BiFSMN can achieve up to 22.3× speedup and 15.5× storage-saving compared with the full-precision D-FSMN.

## 2 RelatedWork

## 2.1 Network Binarization

Recently, various binarization methods for neural networks have emerged to compress and accelerate networks. The existing binarization methods are designed to obtain accurate binarized networks by minimizing the quantization error [Rastegari et al., 2016], improving loss function [Ding et al., 2019], etc. And from the architectures prospective, despite the most popular CNNs [Liu et al., 2018], transformerbased and MLP-based networks are also studied for binarization [Qin et al., 2021]. The practical use of binarization on real devices relies on deployment support. There are binarization frameworks with different target platforms (e.g., CPUs, GPUs, and FPGAs) and applications, such as daBNN [Zhang et al., 2019] and Bort [Shang et al., 2021].

## 2.2 Deep Learning for Keyword Spotting

Due to their learning potential and superior performance, deep neural networks for KWS have become widely studied. One classic model is the recurrent neural network (RNN), which enables to capture of the context in a sequence of data [Tian et al., 2021]. CNN-based (BC-ResNet [Kim et al., 2021]) and transform-based (Audiomer) models for KWS are also proposed for better performance and cheaper energy cost. Feedforward Sequential Memory Networks (FSMN) [Zhang et al., 2015] mitigates the vanishing gradient problem of RNNs, and is also efficient in computation in convergence. Improvements on the original design of FSMN are varied, such as compact FSMN (cFSMN) [Chen et al., 2018], Deep-FSMN (D-FSMN), and pyramidal FSMN (pFSMN) [Yang et al., 2018].

## 3 BiFSMN

In this section, we present the BiFSMN for KWS application. We first build a basic binarization framework and then introduce our techniques, including High-frequency Enhancement Distillation (HED), Thinnable Binarization Architecture (TBA), and Fast Bitwise Computation Kernel (FBCK).

## 3.1 Basic Binarization Framework

Here we give an introduction to the process of obtaining the basic binarization framework. As one of the most classic and widely used models for speech tasks, D-FSMN [Zhang et al., 2018] is considered as a binarization-friendly architecture for the following reasons: (1) The D-FSMN is a pure feedforward structure with the backbone built up by stacking FIRlike memory blocks. (2) D-FSMN introduces skip connections between memory blocks in adjacent layers to allow the information to flow directly to the next layer, which is also proved important for accurate binarized networks [Liu et al., 2018]. Therefore, we consider the construction of the binarized D-FSMN as the basic binarization framework.

We first introduce the basic formulations of binarization. In the binarized network, both weights and activations are com-

˜pℓt =

+

![Image](https://ijcai.org/proceedings/2022/fulltext/603/image_000001_dfc74ad1977aae99cc711689dea8c26ba608edb4fdfa56b0f6c00d01be15efaa.png)

![Image](https://ijcai.org/proceedings/2022/fulltext/603/image_000002_d8684e17efface101f0e49f29621ca877339fa72068dfed67db16f0182cd197e.png)

(1)

where C is the cost function for the minibatch, x denotes the

element in floating-point parameters. The scaling factor α is

![Image](https://ijcai.org/proceedings/2022/fulltext/603/image_000003_e7fad7007bcdc9f6f42df81285382b70fd9e9c12eae07c737224725f3554f28f.png)

highpass

pressed to 1-bit using the sign function in the forward propa-

gation, and the STE [Courbariaux et al., 2015] is applied to

clip the gradient in the backward propagation:

sign(x) =

-1 otherwise , ∂C

∂ sign(x) if |x| ≤ 1

![Image](https://ijcai.org/proceedings/2022/fulltext/603/image_000004_0c0766f8944c4f3922c39571cd7611a7ce4f7d3f1944ba85d92fe3db4a1bfcb9.png)

![Image](https://ijcai.org/proceedings/2022/fulltext/603/image_000005_3e9714c63b6cb12c15ef547369d72deeeda202934b002e0d9bb202c331061e8c.png)

![Image](https://ijcai.org/proceedings/2022/fulltext/603/image_000006_17c5557c959cab9fa7d77e1a04dbe56a1da84ac4d1dc42e864e81bbbaa22e389.png)

also introduced to retain the magnitude of real-value weights: (a) original (b) after applying wavelet transform

![Image](https://ijcai.org/proceedings/2022/fulltext/603/image_000007_0854a3004efe059e1c71ebf94d240e9a5a736b5eef36a2003223527bb8699941.png)

αw = 1n w⊤sign(w) = 1n ∥w∥l1 ,

(2)

we make w ≈ αwBw to reduce the quantization error, where

Bw is the 1-bit weight binarized by sign function.

Then, we introduce the binarized network architecture.

When constructing a binarized D-FSMN, we binarize both

![Image](https://ijcai.org/proceedings/2022/fulltext/603/image_000008_49297d81b6d49d96845786438a4600cfb08edae975c261d1ad06c7dc1ca626cb.png)

the floating-point weight and activation for linear and con-

volutional layers. Given the input ℓ-th hidden states Hℓ =

[hℓ1 , hℓ2 , ..., hℓT ], and each hℓt ; t ∈ [1, T ] denotes a fixed-size

representation of the long surrounding context at time in-

![Image](https://ijcai.org/proceedings/2022/fulltext/603/image_000009_fcbf626ab027e39429179154e7d3ff652b3067ce5430b430d274c178a27c47ad.png)

highpass lowpass

![Image](https://ijcai.org/proceedings/2022/fulltext/603/image_000010_96ff5c3e888c33bc0dff8351f03e8cdec1f48582059911c2ce30a8a0d6e55ac6.png)

stance t. The formulation of the ℓ-th binarized memory block

takes the following form: (a) original

N ℓ

1∑

i=0

N ℓ

<!-- formula-not-decoded -->

2∑

) + H ( ˜pℓ-1

t ) +pℓt .

Here, pℓt = αV (BVℓ ⊗ Bhℓt ) +bℓ denotes the linear output of the binarized linear projection layer. ⊗ denotes the inner product with bitwise operations XNOR and Bitcount. ˜pℓt denotes the output of the memory block. H(·) denotes the skip connection (identity mapping) within the memory block. N ℓ 1 and N ℓ 2 denotes the look-back and lookahead orders and s1 and s2 are the stride for look-back and lookahead filters respectively. The input of the units for the next hidden layer Hℓ+1 = [hℓ+1 1 , hℓ+1 2 , · · · , hℓ+1 T ] is calculated as follow:

<!-- formula-not-decoded -->

where f(·) = BN · Nonlinear(·) denotes the composition of batch normalization and nonlinear functions (PReLU in the binarized network [Martinez et al., 2020]).

## 3.2 High-frequency Enhancement Distillation for Binarization-aware Training

When the neural network is binarized, its representation capability is extremely limited, and the accuracy is significantly decreased compared with the full-precision counterparts. As shown in Figure 2, binarization makes the intermediate representation visually monotonous since it restricts the pixels to binary, while the original feature information is richer and contains much detailed information. However, since it is highly discrete in binarized representations, values on the edges falling to 1 or -1 outline the object, conveying more

(b) after applying wavelet transform

(Bℓai ⊗Bpℓt-is1

)

αℓai

(3)

![Image](https://ijcai.org/proceedings/2022/fulltext/603/image_000011_a8664adfb3b8cf4ed291236eb4e0efd7e727f28157b33566e9158b50cdd6839a.png)

(a) original

![Image](https://ijcai.org/proceedings/2022/fulltext/603/image_000012_72aaf432085a4438b631b6d396d4da9eba2e769c55bccbfa524d3b49baefa006.png)

high-frequency low-frequency (b) after applying WT and IWT

![Image](https://ijcai.org/proceedings/2022/fulltext/603/image_000013_f6b453b005be373bb00435ea06eb5019ed47c78cd693f872d47396cd7b617568.png)

![Image](https://ijcai.org/proceedings/2022/fulltext/603/image_000014_9ec34f64911beaf48a3b9d6669425a43a9e41055be766d4e4d48b1bd9298e7b5.png)

![Image](https://ijcai.org/proceedings/2022/fulltext/603/image_000015_91543b0f7d3ed29fb6e916fef2ff22489b6441784d4f8a0203edc0581fe54671.png)

Figure 2: Compared with the original full-precision representation, the relative wavelet energy of the high-frequency component of the binarized representation is larger while that of the low-frequency component is much smaller.

important information than plain blocks. While it is wellknown that edges often present as local maxima of the gradient, which is hard to be improved directly by global optimization.

Fortunately, we find that the essence of the information inclination to edge is that the essential binarized representation tends to concentrate on high-frequency components. We use 2D Haar Wavelet Transform (WT) [Meyer, 1992], which is most frequently used as a separable transform that isolates horizontal and vertical edges, to decompose the representation into low and high-frequency components. The hidden state H inputted to a specific layer can be represented as a weighted sum of the wavelet function family:

<!-- formula-not-decoded -->

where ϕ is the mother wavelet function with a specific time parameter, j = -1, · · · ,-N is the resolution level, and k determines the translation of the waveform.

To measure the information amount conveyed by the single component of representation, the relative wavelet energy is used to define the amount of information [Rosso et al., 2001]. The wavelet energy Ej at j-th level is first calculated as:

<!-- formula-not-decoded -->

When we obtain low and high-frequency coefficients (Cj ∈ {CL,CH}, N = 2) by once decomposition, their relative wavelet energy pH and pL can be expressed as:

<!-- formula-not-decoded -->

The larger relative wavelet energy demonstrates the information is more gathered in this component. As Figure 2 shows, compared with the full-precision representation, the relative wavelet energy of the high-frequency components of the binarized ones increases significantly, which implies that binarized representation inclines higher-frequency components.

Based on the above analysis, we propose a High-frequency Enhancement Distillation for binarization-aware training.

Figure 3: An instance of Thinnable Binarization Architecture (N = 8, δ = 1, 2, 4) at runtime, where red arrows denote skip connections.

![Image](https://ijcai.org/proceedings/2022/fulltext/603/image_000016_9de120f1d37effdcafaf8a9bd2057320e3897742acffa6977872359c56aa3cd8.png)

The scheme utilizes a pre-trained full-precision D-FSMN as the teacher, and enhances the high-frequency components of its hidden states during distillation. Specifically, we apply wavelet transform on the original representations, remove the low-frequency component, and then apply Inverse Wavelet Transform (IWT) function on the high-frequency components to retrieve selected representation. The process can be formulated as follow:

<!-- formula-not-decoded -->

And then the emphasized high-frequency representations are added to the original ones:

<!-- formula-not-decoded -->

where σ(·) is the standard deviation. Then, inspired by [Martinez et al., 2020], we minimize the attention distillation loss between ˆHT from the teacher and ˆHS directly from the hidden states of the student, which is expressed as:

<!-- formula-not-decoded -->

where ℓ denotes the ℓ-th block and ∥ · ∥ is the L2-norm.

The HED scheme above makes it easier for the binarized student network to exploit the essential information from emphasized full-precision representations and improve accuracy.

## 3.3 Thinnable Binarization Architecture for Runtime Accuracy-efficiency Trade-off

As discussed earlier, binarization is an efficient compression approach with extremely lightweight 1-bit parameters and efficient bitwise operations, enabling fast inferences on resource-limited devices. As one of the advantages, binarization will not affect the model architecture, which is critical for well-designed structures. However, the energy budget varies between devices and even during wake-up and power-saving modes on a single device. Therefore, a lightweight yet adaptive binarized architecture, which can switch among different widths at runtime, permits instant and adaptive accuracyefficiency trade-offs for KWS.

## Algorithm 1: The training process of our BiFSMN.

Input: Fixed pre-trained full-precision teacher MFP32 and thinnable binarized model M (BiFSMN) with N basic binarized blocks, training iterations T .

Output: Well-trained thinnable binarized model M

for all t = 1, 2, . . . , T do Forward propagate MFP(x) and obtain the information-enhanced intermediate features ˆHT = { ˆH1T , ˆH2T , . . . , ˆHNT }; for all δ = 1, 2, . . . , log2 N do Forward propagate M(x; δ) and obtain the intermediate features HδS = {HδS , H2δ S , . . . ,HNS }; Compute the distillation loss Lδdist by Eq. (14); Compute the cross-entropy loss LδCE; Descend Ltot as Eq. (15) and update M; Get the well-trained BiFSMNmodel M; Evaluate the BiFSMN on test dataset and get the accuracy.

We present a Thinnable Binarization Architecture (TBA) for KWS, which can select a thinner model with fewer layers at runtime, directly reducing the computational consumption. When we focus on the computational expensive backbone, the basic binarization architecture M′ containing N blocks (N ∈ {2n , n ∈ Z+}) can be expressed as:

<!-- formula-not-decoded -->

where M′ and φℓ are the binarized network and ℓ-th binarized D-FSMN block, respectively, and x is the input of network. The TBA derived from M can be defined as:

<!-- formula-not-decoded -->

where δ is the interval of selected layers, which is confined to be divisible into N. And each thinnable block Φℓ can be defined as

<!-- formula-not-decoded -->

And the batch normalization in the function f(·) in Eq. (4) in ℓ-th binarized D-FSMN block φℓ are preassigned according to different variants in the thinnable network. The thinnable network architecture will skip intermediate blocks every δ layers by replacing them with identity functions. Figure 1 shows the formalization of our thinnable binarization architecture, and we also provide an instance for N = 8, δ = 1, 2, 4 in Figure 3, which is also the default setting in our experiments.

To optimize the binarization-aware training for the proposed TBA, we adopt the uniform layer mapping strategy to better align and learn representation in the HED:

<!-- formula-not-decoded -->

The gradients from different switches are accumulated during backward propagation to update the weight jointly. According to the compression ratio in thinnable architecture, the weighted loss can be calculated as:

Ltot = ∑

δ

![Image](https://ijcai.org/proceedings/2022/fulltext/603/image_000017_b5215fe023c85f3dcd402d4c2fa4dc512cf64c8c8e2d05ed29edbaed238f1a32.png)

where LδCE denotes the cross-entropy loss of M(·; δ) and γ is a hyperparameter to control distillation impact, set to 0.01 as default. The detailed training procedures for the BiFSMN are listed in Algorithm 1.

## 3.4 Fast Bitwise Computation Kernel for Efficient Hardware Deployment

Benefiting from binarized weights and activations compressed to 1 32 of the original bit-width, a single binarized layer has an extreme-high 64× theoretical reduction of FLOPs [Liu et al., 2018]. However, when we implement and deploy the entire binary neural network on real-world hardware using existing binarization deployment frameworks, such as daBNN [Zhang et al., 2019] and Bolt [huawei noah, 2021], its overall inference efficiency is often significantly lower than the theoretical upper limit. One of the key bottlenecks of acceleration is the Binarized General Matrix Multiply (BGEMM) performed with the bitwise XNOR and Bitcount. Therefore, for efficient deployment on edge devices with limited computational resources, we further optimize the 1-bit computation with new instruction and register allocation strategy to accelerate the inference on ARMv8-A architecture widely used on edge devices. We dub it Fast Bitwise Computation Kernel (FBCK).

According to the number of registers on ARMv8 architecture, we first reallocate the registers in the kernel as five partitions in order to improve the register utilization and reduce memory footprint: partition A has four registers (except register v0) for one input (weight/activation), B has two for the other input, C has eight for intermediate results of EOR and CNT, D has eight for the output in one loop, and E has eight for the final results. Each input is packed as INT16. Each register in A stores one input while repeated 8 times, while each in B stores 8 different inputs. We first apply EOR and CNT for A with one register of B to get 32 INT8 results in intermediate partition C, and then perform ADD to accumulate the INT8 to D, and do the same for the other register of B. After sixteen times loop, we finally accumulate the INT8 data

stored in D to an INT16 register (in E) using long instruction

ADALP, which extends INT8 data to double width. FBCK makes full use of registers almost without idle bits during the computation. Refer to Figure 4 as illustration.

## 4 Experiments

In this section, we conduct experiments on the Google Speech Commands V1 and V2 datasets [Warden, 2018] to verify the effectiveness of BiFSMN and compare it with state-of-the-art (SOTA) binarization methods and various architectures.

## 4.1 Ablation Study

We perform ablation studies to investigate the effect of components of the proposed BiFSMN, including the Highfrequency Enhancement Distillation (HED) and Thinnable

(15)

Figure 4: Fast Bitwise Computation Kernel for BiFSMN, which improves the utilization of registers to expand instruction throughput.

![Image](https://ijcai.org/proceedings/2022/fulltext/603/image_000018_77686b450c385197093097c64d019a014b774926b6df2d95b3457b6f80458220.png)

Table 1: Ablation study of BiFSMN on Speech Command 12 tasks. FLOPs denotes million FLOPs, same below.

| Arch.                      | Quant               | #Bits       | FLOPs             | V1                      | V2                      |
|----------------------------|---------------------|-------------|-------------------|-------------------------|-------------------------|
| D-FSMN                     | Full Prec.          | 32/32       | 710.15            | 97.51                   | 96.01                   |
| D-FSMN                     | Vanilla Distill HED | 1/1 1/1 1/1 | 40.46 40.46 40.46 | 87.71 90.02 93.47       | 89.53 90.95 93.54       |
| BiFSMN (TBA) [1,0.5,0.25]× | Vanilla             | 1/1         | 40.46 29.90 24.62 | 87.72 86.95 84.19       | 89.96 88.85 87.09 93.00 |
| BiFSMN (TBA) [1,0.5,0.25]× | Distill             | 1/1         | 40.46 29.90 24.62 | 92.31 91.89 91.83 95.03 | 92.84 92.70 94.86 94.74 |
| BiFSMN (TBA) [1,0.5,0.25]× | HED                 | 1/1         | 40.46 29.90 24.62 | 94.87 94.48             | 94.63                   |

Binarization Architecture (TBA), on the Speech Commands V1-12 and V2-12 KWS tasks.

As shown in Table 1, the vanilla binarization baseline suffers a significant performance drop in both datasets. The naive distillation scheme helps with the accuracy on the basic D-FSMN architecture, and the application of HED further improves the performance considerably based on distillation. It demonstrates that emphasizing high-frequency information makes it easier for the binarized network to exploit the most crucial representation. And the distillation strategy is also indispensable for better aligning and transferring information.

On the other hand, when solely utilizing TBA, we train a single model but optimize it in different parameter scales through weighted backward propagation. It shows a great deal of potential in not only the adaptive and lightweight computation at runtime but also the optimization of the binarized network during training. Moreover, jointly using HED and TBA further close the accuracy gap between the binarized model and the full-precision counterpart, which is less than 3% on both datasets.

## 4.2 Comparative Experiments

We first compare our BiFSMN with existing structureindependent binarization methods, including BNN [Courbariaux et al., 2016], DoReFa [Zhou et al., 2016], XNOR [Rastegari et al., 2016], Bi-Real [Liu et al., 2018], IR-Net [Qin et al., 2020], and RAD [Ding et al., 2019]. We evaluate these binarization methods on 8-block D-FSMN architecture with the same size as the largest variant of BiFSMN. The results in Table 2 show that our 1-bit BiFSMN completely outperforms other SOTA binarization methods by a wide margin. It is noteworthy that BiFSMN even enjoys competitive accuracy to full-precision counterparts within 4% average accuracy drop on both datasets.

Table 2: Comparison of SOTA binarization methods on Speech Commands V1 and V2 datasets.

| Dataset            | Method                   | #Bits   | FLOPs       | V1          | V2          |
|--------------------|--------------------------|---------|-------------|-------------|-------------|
| Speech Commands 12 | Full Prec.               | 32/32   | 710.15      | 97.93       | 98.05       |
| Speech Commands 12 | DoReFa                   | 1/1     | 40.46       | 66.42       | 66.59       |
| Speech Commands 12 | BNN                      | 1/1     | 35.87       | 68.84       | 70.87       |
| Speech Commands 12 | RAD                      | 1/1     | 35.87       | 71.51       | 69.80       |
| Speech Commands 12 | XNOR                     | 1/1     | 45.04       | 82.74       | 87.34       |
| Speech Commands 12 | Bi-Real                  | 1/1     | 40.46       | 85.87       | 87.93       |
| Speech Commands 12 | IR-Net                   | 1/1     | 40.46       | 86.81       | 85.10       |
| Speech Commands 12 | BiFSMN                   |         | 40.46       | 95.03       | 94.86       |
| Speech Commands 12 |                          | 1/1     | 29.90 24.62 | 94.87 94.48 | 94.73 94.63 |
| Speech Commands 12 | [1,0.5,0.25]× Full Prec. | 32/32   | 711.20      | 96.57       | 97.00       |
| Speech Commands 20 | XNOR                     | 1/1     | 45.04       | 80.69       | 85.05       |
| Speech Commands 20 | Bi-Real                  | 1/1     | 41.50       | 80.84       | 84.39       |
| Speech Commands 20 | IR-Net                   | 1/1     | 41.50       | 83.78       | 83.32       |
| Speech Commands 20 | BiFSMN                   | 1/1     | 41.50       | 92.88       | 92.98       |
| Speech Commands 20 | [1,0.5,0.25]×            |         | 30.95 25.67 | 92.65       | 92.81       |
| Speech Commands 20 | Full Prec.               | 1/1 1/1 |             | 92.67       | 92.72       |
| Speech Commands 20 |                          | 32/32   | 713.16      | 96.63       | 95.96       |
| Speech             | IR-Net Bi-Real           |         | 43.47 43.47 | 74.09       | 74.93 81.86 |
| Commands 35        | XNOR                     | 1/1     | 48.06       | 81.25       | 84.05       |
| Speech Commands 20 |                          |         |             | 80.86       |             |
| Speech Commands 20 | BiFSMN                   |         | 43.47       | 92.10       | 90.54       |
| Speech Commands 20 |                          | 1/1     | 32.91       | 91.93       | 90.67       |
| Speech Commands 20 | [1,0.5,0.25]×            |         |             |             |             |
| Speech Commands 20 |                          |         | 27.63       | 91.85       | 90.42       |

Second, to validate the advantage of our TBA from the architecture perspective, we also compare it with various networks widely used in KWS, including FSMN [Zhang et al., 2015], VGG19bn [Simonyan and Zisserman, 2014], BCResNet [Kim et al., 2021], and Audiomer [Sahu et al., 2021]. We binarized these architectures with XNOR and IR-Net. In Table 3, our HED can generally be applied in FSMN-based architectures and make a difference for the binarized model performance. Moreover, equipped with TBA, BiFSMN can further strike a balance between accuracy and efficiency at runtime. We further prune the model width and provide an extremely tiny BiFSMNS (with 32 backbone memory size and 64 hidden size) with only 0.05M parameters and 9.16M FLOPs, demonstrating that our methods also works well on tiny networks.

## 4.3 Deployment Efficiency

To validate the practicability of BiFSMN, we test the actual speed of BiFSMN on Raspberry Pi 3B+ with 1.2GHz 64-bit ARMv8 CPU Cortex-A53.

According to Figure 5, due to the proposed optimized 1bit Fast Bitwise Computation Kernel, our BiFSMN delivers 10.9× acceleration compared to the full-precision counterparts. It is also much faster than the existing opensource high-performance binarization frameworks (daBNN and Bolt). Furthermore, benefiting from the thinnable architecture, BiFSMN can adaptively balance accuracy and efficiency at runtime according to the resources on device, and switches to BiFSMN0.5× or BiFSMN0.25× for further 15.5× and 22.3× speedups, respectively. It shows that our BiFSMN can satisfy different resource constraints.

| Arch.     | Quant       | #Bits   | #Param      | FLOPs           | Acc.        |
|-----------|-------------|---------|-------------|-----------------|-------------|
| VGG19bn   | Full Prec.  | 32/32   | 38.97       | 53348.40        | 97.74       |
| VGG19bn   | IR-Net XNOR | 1/1 1/1 | 38.97 38.97 | 1030.18 1061.63 | 63.86 66.10 |
| BC-ResNet | Full Prec.  | 32/32   | 0.35        | 3749.71         | 97.84       |

IR-Net

XNOR

1/1

0.35

619.03 65.94

1/1

0.35

541.70 66.51

FSMN

D-FSMN

![Image](https://ijcai.org/proceedings/2022/fulltext/603/image_000019_72c843f8a9a4fa370c751b3045e0a727dbd7ee8fab07a276eccbef5142d0b02c.png)

Full Prec.

HED (ours)

32/32

1/1

0.80 18577.49 98.95

0.80

1449.41 62.44

0.80

2567.19 62.44

0.45

1625.29 97.52

0.45

80.61 55.89

0.45

0.45

64.36 89.90

0.60

64.36 88.35

710.15 97.93

0.60

45.04 82.74

0.60

0.60

40.46 93.47

40.46 86.81

BiFSMN

[1,0.5,0.25]×

Full Prec.

32/32

0.60

710.15 97.93

IR-Net

1/1

0.61

HED (ours)

1/1

0.61

40.46 88.37

29.90 87.11

24.62 86.08

40.46 95.03

29.90 94.87

Speech Commands V1-12 task. #Param denotes million parameters.

![Image](https://ijcai.org/proceedings/2022/fulltext/603/image_000020_7d8372f208c4c518a146b8fad5949e4cdf5459f37480c6fb6fec2f0c19b499ba.png)

Figure 5: Performance evaluation on real-world ARMv8 devices.

![Image](https://ijcai.org/proceedings/2022/fulltext/603/image_000021_9b9b2f2026f0e6e856e8310d5b2cf127f46b8d96fe7e4f213342fcaf346f7cf6.png)

## 5 Conclusion

We present BiFSMN, an accurate and extreme-efficient binary neural network for KWS. We first construct an HED scheme to emphasize high-frequency information to optimize the training of the binarized network. We also propose a TBA to achieve instant and adaptive accuracy-efficiency trade-offs at runtime. BiFSMN outperforms existing binarization methods by convincing margins and is even comparable to the full-precision counterpart. Moreover, our implementation for BiFSMN on ARMv8 real-world devices achieves an impressive 22.3× speedup and 15.5× storage-saving.

## Acknowledgements

This work was supported in part by National Natural Science Foundation of China under Grant 62022009 and Grant 61872021, Beijing Nova Program of Science and Technology under Grant Z191100001119050.

606/44

dabnn

FP 377,

8L 81,8

2L 28,7

88517

11054

2,950,

Our fas

8L 34,6

4L 22,8

2L 16,9

BiFSMN

8L 81.9

4L 46,4

2L 28.8

bolt

8L(2,95

4L 26,2

2L(2,95

存储

2L 60K

8L 110

FP 1.7

## References

1. [Chen et al., 2014] Guoguo Chen, Carolina Parada, and Georg Heigold. Small-footprint keyword spotting using deep neural networks. In ICASSP, 2014.
2. [Chen et al., 2018] Mengzhe Chen, Shiliang Zhang, Ming Lei, Yong Liu, Haitao Yao, and Jie Gao. Compact feed- forward sequential memory networks for small-footprint keyword spotting. In Interspeech, 2018.
3. [Courbariaux et al., 2015] Matthieu Courbariaux, Yoshua Bengio, and Jean-Pierre David. Binaryconnect: Training deep neural networks with binary weights during propaga- tions. In NeurIPS, 2015.
4. [Courbariaux et al., 2016] Matthieu Courbariaux, Itay Hubara, Daniel Soudry, Ran El-Yaniv, and Yoshua Ben- gio. Binarized neural networks: Training deep neural networks with weights and activations constrained to+ 1 or-1. arXiv, 2016.
5. [Ding et al., 2019] Ruizhou Ding, Ting-Wu Chin, Zeye Liu, and Diana Marculescu. Regularizing activation distribu- tion for training binarized deep networks. In CVPR, 2019. [huawei noah, 2021] huawei noah. Bolt. https://github.com/ huawei-noah/bolt, 2021. Accessed: 2022-01-08.
6. [Kim et al., 2021] Byeonggeun Kim, Simyung Chang, Jinkyu Lee, and Dooyong Sung. Broadcasted residual learning for efficient keyword spotting. arXiv, 2021.
7. [Liu et al., 2018] Zechun Liu, Baoyuan Wu, Wenhan Luo, Xin Yang, Wei Liu, and Kwang-Ting Cheng. Bi-real net: Enhancing the performance of 1-bit cnns with im- proved representational capability and advanced training algorithm. In ECCV, 2018.
8. [Martinez et al., 2020] Brais Martinez, Jing Yang, Adrian Bulat, and Georgios Tzimiropoulos. Training binary neu- ral networks with real-to-binary convolutions. In ICLR, 2020.
9. [Meyer, 1992] Yves Meyer. Wavelets and Operators: Volume 1. Cambridge university press, 1992.
10. [Qin et al., 2020] Haotong Qin, Ruihao Gong, Xianglong Liu, Mingzhu Shen, Ziran Wei, Fengwei Yu, and Jingkuan Song. Forward and backward information retention for ac- curate binary neural networks. In CVPR, 2020.
11. [Qin et al., 2021] Haotong Qin, Zhongang Cai, Mingyuan Zhang, Yifu Ding, Haiyu Zhao, Shuai Yi, Xianglong Liu, and Hao Su. Bipointnet: Binary neural network for point clouds. In ICLR, 2021.
12. [Qin et al., 2022] Haotong Qin, Yifu Ding, Mingyuan Zhang, Qinghua YAN, Aishan Liu, Qingqing Dang, Ziwei Liu, and Xianglong Liu. BiBERT: Accurate fully binarized BERT. In ICLR, 2022.
13. [Rastegari et al., 2016] Mohammad Rastegari, Vicente Or- donez, Joseph Redmon, and Ali Farhadi. Xnor-net: Ima- genet classification using binary convolutional neural net- works. In ECCV, 2016.
14. [Ren et al., 2020] Yi Ren, Chenxu Hu, Xu Tan, Tao Qin, Sheng Zhao, Zhou Zhao, and Tie-Yan Liu. Fastspeech 2: Fast and high-quality end-to-end text to speech. In ICLR, 2020.
15. [Rosso et al., 2001] Osvaldo A Rosso, Susana Blanco, Ju- liana Yordanova, Vasil Kolev, Alejandra Figliola, Martin Schürmann, and Erol Başar. Wavelet entropy: a new tool for analysis of short duration brain electrical signals. J. Neurosci. Methods, 2001.
16. [Sahu et al., 2021] Surya Kant Sahu, Sai Mitheran, Juhi Kamdar, and Meet Gandhi. Audiomer: A convo- lutional transformer for keyword spotting. ArXiv, abs/2109.10252, 2021.
17. [Shang et al., 2021] Hengchao Shang, Ting Hu, Daimeng Wei, Zongyao Li, Jianfei Feng, Zhengzhe Yu, Jiaxin Guo, Shaojun Li, Lizhi Lei, Shimin Tao, et al. Hw-tsc's partic- ipation in the wmt 2021 efficiency shared task. In Pro- ceedings of the Sixth Conference on Machine Translation, pages 781-786, 2021.
18. [Simonyan and Zisserman, 2014] Karen Simonyan and An- drew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv:1409.1556, 2014.
19. [Tian et al., 2021] Yao Tian, Haitao Yao, Meng Cai, Yam- ing Liu, and Zejun Ma. Improving rnn transducer mod- eling for small-footprint keyword spotting. In ICASSP, 2021.
20. [Warden, 2018] Pete Warden. Speech commands: A dataset for limited-vocabulary speech recognition. arXiv:1804.03209, 2018.
21. [Yang et al., 2018] Xuerui Yang, Jiwei Li, and Xi Zhou. A novel pyramidal-fsmn architecture with lattice-free mmi for speech recognition. arXiv:1810.11352, 2018.
22. [Zhang et al., 2015] Shiliang Zhang, Cong Liu, Hui Jiang, Si Wei, Lirong Dai, and Yu Hu. Feedforward sequential memory networks: A new structure to learn long-term de- pendency. arXiv:1512.08301, 2015.
23. [Zhang et al., 2017] Yundong Zhang, Naveen Suda, Liangzhen Lai, and Vikas Chandra. Hello edge: Keyword spotting on microcontrollers. arXiv:1711.07128, 2017.
24. [Zhang et al., 2018] Shiliang Zhang, Ming Lei, Zhijie Yan, and Lirong Dai. Deep-fsmn for large vocabulary continu- ous speech recognition. In ICASSP, 2018.
25. [Zhang et al., 2019] Jianhao Zhang, Yingwei Pan, Ting Yao, He Zhao, and Tao Mei. dabnn: A super fast inference framework for binary neural networks on ARM devices. In ACM MM, 2019.
26. [Zhou et al., 2016] Shuchang Zhou, Yuxin Wu, Zekun Ni, Xinyu Zhou, He Wen, and Yuheng Zou. Dorefa-net: Train- ing low bitwidth convolutional neural networks with low bitwidth gradients. arXiv, abs/1606.06160, 2016.
