Tied Hidden Factors in Neural Networks for End-to-End Speaker Recognition
Antonio Miguel Jorge Llombart Alfonso Ortega Eduardo Lleida


Semi-Lévy driven continuous-time GARCH process
    M. Mohammadi
Faculty of Mathematics and Computer Science, Amirkabir University of Technology, 
Tehran, Iran. E-mail: m.mohammadiche@aut.ac.ir(M. Mohammadi) and rezakhah@aut.ac.ir(S. 
Rezakhah).
S. Rezakhah^* N. Modarresi
Department of Mathematics and computer science, Allameh Tabataba'i University, Tehran, 
Iran. E-mail: n.modarresi@atu.ac.ir(N. Modarresi).
    December 30, 2023
===========================================================================================================================================================================================================================================================================================================================================================================



In this paper we propose a method to model speaker and session variability and able to generate likelihood ratios using neural networks in an end-to-end phrase dependent speaker verification system. 
As in Joint Factor Analysis, the model uses tied hidden variables to model speaker and session variability and a MAP adaptation of some of the parameters of the model.
In the training procedure our method jointly estimates the network parameters and the values of the speaker and channel hidden variables. 
This is done in a two-step backpropagation algorithm, first the network weights and factor loading matrices are updated and then the hidden variables, whose gradients are calculated by aggregating the corresponding speaker or session frames, since these hidden variables are tied. 
The last layer of the network is defined as a linear regression probabilistic model whose inputs are the previous layer outputs. 
This choice has the advantage that it produces likelihoods and additionally it can be adapted during the enrolment using MAP without the need of a gradient optimization. 
The decisions are made based on the ratio of the output likelihoods of two neural network models, speaker adapted and universal background model.
The method was evaluated on the RSR2015 database.



[Cite as: A. Miguel, J. Llombart, A. Ortega, E. Lleida, “Tied Hidden Factors in Neural Networks for End-to-End Speaker Recognition.”
 In Proc. Interspeech, pp 2819–2823, Stockholm, Sweden, 2017.]
Index Terms: Neural Networks, Joint Factor Analysis, Tied Factor Analysis, Speaker variability, Session variability, Linear Regression Models.



§ INTRODUCTION


Deep neural networks (DNNs) have been successfully applied in many speech and speaker recognition tasks in recent years, providing outstanding performances.

In speech technologies most of the DNN solutions have used them as classifiers or feature extractors, but in this work we propose to apply them in an end-to-end detection task, where the output of the system is a likelihood score ratio, which after applying a threshold provides good performance without the need of further calibration.

Unfortunately, the high number of parameters of DNNs and their tendency to overfit data make that type of detection task difficult to approach.

In this work we try to take advantage of the high flexibility of these models and their capacity to learn nonlinear patterns from the input signals.

This has required to provide solutions to decrease the overfitting problems and their lack of a measure of uncertainty by adding external control variables to model session and speaker variability, and also proposing Bayesian adaptation and evaluation mechanisms.





Recent approaches to speaker recognition use Joint Factor Analysis (JFA) <cit.> with GMMs or HMMs as base distributions, i-vector systems <cit.>, neural networks as bottleneck feature extractors for JFA or i-vector systems <cit.>, or neural networks as classifiers to produce posterior probabilities for JFA or i-vector extractors <cit.>.

There have been other approaches to create speaker verification using neural networks by means of LSTM networks <cit.> to provide sequence to vector compression or to extract total variability latent factors (similar to i-vector) directly from a neural network in <cit.>, in that case a PLDA backend was used in a text independent speaker recognition task. 

The proposed method has several parallelisms to JFA models since we also encode speaker and session information using latent variables, and the model probability distribution can also be adapted to the speaker data using MAP or Bayesian techniques, but in this paper the model is built on top of an autoencoder neural network as an alternative to other models like GMMs or HMMs.

The proposed method is an end-to-end solution since the neural network performs all the processing steps and it provides the likelihood ratio.

The autoencoder <cit.> is a generative model that is trained to predict its input with the restriction that the network has a bottleneck layer of smaller dimension. 

Its training is unsupervised  in terms of frame level phoneme labels, what makes it a candidate to substitute GMMs as the underlying model of the system. 

In addition, it can be robustly trained using Bayesian methods and its output layer can be probabilistic, as it has been shown in recent works <cit.>. 

As we show later in the paper, we can build a system using these probabilistic autoencoders, but performance can be improved by using tied hidden variables to model speaker and session variability.




Speaker factors have been used as a source of additional information for neural networks in speech recognition to improve the performance of speaker independent recognizers <cit.>.

