Matching model training methods, equipment and media

By clustering and concatenating unlabeled datasets using clustering algorithms, label values ​​are determined to train a matching model. This solves the problem of difficulty in obtaining labeled data and achieves efficient and accurate matching model training.

CN115982600BActive Publication Date: 2026-05-05CHINA TELECOM CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHINA TELECOM CORP LTD
Filing Date
2022-12-28
Publication Date
2026-05-05

AI Technical Summary

Technical Problem

In existing technologies, the training process of matching models relies on labeled training data, which is difficult to obtain and time-consuming and labor-intensive to add labels, resulting in high costs and making it impossible to effectively utilize unlabeled data for training.

Method used

Clustering algorithms are used to cluster unlabeled target datasets, splicing and combining data, determining label values ​​based on data clustering, and training a matching model using unlabeled data until the matching loss function and similarity preset values ​​are met, thereby optimizing the clustering effect.

Benefits of technology

It enables the training of a highly accurate matching model under unlabeled data conditions, simplifies the data acquisition and training process, and improves the model's generalization ability and matching accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115982600B_ABST
    Figure CN115982600B_ABST
Patent Text Reader

Abstract

This disclosure provides a matching model training method, device, and medium, relating to the field of computer technology. The method includes: clustering the original data in an unlabeled target dataset using a clustering algorithm to obtain multiple data clusters. The target dataset is obtained by combining two unlabeled candidate datasets. Each pair of original data from the multiple data clusters is concatenated to obtain N concatenated data. Then, each pair of concatenated data from the N concatenated data is combined to obtain K data groups. The label value of each data group is determined based on the clustering of the original data within each data group. An untrained matching model is trained based on the K data groups and the label values ​​of each data group until a trained matching model is obtained. Labels are added to the unlabeled data through clustering and data sources, and the effect is optimized through an iterative training process, ultimately resulting in a more accurate trained matching model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and in particular to a matching model training method, device and medium. Background Technology

[0002] With the development of computer technology, more and more methods are being applied to real life. For example, matching models are mainly used to study the relationship between two pieces of text and are widely used in applications such as text question answering, recommendation, intelligent customer service, dialogue quality inspection, and database question answering.

[0003] In related technologies, the training process of matching models is mainly completed through labeled training data. However, it is difficult to obtain standard training data, and adding labels to the training data is time-consuming, labor-intensive, and costly. Therefore, how to provide a way to obtain a well-trained matching model from unlabeled training data is an urgent problem to be solved.

[0004] It should be noted that the information disclosed in the background section above is only used to enhance the understanding of the background of this disclosure, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention

[0005] This disclosure provides a matching model training method, device, and medium that can train a matching model using unlabeled data, making the matching model's predictions more accurate.

[0006] Other features and advantages of this disclosure will become apparent from the following detailed description, or may be learned in part from practice of this disclosure.

[0007] In a first aspect, embodiments of this disclosure provide a matching model training method, the method comprising:

[0008] The original data in the target dataset is clustered using a clustering algorithm to obtain multiple data clusters; wherein, the target dataset is obtained by combining two unlabeled candidate datasets.

[0009] Each pair of original data from the multiple data clusters is concatenated to obtain N concatenated data;

[0010] Combine every two pieces of spliced ​​data from N spliced ​​data to obtain K data groups, and determine the label value of each data group based on the data clustering of the original data in the K data groups;

[0011] The untrained matching model is trained based on the K data groups and the label value of each data group until the matching loss function value corresponding to the untrained matching model is less than a first preset value, and the similarity result obtained by the untrained matching model based on the original data in the multiple data clusters is greater than a second preset value. Then the trained matching model is obtained.

[0012] In one possible embodiment, the step of combining every two spliced ​​data points from N spliced ​​data points to obtain K data groups, and determining the label value of each data group based on the data clustering of the original data in the K data groups, includes:

[0013] During the process of combining each pair of spliced ​​data, any data group obtained is judged to determine the label value corresponding to the data group.

[0014] The judgment for any one of the K data sets is as follows:

[0015] If the original data in two concatenated data sets within any given data set belongs to the same candidate dataset, then the label value of that data set is determined based on the data clustering of the four original data sets within that data set; and

[0016] If any two original data points in any two concatenated data points in any data group belong to different candidate datasets, then the label value of any data group is determined based on the candidate dataset situation and data clustering situation corresponding to the four original data points in any data group.

[0017] In one possible embodiment, any one of the data groups includes first spliced ​​data and second spliced ​​data; the first spliced ​​data includes first original data located in the first half of the splicing process and second original data located in the second half of the splicing process; the second spliced ​​data includes third original data located in the first half of the splicing process and fourth original data located in the second half of the splicing process.

[0018] If the original data in two concatenated data sets in any data group belongs to the same candidate dataset, then the label value of any data group is determined based on the data clustering of the four original data sets in that data group, including:

[0019] If the first original data and the second original data in the first spliced ​​data belong to the same data cluster, and the original data in the second spliced ​​data and the original data in the first spliced ​​data belong to the same data cluster, then the label value of any data group is determined to be the first value.

[0020] If the first original data and the second original data in the first spliced ​​data belong to the same data cluster, and the third original data and the first original data belong to the same data cluster, and the fourth original data and the second original data do not belong to the same data cluster, or the third original data and the first original data do not belong to the same data cluster, and the fourth original data and the second original data belong to the same data cluster, then the label value of any one of the data groups is determined to be the second value.

[0021] If the first original data and the second original data in the first spliced ​​data belong to the same data cluster, and the third original data does not belong to the same data cluster as the first original data, and the fourth original data does not belong to the same data cluster as the second original data, then the label value of any data group is determined to be the third value.

