Graph Neural Network Backend for Speaker Recognition
Currently, most speaker recognition backends, such as cosine, linear
discriminant analysis (LDA), or probabilistic linear discriminant analysis
(PLDA), make decisions by calculating similarity or distance between enrollment
and test embeddings which are already extracted from neural networks. However,
for each embedding, the local structure of itself and its neighbor embeddings
in the low-dimensional space is different, which may be helpful for the
recognition but is often ignored. In order to take advantage of it, we propose
a graph neural network (GNN) backend to mine latent relationships among
embeddings for classification. We assume all the embeddings as nodes on a
graph, and their edges are computed based on some similarity function, such as
cosine, LDA+cosine, or LDA+PLDA. We study different graph settings and explore
variants of GNN to find a better message passing and aggregation way to
accomplish the recognition task. Experimental results on NIST SRE14 i-vector
challenging, VoxCeleb1-O, VoxCeleb1-E, and VoxCeleb1-H datasets demonstrate
that our proposed GNN backends significantly outperform current mainstream
methods.
Liang He, Ruida Li, Mengqi Niu
# Graph Neural Network Backend for Speaker Recognition

###### Abstract

Currently, most speaker recognition backends, such as cosine, linear discriminant analysis (LDA), or probabilistic linear discriminant analysis (PLDA), make decisions by calculating similarity or distance between enrollment and test embeddings which are already extracted from neural networks. However, for each embedding, the local structure of itself and its neighbor embeddings in the low-dimensional space is different, which may be helpful for the recognition but is often ignored. In order to take advantage of it, we propose a graph neural network (GNN) backend to mine latent relationships among embeddings for classification. We assume all the embeddings as nodes on a graph, and their edges are computed based on some similarity function, such as cosine, LDA+cosine, or LDA+PLDA. We study different graph settings and explore variants of GNN to find a better message passing and aggregation way to accomplish the recognition task. Experimental results on NIST SRE14 i-vector challenging, VoxCeleb1-O, VoxCeleb1-E, and VoxCeleb1-H datasets demonstrate that our proposed GNN backends significantly outperform current mainstream methods.

 Speaker recognition, graph neural network, embeddings, representative learning

## I Introduction

The core task of speaker recognition is to determine whether two utterances are from the same speaker. Currently, the mainstream methods are variants of x-vector [1], which has obtained excellent performance in recent evaluations and applications [2]. It mainly consists of a frontend neural network responsible for mapping from an utterance with variable duration to a fixed dimension embedding, also termed an x-vector, and a backend module in charge of making the decision based on enrollment and test embeddings.

Most studies are about improvements of the neural networks, e.g., time-delay neural network (TDNN) [1], emphasized channel attention, propagation and aggregation-TDNN (ECAPA-TDNN) [3], ResNet [4], ResNeXt [5], of pooling layer, e.g., attentive statistics pooling (ASP) [6], multi-head attention pooling (MHAP) [7], learnable dictionary encoding (LDE) [8], and of the loss function, e.g., angular softmax (A-softmax) loss [9], additive margin softmax loss (AM-softmax) [10, 11], additive angular margin (ArcFace) loss [12], dynamic margin softmax loss [13], adaptive margin circle loss [14], and _etc_.

In contrast, there is less research on the backend. The mainstream backends are still cosine scoring and linear discriminant analysis (LDA) followed by probabilistic LDA (PLDA, LDA+PLDA), which is already verified on most databases or evaluations [2, 15, 16]. In recent years, there are three kinds of representative methods to improve the backend. The first category is about PLDA, such as Neural PLDA [17], discriminative PLDA (DPLDA) [18], heavy-tailed PLDA (HTPLDA) [19], multi-objective optimization training of PLDA (Mot-PLDA) [20] and _etc_. The second is to add an additional trainable neural network module, e.g., decision residual networks (Dr-vectors) [21], deep learning backend (DLB) [22] and tied variational autoencoder (TVAE) [23]. And the last is to develop a robust backend against domain mismatch, such as Coral++ [24], domain-aware batch normalization (DABN) and domain-agnosticinstance normalization (DAIN) [25], information-maximized variational domain adversarial neural network (InfoVDANN) [26], and _etc_. However, these algorithms rarely use spatial or graph information among the extracted embeddings, which may significantly boost the performance.

