A Hierarchical Recurrent Encoder-Decoder For Generative Context-Aware Query Suggestion

Alessandro Sordoni, Yoshua Bengio, Hossein Vahabi, Christina Lioma, Jakob G. Simonsen, Jian-Yun Nie

Introduction

Modern search engines heavily rely on query suggestions to support users during their search task. Query suggestions can be in the form of auto-completions or query reformulations. Auto-completion suggestions help users to complete their queries while they are typing in the search box. In this paper, we focus on query reformulation suggestions, that are produced after one or more queries have already been submitted to the search engine.

Search query logs are an important resource to mine user reformulation behaviour. The query log is partitioned into query sessions, i.e. sequences of queries issued by a unique user and submitted within a short time interval. A query session contains the sequence of query reformulations issued by the user while attempting to complete the search mission. Therefore, query co-occurrence in the same session is a strong signal of query relatedness and can be straightforwardly used to produce suggestions.

Methods solely relying on query co-occurrence are prone to data sparsity and lack coverage for rare and long-tail queries, i.e. unseen in the training data. A suggestion system should be able to translate infrequent queries to more common and effective formulations based on similar queries that have been seen in the training data. Amongst the interesting models that have been proposed, some capture higher order collocations , consider additional resources , move towards a word-level representation or describe queries using a rich feature space and apply learning to rank techniques to select meaningful candidates .

An additional desirable property of a suggestion system is context-awareness. Pairwise suggestion systems operate by considering only the most recent query. However, previous submitted queries provide useful context to narrow down ambiguity in the current query and to produce more focused suggestions . Equally important is the order in which past queries are submitted, as it denotes generalization or specification reformulation patterns . A major hurdle for current context-aware models is dealing with the dramatic growth of diverse contexts, since it induces sparsity, and classical count-based models become unreliable .

Finally, relatively unexplored for suggestion systems is the ability to produce synthetic suggestions. Typically, we assume that useful suggestions are already present in the training data. The assumption weakens for rare queries or complex information needs, for which it is possible that the best suggestion has not been previously seen . In these cases, synthetic suggestions can be leveraged to increase coverage and can be used as candidates in complex learning to rank models .

We present a generative probabilistic model capable of producing synthetic, context-aware suggestions not only for popular queries, but also for long tail queries. Given a sequence of queries as prefix, it predicts the most likely sequence of words that follow the prefix. Variable context lengths can be accounted for without strict built-in limits. Query suggestions can be mined by sampling likely continuations given one or more queries as context. Prediction is efficient and can be performed using standard natural language processing word-level decoding techniques . The model is robust to long-tail effects as the prefix is considered as a sequence of words that share statistical weight and not as a sequence of atomic queries.

As an example, given a user query session composed of two queries cleveland gallery →\rightarrow lake erie art issued sequentially, our model predicts sequentially the words cleveland, indian, art and ∘\circ, where ∘\circ is a special end-of-query symbol that we artificially add to our vocabulary. As the end-of-query token has been reached, the suggestion given by our model is cleveland indian art. The suggestion is contextual as the concept of cleveland is justified by the first query thus the model does not merely rely on the most recent query only. Additionally, the produced suggestion is synthetic as it does not need to exist in the training set.

To endow our model with such capabilities, we rely on recent advances in generative natural language applications with neural networks . We contribute with a new hierarchical neural network architecture that allows to embed a complex distribution over sequences of queries within a compact parameter space. Differently from count-based models, we avoid data sparsity by assigning single words, queries and sequences of queries to embeddings, i.e. dense vectors bearing syntactic and semantic characteristics (Figure 1) . Our model is compact in memory and can be trained end-to-end on query sessions. We envision future applications to various tasks, such as search log mining, query auto-completion and query next-word prediction.

Key Idea

Suggestion models need to capture the underlying similarities between queries. Vector representations of words and phrases, also known as embeddings, have been successfully used to encode syntactic or semantic characteristics thereof . We focus on how to capture query similarity and query term similarity by means of such embeddings. In Figure 1 (a) and (b), we plot a two-dimensional projection of the word and query embeddings learnt by our model. The vectors of topically similar terms or queries are close to each other in the vector space.

