<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>A Semantic Similarity Computing Model based on Siamese Network for Duplicate Questions Identification</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Zongkui Zhu</string-name>
          <xref ref-type="aff" rid="aff2">2</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Zhengqiu He</string-name>
          <xref ref-type="aff" rid="aff2">2</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Ziyi Tang</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Baohui Wang</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Wenliang Chen</string-name>
          <xref ref-type="aff" rid="aff2">2</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>College of Electrical and Information Engineering, Hunan University</institution>
          ,
          <addr-line>Changsha, Hunan, 410082</addr-line>
          ,
          <country country="CN">China</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>Laiye Inc</institution>
          ,
          <addr-line>Beijing, 100080</addr-line>
          ,
          <country country="CN">China</country>
        </aff>
        <aff id="aff2">
          <label>2</label>
          <institution>School of Computer Science and Technology, Soochow University</institution>
          ,
          <addr-line>Suzhou, Jiangsu, 215006</addr-line>
          ,
          <country country="CN">China</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>Traditional semantic similarity computing methods mostly regard the text as a set of words, by calculating the number of words occurred in the text to build the feature vector, then using the metrics such as cosine distance between the vectors to calculate the text similarity. However, these methods only consider the word level of the sentence, not the semantic level, which may ignore many important information, including syntax and word order. This paper proposes a new deep learning method, which combines the attention mechanism with BiLSTM based on Siamese network to achieve the semantic similarity matching for given question pairs. Experimental results show that our models can make full use of the semantic information of the text, and the F1 value in the dataset provided by the CCKS2018 question-intention matching task is 0.84586, achieving fourth place in the final test.</p>
      </abstract>
      <kwd-group>
        <kwd>Sentence Matching</kwd>
        <kwd>Semantic Similarity</kwd>
        <kwd>LSTM</kwd>
        <kwd>Attention Mechanism</kwd>
        <kwd>Siamese Network</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>The goal of CCKS2018 question-intention matching (QIM) task is to match the
question pairs against Chinese real-world customer service data. In the task, we should
design models and algorithms to determine which of the provided pairs of questions
contain two questions with the same intention. For example, given a sentence pair: “一般
几天能通过审核” and “一般审核通过要多久”, we need to determine whether they
convey similar meaning (label 1) or not (label 0).</p>
      <p>Sentence matching, also called semantic equivalence identification or short text
semantic similarity computing, is one of the most basic tasks of NLP. It is the basis of
various NLP tasks such as automatic question and answer, chat robot, information
retrieval, and machine translation. In recent years, with the rapid development of Internet
technology, various data information shows explosive growth, and the demand for
processing large amounts of similar data is increasing. Although researchers have
advanced the semantic similarity task, there are many challenges remained.</p>
      <p>If the requirements for question matching are different, the definition of matching
will be not the same. For example, in classic sentence retelling task, we need to
judge whether the two sentences are merely different in expression, but the
meaning is the same.
 We often face short sentences and the complex structures in the task. Thus, it is
difficult to extract informative features purely based on the sentence itself.
 The data of QIM task comes from the log text of original smart customer service
in the field of bank, so there is much dirty data, such as mislabeling, typos, missing
words and simplified words, which can easily lead to word segmentation errors,
including the identification of the unknown words.
 In addition, the training of word vectors also lacks corpus data for specific financial
fields, which associated with this task.</p>
      <p>In this paper, we propose a semantic matching method based on Siamese network
[1] for this task. For the similarity computing, instead of using the traditional artificial
designed features, we adopt the neural network to learn automatically the information
contained in the question pairs. In this way, it can mine the potential syntactic and
semantic features in the sentences, which effectively compensates for the shortcomings
in the manual extraction of features.
2</p>
    </sec>
    <sec id="sec-2">
      <title>Related Work</title>
      <p>The core of text similarity computing is to compare the differences between two given
