A question and answer system search matching method based on semantic similarity and application thereof

By employing a semantic similarity-based question-answering system search and matching method, and utilizing a pre-trained BERT model and Siamese network architecture, the search and matching of the question-answering system is optimized. This addresses the issues of low accuracy, long processing time, and high maintenance costs in existing technologies, achieving efficient and accurate question-answering system matching, which is particularly suitable for tax consulting.

CN114461774BActive Publication Date: 2025-12-30YUANZHIFU (HANGZHOU) TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202210114916.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-31
Publication Date
2025-12-30
Estimated Expiration
2042-01-31

AI Technical Summary

Technical Problem

Existing question-answering systems suffer from low accuracy, long processing time, and high maintenance costs when matching user questions. In particular, traditional word segmentation matching and neural network-based methods cannot effectively solve polysemy and synonym matching, and the BERT model is time-consuming and inaccurate in prediction.

Method used

We adopt a question-answering system search and matching method based on semantic similarity. We use a pre-trained BERT model for feature encoding, combine it with a Siamese network architecture, train it by constructing a sample set, calculate sentence vector similarity using cosine similarity, and optimize the model to improve accuracy and efficiency.

Benefits of technology

It significantly improves the model's prediction accuracy and generalization ability, reduces maintenance costs, solves the error propagation problem in traditional methods, shortens prediction time, and enhances user experience, making it particularly suitable for the tax consulting field.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114461774B_ABST
    Figure CN114461774B_ABST
Patent Text Reader

Abstract

The application relates to a semantic similarity-based question and answer system search matching method and application thereof. The question and answer system comprises standard questions and answers, and a plurality of similar questions are set corresponding to the standard questions; a sample set is constructed, a pre-training model is adjusted and trained; questions in the question and answer system are vectorized, new user questions are vectorized, cosine similarity calculation is carried out, all questions in the question and answer system are sorted according to the similarity scores, and a preset number of questions are output; the method is applied to a tax question and answer system. The application solves the problems of polysemy, word ambiguity, word segmentation accuracy and the like of a traditional model, can fully obtain semantic information contained in a sentence, greatly improves the performance of the model, the training and prediction stages are fully parallel, the prediction accuracy of the model is improved, search recommendation indexes are improved, the generalization ability of the model is enhanced, user experience is improved, and maintenance cost is reduced; and the application is particularly suitable for the field of tax consultation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the technical fields of information retrieval, database structure, and file system structure, and particularly to a search and matching method for a question-answering system based on semantic similarity and its application. Background Technology

[0002] With the continuous development of machine learning and deep learning technologies, intelligent information consultation through deep learning-related technologies has become a key component of question-answering systems. In intelligent consultation systems, optimizing model accuracy and shortening search and matching time are the core points for improving user experience and alleviating the pressure on human services, in order to match and search user questions with a question database to be sorted, and then obtain one or more of the most matching results through similarity calculation and return them in order.

[0003] In existing technologies, intelligent question answering systems generally achieve the above functions by word segmentation and keyword matching, or by using models based on recurrent neural networks (RNN) or their variants such as LSTM and GRU.

[0004] Word segmentation and keyword matching refers to segmenting the concatenated sentence into words, training the vectorized word vectors, obtaining the vector representation of the concatenated sentence, and then performing dimensionality reduction processing to finally obtain a set of similarity scores between sentences and output them in a sorted manner. The main problem is that it cannot match sentences that do not contain the search keywords, and the matching results are unstable and have limited accuracy.

[0005] Compared to keyword matching, using neural networks can capture some contextual information within a sentence, solving the problem of keyword matching failing to match sentences that don't contain the search keyword. However, this approach cannot effectively address polysemy and ignores similarity matching for synonyms. When the question-and-answer database for user questions is large, this search matching method significantly increases prediction time. Most importantly, models trained using this method rely on word segmentation and word vector models, which can easily lead to error propagation between models and increase the overall maintenance difficulty, resulting in long search ranking model execution time, high maintenance costs, and low accuracy.

[0006] With the further development of NLP (Natural Language Processing) technology, Google proposed the Transformer model in 2017, which promoted the development of related technologies in the field of natural language processing. Subsequently, the BERT model was proposed, which achieved excellent performance on various NLP tasks. More and more research began to try to use the BERT model in search matching tasks and achieved very good results. However, although the BERT model has excellent encoding capabilities and can fully capture the semantic information of the context in a sentence, it still has problems such as long prediction time and inability to meet the accuracy requirements under high requirements. Summary of the Invention