[0022] If the first original data and the second original data in the first spliced ​​data do not belong to the same data cluster, and the third original data belongs to the same data cluster as the first original data, and the fourth original data belongs to the same data cluster as the second original data, then the label value of any data group is determined to be the first value.

[0023] If the first original data and the second original data in the first spliced ​​data do not belong to the same data cluster, and the third original data and the first original data belong to the same data cluster, and the fourth original data and the second original data do not belong to the same data cluster, or the third original data and the first original data do not belong to the same data cluster, and the fourth original data and the second original data belong to the same data cluster, then the label value of any one of the data groups is determined to be the second value.

[0024] If the first original data and the second original data in the first spliced ​​data do not belong to the same data cluster, and the third original data does not belong to the same data cluster as the first original data, and the fourth original data does not belong to the same data cluster as the second original data, then the label value of any one of the data groups is determined to be the third value.

[0025] In one possible embodiment, any one of the data groups includes first spliced ​​data and second spliced ​​data; the first spliced ​​data includes first original data located in the first half of the splicing process and second original data located in the second half of the splicing process; the second spliced ​​data includes third original data located in the first half of the splicing process and fourth original data located in the second half of the splicing process.

[0026] If any two original data points in any concatenated data set belong to different candidate datasets, then the label value of any data set is determined based on the candidate dataset information and data clustering information corresponding to the four original data points in the data set, including:

[0027] If the first original data and the third original data belong to the same candidate dataset, and the second original data and the fourth original data do not belong to the same candidate dataset, and the first original data and the third original data belong to the same data cluster, then the label value of any one of the data groups is determined to be the second value.

[0028] If the first original data and the third original data do not belong to the same candidate dataset, and the second original data and the fourth original data belong to the same candidate dataset, and the second original data and the fourth original data belong to the same data cluster, then the label value of any one of the data groups is determined to be the second value.

[0029] If the first original data and the third original data belong to the same candidate dataset, and the second original data and the fourth original data do not belong to the same candidate dataset, and the first original data and the third original data do not belong to the same data cluster, then the label value of any one of the data groups is determined to be the third value.

[0030] If the first original data and the third original data do not belong to the same candidate dataset, and the second original data and the fourth original data belong to the same candidate dataset, and the second original data and the fourth original data do not belong to the same data cluster, then the label value of any one of the data groups is determined to be the third value.

[0031] If the first original data and the third original data do not belong to the same candidate dataset, and the second original data and the fourth original data do not belong to the same candidate dataset, then the label value of any one of the data groups is determined to be the third value.

[0032] In one possible embodiment, the untrained matching model comprises two fully connected layers and an untrained matching sub-model;

[0033] The process of training the untrained matching model based on the K data groups and the label value of each data group is as follows:

[0034] The untrained matching model is iteratively trained using the K data sets and the label values ​​of each data set, wherein one iteration of the training process includes:

[0035] Training samples are extracted from the K data groups and input sequentially into two fully connected layers to train the self-representation of the original data, thus obtaining the first output result.

[0036] The first output result is input into the untrained matching sub-model to train the correlation between the original data in the K data groups, and a second output result is obtained.

[0037] The matching loss function value is determined based on the label value corresponding to the training sample and the second output result;

[0038] Based on the matching loss function value, adjust the network parameters of the untrained matching model until the matching loss function value meets the first preset value to obtain an intermediate matching model;

[0039] The similarity results are obtained by predicting the original data in multiple data clusters based on the intermediate matching model;

[0040] If the similarity result is greater than the second preset value, then the trained matching model is obtained.

[0041] In one possible implementation, the matching loss function is as follows:

[0042]

[0043] in, This represents the matching loss function; This represents the label value corresponding to the training sample extracted from the K data groups; This represents the second output result obtained from training the untrained matching model.

[0044] In one possible embodiment, the step of predicting the original data in multiple data clusters based on an intermediate matching model to obtain similarity results includes:

[0045] For multiple data clusters, select any one data cluster and determine the original data corresponding to the cluster center of the arbitrary data cluster. Use the original data corresponding to the cluster center of the arbitrary data cluster as the first data to be predicted, and use the other original data in the arbitrary data cluster other than the original data corresponding to the cluster center as the second data to be predicted.

[0046] The first data to be predicted is concatenated with itself to obtain the first concatenated data to be predicted.

[0047] The second data to be predicted is concatenated with itself to obtain the second concatenated data to be predicted;

[0048] The first and second data to be predicted are treated as a set of data to be predicted.

[0049] Multiple sets of data to be predicted and spliced ​​are determined from the multiple data clusters;

[0050] The multiple sets of spliced ​​data to be predicted are input into the intermediate matching model for prediction, and the similarity corresponding to the multiple sets of spliced ​​data to be predicted is obtained.

[0051] The similarity result is determined by averaging the similarities of the multiple sets of spliced ​​data to be predicted.

[0052] In one possible embodiment, after obtaining the trained matching model, the method further includes:

[0053] Get the first and second data to be matched;

[0054] The first data to be matched is concatenated with itself to obtain the first concatenated data to be matched;

[0055] The second data to be matched is concatenated with itself to obtain the second concatenated data to be matched;

[0056] The first and second data to be matched are input into the trained matching model to determine the matching similarity between the first and second data to be matched.

[0057] Secondly, embodiments of this disclosure provide a matching model training apparatus, comprising:

[0058] Clustering units are used to cluster the original data in the target dataset using a clustering algorithm to obtain multiple data clusters; wherein, the target dataset is obtained by combining two unlabeled candidate datasets;

[0059] The splicing unit is used to splice every two original data points from the multiple data clusters to obtain N spliced ​​data points;

[0060] The combination unit is used to combine every two pieces of spliced ​​data from N spliced ​​data to obtain K data groups, and to determine the label value of each data group based on the data clustering situation corresponding to the original data in the K data groups.

