Query-by-Example Search with Discriminative Neural Acoustic Word Embeddings

Shane Settle, Keith Levin, Herman Kamper, Karen Livescu

Introduction

Query-by-example speech search (QbE) is the task of searching for a spoken query term (a word or phrase) in a collection of speech recordings. Unlike keyword search and spoken term detection, where the search terms are given as text, QbE involves matching audio segments directly. This task arises naturally when the search terms may be out-of-vocabulary , in hands-free settings, or in low- or zero-resource settings .

For QbE in high-resource settings, one can train a model to map the audio query to a sequence of subword units, such as phonemes, and search for this sequence in a lattice built from the search collection . This approach requires very significant resources, since it involves much the same process as training a full speech recognition system.

In low-resource settings, typical approaches for this task use dynamic time warping (DTW) to determine the similarity between audio segments. Early approaches to low-resource QbE were based on performing DTW alignment of the query against a search collection either exactly or approximately .

An alternative to DTW for QbE, which we explore in this paper, is to represent variable-duration speech segments as fixed-dimensional vectors and directly measure similarity between them via a simple vector distance. In this approach, shown in Figure 1, the query is embedded using an acoustic word embedding function, producing a vector representation of the query. All potential segments in the search collection are then represented as vectors using the same embedding function. The putative hits (matches) correspond to those segments in the search collection that are closest to the query in the fixed-dimensional embedding space. This type of approach requires preprocessing steps for learning the embedding function and generating the embeddings for the search collection. At test time, efficient approximate nearest-neighbor search can greatly speed up computation.

In prior work, Levin et al. used a template-based acoustic word embedding function, and showed that this type of embedding-based QbE search can greatly speed up search compared to a purely DTW-based system, while matching or improving performance. Their template-based embedding approach does not require any labeled supervision. However, in many practical settings, a limited amount of training data might be available. In this work we consider this low-resource setting; in particular, we use acoustic word embeddings based on neural models learned to discriminate between words given a limited (roughly 2-hour) training set.

We build on a growing body of work on neural network-based acoustic word embeddings . In several of these studies, neural approaches are shown to far outperform template-based embeddings (such as those used in ) on an isolated-word discrimination task, which can be viewed as a proxy for QbE. Here, we use the neural embedding approach of , based on Siamese recurrent neural networks, and incorporate these into a complete QbE system using the embedding-based approach of Levin et al. . We show that these neural embeddings, trained only on a small amount of labeled data, achieve large improvements in true QbE performance.

Neural embedding-based QbE

As illustrated in Figure 1, embedding-based query-by-example (QbE) consists of an embedding method and a nearest neighbor search component. We first describe our neural acoustic word embedding approach, and then give details of the embedding-based QbE search system in which the embeddings are used.

Recently, neural acoustic word embeddings (NAWEs) have been proposed as an alternative . In this recent work, NAWEs have achieved much better performance than the template-based approach, but only in an isolated-word discrimination task that can be seen as a proxy for QbE . Here, we specifically focus on the NAWE approach developed in , where it was shown that embeddings based on Long Short-Term Memory (LSTM) networks outperform competing feedforward and convolutional methods. Rather than the proxy task, here we apply these NAWEs in a complete QbE system.

Concretely, we use the concatenation of the hidden representations from a deep bidirectional LSTM network as our embedding function, i.e. x=g(Y)=[hT→;h1←]x=g(Y)=[\overrightarrow{h_{T}};\overleftarrow{h_{1}}], where hT→,h1←\overrightarrow{h_{T}},\overleftarrow{h_{1}} refer to the final hidden state vector from the forward and backward LSTMs, respectively. This LSTM is trained using a Siamese weight-sharing scheme depicted in Figure 2 with a contrastive triplet loss , lcos hinge(Ya,Ys)l_{\textrm{cos hinge}}(Y_{a},Y_{s}), defined as

