Convolutional Bi-directional LSTM for Detecting Inappropriate Query Suggestions in Web Search

  • Harish YenalaEmail author
  • Manoj Chinnakotla
  • Jay Goyal
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 10234)


A web search query is considered inappropriate if it may cause anger, annoyance to certain users or exhibits lack of respect, rudeness, discourteousness towards certain individuals/communities or may be capable of inflicting harm to oneself or others. A search engine should regulate its query completion suggestions by detecting and filtering such queries as it may hurt the user sentiments or may lead to legal issues thereby tarnishing the brand image. Hence, automatic detection and pruning of such inappropriate queries from completions and related search suggestions is an important problem for most commercial search engines. The problem is rendered difficult due to unique challenges posed by search queries such as lack of sufficient context, natural language ambiguity and presence of spelling mistakes and variations.

In this paper, we propose a novel deep learning based technique for automatically identifying inappropriate query suggestions. We propose a novel deep learning architecture called “Convolutional Bi-Directional LSTM (C-BiLSTM)” which combines the strengths of both Convolution Neural Networks (CNN) and Bi-directional LSTMs (BLSTM). Given a query, C-BiLSTM uses a convolutional layer for extracting feature representations for each query word which is then fed as input to the BLSTM layer which captures the various sequential patterns in the entire query and outputs a richer representation encoding them. The query representation thus learnt passes through a deep fully connected network which predicts the target class. C-BiLSTM doesn’t rely on hand-crafted features, is trained end-end as a single model, and effectively captures both local features as well as their global semantics. Evaluating C-BiLSTM on real-world search queries from a commercial search engine reveals that it significantly outperforms both pattern based and other hand-crafted feature based baselines. Moreover, C-BiLSTM also performs better than individual CNN, LSTM and BLSTM models trained for the same task.