In many cases the latent variables were obtained by using an external system like a GMM based JFA or i-vector extractor, and the network is then retrained to capture this extra information <cit.>.

There have been works were speaker factors or speaker codes are used to enhance speech recognition systems and they were optimized by gradient optimization <cit.> or initialized using Singular Value Decomposition <cit.>. 

We propose a joint factor approach for neural networks to model speaker and session variability, showing that effective improvements can be obtained by using the latent factors with respect to a reference network.



A modified two-step backpropagation algorithm is proposed to train the model parameters and the latent factors, first the network weights and factor loading matrices are updated given the current value of the latent variables and then the latent variables are updated.

To calculate the gradients of the cost function with respect to the network weights the minibatch samples can be randomly permuted to facilitate convergence, but the gradients with respect to the hidden factors are calculated by aggregating all the corresponding speaker or session frames, since these hidden variables are tied. 





This paper is organized as follows.

In Section <ref> the tied factor analysis model for neural networks is presented.

Section <ref> discusses the use of autoencoder neural networks for speaker verification. 
 
Section <ref> presents an experimental study to show the accuracy of the models in phrase dependent speaker recognition.

Conclusions are presented in Section <ref>.

 


§ TIED HIDDEN FACTORS IN NEURAL NETWORKS



 

The concept of tied hidden factors to model contextual or sequence information has appeared in many different contexts like face recognition <cit.>, speech recognition <cit.>, language recognition <cit.>, speaker diarization <cit.> or audio segmentation <cit.>, but their most prominent field has been speaker recognition with JFA or i-vector approaches  <cit.> 

The use of these type of global variables has been defined in more general approaches as hierarchical models <cit.> and more recently in the context of DNNs in <cit.>. 

We propose to use two types of tied hidden factors in neural networks to extend previous works with a general algorithm to estimate them.

We refer to this model in general as Tied Factor Deep Neural Network (TF-DNN), and for the special case of two factors speaker and session, TF2-DNN.



In Figure <ref> it is depicted the conceptual difference of the decoder part of a standard DNN autoencoder and a TF-DNN, where 𝐳_t^(0) is the bottleneck layer which changes for every frame t, but there are tied variables that affect the output of many samples 𝐱_t of the same session (or file in databases like RSR2015) 𝐳_f^(1) and same speaker 𝐳_s^(2), displaying a similar the idea to <cit.> for GMMs.




To define the model, first we need to describe the observed data, 𝐗 = {𝐱_t}_t=1^T as a sequence of feature vectors 𝐱_t ∈ℝ^D with D the feature dimension. 

In the proposed TF2-DNN approach we assume that a set of hidden variables encode speaker and session information.

The session and speaker latent factors are denoted as 𝐙^(1) = {𝐳^(1)_f}_f=1^F and 𝐙^(2) = {𝐳^(2)_s}_s=1^S with 𝐳^(1)_f ∈ℝ^R^(1) and 𝐳^(2)_s ∈ℝ^R^(2), where F and S are the number of sessions and speakers and R^(1) and R^(2) are the dimension of their respective subspaces. 

The complete set of hidden variables is denoted as  𝒵 = (𝐙^(1), 𝐙^(2)), they encode speaker and session information, and since they are unknown we need to estimate them using a labeled dataset.

The training data are typically organized by sessions. 

If sessions are labeled by speaker, then it is straightforward to obtain frame level session labels ϕ^(1)_t ∈{ 1,…,F}, and speaker labels as ϕ^(2)_t ∈{ 1,…,S}, so that the training dataset is defined as 𝒟={𝐱_t, ϕ^(1)_t, ϕ^(2)_t }_t=1^T, for each data sample we need its speaker and session label.






The TF2-DNN is built on top of a regular neural network whose parameters are the weights 𝐖_l and biases 𝐛_l of all the layers l=1,…,L. 

We denote them by 𝐖̅ = {𝐖_1, 𝐛_1, …, 𝐖_L, 𝐛_L} for a NN with L layers.

The layers of the network which are connected to the latent variables are called TF2 layers and have additional parameters and a different output than a standard network.

In Figure <ref>, we show a simplified model of a DNN with standard layers and TF-DNN with a TF2 layer. 

In the case of linear embedding, a factor loading matrix 𝐕_l is required for each factor and the layer l output is defined as

    𝐱_t,l =
        σ( 𝐖_l 𝐱_t,l-1 + 𝐛_l + 𝐕^(1)_l 𝐳^(1)_f + 𝐕^(2)_l 𝐳^(2)_s ),