Vector representations for phrases can be obtained by averaging word vectors . However, the order of terms in queries is usually important . To obtain an order-sensitive representation of a query, we use a particular neural network architecture called Recurrent Neural Network (RNN) . For each word in the query, the RNN takes as input its embedding and updates an internal vector, called recurrent state, that can be viewed as an order-sensitive summary of all the information seen up to that word. The first recurrent state is usually set to the zero vector. After the last word has been processed, the recurrent state can be considered as a compact order-sensitive encoding of the query (Figure 2 (a)).

A RNN can also be trained to decode a sentence out of a given query encoding. Precisely, it parameterizes a conditional probability distribution on the space of possible queries given the input encoding. The process is illustrated in Figure 2 (b). The input encoding may be used as initialization of the recurrence. Then, each of the recurrent states is used to estimate the probability of the next word in the sequence. When a word is sampled, the recurrent state is updated to take into account the generated word. The process continues until the end-of-query symbol ∘\circ is produced.

The previous two use cases of RNNs can be pipelined into a single recurrent encoder-decoder, as proposed in for Machine Translation purposes. The architecture can be used to parameterize a mapping between sequences of words. This idea can be promptly casted in our framework by predicting the next query in a session given the previous one. With respect to our example, the query encoding estimated by the RNN in Figure 2 (a) can be used as input to the RNN in Figure 2 (b): the model learns a mapping between the consecutive queries cleveland gallery and lake erie art. At test time, the user query is encoded and then decoded into likely continuations that may be used as suggestions.

Although powerful, such mapping is pairwise, and as a result, most of the query context is lost. To condition the prediction of the next query on the previous queries in the session, we deploy an additional, session-level RNN on top of the query-level RNN encoder, thus forming a hierarchy of RNNs (Figure 3). The query-level RNN is responsible to encode a query. The session-level RNN takes as input the query encoding and updates its own recurrent state. At a given position in the session, the session-level recurrent state is a learnt summary of the past queries, keeping the information that is relevant to predict the next one. At this point, the decoder RNN takes as input the session-level recurrent state, thus making the next query prediction contextual.

The contribution of this architecture is two-fold. The query-level encoder RNN maps similar queries to vectors close in the embedding space (Figure 1 (b)). The mapping generalizes to queries that have not been seen in the training data, as long as their words appear in the model vocabulary. This allows the model to map rare queries to more useful and general formulations, well beyond past co-occurred queries. The session-level RNN models the sequence of the previous queries, thus making the prediction of the next query contextual. Similar contexts are mapped close to each other in the vector space. This property allows to avoid sparsity, and differently from count-based models , to account for contexts of arbitrary length.

Mathematical Framework

We start by presenting the technical details of the RNN architecture, which our model extends. We consider a query session as a sequence of MM queries S={Q1,…,QM}S=\{Q_{1},\ldots,Q_{M}\} submitted by a user in chronological order, i.e. Qm<tQm+1{Q_{m}}<_{t}{Q_{m+1}} where <t<_{t} is the total order generated by the submission time, and within a time frame, usually 30 minutes. A query QmQ_{m} is a sequence of words Qm={wm,1 ,… ,wm,Nm}Q_{m}=\{w_{m,1}\,,\ldots\,,w_{m,N_{m}}\}, where NmN_{m} is the length of query mm. VV is the size of the vocabulary.

For each query word wnw_{n}, a RNN computes a dense vector called recurrent state, denoted hnh_{n}, that combines wnw_{n} with the information that has already been processed, i.e. the recurrent state hn−1h_{n-1}. Formally:

Usually, ff consists of a non-linear function, i.e. the logistic sigmoid or hyperbolic tangent, applied element-wise to a time-independent affine transformation . The complexity of the function ff has an impact on how accurately the RNN can represent sentence information for the task at hand. To reduce the fundamental difficulty in learning long-term dependencies , i.e. to store information for longer sequences, more complex functions have been proposed such as the Long Short-Term Memory (LSTM) and the Gated Recurrent Unit (GRU) .