[0007] This invention addresses the problems existing in the prior art and provides an optimized search and matching method for question-answering systems based on semantic similarity, as well as its applications.

[0008] The technical solution adopted in this invention is a search and matching method for a question-answering system based on semantic similarity. The question-answering system includes standard questions and their corresponding answers, and sets several similar questions for any standard question.

[0009] The method includes the following steps:

[0010] Step 1: Build a pre-trained model;

[0011] Step 2: Construct a sample set, adjust the pre-trained model, and train it based on the adjustment results; obtain the trained model;

[0012] Step 3: Input all the questions in the question-answering system into a trained model, and then vectorize and store all the questions using the trained model;

[0013] Step 4: Obtain a new user question and input it into another trained model so that the trained model can vectorize the new user question;

[0014] Step 5: Calculate the cosine similarity between the vector processed in Step 4 and all vectors stored in Step 3. Sort all questions in the question-answering system according to the similarity scores and output the preset number of questions.

[0015] Preferably, the pre-trained model comprises the following sequentially configured components:

[0016] The character-based segmentation layer is used to segment each single sentence into characters and obtain the corresponding token ID;

[0017] A vector transformation layer is used to vectorize the token IDs output by each single sentence;

[0018] A feature extraction layer is used to extract features from the vectorized token IDs and positional codes to obtain the feature vector of the token corresponding to each character;

[0019] An average pooling layer is used to perform average pooling on the feature vectors of the tokens for all characters in each sentence.

[0020] An output layer is used to output the average pooled vector, identifying each single sentence.

[0021] Preferably, in step 2, the sample set includes positive samples and negative samples, with positive samples labeled as 1 and negative samples labeled as 0; the negative samples include random negative samples.

[0022] Preferably, the positive samples include: stored user questions and their corresponding standard questions, and similar questions to user questions and their corresponding standard questions;

[0023] The random negative samples include: several similar problems or user problems corresponding to any standard problem and other standard problems.

[0024] Preferably, the negative samples further include carefully selected negative samples, and obtaining the carefully selected negative samples includes the following steps:

[0025] Step 2.1.1: Adjust the pre-trained model using positive samples and the random negative samples until it reaches the preset standard;

[0026] Step 2.1.2: Using the adjusted pre-trained model, calculate the vectorized representation of the user question and its similar questions for each positive sample in the sample set, and calculate the similarity between the user question and its similar questions and all questions in the question-answering system;

[0027] Step 2.1.3: Reorder all stored questions in the question-answering system from highest to lowest similarity;

[0028] Step 2.1.4: Take the k stored questions with the highest similarity after sorting; select the other stored questions before the first stored question that matches the user question, and use the standard questions corresponding to the other stored questions and the similar questions and user questions in step 2.1.2 as the selected negative samples.

[0029] Preferably, in step 2.1.2, the sample set is a dataset with a ratio of positive samples to negative samples of 1:1.

[0030] Preferably, the training includes the following steps:

[0031] Step 2.2.1: Calculate the vectorized representation V of any standard question, its corresponding user question, and similar questions in the question-answering system.mean , Where i corresponds to each character in each question, and maxlen is the number of tokens in each sentence;

[0032] Step 2.2.2: After processing the vectorized representations of any standard question, the corresponding user question, and the similar question, perform average pooling, and then calculate the similarity.

[0033] Step 2.2.3: Based on the calculated similarity and labels, calculate the loss function lossMSE, and continue to adjust the loss function and train the model.

[0034] Preferably,

[0035]

[0036] Where V and U represent the sentence vectors of the two questions, respectively. y represents the similarity score calculated by the current model. i Tags indicating sentence pairs; w i The weight parameter is w i ∈[0,1]; m is the size of the batch, and n is the number of samples.

[0037] Preferably, the sentence vector dimension during model training is 1024, using the AdamW optimizer with a learning rate of 2e. -5 The learning rate decay rate is 0.01.

[0038] An application of the semantic similarity-based question-answering system search matching method is described above, applied to a tax question-answering system, wherein the tax question-answering system matches user questions with standard questions and similar questions based on the question-answering system search matching method.