[0061] The training unit is used to train the untrained matching model based on the K data groups and the label value of each data group until the matching loss function value corresponding to the untrained matching model is less than a first preset value, and the similarity result obtained by the untrained matching model based on the original data in the multiple data clusters is greater than a second preset value, then the trained matching model is obtained.

[0062] In one possible embodiment, the combining unit is further configured to:

[0063] During the process of combining each pair of spliced ​​data, any data group obtained is judged to determine the label value corresponding to the data group.

[0064] The judgment for any one of the K data sets is as follows:

[0065] If the original data in two concatenated data sets within any given data set belongs to the same candidate dataset, then the label value of that data set is determined based on the data clustering of the four original data sets within that data set; and

[0066] If any two original data points in any two concatenated data points in any data group belong to different candidate datasets, then the label value of any data group is determined based on the candidate dataset situation and data clustering situation corresponding to the four original data points in any data group.

[0067] In one possible embodiment, the training unit is further configured to:

[0068] The untrained matching model is iteratively trained using the K data sets and the label values ​​of each data set, wherein one iteration of the training process includes:

[0069] Training samples are extracted from the K data groups and input sequentially into two fully connected layers to train the self-representation of the original data, thus obtaining the first output result.

[0070] The first output result is input into the untrained matching sub-model to train the correlation between the original data in the K data groups, and a second output result is obtained.

[0071] The matching loss function value is determined based on the label value corresponding to the training sample and the second output result;

[0072] Based on the matching loss function value, adjust the network parameters of the untrained matching model until the matching loss function value meets the first preset value to obtain an intermediate matching model;

[0073] The similarity results are obtained by predicting the original data in multiple data clusters based on the intermediate matching model;

[0074] If the similarity result is greater than the second preset value, then the trained matching model is obtained.

[0075] Thirdly, embodiments of this disclosure provide an electronic device, including: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to perform the method described in the first aspect above by executing the executable instructions.

[0076] Fourthly, embodiments of this disclosure provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in the first aspect above.

[0077] Fifthly, according to another aspect of this disclosure, a computer program product or computer program is also provided, the computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, causing the computer device to perform the methods described in any of the preceding claims.

[0078] The embodiments of this disclosure provide a matching model training method, which performs clustering processing on the original data in the target dataset using a clustering algorithm to obtain multiple data clusters; wherein the target dataset is obtained by combining two unlabeled candidate datasets; each pair of original data from the multiple data clusters is concatenated to obtain N concatenated data; each pair of concatenated data from the N concatenated data is combined to obtain K data groups, and the label value of each data group is determined according to the data clustering situation corresponding to the original data in the K data groups; the untrained matching model is trained according to the K data groups and the label value of each data group until the matching loss function value corresponding to the untrained matching model is less than a first preset value, and the similarity result predicted by the untrained matching model based on the original data in the multiple data clusters is greater than a second preset value, then the trained matching model is obtained. On the one hand, two unlabeled training datasets are introduced, and labels are added to the data groups through clustering and dataset source. The clustering effect is optimized and the matching model is trained through continuous iteration of the training process. On the other hand, introducing two training datasets can provide more learning directions for training the matching model, enabling the model to learn the differences between different datasets and improve the accuracy of the matching model in use.

[0079] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description

[0080] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure. It is obvious that the drawings described below are merely some embodiments of this disclosure, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.

[0081] Figure 1This illustration shows one of the flowcharts of a matching model training method according to an embodiment of the present disclosure;

[0082] Figure 2 A schematic diagram of a target dataset is shown in an embodiment of this disclosure;

[0083] Figure 3 This diagram illustrates a possible label value in an embodiment of the present disclosure.

[0084] Figure 4 This diagram illustrates another possible label value in an embodiment of the present disclosure.

[0085] Figure 5 This is a second schematic flowchart of a matching model training method according to an embodiment of the present disclosure;

[0086] Figure 6 A flowchart illustrating the process of using a matching model in an embodiment of this disclosure is shown.

[0087] Figure 7 This diagram illustrates the structure of a matching model training apparatus according to an embodiment of the present disclosure.

[0088] Figure 8 A schematic diagram of the structure of an electronic device according to an embodiment of the present disclosure is shown. Detailed Implementation

[0089] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, they are provided so that this disclosure will be more comprehensive and complete, and will fully convey the concept of the exemplary embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.

[0090] Furthermore, the accompanying drawings are merely illustrative of this disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and therefore repeated descriptions of them will be omitted. Some block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities may be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.

[0091] In related technologies, the training process for matching models is primarily accomplished using labeled training data. However, obtaining standard training data is difficult, and adding labels to the training data is time-consuming, labor-intensive, and costly. Using data with small volumes and manually labeled data cannot learn enough features.

[0092] Therefore, clustering can be applied to unsupervised classification. However, due to the lack of labels, it is difficult to determine the stopping condition for clustering, and clustering may overfit and have low generalization ability when the amount of data is small. Therefore, the idea of ​​contrastive learning can be used for unsupervised data. When the data has no labels, it can rely on the similarity relationship between the labels to train the data.

[0093] The specific method includes: clustering the original data in the unlabeled target dataset using a clustering algorithm to obtain multiple data clusters; concatenating every two original data points from each cluster to obtain N concatenated data points; then combining every two concatenated data points to obtain K data groups; determining the label value for each data group based on the clustering of the original data in the data group and the dataset to which it belongs; and training an untrained matching model based on the K data groups and the label values ​​of each data group until a trained matching model is obtained. Alternatively, an unlabeled training dataset is introduced, and labels are added to the data groups based on clustering and the dataset source. The clustering effect and the matching model are optimized through an iterative training process, ultimately resulting in a more accurate trained matching model.