Query classification Deep learning Query auto suggest Web search CNN + Bi-directional LSTM Supervised learning 


  1. 1.
    Bar-Yossef, Z., Kraus, N.: Context-sensitive query auto-completion. In: WWW 2011, pp. 107–116. ACM, New York (2011)Google Scholar
  2. 2.
    Shokouhi, M., Radinsky, K.: Time-sensitive query auto-completion. In: SIGIR 2012, pp. 601–610. ACM, New York (2012)Google Scholar
  3. 3.
    Whiting, S., Jose, J.M.: Recent and robust query auto-completion. In: WWW 2014 (2014)Google Scholar
  4. 4.
    Cai, F., de Rijke, M.: A survey of query auto completion in information retrieval. Found. Trends\(\textregistered \) Inf. Retrieval 10(4), 273–363 (2016)Google Scholar
  5. 5.
    Di Santo, G., McCreadie, R., Macdonald, C., Ounis, I.: Comparing approaches for query autocompletion. In: SIGIR 2015. ACM, New York (2015)Google Scholar
  6. 6.
    Vandersmissen, B., De Turck, F., Wauters, T.: Automated Detection of Offensive Language Behavior on Social Networking Sites, vol. xiv, 81 p. (2012)Google Scholar
  7. 7.
    Xiang, G., Fan, B., Wang, L., Hong, J., Rose, C.: Detecting offensive tweets via topical feature discovery over a large scale Twitter corpus, pp. 1980–1984 (2012)Google Scholar
  8. 8.
    Xu, Z., Zhu., S.: Filtering offensive language in online communities using grammatical relations. In: Proceedings of the Seventh Annual CEAS (2010)Google Scholar
  9. 9.
    Razavi, A.H., Inkpen, D., Uritsky, S., Matwin, S.: Offensive language detection using multi-level classification. In: Farzindar, A., Kešelj, V. (eds.) AI 2010. LNCS (LNAI), vol. 6085, pp. 16–27. Springer, Heidelberg (2010). doi: 10.1007/978-3-642-13059-5_5 CrossRefGoogle Scholar
  10. 10.
    Blei, D.M., Ng, A.Y., Jordan, M.I.: Latent Dirichlet allocation. J. Mach. Learn. Res. 3, 993–1022 (2003)zbMATHGoogle Scholar
  11. 11.
    Chuklin, A., Lavrentyeva, A.: Adult query classification for web search and recommendation. In: Search and Exploration of X-Rated Information (WSDM 2013)Google Scholar
  12. 12.
    Yelong, S., Xiaodong, H., Jianfeng, G., Li, D., Gregoire, M.: A latent semantic model with convolutional-pooling structure for information retrieval. In: CIKM, November 2014Google Scholar
  13. 13.
    Huang, P.S., He, X., Gao, J., Deng, L., Acero, A., Heck, L.: Learning deep structured semantic models for web search using clickthrough data. In: CIKM 2013 (2013)Google Scholar
  14. 14.
    Zhou, C., Sun, C., Liu, Z., Lau, F.C.M.: A C-LSTM neural network for text classification. CoRR abs/1511.08630 (2015)Google Scholar
  15. 15.
    Sainath, T.N., Senior, A.W., Vinyals, O., Sak, H.: Convolutional, long short-term memory, fully connected deep neural networks. US Patent App. 14/847,133, 7 April 2016Google Scholar
  16. 16.
    Chiu, J.P.C., Nichols, E.: Named entity recognition with bidirectional LTM-CNNs. CoRR abs/1511.08308 (2015)Google Scholar
  17. 17.
    Nair, V., Hinton, G.E.: Rectified linear units improve restricted Boltzmann machines. In: ICML 2010, 21–24 June 2010, Haifa, Israel, pp. 807–814 (2010)Google Scholar
  18. 18.
    Hochreiter, S., Schmidhuber, J.: Long short-term memory. Neural Comput. 9(8), 1735–1780 (1997)CrossRefGoogle Scholar
  19. 19.
    Werbos, P.J.: Backpropagation through time: what it does and how to do it. Proc. IEEE 78(10), 1550–1560 (1990)CrossRefGoogle Scholar
  20. 20.
    Rumelhart, D.E., Hinton, G.E., Williams, R.J.: Learning representations by back-propagating errors. Cogn. Model. 5(3), 1 (1988)Google Scholar
  21. 21.
    Duchi, J., Hazan, E., Singer, Y.: Adaptive subgradient methods for online learning and stochastic optimization. Technical report UCB/EECS-2010-24Google Scholar
  22. 22.
    Fleiss, J.L.: Measuring nominal scale agreement among many raters. Psychol. Bull. 76(5), 378–382 (1971)CrossRefGoogle Scholar
  23. 23.
    Cortes, C., Vapnik, V.: Support-vector networks. Mach. Learn. 20(3) (1995)Google Scholar
  24. 24.
    Friedman, J., Hastie, T., Tibshirani, R.: The Elements of Statistical Learning. Springer Series in Statistics, vol. 1. Springer, Berlin (2001)zbMATHGoogle Scholar
  25. 25.
    Pedregosa, F., Varoquaux, G., Gramfort, A., Michel, V., Thirion, B., Grisel, O., Blondel, M., Prettenhofer, P., Weiss, R., Dubourg, V., Vanderplas, J., Passos, A., Cournapeau, D., Brucher, M., Perrot, M., Duchesnay, E.: Scikit-learn: machine learning in Python. J. Mach. Learn. Res. 12, 2825–2830 (2011)MathSciNetzbMATHGoogle Scholar
  26. 26.
    Manning, C.D., Raghavan, P., Schütze, H.: Introduction to Information Retrieval. Cambridge University Press, New York (2008)CrossRefzbMATHGoogle Scholar

Copyright information

© Springer International Publishing AG 2017

Authors and Affiliations

  1. 1.IIIT HyderbadHyderbadIndia
  2. 2.MicrosoftHyderbadIndia

Personalised recommendations