where 𝐱_t,l-1 and 𝐱_t,l are the previous layer output and the current layer output, the function σ() is the layer nonlinearity, 𝐳^(1)_f is the session factor corresponding to the frame 𝐱_t, and f is the corresponding file label f=ϕ^(1)_t, and 𝐳^(2)_s is the corresponding speaker factor and s is the speaker label s=ϕ^(2)_t.

The set of all the network parameters is denoted as Θ = (𝐖̅, 𝐕̅).











Given a cost function J(𝒟,𝒵,Θ) that can be evaluated for some training data, 𝒟, and an instance of the unknown parameters 𝒵 and Θ, we can define an optimization method to minimize the cost.

In this work we have used gradient based optimization since it can be scaled to larger datasets and still be tractable.

To estimate both the network weights and the tied latent factors Algorithm <ref> is proposed.

This algorithm optimizes both sets of variables in an alternate way like in coordinate descent type algorithms.

In <cit.> the alternate E and M steps had the same motivation, since the E step considered the likelihood as the objective and the latent variables were optimized in a search process given the other parameters fixed.

The gradients with respect to the network parameters Θ in the step 2.1 are computed as usual gradients since the hidden variables are given as argument with their current value and they can be interpreted as external information to the network.

The gradients with respect to the tied hidden variables have to be considered more carefully, since they have to be calculated by aggregating all the corresponding speaker or session frames since they are tied.
Then the gradients for session f and speaker s factors are

    ∇_𝐳^(1)_f 
        J(𝒟,𝒵,Θ ) = ∑_t | ϕ^(1)_t = f∇_𝐳^(1)  
        J(𝐱_t,𝐳^(1)_ϕ^(1)_t,𝐳^(2)_ϕ^(2)_t,Θ ) 
    ∇_𝐳^(2)_s 
        J(𝒟,𝒵, Θ) = ∑_t | ϕ^(2)_t = s∇_𝐳^(2)  
        J(𝐱_t,𝐳^(1)_ϕ^(1)_t,𝐳^(2)_ϕ^(2)_t,Θ ).








§ NEURAL NETWORK END-TO-END SPEAKER VERIFICATION SYSTEM


The autoencoder <cit.> is a generative model that is trained to predict its input with the restriction that the network has a bottleneck layer of smaller dimension. 

Then, the system has two parts: the first part, encoder, learns how to compress the information and the second part, decoder, learns how to reconstruct the signal. 

To adapt this type of network to the task of speaker recognition we need to compute likelihoods of the observed data 𝐱_t.

In <cit.> the bottleneck layer of the autoencoder was considered analogous to the hidden variable 𝐳_t in a factor analysis model <cit.>. 
Then, the encoder part was associated to a variational approximation to the posterior distribution q(𝐳_t | 𝐱_t), and the decoder part could be associated to the likelihood of the observed data given the hidden variable by parametrizing a probabilistic model using the network outputs p(𝐱_t | 𝐳_t).



To follow with the previous section notation for the latent factors, <cit.>, the bottleneck layer of the autoencoder is denoted as 𝐳^(0)_t, since it encodes intra-frame information <cit.> and it is the lowest level in the hierarchy: frame (0), session (1), speaker (2).

We can see that other levels could be added easily.




 §.§ Linear Regression probability model


In this paper we use the same parametrization mechanism as in <cit.> to define that the last layer provides the mean vector of a Gaussian distribution, which we combine with the following idea: if the last layer is a linear function,  𝐱_t,L = 𝐖_L 𝐱_t,L-1 + 𝐛_L, the likelihood can also be interpreted as a linear regression probability model whose regression coefficient matrix 𝐁 is the last layer weight matrix 𝐖_L as

    p( 𝐱_t |𝐳_t^(0)) = 
        𝒩( 𝐱_t,L , Ψ  ) 
         = 
        𝒩( 𝐖_L 𝐱_t,L-1 + 𝐛_L, Ψ ),

where the output 𝐱_t,L acts as mean and we can define an arbitrary covariance matrix Ψ.


The following steps could be carried out for the bias parameter 𝐛_L and the covariance matrix Ψ as well, but to keep the notation simpler <cit.>, and focus on the most important parameters, the weigths 𝐁 = 𝐖_L, we derive the network adaptation mechanism for this simpler distribution

    p( 𝐱_t | 𝐲_t)  = 𝒩( 𝐁𝐲_t, β^-1𝐈 ),

where β^-1𝐈 is the covariance matrix, now controlled by a single parameter and we denote the outputs of the previous layer as 𝐲_t for simplicity, with 𝐲_t =𝐱_t,L-1 = f(𝐳^(0)_t) using the decoder part of the network except the last layer.