[0094] The following detailed description of this exemplary implementation method is provided in conjunction with the accompanying drawings and embodiments.

[0095] First, this disclosure provides a matching model training method, which can be executed by any electronic device with computing power. In the following process, the electronic device is used as a server.

[0096] Figure 1 This diagram illustrates a matching model training flowchart according to an embodiment of the present disclosure, such as... Figure 1 As shown, the matching model training method provided in this embodiment includes the following steps:

[0097] S102: Cluster the original data in the target dataset using a clustering algorithm to obtain multiple data clusters.

[0098] The target dataset is obtained by combining two unlabeled candidate datasets.

[0099] In one possible implementation, before training the untrained matching model, it is generally possible to use only one dataset for training. However, a single dataset cannot achieve good clustering results when clustering. Therefore, two candidate datasets are combined to obtain an unlabeled target dataset.

[0100] Specifically, arbitrarily select a candidate dataset D0 and introduce unlabeled candidate datasets D1 from other industries to form a new target dataset D2, which is used to cluster a large amount of data to train the matching model's ability to distinguish between different datasets.

[0101] like Figure 2 As shown, it is not easy to match and predict the matching of any two original data a and b in candidate dataset D0, but it is easy to determine that a and b in candidate dataset D0 do not match the original data c in candidate dataset D1.

[0102] Clustering algorithms are used to cluster the target dataset D2, generating multiple data clusters.

[0103] Specifically, clustering algorithms can include k-means clustering, etc.

[0104] After generating multiple data clusters, the data clusters can be named, for example, C_classid_id in the current class; that is, C_1_1 represents the first original data in data cluster 1.

[0105] S104: Concatenate every two original data points from multiple data clusters to obtain N concatenated data points.

[0106] In one possible implementation, the data is combined based on the clustering of data after initial clustering and the dataset source in the original data, enabling the matching model to learn more matching relationships between the original data itself and the concatenated data. The specific process is as follows:

[0107] The original data is concatenated pairwise to obtain N concatenated data.

[0108] Furthermore, a special symbol [sep] can be added between the concatenated data, which allows the matching model to learn the relationship between the two original data sets.

[0109] After obtaining the spliced ​​data, there are two possible scenarios.

[0110] (1) The two original data in a spliced ​​data belong to the same data cluster.

[0111] (2) The two original data in a spliced ​​data do not belong to the same data cluster.

[0112] S106: Combine every two concatenated data points from the N concatenated data points to obtain K data groups, and determine the label value of each data group based on the data clustering of the original data in the K data groups.

[0113] In one possible embodiment, after obtaining the spliced ​​data, the spliced ​​data can be combined to obtain K data groups, wherein each data group includes two spliced ​​data, which is four original data.

[0114] Labels are added to the data groups based on the data clustering results of the original data in the two concatenated data sets within each data group.

[0115] Specifically, in the process of combining each pair of spliced ​​data, any resulting data group is judged to determine the corresponding label value.

[0116] Let's take any one of the K data sets as an example. Consider two concatenated data sets, A and B. The first concatenated data set includes the first original data located in the first half of the concatenation and the second original data located in the second half. The second concatenated data set includes the third original data located in the first half of the concatenation and the fourth original data located in the second half. There are two possible judgments.

[0117] First, the two original data points in A and the two original data points in B belong to the same candidate dataset.

[0118] If the original data in two concatenated data sets in any data group belongs to the same candidate dataset, then the label value of any data group is determined based on the data clustering situation corresponding to the four original data sets in any data group.

[0119] Furthermore, when two original data points in A and two original data points in B belong to the same candidate dataset, there are two specific ways to determine this.

[0120] 1. The first original data and the second original data in the first spliced ​​data A belong to the same data cluster.

[0121] (1) If the original data in the second spliced ​​data B and the original data in the first spliced ​​data belong to the same data cluster, then the label value of the data group is determined to be the first value.

[0122] This can also be understood as follows: the third original data in the second spliced ​​data B belongs to the same data cluster as the first original data, and the fourth original data belongs to the same data cluster as the second original data. Therefore, the label value can be determined as the first value, which can be 1.

[0123] (2) If the third original data and the first original data belong to the same data cluster, and the fourth original data and the second original data do not belong to the same data cluster, or if the third original data and the first original data do not belong to the same data cluster, and the fourth original data and the second original data belong to the same data cluster, then the label value of any data group is determined to be the second value.

[0124] The second value can be 0.5.

[0125] (3) If the third original data and the first original data do not belong to the same data cluster, and the fourth original data and the second original data do not belong to the same data cluster, then the label value of any data group is determined to be the third value.

[0126] The third value can be 0.

[0127] 2. The first original data and the second original data in the first spliced ​​data do not belong to the same data cluster.

[0128] (1) If the third original data and the first original data belong to the same data cluster, and the fourth original data and the second original data belong to the same data cluster, then the label value of any data group is determined to be the first value.

[0129] The first value can be 1.

[0130] (2) If the third original data and the first original data belong to the same data cluster, and the fourth original data and the second original data do not belong to the same data cluster, or if the third original data and the first original data do not belong to the same data cluster, and the fourth original data and the second original data belong to the same data cluster, then the label value of any data group is determined to be the second value.

[0131] The second value can be 0.5.

[0132] (3) If the third original data and the first original data do not belong to the same data cluster, and the fourth original data and the second original data do not belong to the same data cluster, then the label value of any data group is determined to be the third value.

[0133] The third value can be 0.

[0134] It should be noted here that if the first original data belongs to data cluster C_1, the third original data belongs to data cluster C_2, the second original data belongs to data cluster C_2, and the fourth original data belongs to data cluster C_3, then it can be seen that the third original data does not belong to the same data cluster as the first original data, and the fourth original data does not belong to the same data cluster as the second original data. Therefore, the label value is also the third value.