In this definition, YaY_{a} and YsY_{s} are two segments that have the same word label, and xa,xsx_{a},x_{s} are their embeddings as output by the neural embedding network. The goal is to push the embeddings xax_{a} and xsx_{s} together, until they are closer to each other by a margin mm than the embedding xdx_{d} of a negative example. Here dcos⁡(x1,x2)=(1−cos⁡(x1,x2))d_{\cos}(x_{1},x_{2})=(1-\cos(x_{1},x_{2})) is the cosine distance between vectors x1x_{1} and x2x_{2}. Rather than sampling a single negative example as in , or keeping track of confusion statistics as in , we sample a set of kk embedded segments D\mathcal{D} from the whole training set with labels different from YaY_{a} and consider only the example embedding, xd∈Dx_{d}\in\mathcal{D}, that most violates the margin constraint. This improves both performance and rate of convergence on the proxy task.

2 Embedding-based QbE

Our system needs to quickly retrieve from a large collection those segments nearest to a given spoken query. For this, we use the Segmental Randomized Acoustic Indexing and Logarithmic-Time Search (S-RAILS) system , an embedding-based QbE approach. Although S-RAILS was first applied using the template-based embedding method, it is agnostic to the embedding type, and here we apply it to our neural embeddings.

S-RAILS has three parameters: the signature length bb, the beamwidth BB, and the number of permutations PP. Increasing any of these parameters will tend to improve performance either because it increases the fidelity of our approximation to the cosine distance (in the case of bb and PP) or because it improves recall (in the case of BB). However, any such improvements come at the cost of increased memory required to store the index and the permuted lists (in the case of bb and PP) and increased runtime (in the case of BB and, to a lesser extent, bb and PP). All told, building the index requires O(PbNlog⁡N)O(PbN\log N) time in the worst case, and querying the index requires O(B+Pblog⁡N)O(B+Pb\log N) time.

Experimental setup

We use data from the Switchboard corpus of (primarily American) English conversational telephone speech . For training the NAWE model, we use a training set consisting of approximately 10k word segments covering less than 2 hours of speech taken from conversation sides distinct from those used to extract the query set and the evaluation collection. The size of this set is comparable to those used for training in prior work on acoustic word embeddings . As acoustic features, we use 39-dimensional MFCC+Δ\Delta+ΔΔ\Delta\Deltas. For QbE, we partition Switchboard into a 37-hour set from which to draw our query terms, a 48-hour development search collection on which to tune parameters of S-RAILS, and a 433-hour evaluation set. These partitions are identical to those used in prior work for the QbE task. We use a set of 43 query words previously used in , which were chosen subject to the constraints that the median word duration of each type across the entire corpus is at least 0.5 seconds and the orthographic representation of each word type has at least six characters . Each word type appears 20 to 162 times in the query set, 2 to 188 times in the development search collection, and 39 to 1386 times in the evaluation set.

For our NAWE model (see Section 2.1), we use a stacked 3-layer bidirectional LSTM with 256 hidden units in each direction; the embeddings produced by the model are therefore 512-dimensional. Dropout is applied with probability 0.30.3 between LSTM layers. For the margin of the contrastive loss, lcos hingel_{\textrm{cos\ hinge}}, we use m=0.5m=0.5, and we sample k=10k=10 negative instances per anchor segment. We use the Adam optimization algorithm with a batch size of 32, learning rate of 0.0010.001, β1=0.9\beta_{1}=0.9, β2=0.999\beta_{2}=0.999, and ϵ=1⋅10−8\epsilon=1\cdot 10^{-8}. We tuned these parameters based on development set performance on the isolated word discrimination task of . For our QbE evaluation experiments, we trained all models for 100100 epochs.

We evaluated the quality of search results according to three commonly used metrics: figure-of-merit (FOM), oracular term weighted value (OTWV), and precision at 10 (P@10). FOM is the recall averaged over the ten operating points at which the false alarm rate per hour of search audio is equal to 1,2,…,101,2,\dots,10. OTWV is a query-specific weighted difference between the recall and the false alarm rate (further explanation can be found in ). P@10 is the fraction of the ten top-scoring results that are correct matches to the query.

Since the multiple query examples within each query type can have significant variation, we report average median example and average maximum example scores for each of these three metrics. That is, we compute the median and maximum score over all examples of each query type, and report an unweighted arithmetic mean across the 43 query types.

Results