texts, usually measured by a real value between 0 and 1. In different fields, domestic
and foreign scholars have proposed many methods of the similarity computing and
applied them in practice. At present, these methods can roughly divide into four
categories: 1) string-based method, which is also called “literal similarity method” and the
typical methods include edit distance, Hamming distance, Euclidean distance, cosine
similarity, longest common substring, Jaccard, and so on. Since the string-based
method does not consider the semantic information of the text, the effect of the method
is limited. 2) corpus-based method, which uses the information obtained from the
corpus to calculate the text similarity, and can subdivide into a word-bag-based model
approach, a neural network-based approach, and a search engine-based approach. The
first two types use the document collection that will compare as the corpus, and the
latter is a web-based corpus. 3) world-knowledge-based method, which makes use of a
knowledge base with a standardized organizational system to calculate text similarity.
4) other methods, which include syntax analysis and mixing methods [2].</p>
      <p>Among them, the neural network-based method can represent the text semantic
information more in line with human cognition, and has become the development trend
of the task, which solves many drawbacks of traditional methods. For example, the
InferSent model proposed by Conneau et al. [3], which based on a Bi-LSTM
architecture with max pooling, and the ESIM model proposed by Chen et al. [4], which based
on chain LSTMs and attention, both preform well on natural language inference (NLI) ,
a task similar to semantic similarity computing.</p>
    </sec>
    <sec id="sec-3">
      <title>Our Approach</title>
      <p>Our work can divide into three parts: data preprocessing, model building and
post-processing.
3.1</p>
      <sec id="sec-3-1">
        <title>Data Preprocessing</title>
        <p>Because the data comes from the log text of original smart customer service in the field
of bank, many sentences are informal and contain much noise. The main issues are
listed as follows:
 Traditional Chinese characters such as “何時會邀請我使用微粒貸” and “为什么
我的微信上还没有出现微米粒”, the first one is written in Traditional Chinese
and the second is in Simplified Chinese. If the sentences are used directly to train
the neural network without preprocessing, it will affect the accuracy of the
prediction to some extent.
 Typos, such as “预期罚息和利息” and “逾期利息”. “预期” should be “逾期” in
the first sentence of the two sentences.
 Too short, such as “我找” and “你老板呢”, the two sentences are very short and it
is not easy to extract useful feature information.
 Redundant Character, such as “用微信都6年，微信没有微粒贷功能 ” and
“4。 号码来微粒贷”, there are both extra numbers, punctuation marks such as
spaces in the two sentences, which also affect the performance of the model.</p>
        <p>Based on the above problems, we carry out the following specific preprocessing on
the data: 1) use the open source OpenCC [5] tool to convert the data from traditional to
simplified, 2) remove the extra space characters, Chinese and English punctuation
marks and numbers, 3) convert all the letters to lowercase. In view of the fact that the
word segmentation tool cannot handle the specific domain data well, and the
experimental results show that the char level is obviously better than word level when tested.
For the lack of training corpus for word vector, we use the training data provided by
the task to train embedding at the char-level.
3.2</p>
      </sec>
      <sec id="sec-3-2">
        <title>Model Building</title>
        <p>To calculate the semantic similarity of the question pair, that is, whether the question
pair belongs to label 1 or 0. Obviously, this is a classification problem in the field of
NLP, but it is different from the traditional text categorization method.</p>
        <p>In order to represent the feature information of two questions at the semantic level
and capture the commonalities between them, we designed the following two models
based on Siamese network. The Siamese network is a neural network framework with
two identical structures and a shared weight subnetwork for evaluating the similarity of
two input samples.</p>
        <p>Figure 1 and Figure 2 show the entire frameworks of the semantic similarity
computing models. It can be found easily from the figures that the structure of the two models
is similar, they both contain Bi-LSTM layer, self-attention layer, non-linear layer,
matching layer and MLP layer.</p>
        <p>Let  1 = [ 1,  2, … ,   ] and  2 = [ 1,  2, … ,   ] be the given two sentences with
length  and  respectively, where   ,   ∈   is a char embedding of  -dimension
vector. The task is to predict a label  that indicates the similarity relationship between
q1 and q2.</p>
        <p>
          For model-I, we apply bidirectional long short-term memory network (Bi-LSTM)