[0135] Based on the above scenarios, labels are added to cases where the original data in the first and second concatenated data sets belong to the same dataset. For details, please refer to... Figure 3 The examples shown correspond to the various label values. The label value is represented by the symbol "label".

[0136] Second, the original data in A and the original data in B, no two original data sets belong to the same candidate dataset.

[0137] 1. The first and third original data belong to the same candidate dataset.

[0138] (1) If the second original data and the fourth original data do not belong to the same candidate dataset, and the first original data and the third original data belong to the same data cluster, then the label value of any data group is determined to be the second value.

[0139] (2) If the first original data and the third original data do not belong to the same data cluster, then the label value of any data group is determined to be the third value.

[0140] 2. The first and third original data do not belong to the same candidate dataset.

[0141] (1) If the second original data and the fourth original data belong to the same candidate dataset and the second original data and the fourth original data belong to the same data cluster, then the label value of any data group is determined to be the second value.

[0142] (2) If the second original data and the fourth original data belong to the same candidate dataset, and the second original data and the fourth original data do not belong to the same data cluster, then the label value of any data group is determined to be the third value.

[0143] (3) If the second original data and the fourth original data do not belong to the same candidate dataset, then the label value of any data group is determined to be the third value.

[0144] The second value mentioned above is always 0.5, and the third value is always 0. Using the above method, Figure 4 A diagram illustrating the possible values ​​of the label is shown.

[0145] By adding labels to any dataset using the above method, the unlabeled target training set can be converted into a labeled dataset, and subsequent steps can be performed.

[0146] S108: Train the untrained matching model based on K data groups and the label value of each data group until the matching loss function value corresponding to the untrained matching model is less than the first preset value, and the similarity result obtained by the untrained matching model based on the original data in multiple data clusters is greater than the second preset value, then the trained matching model is obtained.

[0147] In one possible embodiment, an untrained matching model can be trained using K data sets with known label values. During the training process, if the above two conditions are met, the final trained matching model can be obtained.

[0148] Figure 5 A flowchart illustrating a specific training process for a matching model is shown. Figure 5 As shown, it includes the following steps:

[0149] S502: Cluster the original data in the target dataset using a clustering algorithm to obtain multiple data clusters.

[0150] The target dataset is obtained by combining two unlabeled candidate datasets.

[0151] S504: Concatenate every two original data points from multiple data clusters to obtain N concatenated data points.

[0152] S506: Combine every two data points from the N concatenated data sets to obtain K data groups, and determine the label value of each data group based on the data clustering of the original data in the K data groups.

[0153] S508: Extract training samples from K data sets and input them sequentially into two fully connected layers to train the self-expression of the original data, and obtain the first output result.

[0154] In one possible embodiment, since the training method in this disclosure processes, concatenates, and combines the original candidate dataset, the relationship between two concatenated data points in the data set can be trained and learned first during training, enabling the model to learn its own representation even without an attention mechanism. The dropout values ​​of the two fully connected layers are generally greater than 0, specifically 0.1.

[0155] The untrained matching model may include two fully connected layers and an untrained sub-matching model. Specifically, the sub-matching model may be an Enhanced Sequential Inference Model (ESIM), a pre-trained Bidirectional Encoder Representation from Transformers (BERT), or other network models. The BERT model used in this disclosure may be a BERT model.

[0156] The first output here is the result after passing through two fully connected layers.

[0157] S510: Input the first output result into the untrained matching sub-model to train the correlation between the original data in the K data groups and obtain the second output result.

[0158] In one possible implementation, taking any sample in the training samples as an example, the two concatenated data included can be two sentences, such as sentence1+[sep]+sentence2.

[0159] When inputting into two fully connected layers with dropout=0.1, the relevant embeddings can be the third word in dropout sentence1 and the fifth word in dropout sentence2. Then, through the sub-matching model, the relevance of each part of the sentence can be learned.

[0160] S512: Determine the matching loss function value based on the label value corresponding to the sample to be trained and the second output result.

[0161] In one possible embodiment, the training is terminated by comparing the second output of the untrained matching model with the determined label value and calculating the loss function value using the matching loss function.

[0162] Specifically, the untrained sub-matching model has a basic loss function. Based on the characteristics of the data in this disclosure and the different training methods, the loss function is improved according to the different sources of the dataset or the different data clustering, so that the model can better learn the differences between the text documents.

[0163] The basic loss function is as follows:

[0164]

[0165] in, Represents the basic loss function; This represents the label value corresponding to the training sample extracted from the K data groups; This represents the second output result obtained from training the untrained matching model.

[0166] Furthermore, the improved matching loss function is as follows:

[0167]

[0168] in, This represents the matching loss function; This represents the label value corresponding to the training sample extracted from the K data groups; This represents the second output result obtained from training the untrained matching model.

[0169] The newly added expression is:

[0170]

[0171] for When =0, for That is, in When =0, A value greater than 0 can be understood as follows: when there are original data from different clusters or different candidate datasets in a data set, the matching model is required to learn the differences between the data during the training process. The matching model needs to have a strong ability to distinguish between them. Otherwise, the matching loss function value will easily become very large, making it difficult to converge and resulting in a large penalty.

[0172] By using the final matching loss function, if the final matching loss function value is less than the first preset value, the matching model can effectively learn the differences between the data.

[0173] S514: Determine whether the matching loss function value is less than the first preset value; if so, proceed to step S516; if not, proceed to step S518.

[0174] S514: Use the current network parameters as the network parameters of the matching model to obtain the intermediate matching model.