Once Eq. 1 has been run through the entire query, the recurrent states h1,…,hNh_{1},\ldots,h_{N} can be used in various ways. In an encoder RNN, the last state hNh_{N} may be viewed as an order-sensitive compact summary of the input query. In a decoder RNN, the recurrent states are used to predict the next word in a sequence . Specifically, the word at position nn is predicted using hn−1h_{n-1}. The probability of seeing word vv at position nn is:

We choose to use the Gated Recurrent Unit (GRU) as our non-linear transformation ff. GRUs have demonstrated to achieve better performance than simpler parameterizations at an affordable computational cost . This function reduces the difficulties in learning our model by easing the propagation of the gradients. We let wnw_{n} denote the one-hot representation of wn=vw_{n}=v, i.e. a vector of the size of the vocabulary with a 1 corresponding to the index of the query word vv. The specific parameterization of ff is given by:

The gates rnr_{n} and unu_{n} are computed in parallel. If, given the current word, it is preferable to forget information about the past, i.e. to reset parts of hnh_{n}, the elements of rnr_{n} will be pushed towards 0. The update gate unu_{n} plays the opposite role, i.e. it judges whether the current word contains relevant information that should be stored in hnh_{n}. In the final update, if the elements of unu_{n} are close to 0, the network discards the update hˉ\bar{h} and keeps the last recurrent state hn−1h_{n-1}. The gating behaviour provides robustness to noise in the input sequence: we hypothesize that this is particularly important for IR as it allows, for example, to exclude from the summary non-discriminative terms appearing in the query.

2 Architecture

Our hierarchical recurrent encoder-decoder (HRED) is pictured in Figure 3. Given a query in the session, the model encodes the information seen up to that position and tries to predict the following query. The process is iterated throughout all the queries in the session. In the forward pass, the model computes the query-level encodings, the session-level recurrent states and the log-likelihood of each query in the session given the previous ones. In the backward pass, the gradients are computed and the parameters are updated.

For each query Qm={wm,1,…,wm,Nm}Q_{m}=\{w_{m,1},\ldots,w_{m,N_{m}}\} in the training session SS, the query-level RNN reads the words of the query sequentially and updates its hidden state according to:

2.2 Session-Level Encoding

The session-level RNN takes as input the sequence of query representations q1,…,qMq_{1},\ldots,q_{M} and computes the sequence of session-level recurrent states. For the session-level RNN, we also use the GRU function:

The session-level recurrent state sms_{m} summarizes the queries that have been processed up to position mm. Each sms_{m} bears a particularly powerful characteristic: it is sensitive to the order of previous queries and, as such, it can potentially encode order-dependent reformulation patterns such as generalization or specification of the previous queries . Additionally, it inherits from the query vectors qmq_{m} the sensitivity to the order of words in the queries.

2.3 Next-Query Decoding

The RNN decoder is responsible to predict the next query QmQ_{m} given the previous queries Q1:m−1Q_{1:m-1}, i.e. to estimate the probability:

The desired conditioning on previous queries is obtained by initializing the recurrence of the RNN decoder with a non-linear transformation of sm−1s_{m-1}:

3 Learning

The model parameters comprise the parameters of the three GRU functions, GRUencGRU_{enc}, GRUdecGRU_{dec}, GRUsesGRU_{ses}, the output parameters Ho,Eo,boH_{o},E_{o},b_{o} and the VV output vectors oio_{i}. These are learned by maximizing the log-likelihood of a session SS, defined by the probabilities estimated with Eq. 6 and Eq 9:

The gradients of the objective function are computed using the back-propagation through time (BPTT) algorithm .

4 Generation and Rescoring

In our framework, the query suggestion task corresponds to an inference problem. A user submits the sequence of queries S={Q1,…,QM}S=\{Q_{1},\ldots,Q_{M}\}. A query suggestion is a query Q∗Q^{*} such that:

where Q\mathcal{Q} is the space of possible queries, i.e. the space of sentences ending by the end-of-query symbol. The solution to the problem can be approximated using standard word-level decoding techniques such as beam-search . We iteratively consider a set of kk best prefixes up to length nn as candidates and we extend each of them by sampling the most probable kk words given the distribution in Eq. 9. We obtain k2k^{2} queries of length n+1n+1 and keep only the kk best of them. The process ends when we obtain kk well-formed queries containing the special end-of-query token ∘\circ.

Consider a user who submits the queries cleveland gallery →\rightarrow lake erie artist. The suggestion system proceeds as follows. We apply Eq. 4 to each query obtaining the query vectors qcleveland galleryq_{\text{cleveland gallery}} and qlake erie artq_{\text{lake erie art}}. Then, we compute the session-level recurrent states by applying Eq. 5 to the query vectors. At this point, we obtain two session-level recurrent states, scleveland gallerys_{\text{cleveland gallery}} and slake erie arts_{\text{lake erie art}}. To generate context-aware suggestions, we start by mapping the last session-level recurrent state, slake erie arts_{\text{lake erie art}}, into the initial decoder input d0d_{0} using Eq. 7. We are ready to start the sampling of the suggestion. Let assume that the beam-search size is 11. The probability of the first word w1w_{1} in the suggestion is computed using Eq. 9 by using d0d_{0} and w0=0w_{0}=0, the null vector. The word with the highest probability, i.e. cleveland, is added to the beam. The next decoder recurrent state d1d_{1} is computed by means of Eq. 8 using d0d_{0} and w1=clevelandw_{1}=\emph{cleveland}. Using d1d_{1}, we are able to pick w2=indianw_{2}=\emph{indian} as the second most likely word. The process repeats and the model selects art and ∘\circ. As soon as the end-of-query symbol is sampled, the context-aware suggestion cleveland indian art is presented to the user. In Table 1 we give an idea of the generated suggestions for 2 contexts in our test set.

Our model can evaluate the likelihood of a given suggestion conditioned on the history of previous queries through Eq. 6. This makes our model integrable into more complex suggestion systems. In the next section, we choose to evaluate our model by adding the likelihood scores of candidate suggestions as additional features into a learning-to-rank system.

Experiments

We test how well our query suggestion model can predict the next query in the session given the history of previous queries. This evaluation scenario aims at measuring the ability of a model to propose the target next query, which is assumed to be one desired by the user. We evaluate this with a learning-to-rank approach (explained in Section 4.3), similar to the one used in for query auto-completion and in for query suggestion. We first generate candidates using a co-occurrence based suggestion model. Then, we train a baseline ranker comprising a set of contextual features depending on the history of previous queries as well as pairwise features which depend only on the most recent query. The likelihood scores given by our model are used as additional features in the supervised ranker. At the end, we have three systems: (1) the original co-occurrence based ranking, denoted ADJ; (2) the supervised context-aware ranker, which we refer to as Baseline Ranker; and (3) a supervised ranker with our HRED feature. We evaluate the performance of the model and the baselines using mean reciprocal rank (MRR). This is common for tasks whose ground truth is only one instance .

We conduct our experiments on the well-known search log from AOL, which is the only available search log that is large enough to train our model and the baselines. The queries in this dataset were sampled between 1 March, 2006 and 31 May, 2006. In total there are 16,946,938 queries submitted by 657,426 unique users. We remove all non-alphanumeric characters from the queries, apply a spelling corrector and lowercasing. After filtering, we sort the query log by query timestamp and we use the queries submitted before 1 May, 2006 as our background data to estimate the proposed model and the baselines. The next two weeks of data are used as a training set for tuning the ranking models. The remaining two weeks are split into the validation and the test set. We follow common practice and we define the end of a session by a 30 minute window of idle time . After filtering, there are 1,708,224 sessions in the background set, 435,705 in the training set, 166,836 in the validation set and 230,359 sessions in the testing set.

2 Model Training