[6] as the basic component of our model, since LSTM unit can effectively extract the
dependence among long-distance and non-continuous words in sentences, which is
more suitable for the semantic representation of the word sequence in the sentence. And
the bidirectional structure can provide complete past and future context information of
each node in a sentence for the output layer. Firstly, we use two layers of Bi-LSTM to
encode the word vector input for the given two sentences q1 and q2, which combines
the forward and backward outputs to obtain a textual representation of each sentence.
The outputs of the first and second layers of the two sentences as follows:
(
          <xref ref-type="bibr" rid="ref1">1</xref>
          )
 
 
 = BiLSTM(q1)
B = BiLSTM(q2)
C = BiLSTM(A)
        </p>
        <p>D = BiLSTM(B)
  = softmax(tanh( )   )</p>
        <p>= ∑ =1   ∗  
  = softmax(tanh( )   )
where  ,  ∈   ∗2 and  ,  ∈   ∗2 are the outputs of the two layers of Bi-LSTM
respectively. Moreover, the two questions share the parameters of Bi-LSTM.</p>
        <p>
          Secondly, we employ the self-attention mechanism [7] to focus on the key parts of
each output of the first layer with Equation (
          <xref ref-type="bibr" rid="ref2">2</xref>
          ). The attention mechanism is an
additional MLP, which determines which words should put more attention on than other
words over the sentence.
        </p>
        <p>
          = ∑ =1   ∗  
(
          <xref ref-type="bibr" rid="ref2">2</xref>
          )
where   and   are attention weights,   and   are the attention outputs of the
question pair, which are a weighted sum that combining each word.
        </p>
        <p>
          Thirdly, we utilize the attention mechanism to select the more important parts of each
for the output of the second layer with the following Equation (
          <xref ref-type="bibr" rid="ref3">3</xref>
          ). Different from the
above, we directly use the self-attention output of the first layer.
        </p>
        <p>= softmax(    )
where   and   are attention weights,   and   are the attention outputs.</p>
        <p>Then, we concatenate the two attention outputs  1 = [  ;   ] and  2 =
[  ;   ], and feed them to a nonlinear layer, so that we can get the deeper and more
abstract semantic representation of the two sentences.</p>
        <p>In order to represent more intuitively the similarity between the two questions, we
calculate the difference:  1 −  2 and elementwise product:  1 ∗  2 , which denote
the distance and angle information respectively between the two questions [8].</p>
        <p>Finally, we feed the question representations, distance and angle information to a
multi-layer perceptron (MLP) layer for classification.</p>
        <p>
          For model-II, what it differs from model-I is that we adopt the word-alignment
attention to obtain the inter-relationship between each word of two questions. Equations
(
          <xref ref-type="bibr" rid="ref5 ref6 ref7">5-7</xref>
          ) provide formal and specific details of this procedure.
        </p>
        <p>=   tanh( [  ;   ] +  ),  ∈ [1,  ],  ∈ [1,  ]
 
 
 = ∑
 =1 ∑
exp(  )
 =1 exp(  )   ,  ∈ [1,  ]
 = ∑ =1 ∑
exp(  )
 =1 exp(  )   ,  ∈ [1,  ]
where   is the attention score as the similarity between the words of the question pair,
and  
represents the extracted relevant information of  while  
represents
the extracted relevant information of  .</p>
        <p>Then, we calculate the distance and angle information of the alignment output of the
two questions respectively with A and B, as the input of the second Bi-LSTM layer.
 = BiLSTM([ ,  
 = BiLSTM([ ,  
,  −  
,  −  
,  ∗  
,  ∗  
])
])
Finally, the self-attention is used to calculate the key parts of each question.
  = softmax(tanh( )   )
information provided by the training data, we use K-fold cross-validation to train each
model, and then obtain the final outputs by voting.
4</p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>Experiments</title>
      <p>
        Datasets and evaluation metrics. The training set consists of 100,000 question pairs,
which include labels and where the ratio of positive and negative samples is close to
1:1. The development set consists of 10,000 unlabeled question pairs. And the last test
set consists of 110,000 unlabeled question pairs. Submissions are finally evaluated on
the test set. Four metrics Precision, Recall, F1-score and Accuracy are used for the task.
(
        <xref ref-type="bibr" rid="ref4">4</xref>
        )
(
        <xref ref-type="bibr" rid="ref5">5</xref>
        )