[0175] S518: Adjust the network parameters of the attention network module based on the matching loss function value, and return to execute S508.

[0176] S520: Based on the intermediate matching model, predict the original data in multiple data clusters to obtain similarity results.

[0177] In one possible embodiment, for multiple data clusters, any one data cluster is selected, and the original data corresponding to the cluster center of any one data cluster is determined. The original data corresponding to the cluster center of any one data cluster is used as the first data to be predicted. The other original data in any one data cluster, excluding the original data corresponding to the cluster center, is used as the second data to be predicted. The first data to be predicted is concatenated with itself to obtain the first concatenated data to be predicted. The second data to be predicted is concatenated with itself to obtain the second concatenated data to be predicted. The first and second concatenated data to be predicted are used as a set of concatenated data to be predicted. Multiple sets of concatenated data to be predicted are determined from multiple data clusters. The multiple sets of concatenated data to be predicted are input into an intermediate matching model for prediction to obtain the similarity corresponding to the multiple sets of concatenated data to be predicted. The average of the similarity corresponding to the multiple sets of concatenated data to be predicted is taken to determine the similarity result.

[0178] For example, original data can be selected from multiple data clusters. Taking the original data in data cluster C_1 as an example, and taking sentences as examples of original data.

[0179] Select the cluster center sentence3 in data cluster C_1 as the first data to be predicted, and arbitrarily select the original data sentence4 in data cluster C_1 other than the cluster center as the second data to be predicted.

[0180] Since this disclosure uses concatenated data during the training of the matching model, sentence3 and sentence4 also need to be concatenated here, and concatenated with themselves respectively to form the first concatenated data to be predicted, sentence3+[sep]+sentence3, and the second concatenated data to be predicted, sentence4+[sep]+sentence4, forming a set of concatenated data to be predicted.

[0181] In this way, multiple sets of data to be predicted can be selected from multiple data clusters, and then input into the intermediate matching model for prediction to obtain the similarity of the multiple sets of data to be predicted. The similarity result is then calculated by taking the average value.

[0182] S522: Determine whether the similarity result is greater than the second preset value; if yes, proceed to step S524; if no, proceed to step S526.

[0183] S524: Adjust the parameters of the clustering algorithm and return to step S502.

[0184] In one possible embodiment, if the value is less than or equal to the second preset value, it indicates that during the model training process, the clustering effect was not good when processing the original data in the target dataset using the clustering algorithm, and re-clustering is required.

[0185] Furthermore, when re-clustering the original data in the target dataset using a clustering algorithm, if the k-means clustering algorithm is used, the value of K can be increased during re-clustering; if hierarchical clustering is used, strata can be added to ensure that the clustering effect is better than the previous clustering effect when re-clustering the original data in the target dataset using a clustering algorithm.

[0186] S526: Obtain the trained matching model.

[0187] The trained matching model can be determined through the above methods. The training method in this disclosure improves the accuracy of training by introducing other candidate datasets to increase the amount of data and increasing the correlation between training data. This provides more learning directions for the training matching model, and the differences between different datasets can also be learned.

[0188] Throughout the training process, unlabeled datasets were used, making the training of the matching model faster and more convenient. The accuracy of clustering was determined by the clustering method and the similarity results predicted by the intermediate matching model. The entire training process not only involved simple and easy data acquisition, but also uncomplicated data processing, without complex calculations, resulting in a high-precision and accurate matching model.

[0189] Once the training matching model is obtained, it can be used in various scenarios, such as computer vision, intelligent customer service, dialogue quality inspection, and database question answering.

[0190] Figure 6 A flowchart illustrating the process of using a matching model is shown, such as... Figure 6 As shown, it includes the following steps:

[0191] S602: Obtain the first and second data to be matched.

[0192] S604: Concatenate the first data to be matched with itself to obtain the first concatenated data to be matched.

[0193] S606: Concatenate the second data to be matched with itself to obtain the second concatenated data to be matched.

[0194] S608: Input the first and second data to be matched into the trained matching model to determine the matching similarity between the first and second data to be matched.

[0195] In one possible embodiment, the first and second data to be matched are input into the trained matching model by first inputting the first and second data to be matched into two fully connected layers, wherein the dropout of the two fully connected layers is greater than 0; the output of the fully connected layers is used as the input of the trained sub-matching model to obtain the matching similarity of the matching model.

[0196] Since the training process in this disclosure uses a data concatenation method, the data to be matched needs to be processed during use. The processing method is relatively simple: just concatenate the data to be matched with itself once, and then input it into the trained matching model to match similarity.

[0197] Based on the same inventive concept, this disclosure also provides a matching model training device, as shown in the following embodiment. Since the principle by which this device embodiment solves the problem is similar to that of the above-described method embodiment, the implementation of this device embodiment can refer to the implementation of the above-described method embodiment, and repeated details will not be elaborated further.

[0198] Figure 7 This diagram illustrates the structure of a matching model training device according to an embodiment of the present disclosure, as shown below. Figure 7 As shown, the matching model training device 70 includes:

[0199] Clustering unit 701 is used to perform clustering processing on the original data in the target dataset using a clustering algorithm to obtain multiple data clusters; wherein, the target dataset is obtained by combining two unlabeled candidate datasets.

[0200] The splicing unit 702 is used to splice every two original data points from multiple data clusters to obtain N spliced ​​data points;

[0201] The combination unit 703 is used to combine every two pieces of spliced ​​data from N spliced ​​data to obtain K data groups, and to determine the label value of each data group based on the data clustering of the original data in the K data groups.

[0202] Training unit 704 is used to train the untrained matching model based on K data groups and the label value of each data group until the matching loss function value corresponding to the untrained matching model is less than a first preset value, and the similarity result obtained by the untrained matching model based on the original data in multiple data clusters is greater than a second preset value, then the trained matching model is obtained.