The analogy in expressions (<ref>) and (<ref>) allows to estimate the value of 𝐖_L using a probabilistic approach if we let the rest of the network parameters and hidden variables unchanged, what makes easy to apply ML, MAP or Bayesian estimation techniques.

Given some training data 𝐗 organized by rows, and the output previous to the last layer 𝐘, the ML estimator is equivalent to minimize square error, MSE, and is obtained as

    𝐁^ML    =     (𝐘^⊺𝐘)^-1𝐘^⊺𝐗.



The ML estimator can have problems when inverting the matrix if it is ill-conditioned. 

To solve that we can impose a penalty to the weights 𝐁 by assuming a Gaussian prior for them 𝐁∼𝒩( 𝐁_0, λ_0^-1𝐈  ), which makes the optimization of the posterior distribution p(𝐁 | 𝐗) equivalent to an L2 regularization <cit.>, this is the MAP estimator

    𝐁^MAP    =     (β𝐘^⊺𝐘 +λ_0  𝐈)^-1 ( β𝐘^⊺𝐗 + λ_0 𝐁_0),

which in the case the prior mean is zero it is usually expressed as

    𝐁^MAP    =     (𝐘^⊺𝐘 + λ_0/β𝐈)^-1𝐘^⊺𝐗.


The fully Bayesian approach <cit.> provides a posterior distribution for the weights given the priors and the observed data that follows a normal distribution, whose mean has the same value as the MAP estimation in (<ref>)

    p( 𝐁 | 𝐘 )     =    𝒩( 𝐁_N, Σ_N ) 
    𝐁_N     =    Σ_N ( β𝐘^⊺𝐗 + λ_0 𝐁_0) 
    Σ_N^-1    =     (β𝐘^⊺𝐘 +λ_0  𝐈).




 §.§ UBM training, speaker enrolment and trial evaluation


Once the building blocks of the model have been established, we describe all the basic steps involved in a speaker recognition system: UBM training, speaker enrolment, and trial evaluation.

The universal background model (UBM) is trained using Algorithm <ref> after a random initialization of all the unknown parameters and latent factors.

The labels to assign training frames to the speaker and latent factors must be supplied to the algorithm.

When the UBM is trained we extract the sums

    S_yy   =  𝐘^⊺𝐘 = ∑_t 𝐲_t 𝐲_t^⊺,      
     S_yx   =  𝐘^⊺𝐗 = ∑_t 𝐲_t 𝐱_t^⊺,

which are the sufficient statistics needed to make adaptations at enrolment time without the need of processing the whole database each time. 𝐲_t and 𝐱_t are column vectors corresponding to frame t. Then, 𝐁^ubm can be obtained from the stats.



To enrol a speaker in the system in the context of the proposed method requires to create an adapted network to the samples used for enrolment, which are a small number compared to the UBM.

Two mechanism are available in this model for this.

The first one is to adapt the speaker latent factor by using step 2.2 of the algorithm for a number of iterations using the enrolment data and using as initial values the UBM parameters.

In this case step 2.1 would not be applied since the network weights have to remain fixed.

The second mechanism is more similar to MAP in JFA systems, two possible adaptations are proposed given the previous linear regression expressions.

One option is to consider the prior mean as the UBM value 𝐁_0 = 𝐁^ubm, then using expression (<ref>) the maximum of the posterior distribution p(𝐁^spk | 𝐘_spk, 𝐁_0 = 𝐁^ubm )

    𝐁^spk    =     (β S_yy^spk +λ_0  𝐈)^-1 ( β S_yx^spk + λ_0 𝐁^ubm).

Other option is to consider the posterior distribution given both the enrolment and the UBM data p(𝐁^spk |𝐘_ubm, 𝐘_spk), with the prior mean equal to zero. 

To control the weight of the UBM samples with respect to the enrolment we introduce an interpolation factor α

    𝐁^spk  = 
        ( α S_yy^ubm + (1 - α)  S_yy^spk +  
        								λ_0/β𝐈 )^-1 
        ( α S_yx^ubm + (1 - α)  S_yx^spk ).


Finally for trial evaluation we evaluate the likelihood ratio

    Λ =  p( 𝐗 | 𝐘_ubm, 𝐘_spk )/ p( 𝐗 | 𝐘_ubm ) ,


where likelihoods are calculated using expression (<ref>), 𝐁^ubm in the denominator is estimated using (<ref>) and the sufficient stats, (<ref>), for all the UBM data 𝐘_ubm.
𝐁^spk in the numerator is estimated using (<ref>) and the speaker and UBM data, 𝐘_spk, 𝐘_ubm, (since it performed better than (<ref>) in preliminary experiments).



 §.§ Bayesian inference