The most frequent 90K90K words in the background set form our vocabulary VV. This is a common setting for RNN applied to language and allows to speed-up the repeated summations over VV in Eq. 9 . Parameter optimization is done using mini-batch RMSPROP . We stabilize the learning by normalizing the gradients if their norm exceeds a threshold c=1c=1 . The training stops if the likelihood of the validation set does not improve for 55 consecutive iterations. We train our model using the TheanoAn implementation of the model is available at https://github.com/sordonia/hed-qs. library . The dimensionality of the query-level RNN is set to dh=1000d_{h}=1000. To ensure a high-capacity session-level RNN, we set ds=1500d_{s}=1500. This is useful to memorize complex information about previous queries. The output word embeddings oio_{i} are 300 dimensional vectors, i.e. de=300d_{e}=300. Differently from context-aware approaches for which the model size increases with the number of queries, our model is compact and can easily fit in memory (Table 2).

3 Learning to Rank

Given a session S={Q1,…,QM}S=\{Q_{1},\ldots,Q_{M}\}, we aim to predict the target query QMQ_{M} given the context Q1,…,QM−1Q_{1},\ldots,Q_{M-1}. QM−1Q_{M-1} is called the anchor query and will play a crucial role in the selection of the candidates to rerank. To probe different capabilities of our model, we predict the next query in three scenarios: (a) when the anchor query exists in the background data (Section 4.4); (b) when the context is perturbed with overly common queries (Section 4.5); (c) when the anchor is not present in the background data (Section 4.6).

For each session, we select a list of 2020 possible candidates to rerank. The exact method used to produce the candidates will be discussed in the next sections. Once the candidates are extracted, we label the true target as relevant and all the others as non-relevant. We choose to use one of the state-of-the-art ranking algorithms LambdaMART as our supervised ranker, which is the winner in the Yahoo! Learning to Rank Challenge in 2010 . We tune the LambdaMART model with 500 trees and the parameters are learnt using standard separate training and validation set.

We describe the set of pairwise and contextual features (17 in total) used to train a supervised baseline prediction model, denoted Baseline Ranker. The baseline ranker is a competitive system comprising features that are comparable with the ones described in the literature for query auto-completion and next-query prediction .

For each candidate suggestion, we count how many times it follows the anchor query in the background data and add this count as a feature. Additionally, we use the frequency of the anchor query in the background data. Following we also add the Levenshtein distance between the anchor and the suggestion. Suggestion features include: the suggestion length (characters and words) and its frequency in the background set.

Similarly to , we add 10 features corresponding to the character nn-gram similarity between the suggestion and the 10 most recent queries in the context. We add the average Levenshtein distance between the suggestion and each query in the context . We use the scores estimated using the context-aware Query Variable Markov Model (QVMM) as an additional feature. QVMM models the context with a variable memory Markov model able to automatically back-off shorter query nn-grams if the exact context is not found in the background data.

The proposed Hierarchical Recurrent Encoder Decoder (HRED) contributes one additional feature corresponding to the log-likelihood of the suggestion given the context, as detailed in Section 3.4.

4 Test Scenario 1: Next-Query Prediction

For each session in the training, validation and test set, we extract 20 queries that most likely follow the anchor query in the background data, i.e. with the highest ADJ score. The session is included if and only if at least 20 queries have been extracted and the target query appears in the candidate list. In that case, the target query is the positive candidate and the 19 other candidates are the negative examples. Note that a similar setting has been used in for query auto-completion. We have 18,882 sessions in the training, 6,988 sessions in the validation and 9,348 sessions in the test set. The distribution of the session length is reported in Figure 4. The scores obtained by the ADJ counts are used as an additional non-supervised baseline.

Table 3 shows the MRR performance for our model and the baselines. Baseline Ranker achieves a relative improvement of 4.3%4.3\% with respect to the ADJ model. We find that the HRED feature brings additional gains achieving 7.8%7.8\% relative improvement over ADJ. The differences in performance with respect to ADJ and the Baseline Ranker are significant using a t-test with p<0.01p<0.01. In this general next-query prediction setting, HRED boosts the rank of the first relevant result.