Recently, graph neural network (GNN) has achieved great success in a large number of areas, such as physics, chemistry, biology, knowledge graph, social network, recommendation systems, and _etc_[27]. It is a powerful tool to mine rich relation information among data, which has great potential for speaker recognition. Jung _et al._ propose a graph attention network (GAT) in the case of test time augmentation (TTA) [28] and demonstrate that the GAT-TTA backend has consistent improvement over cosine scoring. Although the proposed GAT-TTA framework takes multiple embeddings to construct graphs, they are still only from the enrollment and test utterances, which do not use the relationship between the concerned embedding and its surrounding embeddings lying on the hypothesized hypersphere. Wang _et al._[29] use a graph neural network for better clustering to accomplish the speaker diarization task. Furthermore, Zheng _et al._[30] construct a heterogeneous graph to realize multi-modal information aggregation. It takes the speaker and speech segment as vertexes and uses the contextual connection of the speech segment and speaker identity to calculate edges. Experimental results on the MELD databases show the effectiveness of the proposed method [30].

To take advantage of the uniqueness of each speaker's low dimensional spatial (graph) structure embedded on the hypothesized hypersphere, we propose a graph neural network (GCN) backend to mine latent relationships between embeddings and their neighbors to improve the system performance. We assume all the embeddings as nodes on a graph, and the edges are constructed by calculating the similarity between two
nodes. The similarity function could be cosine, LDA+cosine, LDA+PLDA, or others, which will be examined in section III. The graph construction methods and variants of GCN are studied and compared to find a better message passing and aggregation way. The experiment results on the NIST SRE14 i-vector challenging and Voxceleb-1 database validate the effectiveness of our proposed method.

## II Graph neural network backend for speaker recognition

### _Motivation_

The task of the backend for speaker recognition is to make correct and robust decisions based on the extracted i-vectors [31] or x-vectors. If we view these vectors as points in space, the position of each point and its local spatial structure with other points together will help to determine its corresponding category, see Fig. 1. We take each point as a node and add edges by their pairwise geometric distance. Thanks to the powerful ability of graph neural networks to process complex non-Euclidean data, we can more effectively use the spatial structural information on the built graph to compare them and make decisions.

Our proposed method contains graph construction and graph neural networks, see Fig. 2. During graph construction, we mainly finish the computation of nodes and edges. The graph neural network includes graph network modules, batch normalizations (BN), fully connected layers, softmax output, and CE loss.

### _Graph building with nearest neighbors_

Suppose the connected graph is represented as \(G=(V,E)\), where \(V\) are the set of nodes and \(E\) are the set of edges. Each vector is a node on the graph, and its connected nodes are calculated by the nearest neighbor algorithm with cosine, LDA, or LDA + PLDA distance. For instance, if the cosine value of two vectors is greater than a pre-defined threshold, we add an edge to connect them. After the construction of the graph, the adjacency matrix \(A\) is subsequently calculated, in which the element \(a_{i,j}=1\) if there is an edge between the nodes \(i\) and \(j\), otherwise \(a_{i,j}=0\). The diagonal elements in the adjacency matrix are set to be \(1\) for including the center vectors when aggregating information.

### _Variants of graph module_

Variants of graph neural network modules are different ways of message-passing to generate the next layer's nodes by aggregating nodes and their neighbors' information. Denote the \(i\)-th node in the \(k\)-th layer by \(\mathbf{x}_{i}^{(k)}\), the message-passing module can be described as:

\[\mathbf{x}_{i}^{(k)}=f_{\mathbf{\Theta}}\left(\mathbf{x}_{i}^{(k-1)},\text{ AGGREGATE}(\{\mathbf{x}_{j}^{(k-1)}|j\in\mathcal{N}_{i}\})\right)\]

where \(\mathcal{N}_{i}=\{j\in V|(i,j)\in E\}\) is the neighbor set of \(i\)-th node. \(\mathbf{\Theta}\) is the parameters of message-passing module. The design of \(f\) and AGGREGATE is what mostly distinguishes one type of GNN from the other.

#### Ii-C1 Graph convolutional network

The graph convolutional network (GCN) can leverage the graph structure and aggregate node information from the neighborhoods in a convolutional way [32]. The core layer of GCN is as follows:

\[X^{(k)}=\sigma\left(\bar{D}^{-\frac{1}{2}}\tilde{A}\bar{D}^{-\frac{1}{2}}X^{ (k-1)}\mathbf{\Theta}^{(k-1)}\right)\]

where each row of \(X\) is \(\mathbf{x}\), \(\sigma\) represents the nonlinear activation function, \(\hat{A}=A+I\) denotes the adjacency matrix with inserted self-loops and \(\bar{D}_{ii}=\sum_{j=0}\hat{A}_{ij}\) is its diagonal degree matrix.

Fig. 1: We randomly select ten speakers’ i-vectors from the NIST SRE14 database to visualize the relationship among them by the GNE. We can see that both location (ellipses) and graph structure (arrows) contain discriminant information, which helps the classification.

Fig. 2: In the graph building, the nodes are i-vectors or x-vectors, and for each node, its corresponding edges are calculated by using the nearest neighbor algorithms. Based on the built graph, we adopt several layers of a graph network module followed by batch normalization. The last two layers include a linear layer and a softmax output layer. The number of output nodes corresponds to the speaker number in the training set. In the enrollment and test phase, we read out the embeddings in the linear layer, name them as g-vectors, and use them instead of x-vectors or i-vectors for the final cosine scoring.
#### Ii-A2 Graph attention networks

