# A Sentence-Matching Model Based on Multi-Granularity Contextual Key Semantic Interaction
###### Abstract  
In the task of matching Chinese sentences, the key semantics within sentences and the deep interaction between them significantly affect the matching performance. However, previous studies mainly relied on shallow interactions based on a single semantic granularity, which left them vulnerable to interference from overlapping terms. It is particularly challenging to distinguish between positive and negative examples within datasets from the same thematic domain. This paper proposes a sentence-matching model that incorporates multi-granularity contextual key semantic interaction. The model combines multi-scale convolution and multi-level convolution to extract different levels of contextual semantic information at word, phrase, and sentence granularities. It employs multi-head self-attention and cross-attention mechanisms to align the key semantics between sentences. Furthermore, the model integrates the original, similarity, and dissimilarity information of sentences to establish deep semantic interaction. Experimental results on both open- and closed-domain datasets demonstrate that the proposed model outperforms existing baseline models in terms of matching performance. Additionally, the model achieves matching effectiveness comparable to large-scale pre-trained language models while utilizing a lightweight encoder. sentence matching; multi-granularity feature extraction; attention mechanism; semantic interaction 2024202024145197202420241451972024145  
et al. [6] utilized ChineseBERT [7] to incorporate the visual and phonetic information of Chinese characters into the pre-training model, which served as encoders for questions and answers. This approach enabled multi-granularity feature encoding. They introduced a multi-scale convolutional neural network [8] to extract local semantic information and developed a context-aware interactive module to model sentence interaction. Furthermore, they proposed a multi-perspective fusion mechanism to integrate local and interactive information, with the goal of capturing rich features from questions and answers. However, these methods have limitations in their focus on low-level local semantic interactions and their limited discriminative ability when dealing with candidate options that contain a high degree of overlapping terms. [PERSON] et al. [9] introduced BERT-SMAP (BERT with self-matching attention pooling), which incorporates a self-matching attention-pooling mechanism into sentence pairs. This mechanism allows the model to prioritize the key terms within the sentence pairs rather than the overlapping terms. [PERSON] et al. [10] proposed MKPM (multi-keyword pair matching), a method for addressing the sentence-matching task. It utilizes attention mechanisms on sentence pairs to identify the most important keyword pairs from the two sentences, representing their semantic relationship and avoiding interference from redundancy and noise. However, these methods have limitations in terms of their performance on closed-domain datasets. In datasets with a high semantic similarity between texts in the same thematic domain, solely focusing on key terms may make it challenging for the model to distinguish between positive and negative examples. Humans first consider the presence of matching keywords and then synthesize the overall meaning of sentences to assess text alignment. To address these issues, this paper proposes a sentence-matching model that incorporates multi-granularity contextual key semantic interaction. The model combines pre-trained language model embeddings with BiGRU contextual encoding to thoroughly consider sentence contextual information. It utilizes multi-scale CNN and multi-level CNN to extract different levels semantic information at word and phrase granularity. The model introduces multi-head self-attention and cross-attention to emphasize key semantics within sentences and align crucial information between sentence pairs.