We first present QbE performance on the development data in order to show how performance differs across parameter settings, and then give evaluation results. In this section, we refer to the QbE system that employs the original template-based embeddings simply as S-RAILS, and to the system with neural embeddings as S-RAILS+NAWE.

Figure 3 shows development set performance, in terms of median P@10, for the baseline QbE system using template-based embeddings (S-RAILS) and our system using NAWEs (S-RAILS+NAWE). Tables 3, 3, and 3 show development set performance for S-RAILS+NAWE as the signature length bb, permutations PP, and beamwidth BB are varied, respectively.

Figure 3 shows that neural embeddings improve the performance of S-RAILS by large margins at all running time operating points. This figure also shows that increased signature length yields much larger improvements in P@10 for S-RAILS+NAWE than it does for the baseline S-RAILS system. Significant improvements in P@10 can be seen when holding fixed any combination of settings for PP and BB. Our performance on P@10 saturates with signatures around 1024 bits, while S-RAILS’ saturates, for the most part, at 256 bits.

Again in contrast to the S-RAILS system, our method responds strongly to increases in the number of permutations used. In both Figure 3 and Table 3, adjustment to this parameter improves performance consistently across signature lengths. This is to be expected if the neural embeddings provide a better measure of speech segment distances, since the increased number of permutations helps provide a more exact estimate of the embedding distance. We note that performance as measured in Table 3 has not plateaued in any of the Median Example metrics. Further increasing the number of permutations may further improve these metrics, but this incurs a large cost in memory.

Figure 3 and Table 3 show that, except for the cases with short signatures and few permutations, increasing beamwidth does not improve P@10 performance, while incurring significant cost. To obtain higher precision systems, it is more important to use computational resources for increasing the number of permutations or using longer signatures. However, as would be expected, the higher beamwidths help to significantly improve the FOM score, a metric concerned primarily with recall.

2 Evaluation set performance

Based on development results, we find that an operating point of 16 permutations, beamwidth of 2000, and signature length of 1024 is close to optimal, in terms of both performance and query speed, for both the baseline S-RAILS and S-RAILS+NAWE. We use these settings for final evaluation. For a qualitative view, Figure 4 visualizes several queries and their top hits in the evaluation collection. This visualization shows some expected properties. For example, the two “Massachusetts” queries and their top hits are embedded close together. Two of the false alarms for “Massachusetts” are the similar-sounding “messages” and “math is just”, while the somewhat more distant “math and science” is (correctly) not retrieved.

Final evaluation performance is shown in Table 4. Besides the S-RAILS baseline, we also compare to RAILS , a DTW-based system that is optimized for speed using LSH to get approximate frame-level near neighbor matches. RAILS evaluation scores are reproduced from . We find that our approach improves significantly over both RAILS and S-RAILS in terms of all performance metrics at this operating point. Note that, based on Figure 3, the improvements should hold at most operating points, including ones with much higher query speeds. The biggest gains from S-RAILS+NAWE are seen in the Median Example results, where there is a relative improvement over S-RAILS of more than 55% across all measures. In terms of FOM and OTWV, we see relative improvements of over 40% in the Best Example case. Although the baselines obtain good P@10, we still find large improvements in this measure as well, from 87.1% to 95.1%.

Conclusion

We have presented an approach to query-by-exmaple speech search using neural acoustic word embeddings, demonstrating the ability of these embedding models to improve over previous methods on a realistic task. The neural embeddings are learned from a very limited set of data; one interesting future direction is to study the limits of the approach as the amount of training data is varied, or to extend it to use no labeled data at all. Another interesting aspect of the approach is that the neural embeddings are learned from speech segments that have been pre-segmented at word boundaries, but they are then applied for embedding arbitrary segments that may or may not (and usually do not) correspond to words. It is encouraging that this approach works despite the lack of non-word examples in the training data, and an interesting avenue for future work is to attempt to further improve performance by explicitly training on both word and non-word segments. Additional future directions include training a QbE system end-to-end and extending our model to operate at the level of multi-word phrases.

Acknowledgements

This material is based upon work supported by the National Science Foundation under Grant No. IIS-1433485 and by a Google faculty award.

References