[0203] Those skilled in the art will understand that various aspects of this disclosure can be implemented as a system, method, or program product. Therefore, various aspects of this disclosure can be specifically implemented in the following forms: a completely hardware implementation, a completely software implementation (including firmware, microcode, etc.), or a combination of hardware and software aspects, collectively referred to herein as a "circuit," "module," or "system."

[0204] The following reference Figure 8 To describe an electronic device 800 according to such an embodiment of the present disclosure. Figure 8 The electronic device 800 shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments disclosed herein.

[0205] like Figure 8 As shown, the electronic device 800 is manifested in the form of a general-purpose computing device. The components of the electronic device 800 may include, but are not limited to: at least one processing unit 810, at least one storage unit 820, and a bus 830 connecting different system components (including storage unit 820 and processing unit 810).

[0206] The storage unit stores program code that can be executed by the processing unit 810, causing the processing unit 810 to perform the steps described in the "Exemplary Methods" section of this specification according to various exemplary embodiments of this disclosure. For example, the processing unit 810 can perform the steps of any of the above method embodiments.

[0207] Storage unit 820 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 8201 and / or a cache memory unit 8202, and may further include a read-only memory unit (ROM) 8203.

[0208] The storage unit 820 may also include a program / utility 8204 having a set (at least one) of program modules 8205, such program modules 8205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each or some combination of these examples may include an implementation of a network environment.

[0209] Bus 830 can represent one or more of several types of bus structures, including a memory cell bus or memory cell controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local bus using any of the various bus structures.

[0210] Electronic device 800 can also communicate with one or more external devices 840 (e.g., keyboard, pointing device, Bluetooth device, etc.), and with one or more devices that enable a user to interact with electronic device 800, and / or with any device that enables electronic device 800 to communicate with one or more other computing devices (e.g., router, modem, etc.). This communication can be performed via input / output (I / O) interface 850. Furthermore, electronic device 800 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 860. As shown, network adapter 860 communicates with other modules of electronic device 800 via bus 830. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with electronic device 800, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0211] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, terminal device, or network device, etc.) to execute the methods according to the embodiments of this disclosure.

[0212] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as a computer program product or a computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods described above.

[0213] In exemplary embodiments of this disclosure, a computer-readable storage medium is also provided, which may be a readable signal medium or a readable storage medium. A program product capable of implementing the methods described above is stored thereon. In some possible implementations, various aspects of this disclosure may also be implemented as a program product including program code, which, when run on a terminal device, causes the terminal device to perform the steps described in the "Exemplary Methods" section of this specification according to various exemplary embodiments of this disclosure.

[0214] More specific examples of computer-readable storage media in this disclosure may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0215] In this disclosure, a computer-readable storage medium may include a data signal propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium, capable of transmitting, propagating, or transmitting a program for use by or in connection with an instruction execution system, apparatus, or device.

[0216] Optionally, the program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.

[0217] In practical implementation, program code for performing the operations of this disclosure can be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java and C++, and conventional procedural programming languages ​​such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).

[0218] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to embodiments of this disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.

[0219] Furthermore, although the steps of the method in this disclosure are described in a specific order in the accompanying drawings, this does not require or imply that the steps must be performed in that specific order, or that all the steps shown must be performed to achieve the desired result. Additional or alternative steps may be omitted, multiple steps may be combined into one step, and / or a step may be broken down into multiple steps.

[0220] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, mobile terminal, or network device, etc.) to execute the methods according to the embodiments of this disclosure.

[0221] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the appended claims.

Claims

1. A matching model training method, characterized in that, The method includes: The original data in the target dataset is clustered using a clustering algorithm to obtain multiple data clusters; wherein, the target dataset is obtained by combining two unlabeled candidate datasets. Each pair of original data from the multiple data clusters is concatenated to obtain N concatenated data; Combine every two pieces of spliced ​​data from N spliced ​​data to obtain K data groups, and determine the label value of each data group based on the data clustering of the original data in the K data groups; The untrained matching model is trained based on the K data groups and the label value of each data group until the matching loss function value corresponding to the untrained matching model is less than a first preset value, and the similarity result obtained by the untrained matching model based on the original data in the multiple data clusters is greater than a second preset value. Then the trained matching model is obtained.

2. The matching model training method according to claim 1, characterized in that, The process involves combining every two concatenated data points from N concatenated data sets to obtain K data groups, and determining the label value for each data group based on the data clustering of the original data in the K data groups, including: During the process of combining each pair of spliced ​​data, any data group obtained is judged to determine the label value corresponding to the data group. The judgment for any one of the K data sets is as follows: If the original data in two concatenated data sets within any given data set belongs to the same candidate dataset, then the label value of that data set is determined based on the data clustering of the four original data sets within that data set; and If any two original data points in any two concatenated data points in any data group belong to different candidate datasets, then the label value of any data group is determined based on the candidate dataset situation and data clustering situation corresponding to the four original data points in any data group.