(
        <xref ref-type="bibr" rid="ref6">6</xref>
        )
(
        <xref ref-type="bibr" rid="ref7">7</xref>
        )
(
        <xref ref-type="bibr" rid="ref8">8</xref>
        )
(9)
Results and Analysis. Table 1 shows the experimental results on the development set,
because the test set has only one submission opportunity. When we test and submit with
the best training model, we find that the recall rate was significantly lower, as shown
in the third and fourth rows in Table 1. This indicates that many positive examples in
the data set cannot recognize. Thus, we use K-fold cross-validation method to get
different experimental results, and post-process on them by voting, that is, as long as M
models consider the question pair to be positive, then the question pair is marked as a
positive example. Besides, we use the state-of-the-art ESIM model as our baseline
system, and we train the system based on char-level and word-level inputs respectively.
From Table 1, we find that the model with char-level input is better than the one with
word-level input. Our two models are greater than ESIM, whose results have obvious
improvement after 10-fold cross-validation.
This paper describes two semantic similarity models for the task of CCKS2018 QIM.
Our solution is based on Siamese network with the attention factors without additional
feature engineering. Finally, our system achieves fourth place in the test data with F1
0.84586.
      </p>
    </sec>
    <sec id="sec-5">
      <title>Acknowledgments</title>
      <p>The research work is supported by the National Natural Science Foundation of China
(61572338) and the Natural Science Foundation of the Jiangsu Higher Education
Institutions (Grant No. 16KJA520001).</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Neculoiu</surname>
            <given-names>P</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Versteegh</surname>
            <given-names>M</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Rotaru</surname>
            <given-names>M</given-names>
          </string-name>
          .
          <article-title>Learning Text Similarity with Siamese Recurrent Networks</article-title>
          [C]// Repl4nlp Workshop at ACL.
          <year>2016</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2. 陈二静, 姜恩波. 文本相似度计算方法研究综述[J].
          <year>数据分析与知识发现</year>
          ,
          <year>2017</year>
          ,
          <volume>1</volume>
          (
          <issue>6</issue>
          ):
          <fpage>1</fpage>
          -
          <lpage>11</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>Conneau</surname>
            <given-names>A</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Kiela</surname>
            <given-names>D</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Schwenk</surname>
            <given-names>H</given-names>
          </string-name>
          , et al.
          <source>Supervised Learning of Universal Sentence Representations from Natural Language Inference Data[J]</source>
          .
          <year>2017</year>
          :
          <fpage>670</fpage>
          -
          <lpage>680</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <surname>Chen</surname>
            <given-names>Q</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Zhu</surname>
            <given-names>X</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Ling</surname>
            <given-names>Z</given-names>
          </string-name>
          , et al.
          <source>Enhanced LSTM for Natural Language Inference[J]</source>
          .
          <year>2016</year>
          :
          <fpage>1657</fpage>
          -
          <lpage>1668</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <given-names>OpenCC</given-names>
            <surname>Homepage</surname>
          </string-name>
          , https://github.com/BYVoid/OpenCC
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>Hochreiter</surname>
            <given-names>S</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Schmidhuber</surname>
            <given-names>J</given-names>
          </string-name>
          .
          <article-title>Long short-term memory</article-title>
          .[J].
          <source>Neural Computation</source>
          ,
          <year>1997</year>
          ,
          <volume>9</volume>
          (
          <issue>8</issue>
          ):
          <fpage>1735</fpage>
          -
          <lpage>1780</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <surname>Luong</surname>
            <given-names>M T</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Pham</surname>
            <given-names>H</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Manning C D. Effective</surname>
          </string-name>
          <article-title>Approaches to Attention-based Neural Machine Translation</article-title>
          [J].
          <source>Computer Science</source>
          ,
          <year>2015</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <surname>Ghaeini</surname>
            <given-names>R</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Hasan</surname>
            <given-names>S A</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Datla</surname>
            <given-names>V</given-names>
          </string-name>
          , et al.
          <article-title>DR-BiLSTM: Dependent Reading Bidirectional LSTM for Natural Language Inference</article-title>
          [J].
          <year>2018</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>