The graph attention networks (GAT) can leverage masked self-attentional weights to aggregate information [33]. The core layer of GAT is as follows:

\[\mathbf{x}_{i}^{(k)}=\alpha_{i,i}\mathbf{\Theta x}_{i}^{(k-1)}+\sum_{j\in\mathcal{ N}(i)}\alpha_{i,j}\mathbf{\Theta x}_{j}^{(k-1)}\]

where the attention coefficients \(\alpha_{i,j}\) are computed as

\[\alpha_{i,j}=\frac{\exp\left(\mathrm{LeakyReLU}\left(\mathbf{a}^{t}\| \mathbf{\Theta x}_{i}\,\|\,\mathbf{\Theta x}_{j}\right)\right)}{\sum_{k\in \mathcal{N}(i)\cup\{i\}}\exp\left(\mathrm{LeakyReLU}\left(\mathbf{a}^{t}| \mathbf{\Theta x}_{i}\,\|\,\mathbf{\Theta x}_{k}\right)\right)}.\]

where \(\mathbf{a}\) is learned, the superscript \(t\) represents transposition and \(\|\) is the concatenation operation.

#### Ii-A3 GATv2

The GATv2 is a modification of GAT, with the attention coefficients \(\alpha_{i,j}\) computed as follows

\[\alpha_{i,j}=\frac{\exp\left(\mathbf{a}^{t}\mathrm{LeakyReLU}\left(\left| \mathbf{\Theta x}_{i}\,\|\,\mathbf{\Theta x}_{j}\right|\right)\right)}{\sum_{k \in\mathcal{N}(i)\cup\{i\}}\exp\left(\mathbf{a}^{t}\mathrm{LeakyReLU}\left( \left|\mathbf{\Theta x}_{i}\,\|\,\mathbf{\Theta x}_{k}\right|\right)\right)}\]

GATv2 is a dynamic graph attention variant that is strictly more expressive than the GAT which is a static graph attention variant [34].

#### Ii-A4 GraphSAGE

The GraphSAGE (SAmple and aggre-GatE) learns a function that generates embeddings by sampling and aggregating features from local neighbors, which can efficiently generate node representation for previously unseen data [35]. The core layer of GraphSAGE is as follows:

\[\mathbf{x}_{i}^{(k)}=\sigma\left(W^{(k)}\cdot\left(\mathbf{x}_{i}^{(k-1)}\| \mathrm{AGGREGATE}(\{\mathbf{x}_{j}^{(k-1)}|j\in\mathcal{N}_{i}\})\right)\right)\]

where \(W^{(k)}\) is the weight matrix of \(k\)-th layer, and the AGGREGATE method could be mean aggregator, LSTM aggregator, or pooling aggregator [35].

#### Ii-A5 Graph transformer

The graph transformer networks are the integration of graph networks and transformer [36]. The graph transformer (GraphTF) layer identifies useful connections, learns a soft selection, and composites an effective node representation [37].

\[\mathbf{x}_{i}^{(k)}=W_{1}^{(k)}\mathbf{x}_{i}^{(k-1)}+\sum_{j\in\mathcal{N}( i)}\alpha_{i,j}W_{2}^{(k)}\mathbf{x}_{j}^{(k-1)}\]

where the attention coefficients \(\alpha_{i,j}\) are computed via multi-head dot product attention [36, 37].

#### Ii-A6 Topology adaptive graph convolutional network

The topology adaptive graph convolutional network (TAGCN) is a generalization of GCN and adopts a set of fixed-size learnable filters to perform convolutions on graphs, which is adaptive to the topology of the graph [38]. The core layer of TAGCN is as follows

\[X^{(k)}=\sum_{p=1}^{P}\left(\tilde{D}^{-\frac{1}{2}}\tilde{A}\tilde{D}^{-\frac {1}{2}}\right)^{P}X^{(k-1)}\mathbf{\Theta}_{p}^{(k-1)}\]

where the \(p\) denotes the number of hops on the graph.

## III Experiments

### _Results on SRE14 i-vector database_

The SRE14 i-vector challenge [39] takes vectors instead of speech as input to compare different speaker verification backends fairly. The dataset is gender independent and contains 1306 speaker models, 9634 test segments, and 12582004 trials. Each speaker model has 5 i-vectors. Trials are randomly divided into a progress subset (40\(\%\)) and an evaluation subset (60\(\%\)). In addition, NIST provided a development set containing 36572 i-vectors. All i-vectors are 600 dimensional. We take both training and test datasets to construct graphs with nearest neighbor algorithms. The development data with labels are used to train LDA, PLDA, and GNN backends. The default dimension of LDA and PLDA are 250 and 50, respectively. The GNN layer is implemented by the Pytorch geometric. Unless otherwise specified, our model architecture includes two layers of GNN+BN, a linear layer, and a softmax output followed by a cross-entropy loss. The g-vectors (See Fig 2) are extracted for the final cosine decision. The model is trained with \(600\) epochs, a fixed learning rate of \(10^{-4}\), and a weight decay parameter of \(5\times 10^{-4}\).