3. The matching model training method according to claim 2, characterized in that, Each data group includes first spliced ​​data and second spliced ​​data; the first spliced ​​data includes first original data located in the first half during splicing and second original data located in the second half during splicing; the second spliced ​​data includes third original data located in the first half during splicing and fourth original data located in the second half during splicing. If the original data in two concatenated data sets in any data group belongs to the same candidate dataset, then the label value of any data group is determined based on the data clustering of the four original data sets in that data group, including: If the first original data and the second original data in the first spliced ​​data belong to the same data cluster, and the original data in the second spliced ​​data and the original data in the first spliced ​​data belong to the same data cluster, then the label value of any data group is determined to be the first value. If the first original data and the second original data in the first spliced ​​data belong to the same data cluster, and the third original data and the first original data belong to the same data cluster, and the fourth original data and the second original data do not belong to the same data cluster, or the third original data and the first original data do not belong to the same data cluster, and the fourth original data and the second original data belong to the same data cluster, then the label value of any one of the data groups is determined to be the second value. If the first original data and the second original data in the first spliced ​​data belong to the same data cluster, and the third original data does not belong to the same data cluster as the first original data, and the fourth original data does not belong to the same data cluster as the second original data, then the label value of any data group is determined to be the third value. If the first original data and the second original data in the first spliced ​​data do not belong to the same data cluster, and the third original data belongs to the same data cluster as the first original data, and the fourth original data belongs to the same data cluster as the second original data, then the label value of any data group is determined to be the first value. If the first original data and the second original data in the first spliced ​​data do not belong to the same data cluster, and the third original data and the first original data belong to the same data cluster, and the fourth original data and the second original data do not belong to the same data cluster, or the third original data and the first original data do not belong to the same data cluster, and the fourth original data and the second original data belong to the same data cluster, then the label value of any one of the data groups is determined to be the second value. If the first original data and the second original data in the first spliced ​​data do not belong to the same data cluster, and the third original data does not belong to the same data cluster as the first original data, and the fourth original data does not belong to the same data cluster as the second original data, then the label value of any one of the data groups is determined to be the third value.

4. The matching model training method according to claim 2, characterized in that, Each data group includes first spliced ​​data and second spliced ​​data; the first spliced ​​data includes first original data located in the first half during splicing and second original data located in the second half during splicing; the second spliced ​​data includes third original data located in the first half during splicing and fourth original data located in the second half during splicing. If any two original data points in any concatenated data set belong to different candidate datasets, then the label value of any data set is determined based on the candidate dataset information and data clustering information corresponding to the four original data points in the data set, including: If the first original data and the third original data belong to the same candidate dataset, and the second original data and the fourth original data do not belong to the same candidate dataset, and the first original data and the third original data belong to the same data cluster, then the label value of any one of the data groups is determined to be the second value. If the first original data and the third original data do not belong to the same candidate dataset, and the second original data and the fourth original data belong to the same candidate dataset, and the second original data and the fourth original data belong to the same data cluster, then the label value of any one of the data groups is determined to be the second value. If the first original data and the third original data belong to the same candidate dataset, and the second original data and the fourth original data do not belong to the same candidate dataset, and the first original data and the third original data do not belong to the same data cluster, then the label value of any one of the data groups is determined to be the third value. If the first original data and the third original data do not belong to the same candidate dataset, and the second original data and the fourth original data belong to the same candidate dataset, and the second original data and the fourth original data do not belong to the same data cluster, then the label value of any one of the data groups is determined to be the third value. If the first original data and the third original data do not belong to the same candidate dataset, and the second original data and the fourth original data do not belong to the same candidate dataset, then the label value of any one of the data groups is determined to be the third value.

5. The matching model training method according to claim 1, characterized in that, The untrained matching model consists of two fully connected layers and an untrained matching sub-model. The process of training the untrained matching model based on the K data groups and the label value of each data group is as follows: The untrained matching model is iteratively trained using the K data sets and the label values ​​of each data set, wherein one iteration of the training process includes: Training samples are extracted from the K data groups and input sequentially into two fully connected layers to train the self-representation of the original data, thus obtaining the first output result. The first output result is input into the untrained matching sub-model to train the correlation between the original data in the K data groups, and a second output result is obtained. The matching loss function value is determined based on the label value corresponding to the training sample and the second output result; Based on the matching loss function value, adjust the network parameters of the untrained matching model until the matching loss function value is less than a first preset value to obtain an intermediate matching model; The similarity results are obtained by predicting the original data in multiple data clusters based on the intermediate matching model; If the similarity result is greater than the second preset value, then the trained matching model is obtained.

6. The matching model training method according to any one of claims 1 or 5, characterized in that, The matching loss function is as follows: in, This represents the matching loss function; This represents the label value corresponding to the training sample extracted from the K data groups; This represents the second output result obtained from training the untrained matching model.

7. The matching model training method according to claim 5, characterized in that, The step of predicting the similarity results of the original data in multiple data clusters based on the intermediate matching model includes: For multiple data clusters, select any one data cluster and determine the original data corresponding to the cluster center of the arbitrary data cluster. Use the original data corresponding to the cluster center of the arbitrary data cluster as the first data to be predicted, and use the other original data in the arbitrary data cluster other than the original data corresponding to the cluster center as the second data to be predicted. The first data to be predicted is concatenated with itself to obtain the first concatenated data to be predicted. The second data to be predicted is concatenated with itself to obtain the second concatenated data to be predicted; The first and second data to be predicted are treated as a set of data to be predicted. Multiple sets of data to be predicted and spliced ​​are determined from the multiple data clusters; The multiple sets of spliced ​​data to be predicted are input into the intermediate matching model for prediction, and the similarity corresponding to the multiple sets of spliced ​​data to be predicted is obtained. The similarity result is determined by averaging the similarities of the multiple sets of spliced ​​data to be predicted.

8. The matching model training method according to claim 1, characterized in that, After obtaining the trained matching model, the method further includes: Get the first and second data to be matched; The first data to be matched is concatenated with itself to obtain the first concatenated data to be matched; The second data to be matched is concatenated with itself to obtain the second concatenated data to be matched; The first and second data to be matched are input into the trained matching model to determine the matching similarity between the first and second data to be matched.

9. An electronic device, characterized in that, include: processor; as well as Memory for storing the executable instructions of the processor; The processor is configured to execute the method of any one of claims 1 to 8 by executing the executable instructions.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method described in any one of claims 1 to 8.