[0039] This invention relates to an optimized search and matching method for a question-answering system based on semantic similarity and its application. The question-answering system includes standard questions and their corresponding answers, and several similar questions are set for any standard question. A sample set is constructed, a pre-trained model is adjusted, and training is performed based on the adjustment results. A trained model is obtained. All questions in the question-answering system are input into a trained model, which vectorizes all questions and stores them to obtain new user questions. These new user questions are then input into another trained model, which vectorizes them. Cosine similarity is calculated between the two models, and all questions in the question-answering system are sorted according to the similarity scores. A preset number of questions are output. The method is applied to a tax question-answering system.

[0040] The beneficial effects of this invention are as follows:

[0041] (1) Avoid using traditional search ranking models based on word segmentation and word vectors, greatly reduce maintenance costs, avoid error propagation caused by model stacking, improve the prediction accuracy of the model, and enhance the generalization ability of the model, that is, the universality of the model.

[0042] (2) When obtaining the feature embedding of sentences, a Chinese-based BERT pre-trained model was used and distilled. A large amount of real user consultation questions and manually labeled data accumulated locally were used to perform special sampling processing and fine-tune the model. The proposed fine-picking negative sampling method was used to perform data augmentation during the model optimization process, which greatly improved the performance of the model.

[0043] (3) Using a pre-trained model to generate character-based sentence vectors solves the problems of polysemy, word ambiguity, and word segmentation accuracy faced by traditional models, and can fully obtain the semantic information contained in the sentence;

[0044] (4) The model architecture based on Siamese networks enables parallel training and prediction phases, which largely solves the problem of slow prediction in traditional BERT-based pre-trained models, while achieving high accuracy and greatly improving the user experience.

[0045] This invention can improve search recommendation metrics, reduce model search time performance under the same conditions, improve user experience, and reduce maintenance costs, and is particularly suitable for the field of tax consulting. Attached Figure Description

[0046] Figure 1 This is a flowchart of the method of the present invention;

[0047] Figure 2 This is a schematic diagram of the model structure of the present invention;

[0048] Figure 3 This is a flowchart illustrating the process of obtaining carefully selected negative samples in this invention, where the darker areas indicate the hit problems;

[0049] Figure 4 This is a schematic diagram of the model training process in this invention;

[0050] Figure 5 This is a schematic diagram of the search and matching process using a model in this invention. Detailed Implementation

[0051] The present invention will be further described in detail below with reference to embodiments, but the scope of protection of the present invention is not limited thereto.

[0052] like Figure 1As shown, this invention relates to a search and matching method for a question-answering system based on semantic similarity. In summary, this invention uses a pre-trained model for feature encoding and extraction, avoiding error propagation caused by using multiple models. Furthermore, to address the issue of excessively long training and prediction times, the pre-trained model employs distillation and secondary fine-tuning, and uses a Siamese network structure to encode user questions and the question-answer database. Cosine similarity is then used to score the similarity of sentence vectors. Each step in the calculation process can be performed in parallel, reducing the time required to encode text into sentence embedding vectors, as well as the time required for similarity calculation and sorting.

[0053] The question-and-answer system includes standard questions and their corresponding answers, and sets several similar questions for any standard question.

[0054] In this invention, taking the scenario of tax consultation as an example, the dataset used is entirely derived from real user questions. User questions refer to tax-related questions raised by users through clients, web pages, etc., such as "How to pay individual income tax"; the terms "user question" and "user problem" in the following text have the same meaning.

[0055] In this invention, user questions correspond to standard questions. Standard questions refer to standardized questions in the local database, which correspond to standard answers. Standard questions are generally labeled manually. Database experts will match the standard questions corresponding to the correct answers of user questions with user questions to form a pair of effective training data, i.e., positive samples. In the following, "standard question" and "standard question" have the same meaning.

[0056] In this invention, a series of similar problems corresponding to the standard problem are simultaneously labeled. Similar problems refer to problems that are associated with the standard problem and express similar or the same meaning. For example, for "How to pay personal income tax", "How to pay personal income tax" is a similar problem. Establishing similar problems can improve the performance of the model. The following "similar question" and "similar problem" refer to the same meaning.

[0057] The method includes the following steps:

[0058] Step 1: Build a pre-trained model;

[0059] like Figure 2 As shown (from bottom to top), the pre-trained model includes the following sequentially configured components:

[0060] The character segmentation layer is used to segment each single sentence into characters and obtain the corresponding token ID. That is, in the diagram, the user's question is converted into individual characters and the corresponding token is obtained. Taking "How to pay personal income tax" as an example, n is 8 here.

[0061] A vector transformation layer is used to vectorize the token IDs output by each single sentence;

[0062] A feature extraction layer is used to extract features from the vectorized token IDs and positional codes to obtain the feature vector of the token corresponding to each character;

[0063] An average pooling layer is used to perform average pooling on the feature vectors of the tokens for all characters in each sentence.

[0064] An output layer is used to output the average pooled vector, identifying each single sentence.

[0065] In this invention, in order to extract semantic information from sentences, a pre-trained model based on Chinese is introduced and fine-tuned to achieve the vectorization of deep semantic information features of sentences, thus solving the problem that traditional methods require reliance on other models such as word segmentation and word vectors.

[0066] The BERT-wwm-based pre-trained model used in this invention differs from the traditional BERT model's training method, employing Whole Word Masking for optimized training specifically for Chinese. More precisely, the masking method used in past Chinese BERT models was inadequate; character-based masking strategies masked certain characters within a sentence before training. This approach is unsuitable for Chinese NLP tasks, neglecting the concepts of words and phrases in Chinese sentences and failing to consider the correlations between them, thus failing to learn grammatical information. In contrast, the pre-trained model of this invention trains on segmented Chinese corpora using random masking of Chinese entity words and phrases. This training method allows the model to learn more semantic information and performs better on relevant NLP tasks in Chinese data environments, resulting in generated character vectors with more semantic features.

[0067] In this invention, the pre-trained model, in fact, including the model after subsequent training, all includes a character segmentation layer, a vector conversion layer, a feature extraction layer, an average pooling layer, and an output layer. Taking "How to pay individual income tax?" as an example, the model first segments the sentence into characters "个", "人", "所", "得", "税", "怎", "么", "交", "?", converts each character into the form of tokensid, vectorizes the generated id, and enters the Transform module together with the position encoding for feature extraction. Finally, the feature vector of each token is obtained. In the average pooling module, the feature vectors of each character obtained are subjected to average pooling, and the obtained Omean vector is used to represent the information of the entire sentence. Among them, the position encoding is a technology involved in BERT. The final feature vector not only includes token embeddings, but also segment embeddings and position embeddings.

[0068] Step 2: Construct a sample set, adjust the pre-trained model, and train based on the result of the adjustment; obtain the trained model.

[0069] In the said Step 2, the sample set includes positive samples and negative samples. The label of the positive sample is 1, and the label of the negative sample is 0. The negative samples include random negative samples.

[0070] The positive samples include: the standard questions corresponding to the stored user questions and their correct answers, and the similar questions of the user questions and their corresponding standard questions.

[0071] The random negative samples include: several similar questions or user questions corresponding to any standard question and other standard questions.

[0072] In this invention, generally, the training set and the validation set are divided in a ratio of 8:2, where the ratio of positive samples to negative samples in the training samples is 1:1.

[0073] In this invention, the standard question corresponding to the correct answer of the user's question is corresponded to the user's question, which is a pair of valid training data, that is, a positive sample. A series of similar questions corresponding to the standard question are marked, and the standard question and each corresponding similar question are also used as positive samples to improve the performance of the model. Simply put, the positive samples include the standard question and the corresponding similar question, and the standard question and the corresponding user question.

[0074] In this invention, random negative sampling is constructed by randomly negative sampling positive samples; each similar question or each user question corresponding to a standard question and other standard questions (excluding itself) is used as a set of negative samples; for example, if there is standard question 1 "How to pay individual income tax", standard question 2 "How should enterprises fill out the annual corporate income tax return", and the similar question corresponding to standard question 2 is "How should enterprises fill out the tax form", then "How to pay individual income tax" and "How should enterprises fill out the tax form" are used as a set of negative samples obtained by random negative sampling.

[0075] In this way, random negative samples with a ratio of 1:1 to positive samples and a label of 0 are constructed.