The TABLE I shows the comparison results of cosine, LDA, LDA+PLDA, DBL, and our proposed GNN backends on the SRE14 dataset. From the table, we can see that the EER and minDCF\({}_{14}\) of our proposed GNN backend are \(1.69\%\) and \(0.238\) on the Progress set, and \(1.55\%\) and \(0.218\) on the Evaluation set, which gains \(22.4\%\), \(0.4\%\), \(25.8\%\), and \(4.3\%\) relative performance improvement compared with the LDA+PLDA, respectively.

### _Ablation study on SRE14 i-vector database_

From the TABLE II, we find that the GAT has the best results in EER and the GCN has the best results in minDCF\({}_{14}\). The GAT learns adaptive weights to edges through the attention mechanism, which means it can filter more effective neighbors for auxiliary decisions. The GCN is good at capturing global information on the graph, and we think it's the reason for its good performance. The structure of GATv2 is similar to the GAT, and its performance is also approximate to the GAT. Both the GCN and GraphSAGE (mean aggregator in our experiment) have a similar aggregation way. However, the GCN takes advantage of the adjacency matrix to normalize the node and its neighbors, which may learn the more robust potential pattern. Similar to the GAT, for a node on the graph, the GraphTF also learns adaptive weights from its neighbors. Introducing multi-heads in the GraphTF brings more freedom to fit the local structure information, which may be adverse to obtaining a model with good generalization ability, especially under limited training data. The TGGCN considers multi-hops (3 hops in our experiments), which is suitable for the social network or recommendation system. But it also brings
instability, and we guess that's the reason for the poor results of TAGCN. According to the above analysis, we do the following ablation experiments using the GAT.

We study the construction method of graphs, e.g., nodes and edges, subsequently. The TABLE III shows that the performance is best when the nodes are 250-dimensional vectors after LDA reduction and edges are built by the PLDA (50 dimensions). We conclude that the dimension deduction is necessary for graph building.

From the TABLE IV, we find that when the threshold is bewteen 4 and 10, the proposed method will maintain relatively stable and good performance. If the threshold is too low, there will be too many neighbors for a node, which makes the local graph structure tend to be consistent, and this is harmful to the classification task. If the threshold is too high, there will be too few neighbors for a node, which makes the training data too sparse.

From the TABLE V, we learn that when the layer is \(2\), the performance is the best. When the layer is \(1\), the shallow model cannot effectively learn the nonlinear structure on the graph. And, it exists over-smoothing if too many layers are adopted.

### _Results on VoxCeleb1-O, VoxCeleb1-E, and VoxCeleb1-H_

Our proposed method is also evaluated on the VoxCeleb1 dataset, using the development set of VoxCeleb2 [41] as the training data for our frontend x-vector extractor. The frontend model utilizes a TDNN network, a statistic pooling layer, and a fully-connected layer, optimized with the AAM-Softmax loss [12] function. The evaluation is performed on all three official trial lists: VoxCeleb1-O, VoxCeleb1-E, and VoxCeleb1-H [42]. The features are extracted using 80-dimensional Fbank features with voice activity detection, augmented with MUSAN [43] and RIRs noise sources, and trained with an Adam optimizer with a \(10^{-3}\) initial learning rate and a weight decay of \(10^{-4}\). The parameters of GCN backends are re-tuned in a similar way, as mentioned earlier. The experiment results shown in TABLE VI demonstrate the effectiveness of graph neural network (GNN) variants on the VoxCeleb1 dataset. Specifically, GCN outperforms all other GNN-based methods with the lowest EER and minDCF\({}_{0.01}\). These results suggest that GNN-based methods can effectively extract speaker-related discriminant information and are promising for speaker verification tasks.

## IV Conclusion

We propose a graph neural network (GNN) backend for speaker recognition. The proposed method can capture the structural relation among extracted i-vectors or x-vectors on a graph and thus allows us to take advantage of more information for classification compared with analyzing them in isolation. The embeddings extracted from the GNN, named g-vectors, are excellent representations and preserve rich graph properties in a low-dimensional Euclidean space, which contains more discriminant information. The detailed experimental results on the SRE14 i-vector and VoxCeleb1-O, VoxCeleb1-E, and VoxCeleb1-H datasets demonstrate that our proposed GNN backend is very effective.