We expect the session length to have an impact on the performance of context-aware models. In Figure 5, we report separate results for short (2 queries), medium (3 or 4 queries) and long sessions (at least 5 queries). HRED brings statistically significant improvements across all the session lengths. For short sessions, the improvement is marginal but consistent even though only a short context is available in this case. The semantic mapping learnt by the model appears to be useful, even in the pairwise case. ADJ is affected by the lack of context-awareness and suffers a dramatic loss of performance with increasing session length. In the medium range, context-aware models account for previous queries and achieve the highest performance. The trend is not maintained for long sessions, seemingly the hardest for the Baseline Ranker. Long sessions can be the result of complex search tasks involving a topically broad information need or changes of search topics. Beyond the intrinsic difficulty in predicting the target query in these cases, exact context matches may be too coarse to infer the user need. Count-based methods such as QVMM meet their limitations due to data sparsity. In this difficult range, HRED achieves its highest relative improvement with respect to both ADJ (+15%) and the Baseline Ranker (+7%), thus showing robustness across different session lengths.

We test whether the performance obtained by HRED on long sessions can be obtained using a shorter context. For each long session in our test set, we artificially truncate the context to make the prediction depend on the anchor query, QM−1Q_{M-1}, only (1 query), on QM−2Q_{M-2} and QM−1Q_{M-1} (2 queries), on 3 queries and on the entire context. When one query is considered, our model behaves similarly to a pairwise recurrent encoder-decoder model trained on consecutive queries. Figure 6 shows that when only one query is considered, the performance of HRED is similar to the Baseline Ranker (0.529) which uses the whole context. However, HRED appears to perform best when the whole context is considered, which highlights the importance of context-information. Additional gains can be obtained by considering more than 3 queries, which highlights the ability of our model to consider long contexts.

5 Test Scenario 2: Robust Prediction

Query sessions contain a lot of common and navigational queries such as google or facebook which do not correspond to a specific search topic. A context-aware suggestion system should be robust to noisy queries and learn to discard them from the relevant history that should be retained. We propose to probe this capability by formulating an original robust prediction task as follows. We label the 100 most frequent queries in the background set as noisyA similar categorization has been proposed in .. For each entry in the training, validation and test set of the previous next-query prediction task, we corrupt its context by inserting a noisy query at a random position. The candidates and the target rest unchanged. The probability of sampling a noisy query is proportional to its frequency in the background set. For example, given the context airlines →\rightarrow united airlines and the true target delta airlines, the noisy sample google is inserted at a random position, forcing the models to predict the target given the corrupted context airlines →\rightarrow united airlines →\rightarrow google.

Table 4 shows that corruption considerably affects the performance of ADJ. Cases in which the corruption occurred at the position of the anchor query severely harm pairwise models. The Baseline Ranker achieves significant gains over ADJ by leveraging context matches. Its performance is inferior to the baseline ADJ performance in the next-query setting reported in Table 3 (0.5334). HRED appears to be particularly effective in this difficult setting achieving a relative improvement of 17.8%17.8\% over ADJ and 9.9%9.9\% over the Baseline Ranker, both statistically significant. Comparative to the next-query task, the improvements over ADJ and the Baseline Ranker are 2.5 and 3 times higher respectively. Our model appears to be more robust than the baselines in these extreme cases and can better reduce the impact of the noisy query.

As noisy queries bring little information to predict future queries in the session, HRED may automatically learn to be robust to the noise at training time. The hierarchical structure allows to decide, for each query, if it is profitable to account for its contribution to predict future queries. This capability is sustained by the session-level GRU, which can ignore the noisy queries by “turning-off” the update gate unu_{n} when they appear (see Section 3.1.1). Given the corrupted context airlines →\rightarrow united airlines →\rightarrow google, the session-level GRU computes three update gate vectors: uau_{a}, uuau_{ua}, ugu_{g}, each corresponding to a position in the context. In Figure 7, we plot the magnitude of the elements in these vectors. As the model needs to memorize the initial information, uau_{a} shows a significant number of non-zero (bright) entries. At this point, general topical information has already been stored in the first recurrent state. Hence, uuau_{ua} shows a larger number of zero (dark) entries. When google is processed, the network tends to keep past information in memory by further zeroing entries in the update gate. This sheds an interesting perspective: this mechanism may be used to address other search log related tasks such as session-boundary detection.