[0076] The negative samples also include carefully selected negative samples. In this invention, the construction of carefully selected negative samples is related to the training of the pre-trained model.

[0077] like Figure 3 As shown, specifically, obtaining the carefully selected negative samples includes the following steps:

[0078] Step 2.1.1: Adjust the pre-trained model using positive samples and the random negative samples until it reaches the preset standard;

[0079] Step 2.1.2: Using the adjusted pre-trained model, calculate the vectorized representation of the user question and its similar questions for each positive sample in the sample set, and calculate the similarity between the user question and its similar questions and all questions in the question-answering system;

[0080] In step 2.1.2, the sample set is a dataset with a ratio of positive samples to negative samples of 1:1.

[0081] Step 2.1.3: Reorder all stored questions in the question-answering system from highest to lowest similarity;

[0082] Step 2.1.4: Take the k stored questions with the highest similarity after sorting; select the other stored questions before the first stored question that matches the user question, and use the standard questions corresponding to the other stored questions and the similar questions and user questions in step 2.1.2 as the selected negative samples.

[0083] In this invention, during the process of constructing samples by carefully selecting negative samples, user questions are derived from user questions or similar questions to standard questions in the positive samples of the training samples; the question-answer library is a set of sentences to be matched as questions and their corresponding answers. The accuracy goal of the model is to match them as accurately as possible based on their similarity. More precisely, in the application example of this invention, it is adapted to semantic matching judgment in the tax field.

[0084] In this invention, during the selective negative sampling, the model is first trained using positive samples and random negative samples. Then, the trained model is used to predict user questions and similar questions in the question-and-answer database. The training adjustment refers to fine-tuning the model, which means training with a pre-trained model and data so that the weight parameters in the pre-trained model can adapt to the data (reach a preset standard) to achieve better performance. This is something that those skilled in the art can easily understand, and they can set it according to their needs.

[0085] In this invention, in the construction of carefully selected negative samples, the user questions and their similar questions in each positive sample in the sample set are first extracted using the fine-tuned model and vectorized representations are calculated for each sample and all questions in the question-answering system. Based on the vectors, the similarity between the user questions and their similar questions and all questions in the question-answering system is calculated using cosine similarity, from which the k questions with the highest similarity are derived.

[0086] Taking k=10 as an example, there is a situation where, among the k questions that are generated, the question in the question-answering system that actually hits the user question and its similar question in the sample set is located at the 6th position. This situation actually exists. Therefore, at this time, we can select the standard questions corresponding to the questions ranked from the 1st to the 5th position, as well as the user questions and similar questions in the sample set at this time, as the carefully selected negative samples, and set their labels to 0.

[0087] correspond Figure 3 Taking user questions as an example, after vectorizing user questions, cosine similarity is calculated between user questions and the vectors of all questions in the question-answering system to obtain the similarity between user questions and different questions in the question-answering system. After sorting, it is found that the similarity of the questions hit by user questions is 0.93 and its ranking is not the first. Therefore, the question ranked before this hit question with a similarity of 0.98 is obviously of research value. So it is combined with user questions to form a carefully selected negative sample.

[0088] In this invention, specifically, when the user asks "How do I pay personal income tax?", the answer to this question appears in the 3rd position of the results, while the 1st and 2nd positions are "Do individuals need to pay taxes?" and "How should companies file taxes?". The standard questions corresponding to these two questions are grouped with "How do I pay personal income tax?" to select negative samples.

[0089] In this invention, experiments have shown that when k=10, the model trained using sentences from the question-and-answer database ranked from the third to the position before the hit position, along with user questions, as negative samples exhibits the best test performance.

[0090] like Figure 4 As shown, taking the standard question "What is the personal income tax rate?" and the user question "What is the personal income tax rate for labor remuneration?" as an example, the training includes the following steps:

[0091] Step 2.2.1: Calculate the vectorized representation V of any standard question, its corresponding user question, and similar questions in the question-answering system. mean , Where i corresponds to each character in each question, and maxlen is the number of tokens in each sentence;

[0092] Step 2.2.2: After processing the vectorized representations of any standard question, the corresponding user question, and the similar question, average pooling is performed, followed by similarity calculation; more precisely, the sentence vector here is obtained by average pooling after BERT, and then used to represent the sentence for similarity calculation.

