A question and answer matching method based on prototype contrast learning for a bidding system
By introducing a self-supervised method of prototype contrastive learning into the question-answering system, the accuracy and robustness issues on small sample question-answering matching datasets are solved, achieving efficient model training and improved data utilization.
Patent Information
- Application Number
- CN202310666236.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-07
- Publication Date
- 2026-11-27
- Estimated Expiration
- 2043-06-07
AI Technical Summary
Existing question-answering systems suffer from low accuracy and poor robustness on small sample question-answering matching datasets, making it difficult to effectively utilize unlabeled data and resulting in insufficient model generalization ability.
A self-supervised method based on prototype contrastive learning is adopted. By constructing a knowledge base for bidding and tendering questions, the prototype representation of the question set is initialized, and data augmentation is performed using an autoencoder. A loss function is constructed to update the model parameters, thereby achieving model convergence.
It improves the model's accuracy and robustness on small sample question-answering matching datasets, reduces the need for manually labeled data, and improves data utilization.
Smart Images

Figure CN117149960B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of text data processing and analysis technology, specifically a question-answering matching method based on prototype comparative learning for bidding systems. Background Technology
[0002] Question answering systems are an advanced form of information retrieval system that focuses on determining whether two questions share the same intent. They provide accurate and concise answers to user-generated questions in natural language. In today's world, people have increasingly higher demands for the speed and accuracy of information access. Traditional question answering systems primarily rely on template matching, keyword retrieval, knowledge graphs, rules, and reasoning methods. These methods often perform poorly on small sample question answering datasets, and their generalization ability urgently needs improvement. Self-supervised learning methods utilize the inherent structure and information of the data itself as supervisory signals, without relying on large amounts of labeled data, effectively improving the utilization rate of unlabeled data. This reduces the need for manual annotation, thereby reducing the cost of data preparation and model training.
[0003] Based on this, the present invention solves the problems of low accuracy and poor robustness of the model on small sample question-answering matching datasets by introducing the instance contrast learning method in unsupervised learning methods; a solution is now proposed. Summary of the Invention
[0004] The present invention aims to solve at least one of the technical problems existing in the prior art; to this end, the present invention proposes a question-answering matching method based on prototype contrastive learning for bidding systems.
[0005] A question-answering matching method based on prototype contrastive learning for bidding systems, the method specifically includes the following steps:
[0006] Step 1: Construct a bidding and tendering Q&A knowledge base of <Question Set - Standard Answer>;
[0007] Step 2: Initialize the prototype representation of the problem set:
[0008] Step 2.1: Initialize the prototype representation of each question set in the <Question Set - Standard Answer> question-answering knowledge base using the BERT pre-trained model.
[0009] As shown in equations (1) and (2), the corresponding representations C = {C1, C2, ..., C} are obtained. l ,…,C M}:
[0010]
[0011]
[0012] Among them, Cl This represents the prototype representation of the m-th problem set. This represents the text of the k-th question in the l-th question set. The representation obtained through the Bert model, f Bert (·) represents the forward propagation function of the BERT pre-trained model; in specific implementation, the activation function of the BERT hidden layer is GLUE, the hidden layer dropout = 0.1, and the dropout of the self-attention weights = 0.1;
[0013] Step 3: Construct the question-answering matching model. QA Specifically, it includes a question-answer cross-attention submodule, an answer-question cross-attention module, and a feature similarity matching module;
[0014] Step 4: Construct the loss function;
[0015] Step 4.1: For each item q in the question-answer matching dataset D j Using data self-enhancement methods and Perform data augmentation to construct positive samples and
[0016] Step 4.2: Use an autoencoder to measure q j and positive samples and Encode the output, then input the encoded output into an aggregation layer to obtain q. j , and vector representation and Will and the question-answering matching dataset D in q j Data augmentation of K-1 different text representations as a positive sample set At the same time, remove q from the dataset D. j Positive samples generated from any of the K-1 different text representations are all considered as q. j negative sample set
[0017] Using equations (15) and (16), the prototype contrastive learning loss L can be obtained. qCL :
[0018]
[0019]
[0020] Where β1 and β2 are hyperparameters, ∑ pos This indicates summing over all positive samples;
[0021] Step 4.3, utilize vector representation and prototype representation C j Based on equations (17) and (18), construct the prototype contrastive loss function L. qICL :
[0022]
[0023]
[0024] Where μ1 and μ2 are hyperparameters;
[0025] Step 4.4: Use an autoencoder to align the samples. and Encode the data, then input the encoded output into an aggregation layer to obtain positive samples. vector representation At the same time, remove a from the question-answer matching dataset D. j Any positive sample generated from any of the other terms is considered as a. j negative samples Using equations (19) and (20), the instance contrast learning loss L can be obtained. aCL :
[0026]
[0027]
[0028] Where ρ1 and ρ2 are hyperparameters;
[0029] Step 4.5, based on L qCL L qICL L main L aCL Using equation (21), the loss function L is obtained. The model is trained using the loss function L and the model parameters and prototype representation are updated based on the backpropagation algorithm. Steps 3 and 4 are repeated until the model converges.
[0030] L=γ1L qCL +γ2L qICL +γ3L main +γ4L aCL (twenty one)
[0031] Where γ1, γ2, γ3, and γ4 are hyperparameters, and γ1+γ2+γ3+γ4=1;
[0032] Step 5: Apply a question-and-answer matching model to perform question-and-answer matching.
[0033] Compared with the prior art, the beneficial effects of the present invention are:
[0034] This invention addresses the issues of low accuracy and poor robustness of models on small-sample question-answering matching datasets by introducing a self-supervised contrastive learning data augmentation method based on prototype contrastive learning, and by maximizing the mutual information between different augmentation perspectives of question representation and answer representation.
[0035] This invention introduces the idea of prototype contrastive learning, which initializes a prototype representation for similar problems and continuously updates the prototype representation through the EM algorithm. The model converges by iteratively performing the E likelihood calculation step and the M likelihood maximization step. Attached Figure Description
[0036] Figure 1 This is a schematic diagram of the overall process of the method of the present invention;
[0037] Figure 2 This is a model structure diagram of the method of the present invention. Detailed Implementation
[0038] The technical solution of the present invention will be clearly and completely described below with reference to the embodiments. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0039] Please see Figures 1-2 This application provides a question-answering matching method based on prototype contrastive learning for bidding systems, including:
[0040] Step 1: Construct a bidding and tendering Q&A knowledge base of <Question Set - Standard Answer>.
[0041] First, relevant questions in the bidding and tendering field are collected to construct a question-and-answer database of standard questions and answers. Given that users' expressions of the same standard question vary in real-world question-and-answer scenarios, a crowdsourcing strategy is used to assign multiple users to express the same standard question, resulting in a set of similar expressions for that standard question. The standard question and the set of similar expressions are then combined into a question set, which, along with the standard answers, constructs a question-and-answer knowledge base, denoted as A = {{B1, a1}, {B2, a2}, ..., {B...}. l ,a l},…,{B M a M}}, where the problem set This represents the set of K different textual representations of the l-th question. Let a represent the k-th textual representation of the l-th question. lLet represent the answer corresponding to the l-th question set, where l∈[1,M], M represents the number of standard questions in the bidding system, and k∈[1,K], where K represents the number of different text representations for each standard question. Based on knowledge base A, each question text in the question set is paired with a standard answer to form a tuple, thus constructing a question-answering matching dataset for training the model.
[0042]
[0043] Step 2: Initialize the prototype representation of the problem set:
[0044] Step 2.1: Initialize the prototype representation of each question set in the question-answering knowledge base <Question Set - Standard Answer> using the Bert pre-trained model, as shown in equations (1) and (2), to obtain the corresponding representation C = {C1, C2, ..., C...}. l ,…,C M}:
[0045]
[0046]
[0047] Among them, C l This represents the prototype representation of the m-th problem set. This represents the text of the k-th question in the l-th question set. The representation obtained through the Bert model, f Bert (·) represents the forward propagation function of the BERT pre-trained model; in the specific implementation, the activation function of the BERT hidden layer is GLUE, the hidden layer dropout = 0.1, and the dropout of the self-attention weights = 0.1.
[0048] Step 3: Construct the question-answering matching model. QA In this embodiment, as Figure 1 As shown, it includes a question-answer cross-attention submodule, an answer-question cross-attention module, and a feature similarity matching module:
[0049] Step 3.1, Question-Answer Cross-Attention Submodule:
[0050] For {q,a}∈D, as shown in equation (3), the representation of the corresponding q,a is obtained through the Bert encoder:
[0051]
[0052]
[0053] Where L Q L is the number of all words in q. ais the total number of words in a, and d is the dimension of the representation of each word in q. As shown in equation (4), for h q ,h a Perform a one-dimensional convolution operation to obtain the following results:
[0054]
[0055]
[0056] h q =f Bert (q), h a =f Bert (a)#(3);
[0057]
[0058] Where f conv1d (·) is a one-dimensional convolution operation function.
[0059] Use equation (5) to calculate the question-answer attention vector.
[0060]
[0061]
[0062] Cos(·,·) is a cosine similarity function.
[0063] h is obtained using formula (6). q attention representation
[0064]
[0065]
[0066] Step 3.2, Answer-Question Cross-Attention Submodule
[0067] Based on h obtained in step 3.1 q h a As shown in equation (7), for h q h a Perform a one-dimensional convolution operation to obtain the following results:
[0068]
[0069]
[0070]
[0071] Use equation (8) to calculate the question-answer attention vector.
[0072]
[0073]
[0074] Using equation (9), we obtain h a attention representation
[0075]
[0076]
[0077] Step 3.3, Feature Matching Module
[0078] Based on steps 3.1 and 3.2 The final matching loss L is obtained by performing one-dimensional convolution, global average pooling, and cosine similarity calculation using formula (10). main .
[0079]
[0080] Among them, f GAP (·) represents the global average pooling operation function.
[0081] Step 4: Construct the loss function
[0082] Step 4.1: For each item q in the question-answer matching dataset D j Using data self-enhancement methods and To perform data augmentation, positive samples are constructed using equations (11) and (12). and In practice, data augmentation methods use masking or synonym substitution.
[0083]
[0084]
[0085] For each item a in the question-and-answer knowledge base A j Using data self-enhancement methods and To perform data augmentation, positive samples are constructed using equations (13) and (14). and
[0086]
[0087]
[0088] Step 4.2: Use an autoencoder to measure q j and positive samples and Encode the output, then input the encoded output into an aggregation layer to obtain q. j , and vector representation and Will and the question-answering matching dataset D in q j Data augmentation of K-1 different text representations as a positive sample set At the same time, remove q from the dataset D. j Positive samples generated from any of the K-1 different text representations are all considered as q. j negative sample set Using equations (15) and (16), the prototype contrastive learning loss L can be obtained. qCL :
[0089]
[0090]
[0091] Where β1 and β2 are hyperparameters, ∑ pos This indicates that the summation is performed over all positive samples. In the specific implementation, β1 = β2 = 0.5.
[0092] Step 4.3, utilize vector representation and prototype representation C j Based on equations (17) and (18), construct the prototype contrastive loss function L. qICL :
[0093]
[0094]
[0095] Where μ1 and μ2 are hyperparameters; in the specific implementation, μ1 = μ2 = 0.5.
[0096] Step 4.4: Use an autoencoder to align the samples. and Encode the data, then input the encoded output into an aggregation layer to obtain positive samples. vector representation At the same time, remove a from the question-answer matching dataset D. j Any positive sample generated from any of the other terms is considered as a. j negative samples Using equations (19) and (20), the instance contrast learning loss L can be obtained. aCL :
[0097]
[0098]
[0099] Where ρ1 and ρ2 are hyperparameters.
[0100] Step 4.5, based on L qCL L qICL L main L aCL Using equation (21), the loss function L is obtained. The model is trained using the loss function L and the model parameters and prototype representation are updated based on the backpropagation algorithm. Steps 3 and 4 are repeated until the model converges.
[0101] L=γ1L qCL +γ2L qICL +γ3L main +γ4L aCL (twenty one)
[0102] Where γ1, γ2, γ3, and γ4 are hyperparameters, and γ1+γ2+γ3+γ4=1; in the specific implementation, γ1=0.1, γ2=0.1, γ3=0.7, and γ4=0.1; the Adam method is used to minimize the loss function L and the learning rate is set to 0.001.
[0103] Step 5: Apply a question-and-answer matching model to perform question-and-answer matching.
[0104] Regarding the user's question Q t Application Model QA By performing a matching operation, the answer a can be obtained using formula (22). t :
[0105]
[0106] The above embodiments are only used to illustrate the technical methods of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical methods of the present invention without departing from the spirit and scope of the technical methods of the present invention.
Claims
1. A question-answering matching method based on prototype contrastive learning for bidding systems, characterized in that, The method specifically includes the following steps: Step 1: Construct a bidding and tendering Q&A knowledge base of <Question Set - Standard Answer>; Step 2: Initialize the prototype representation of the problem set: Step 2.1: Initialize the prototype representation of each question set in the <Question Set - Standard Answer> question-answering knowledge base using the BERT pre-trained model. As shown in equations (1) and (2), the corresponding representations are obtained. : ; in, This represents the prototype representation of the l-th problem set. This represents the text of the k-th question in the l-th question set. The representation obtained through the BERT model This represents the forward propagation function of the BERT pre-trained model; in specific implementations, the activation function of the BERT hidden layer is GLUE, the hidden layer dropout is 0.1, and the self-attention weight dropout is 0.
1. Step 3: Construct a question-answering matching model Specifically, it includes a question-answer cross-attention submodule, an answer-question cross-attention module, and a feature similarity matching module; Step 4: Construct the loss function; Step 4.1: For the j-th question-answer pair in the question-answer matching dataset D... Using data self-enhancement methods Perform data augmentation to construct positive samples for the problem. ; Step 4.2: Use an autoencoder to... and positive samples Encode the data, then input the encoded output into an aggregation layer to obtain... , vector representation ,Will and question-answering matching dataset D Data augmentation of K-1 different text representations as a positive sample set At the same time, remove the following from dataset D: Positive samples generated from any of the K-1 different text representations are all considered as... negative sample set ; Using equations (15) and (16), the prototype contrastive learning loss can be obtained. : ; in, For hyperparameters, This indicates summing over all positive samples; Step 4.3, utilize vector representation and prototype representation Based on equations (17) and (18), construct a prototype contrastive loss function. : ; in, For hyperparameters; Step 4.4: Analyze the answer to the j-th question-answer pair in the question-answer matching dataset D. Using data self-enhancement methods Perform data augmentation to construct positive samples of the answers. Use an autoencoder to sample positive answers. Encode the data, then input the encoded output into an aggregation layer to obtain positive samples. vector representation At the same time, the question-and-answer matching dataset D will be divided into... Positive samples generated from any of the other terms are considered as negative samples Using equations (19) and (20), the instance-contrast learning loss can be obtained. : ; in, For hyperparameters; Step 4.5, based on The loss function is obtained using equation (21). Using loss function Train the model and update the model parameters and prototype representation based on the backpropagation algorithm. Repeat steps 3 and 4 until the model converges. ; in It is a hyperparameter, and A formula to characterize the matching of questions and answers; Step 5: Apply a question-and-answer matching model to perform question-and-answer matching.
2. The question-answering matching method based on prototype contrastive learning for a bidding system according to claim 1, characterized in that, The specific method for building the bidding and tendering Q&A knowledge base in step 1 is as follows: First, collect relevant questions in the bidding and tendering field and build a question-and-answer database of standard questions and standard answers; A crowdsourcing strategy is employed to assign multiple individuals to express the same standard question, resulting in a set of similar expressions for that standard question. This standard question and the set of similar expressions are then combined to form a question set, which, along with the standard answer, constructs a question-and-answer knowledge base, denoted as [the question set]. Among them, the problem set This represents the set of K different textual representations of the l-th question. This represents the k-th textual representation of the l-th question. This represents the answer to the set of questions of the ith nature. M represents the number of standard questions in the bidding system. K represents the number of distinct textual representations of each standard question; Based on knowledge base A, each question text in the question set is paired with the standard answer to form a tuple, thus constructing a question-answering matching dataset for training the model: 。 3. The question-answering matching method based on prototype contrastive learning for a bidding system according to claim 2, characterized in that, The question-answer cross-attention submodule is: for As shown in equation (3), the corresponding result is obtained through the Bert encoder. The representation in, It is the number of all words in q. d is the total number of words in a, and d is the dimension of the representation of each word in q; As shown in equation (4), for Perform a one-dimensional convolution operation to obtain the following results: ; in, It is a one-dimensional convolution operation function; Use equation (5) to calculate the question-answer attention vector: ; ; in It is a cosine similarity function; Using formula (6) to obtain attention representation ; 。 4. The question-answering matching method based on prototype contrastive learning for a bidding system according to claim 3, characterized in that, The answer-question cross-attention submodule is: According to the obtained As shown in equation (7), for Perform a one-dimensional convolution operation to obtain the following results: ; Use equation (8) to calculate the question-answer attention vector. ; Using equation (9) to obtain attention representation ; 。 5. The question-answering matching method based on prototype contrastive learning for a bidding system according to claim 4, characterized in that, According to the obtained The final matching loss is obtained by performing one-dimensional convolution, global average pooling, and cosine similarity calculation using formula (10). ; ; in, This represents the global average pooling operation function.
6. The question-answering matching method based on prototype contrastive learning for a bidding system according to claim 1, characterized in that, The data augmentation methods in step 4.1 use the mask method or the synonym substitution method, as shown in equations (11) and (12). ; For each item in question-and-answer knowledge base A Using data self-enhancement methods To perform data augmentation, positive samples are constructed using equations (13) and (14). : 。 7. The question-answering matching method based on prototype contrastive learning for a bidding system according to claim 1, characterized in that, In step 4.5: ; Minimize the loss function using the Adam method. And set the learning rate to 0.
001.
8. The question-answering matching method based on prototype contrastive learning for a bidding system according to claim 1, characterized in that, Regarding the questions raised by users Application Model Perform a matching operation and use formula (22) to obtain the answer. ; 。
Citation Information
Patent Citations
Implementation method of question and answer model based on symbolic knowledge and neural network
CN112035629A
Question and answer system search matching method based on semantic similarity and application thereof
CN114461774A