Recent advances on applying Bayesian estimation techniques to DNNs  have been shown to be effective against overfitting and to deal with uncertainty <cit.>.

To avoid overfitting when data size is small, we propose to use dropout layers, <cit.>, interleaved with the TFA2 layers, as an alternative to the variational approach <cit.>.
We train the network using the proposed algorithm with the dropout Bernoulli distribution, ξ∼ Be(p), which switches off some of the layer outputs with probability p.
Then we perform the trial evaluation by sampling


    p(𝐱_t|𝐳_t^(0))  =  ∫ p(𝐱_t|𝐳_t^(0),ξ) p(ξ) dξ
    ≃1/L∑_ξ_l ∼ Be(p) p(𝐱_t|𝐳_t^(0),ξ_l).








§ EXPERIMENTS



The experiments have been conducted on the RSR2015 part I text dependent speaker recognition database <cit.>.

The speakers are distributed in three subsets: bkg, dev and eval.

We have only used background data (bkg) to train the UBMs, which can be phrase independent or phrase dependent, as in <cit.>.

The evaluation part is used for enrolment and trial evaluation. 

The dev part was not used in these experiments and files were not rejected because of low quality.

Speaker models are build using 3 utterances for each combination of speaker and phrase (1708 for males and 1470 for females).

For testing we have selected the trials using the same phrase as the model, called impostor-correct in <cit.>: 10244(tgt) + 573664(non) = 583908 male trials; 8810(tgt) + 422880(non) = 431690 female trials.

We use the database 16kHz signals to extract 20 MFCCs and their first and second derivatives. 
Then, an energy based voice activity detector is used and data are normalized using short term Gaussianization.

In the experiments in this work the speaker factor is a speaker-phrase combination as in <cit.>.

To train the autoencoders in this work we used the same DNN architecture in all of the experiments of 4 hidden layers of 500 units, softplus nonlinearities <cit.> and a bottleneck layer of 15 units, which makes the dimension R^(0) four times smaller than the feature dimension of 60, and finally the linear regression layer.

The weight and factor loading matrices were updated using Adam <cit.> and the cost function was the MSE.

The likelihood (<ref>) in the experiments was calculated using bias and diagonal covariance matrix.




A set of experiments was performed using Theano <cit.> to evaluate the model using gender dependent and phrase independent UBMs.

We compared the DNN which updates the last layer using (<ref>) to the TF2-DNN which also updates the last layer and in addition includes speaker and session factors.

The results in Table <ref> show both DNN systems performing under 1% EER for the male and female tasks, but the performance is greater in the case of models using tied factors in the model.

In the paper we exposed some parallelism between the DNN and a GMM both adapted with MAP. 

We can see in the experiments that the range of EER achieved is also comparable to GMMs in other works <cit.>.

And the relative improvement provided by the TF2-DNN with respect to the DNN system is also similar to  <cit.>, although in that case the files were processed at 8kHz.















In RSR2015, phrase dependent UBMs can be more specific, but there are less data available for the UBM, which makes difficult to train a DNN with many layers.

For that scenario we propose the use of dropout <cit.> and to approximate the likelihoods using (<ref>).

We performed some experiments using the female subset and phrase dependent UBMs.
A dropout layer was interleaved in the encoder and the decoder, with p = 0.05. The TF2-DNN had as dimensions  R^(1)=5 and R^(2)=20) and the system provided a 0.11% of EER.

This preliminary experiment showed us that dropout and other Bayesian techniques can mitigate part of the effect of overfitting of large DNNs when learning small datasets, and the system still can provide well calibrated scores in the context of these models.




































































































§ CONCLUSIONS



In this paper we present an end-to-end method for speaker recognition based on neural networks, using tied hidden variables to model speaker and session variability and a MAP and Bayesian techniques to enrol and evaluate trials.

The last layer of the network is defined as a linear regression probabilistic model that  can be adapted during the enrolment so that the model can calculate likelihood ratios to decide the trial evaluations.

To estimate the model parameters and the hidden variables a two-step backpropagation algorithm is used.

We have tested the models in the text dependent speaker recognition database RSR2015 part I providing competitive results with respect to previous approaches.




§ ACKNOWLEDGEMENTS

This work is supported by the Spanish Government and European Union (project TIN2014–54288–C4–2–R), and by the European Commission 
 FP7 IAPP Marie Curie Action GA–610986. We gratefully acknowledge the support of NVIDIA Corporation with the donation of a Titan X GPU used for this research.


IEEEtran_nourl