[0093] Step 2.2.3: Based on the calculated similarity and labels, calculate the loss function lossMSE, and continue to adjust the loss function and train the model.

[0094]

[0095]

[0096] Where V and U represent the sentence vectors of the two questions, respectively. y represents the similarity score calculated by the current model. i Tags indicating sentence pairs; w i The weight parameter is w i ∈[0,1]; m is the size of the batch, and n is the number of samples.

[0097] The sentence vector dimension during model training is 1024, using the AdamW optimizer with a learning rate of 2e. -5 The learning rate decay rate is 0.01.

[0098] In this invention, the pooling layer uses the average of each character vector as the sentence vector. Experiments have shown that, compared to using the [CLS] vector, combining feature vectors of other IDs with mean pooling results in better performance of the model.

[0099] In this invention, experiments showed that when the batch size was 16, the model achieved optimal performance on the test set at epoch=7.

[0100] Step 3: Input all the questions in the question-answering system into a trained model, and then vectorize and store all the questions using the trained model;

[0101] Step 4: Obtain a new user question and input it into another trained model so that the trained model can vectorize the new user question;

[0102] Step 5: Calculate the cosine similarity between the vector processed in Step 4 and all vectors stored in Step 3. Sort all questions in the question-answering system according to the similarity scores and output the preset number of questions.

[0103] like Figure 5 As shown, in this invention, after the model training is completed, similar to the training process, the user's question and the questions to be matched in the question-and-answer database are vectorized, and then the cosine similarity between them is calculated and sorted. Different numbers of answers are generated according to different task types. For example, for text-based search and matching tasks, the first three sentences predicted by the model need to be generated, while for speech tasks, the first sentence predicted by the model is generated.

[0104] Throughout this invention, the use of a Siamese network model architecture for training and prediction is consistently employed. This is achieved through weight sharing within the model, which reduces the impact of mislabeled samples on the model results during prediction. During training, the pre-trained model within the Siamese network architecture is fine-tuned. The training corpus consists of question pairs composed of real user questions from consultations and their labeled standard questions, as well as negative sample question pairs constructed through random negative sampling and selective negative sampling methods, significantly improving the training effectiveness and speed.

[0105] To achieve the above, the present invention also relates to a computer-readable storage medium storing a program for a question-answering system search and matching method based on semantic similarity. When the program is executed by a processor, it implements the aforementioned question-answering system search and matching method based on semantic similarity, thereby solving problems such as long prediction time and inability to meet accuracy requirements under high demands. It improves search recommendation indicators, improves the performance of model search time under the same conditions, enhances user experience, and reduces maintenance costs, and is particularly suitable for the field of tax consulting.

[0106] To achieve the above, the present invention also proposes a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the above-mentioned question-answering system search matching method based on semantic similarity, thereby solving problems such as long prediction time and inability to meet accuracy requirements under high demands, improving search recommendation indicators, improving the performance of model search time under the same conditions, improving user experience, and reducing maintenance costs. It is particularly suitable for the field of tax consulting.

[0107] This invention also relates to an application of the aforementioned semantic similarity-based question-answering system search matching method, applied to a tax question-answering system, wherein the tax question-answering system matches user questions with standard questions and similar questions based on the question-answering system search matching method.

[0108] This invention is particularly suitable for question-and-answer systems with many details and elements, including but not limited to tax question-and-answer systems. However, through experiments, this invention has achieved good matching results when applied to tax question-and-answer systems.

[0109] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0110] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0111] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0112] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0113] Although preferred embodiments of the invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including both the preferred embodiments and all changes and modifications falling within the scope of the invention.

[0114] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the claims of this invention and their equivalents, this invention also intends to include these modifications and variations.

Claims

