Computer and Modernization ›› 2021, Vol. 0 ›› Issue (11): 12-16.

Previous Articles     Next Articles

Text Matching Model Based on BERT and Self-attention Mechanism of Image

  

  1. (School of Computer Science and Technology, Xi’an University of Posts and Telecommunications, Xi’an 710121, China)
  • Online:2021-12-13 Published:2021-12-13

Abstract: In order to improve the accuracy of text matching, a text matching model based on BERT(Bidirectional Encoder Representations from Transformers) and self-attention mechanism of image is proposed to overcome the limitations of BERT model and MatchPyramid model in text matching. Firstly, a pair of text is encoded into word-level feature vectors by using the BERT model. Secondly, the matching matrix of word to word similarity between two texts is constructed according to the word vector, which is regarded as a single channel image representation. Then the self-attention feature matrix of the matching matrix is generated by the self-attention mechanism of image. Finally, the matching matrix and the self-attention feature matrix are connected into multi-channel to capture the text matching signals in the image by the convolutional neural network. After the matching signal is connected with the coding vector called [CLS] which is yielded by the BERT model, the similarity of the two texts is obtained by inputting the fully connected neural layer. The experimental results show that the model can effectively improve the MAP and MRR metrics compared with BERT model, MatchPyramid model and other text matching models on WikiQA dataset, and the effectiveness of the model is verified.

Key words: matching matrix, self-attention mechanism of image, feature fusion, text matching, BERT model