6 Test Scenario 3: Long-Tail Prediction

To analyze the performance of the models in the long-tail, we build our training, validation and test set by retaining the sessions for which the anchor query has not been seen in the background set, i.e. it is a long-tail query. In this case, we cannot leverage the ADJ score to select candidates to rerank. For each session, we iteratively shorten the anchor query by dropping terms until we have a query that appears in the background data. If a match is found, we proceed as described in the next-query prediction setting, that is, we guarantee that the target appears in the top 20 queries that have the highest ADJ scores given the anchor prefix. The statistics of the obtained dataset are reported in Figure 4. As expected, the distribution of lengths changes substantially with respect to the previous settings. Long-tail queries are likely to appear in medium and long sessions, in which the user strives to find an adequate textual query.

Table 5 shows that, due to the anchor prefix matching, ADJ suffer a significant loss of performance. The performances of the models generally confirm our previous findings. HRED improves significantly by 5.6% over the Baseline Ranker and proves to be useful even for long-tail queries. Supervised models appear to achieve higher absolute scores in the long-tail setting than in the general next-query setting reported in Table 3. After analysis of the long-tail testing set, we found that only 8% of the session contexts contain at least one noisy query. In the general next-query prediction case, this number grows to 37%. Noisy queries generally harm performance of the models by increasing the ambiguity in the next query prediction task. This fact may explain why the Baseline ranker and HRED perform better on long-tail queries than in the general case. It is interesting to see how the improvement of HRED with respect to the Baseline Ranker is larger for long-tail queries than in the general setup (5.6% to 3.3%). Although not explicitly reported, we analyzed the performance with respect to the session length in the long-tail setting. Similarly to the general next-query prediction setting, we found that the Baseline Ranker suffers significant losses for long sessions while our model appears robust to different session lengths.

7 User Study

The previous re-ranking setting doesn’t allow to test the generative capabilities of our suggestion system. We perform an additional user study and ask human evaluators to assess the quality of synthetic suggestions. To avoid sampling bias towards overly common queries, we choose to generate suggestions for the 50 topics of the TREC Web Track 2011 . The assessment was conducted by a group of 5 assessors. To palliate the lack of context information for TREC queries, we proceed as follows: for each TREC topic QMQ_{M}, we extract from the test set the sessions ending exactly with QMQ_{M} and we take their context Q1,…,QM−1Q_{1},\ldots,Q_{M-1}. After contextualization, 19 TREC queries have one or more queries as context and the remaining are singletons. For HRED, we build synthetic queries following the generative procedure described in Section 3.4. In addition to QVMM and ADJ, we compare our model with two other baselines: CACB , which is similar to QVMM but builds clusters of queries to avoid sparsity, and SS (Search Shortcuts) , which builds an index of the query sessions and extracts the last query of the most similar sessions to the source context. Note that we do not compare the output of the previous supervised rankers as this would not test the generative capability of our model. Each assessor was provided with a random query from the test bed, its context, if any, and a list of recommended queries (the top-5 for each of the methods) selected by the different methods. Recommendations were randomly shuffled, so that the assessors could not distinguish which method produced them. Each assessor was asked to judge each recommended query using the following scale: useful, somewhat useful, and not useful. The user study finished when each assessor had assessed all recommendations for all 50 queries in the test bed. Figure 8 reports the results of the user study averaged over all raters. Overall, for HRED, 64% of the recommendations were judged useful or somewhat useful. The quality of the queries recommended by HRED is higher than our baselines both in the somewhat and in the useful category.

Related Works