1. A semantic similarity based question answering system search matching method, characterized in that: The method is applied to a tax question-answering system; the question-answering system comprises standard questions and corresponding answers, and a plurality of similar questions corresponding to any standard question; The method comprises the following steps: Step 1: constructing a pre-training model, comprising a character segmentation layer, a vector conversion layer, a feature extraction layer, an average pooling layer and an output layer arranged in sequence, converting each character into a tokens id, vectorizing the generated id, entering the Transform module feature extraction together with the position encoding to obtain a feature vector of each token, and performing average pooling on the feature vector of each character to obtain a vector representing the information of the entire sentence; Step 2: constructing a sample set comprising positive samples and negative samples, the negative samples comprising random negative samples, adjusting the pre-training model to obtain carefully selected negative samples, and training based on the adjustment result; obtaining a trained model; Obtaining the carefully selected negative samples comprises the following steps: Step 2.1.1: adjusting the pre-training model with the positive samples and the random negative samples until a preset standard is reached; Step 2.1.2: calculating the vectorized expressions of each positive sample and its similar questions in the sample set and all questions in the question-answering system respectively using the adjusted pre-training model, and calculating the similarity between the user question and the similar questions and all questions in the question-answering system; Step 2.1.3: reordering all stored questions in the question-answering system based on the similarity from large to small; Step 2.1.4: taking the top k stored questions with the largest similarity, selecting other stored questions before the first stored question that hits the user question, and taking the standard questions corresponding to the other stored questions and the similar questions and user questions in step 2.1.2 as the carefully selected negative samples; The training comprises the following steps: Step 2.2.1: Calculate the vectorized representation V of any standard question, corresponding user question and similar question in the question answering system mean , where i corresponds to each word of each question, and maxlen is the number of tokens for each sentence. Step 2.2.2: performing average pooling on the vectorized expressions of any standard question, corresponding user question and similar question respectively after processing, and then performing similarity calculation; Step 2.2.3: Based on the calculated similarity and the label, calculate the loss function loss MSE Continue loss function adjustment, train the model; Step 3: inputting all questions in the question-answering system into a trained model, and vectorizing all questions using the trained model for storage; Step 4: obtaining a new user question and inputting it into another trained model, and vectorizing the new user question using the trained model; Step 5: calculating the cosine similarity between the vector processed in step 4 and all vectors stored in step 3, sorting all questions in the question-answering system according to the similarity score, and outputting a preset number of questions.

2. The search matching method of a question-answering system based on semantic similarity according to claim 1, characterized in that: The pre-training model comprises the following arranged in sequence: a character segmentation layer for character segmentation of each single sentence and obtaining corresponding tokens id; a vector conversion layer for vectorizing the tokens id output by each single sentence; a feature extraction layer for feature extraction of the vectorized tokens id and position encoding to obtain a feature vector of each token corresponding to each character; an average pooling layer for performing average pooling on the feature vectors of all tokens of each single sentence; An output layer is configured to output the average-pooled vectors, and identify each single sentence. 3.The search matching method of a question answering system based on semantic similarity according to claim 1, characterized in that: In step 2, the label of the positive sample is 1, and the label of the negative sample is 0.

4. The search matching method of a question-answering system based on semantic similarity according to claim 3, characterized in that: The positive sample includes: the standard question corresponding to the stored user question and the correct answer of the user question, and the similar question of the user question and the corresponding standard question; The random negative sample includes: a plurality of similar questions or user questions corresponding to any standard question and other standard questions.

5. The search matching method of a question-answering system based on semantic similarity according to claim 1, characterized in that: In step 2.1.2, the sample set is a data set with a positive sample to negative sample ratio of 1:

1.

6. The search matching method based on the semantic similarity of the question and answer system according to claim 1, characterized in that: , , where V, U represent the sentence vectors of two questions respectively, denotes the similarity score calculated by the current model, denotes the label of the sentence pair; w k is a weight parameter and w k ∈ [0, 1]; m is the size of the batch, and n is the number of samples.

7. The method of claim 1, wherein the method further comprises: The sentence vector dimension during model training is 1024, the AdamW optimizer is used, the learning rate is 2e -5 , and the learning rate decay rate is 0.

01.

8. The application of the search matching method of the semantic similarity-based question answering system according to any one of claims 1-7, characterized in that: The tax question and answer system is applied to the tax question and answer system based on the search matching method of the question and answer system to match the standard question and the similar question of the user question.

Citation Information

Patent Citations

  • Language model pre-training method combined with class word information

    CN110489555A

  • Automatic question and answer processing method and device, computer equipment and storage medium

    CN111858859A

  • BERT-based machine reading understanding method, apparatus and device, and storage medium

    CN112464641A

  • Intelligent question and answer matching method and system based on twin network BERT model

    CN112667794A

  • Negative sample determination method, related equipment and readable storage medium

    CN113849603A