A notorious context-aware method was proposed by He et al. . The authors use a Variable Memory Markov model (QVMM) and build a suffix tree to model the user query sequence. We used this model as a context-aware baseline feature in our supervised ranker. The method by Cao et al. is similar but they build a suffix tree on clusters of queries and model the transitions between clusters. We didn’t notice any improvements by adding this model as a feature in our case. For both models, the number of parameters increases with the depth of the tree inducing sparsity. Instead, our model can consider arbitrary length contexts with a fixed number of parameters. Jiang et al. and Shokouhi et al. propose context-aware approaches for query auto-completion. We adopted a similar framework for query suggestion and use our model as a feature to rank the next-query. Santos et al. and Ozertem et al. also use learning to rank approach for query suggestion. In those cases, the rankers are trained using pairwise features and do not consider previous queries. Interestingly, the authors model explicitly the usefulness of a suggestion by using click data and the result list. In the future, we plan to integrate click information in the generation process of our model.

Query suggestion algorithms use clustering methods to find similar queries so that they can be used as suggestions for one another . We demonstrated that our model exhibits similar clustering properties due to the embeddings learnt by the neural network. Other works build a Query Flow Graph (QFG) to capture high-order query co-occurrence . Operating at the query-level, these methods suffer from the long-tail problem. Bonchi et al. propose a solution to these problems by introducing the Term-QFG (TQG), where single query terms are also included into the graph. However, suggestion requires repeated complex random walks with restart. Similarly, our model can handle rare queries as long as their words appear in the model vocabulary. Vahabi et al. find suggestions to long-tail queries by comparing their search results. Although effective, the approach requires to have 100100 results per query. A related approach is the Search Shortcut which avoids the long-tail problem by means of a retrieval algorithm.

Few synthetic suggestion models have been proposed in the literature. Szpektor et al. use a template generation method by leveraging WordNet. Jain et al. combine different resources and use a machine learning approach to prune redundant suggestions. These methods achieve automatic addition, removal and substitution of related terms into the queries. By maximizing the likelihood of the session data, our model learns to perform similar modifications.

Neural networks have found several applications in a variety of tasks, ranging from Information Retrieval (IR) , Language Modeling (LM) and Machine Translation (MT) . Cho et al. and Sutskever et al. use a Recurrent Neural Network (RNN) for end-to-end MT. Our model bears similarities to these approaches but we contribute with the hierarchical structure. The idea of encoding hierarchical multi-scale representations is also explored in . In IR, neural networks embeddings were used by Li et al . The authors used deep feed-forward neural networks to use previous queries by the same user to boost document ranking. In , the authors propose to use clickthrough data to learn a ranking model for ad-hoc IR. Our model shares similarities with the interesting recent work by Mitra . The authors apply the discriminative pairwise neural model described in to measure similarity between queries. Context-awareness is achieved at ranking time, by measuring the similarity between the candidates and each query in the context. Our work has several key differences. First, we deploy a novel RNN architecture. Second, our model is generative. Third, we model the session context at training time. To our knowledge, this is the first work applying RNNs to an IR task.

Conclusion

In this paper, we formulated a novel hierarchical neural network architecture and used it to produce query suggestions. Our model is context-aware and it can handle rare queries. It can be trained end-to-end on query sessions by simple optimization procedures. Our experiments show that the scores provided by our model help improving MRR for next-query ranking. Additionally, it is generative by definition. We showed with a user study that the synthetic generated queries are better than the compared methods.

In future works, we aim to explicitly capture the usefulness of a suggestion by exploiting user clicks . This may be done without much effort as our architecture is flexible enough to allow joint training of other differentiable loss functions. Then, we plan to further study the synthetic generation by means of a large-scale automatic evaluation. Currently, the synthetic suggestions tend to be horizontal, i.e. the model prefers to add or remove terms from the context queries and rarely proposes orthogonal but related reformulations . Future efforts may be dedicated to diversify the generated suggestions to account for this effect. Finally, the interactions of the user with previous suggestions can also be leveraged to better capture the behaviour of the user and to make better suggestions accordingly. We are the most excited about possible future applications beyond query suggestion: auto-completion, next-word prediction and other NLP tasks such as Language Modelling may be fit as possible candidates.

Acknowledgments

We would like to thank Jianfeng Gao, Çağlar Gülçehre and Bhaskar Mitra for their precious advice, enlightening discussions and invaluable moral support. We gratefully acknowledge the support of NVIDIA Corporation with the donation of the Tesla K40 GPU used for this research.

References