Method and device for content comparison, equipment and storage medium

By introducing a difference margin into the content matching model, adjusting the difference between positive and negative sample pairs, and updating the model parameters, the problem of the traditional model's insufficient ability to distinguish between positive and negative sample pairs is solved, and the effect of the content matching task is improved.

CN120705600APending Publication Date: 2025-09-26BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510819888.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-18
Publication Date
2025-09-26

AI Technical Summary

Technical Problem

Traditional content matching models lack clear distinction and consideration of the intrinsic differences between sample pairs when distinguishing positive and negative sample pairs, resulting in insufficient task performance.

Method used

By introducing the difference margin, the difference margin is added to the predicted difference for positive sample pairs, and the difference margin is deducted from the predicted difference for negative sample pairs, and the parameters of the target machine learning model are updated to improve the model's discrimination ability in content matching tasks.

Benefits of technology

This improves the model's ability to distinguish between similar and dissimilar content sample pairs, enhancing the performance of content matching tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120705600A_ABST
    Figure CN120705600A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a content comparison method and device, equipment and a storage medium. The method comprises the following steps: acquiring corresponding reference indexes and corresponding training indexes for a plurality of content sample pairs; determining a difference margin between the positive sample pair and the at least one negative sample pair based on a reference index for the positive sample pair; based on the training indexes and the difference margin of the plurality of content sample pairs, determining the corresponding similarity measure of the plurality of content sample pairs, the similarity measure of the positive sample pair being determined by adding the difference margin on the corresponding training indexes, the similarity measurement of the at least one negative sample pair is determined by deducting the difference margin from the corresponding training index; and updating parameters of the target machine learning model based on the corresponding similarity measurements of the plurality of content sample pairs to obtain a trained target machine learning model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Example embodiments of the present disclosure generally relate to the field of computers, and more particularly, to methods, devices, apparatuses, computer-readable storage media, and computer program products for content comparison. Background Art

[0002] Content matching tasks involve using models to determine matching relationships between content pairs (e.g., text pairs, image pairs, etc.). This type of task has important applications in a variety of scenarios, including information retrieval, machine translation, and dialogue systems. However, the performance of traditional models in content matching tasks still needs to be improved. Summary of the Invention

[0003] In a first aspect of the present disclosure, a method for content comparison is provided. The method includes: obtaining corresponding reference indicators and corresponding training indicators for multiple content sample pairs, the reference indicators indicating reference differences of content samples in the corresponding content sample pairs, the training indicators indicating predicted differences of content samples in the corresponding content sample pairs determined via a target machine learning model, the multiple content sample pairs including positive sample pairs and at least one negative sample pair; determining a difference margin between the positive sample pair and the at least one negative sample pair based on the reference indicators for the positive sample pairs; determining corresponding similarity metrics for the multiple content sample pairs based on the training indicators and difference margins for the multiple content sample pairs, the similarity metrics for the positive sample pairs being determined by adding the difference margin to the corresponding training indicators, and the similarity metrics for each of the at least one negative sample pairs being determined by deducting the difference margin from the corresponding training indicators; and updating parameters of the target machine learning model based on the corresponding similarity metrics for the multiple content sample pairs to obtain a trained target machine learning model.

[0004] In the second aspect of the present disclosure, a device for content comparison is provided. The device includes: an acquisition module, configured to acquire corresponding reference indicators and corresponding training indicators for multiple content sample pairs, the reference indicators indicating the reference difference of the content samples in the corresponding content sample pairs, the training indicators indicating the predicted difference of the content samples in the corresponding content sample pairs determined by the target machine learning model, and the multiple content sample pairs including positive sample pairs and at least one negative sample pair; a first determination module, configured to determine the difference margin between the positive sample pair and the at least one negative sample pair based on the reference indicators for the positive sample pair; a second determination module, configured to determine the corresponding similarity metrics of the multiple content sample pairs based on the training indicators and the difference margin of the multiple content sample pairs, the similarity metrics of the positive sample pairs are determined by adding the difference margin to the corresponding training indicators, and the similarity metrics of the at least one negative sample pair are determined by deducting the difference margin from the corresponding training indicators; and an update module, configured to update the parameters of the target machine learning model based on the corresponding similarity metrics of the multiple content sample pairs to obtain a trained target machine learning model.

[0005] In a third aspect of the present disclosure, an electronic device is provided. The device includes at least one processor; and at least one memory coupled to the at least one processor and storing instructions for execution by the at least one processor. When executed by the at least one processor, the instructions cause the device to perform the method of the first aspect.

[0006] In a fourth aspect of the present disclosure, a computer-readable storage medium is provided, wherein computer-executable instructions are stored on the computer-readable storage medium, and the computer-executable instructions can be executed by a processor to implement the method of the first aspect.

[0007] In a fifth aspect of the present disclosure, a computer program product is provided, comprising computer-executable instructions, wherein when the computer-executable instructions are executed by a processor, the method according to the first aspect of the present disclosure is implemented.

[0008] It should be understood that the content described in this summary section is not intended to limit the key features or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0009] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. In the accompanying drawings, the same or similar reference numerals represent the same or similar elements, wherein:

[0010] Figure 1 A schematic diagram illustrating an example environment in which embodiments according to the present disclosure may be implemented;

[0011] Figure 2 A schematic diagram illustrating an example architecture for content comparison according to some embodiments of the present disclosure is shown;

[0012] Figure 3 A flowchart illustrating a process for content comparison according to some embodiments of the present disclosure is shown;

[0013] Figure 4 A schematic structural block diagram showing an example apparatus for content comparison according to some embodiments of the present disclosure; and

[0014] Figure 5 A block diagram of an electronic device capable of implementing various embodiments of the present disclosure is shown. DETAILED DESCRIPTION

[0015] The following describes embodiments of the present disclosure in more detail with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as limited to the embodiments described herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of protection of the present disclosure.

[0016] In the description of the embodiments of the present disclosure, the term "including" and similar terms should be understood as open inclusion, i.e., "including but not limited to". The term "based on" should be understood as "based at least in part on". The term "one embodiment" or "the embodiment" should be understood as "at least one embodiment". The term "some embodiments" should be understood as "at least some embodiments". Other explicit and implicit definitions may be included below.

[0017] Herein, unless explicitly stated otherwise, executing a step “in response to A” does not mean executing the step immediately after “A” but may include one or more intermediate steps.

[0018] It is understandable that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) must comply with the requirements of relevant laws, regulations and relevant provisions.

[0019] It is understandable that before using the technical solutions disclosed in the various embodiments of this disclosure, the type, scope of use, usage scenarios, etc. of the personal information involved in this disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.

[0020] For example, in response to receiving a user's active request, a prompt message is sent to the user to clearly remind the user that the operation requested to be performed will require obtaining and using the user's personal information, so that the user can independently choose whether to provide personal information to the electronic device, application, server or storage medium and other software or hardware that performs the operation of the technical solution of the present disclosure based on the prompt message.

[0021] As an optional but non-limiting implementation, in response to receiving a user's active request, a prompt message may be sent to the user, for example, in the form of a pop-up window, in which the prompt message may be presented in text form. Furthermore, the pop-up window may also include a selection control for the user to select "agree" or "disagree" to provide personal information to the electronic device.

[0022] It is understandable that the above notification and the process of obtaining user authorization are merely illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that comply with relevant laws and regulations may also be applied to the implementation of the present disclosure.

[0023] As used herein, the term "model" can learn the association between corresponding inputs and outputs from training data, so that after training is completed, corresponding outputs can be generated for given inputs. The generation of the model can be based on machine learning technology. Deep learning is a machine learning algorithm that processes inputs and provides corresponding outputs by using multiple layers of processing units. A neural network model is an example of a model based on deep learning. In this article, "model" may also be referred to as "machine learning model", "learning model", "machine learning network" or "learning network", and these terms are used interchangeably in this article.

[0024] A "neural network" is a machine learning network based on deep learning. A neural network is capable of processing inputs and providing corresponding outputs. It typically includes an input layer, an output layer, and one or more hidden layers between the input and output layers. Neural networks used in deep learning applications typically include many hidden layers, thereby increasing the depth of the network. The layers of a neural network are connected in sequence so that the output of the previous layer is provided as input to the next layer, where the input layer receives the input of the neural network and the output of the output layer serves as the final output of the neural network. Each layer of a neural network includes one or more nodes (also called processing nodes or neurons), each of which processes the input from the previous layer.

[0025] Generally speaking, machine learning can be roughly divided into three stages, namely the training stage, the testing stage, and the application stage (also known as the inference stage). In the training stage, a given model can be trained using a large amount of training data, and the parameter values ​​are continuously updated iteratively until the model can obtain consistent inferences that meet the expected goals from the training data. Through training, the model can be considered to be able to learn the association between input and output (also known as input-to-output mapping) from the training data. The parameter values ​​of the trained model are determined. In the testing stage, the test input is applied to the trained model to test whether the model can provide the correct output, thereby determining the performance of the model. In the application stage, the model can be used to process the actual input based on the parameter values ​​obtained through training to determine the corresponding output.

[0026] Figure 1 1 is a schematic diagram illustrating an example environment 100 in which embodiments of the present disclosure can be implemented. Figure 1 In the environment 100 of FIG. 1 , it is desirable to train and use such a model 130. The model 130 is configured to process inputs of one or more modalities, such as text, images, audio, video, and the like. In some examples, the model 130 can be trained to determine matching relationships between pairs of input content, such as whether the pairs of content are related or similar. In some examples, the model 130 can be a classification model that can be used to determine the category of the input content. In some embodiments, the model 130 can be an autoregressive model, such as a Transformer model.

[0027] like Figure 1 As shown, the environment 100 includes a training sample set 110 , a model training system 120 , and a model application system 140 . Figure 1 The upper part shows the process of the model training phase, and the lower part shows the process of the model application phase. Before training, the parameter values ​​of the model 130 may have initial values, or may have pre-trained parameter values ​​obtained through a pre-training process.

[0028] During the model training phase, a model 130 can be trained based on a training sample set 110 including a plurality of training samples 111 and using a model training system 120. Here, each training sample 111 can be in a two-tuple format. For example, for a content matching task, the training sample 111 can include a model input 112 and a model output 113. The model input 112 can include tokenized content pairs, and the model output 113 can include a true value result indicating a matching relationship between the content pairs. The training sample 111 including the model input 112 and the model output 113 can be used to train the model 130. For example, the training process can be iteratively performed using a large number of training samples. The model 130 can be trained via forward propagation and backpropagation, and the parameter values ​​of the model 130 can be updated and adjusted during the training process.

[0029] After training is completed, model 130' can be obtained. At this point, the parameter values ​​of model 130' have been updated, and based on the updated parameter values, model 130' can be used to determine the matching relationship between content pairs or to determine the category of content during the model application phase. During the model application phase, model 130' (at this point, model 130' has the trained parameter values) can be used to perform corresponding tasks through model application system 140. For example, a model input 141 including at least one word unit can be received, and a corresponding model output 142 can be output.

[0030] exist Figure 1 In the present invention, the model training system 120 and the model application system 140 may include any computing system with computing capabilities, such as various computing devices / systems, terminal devices, servers, etc. Terminal devices may involve any type of mobile terminal, fixed terminal, or portable terminal, including mobile phones, desktop computers, laptop computers, notebook computers, netbook computers, tablet computers, media computers, multimedia tablets, or any combination of the foregoing, including accessories and peripherals of these devices or any combination thereof. Servers include but are not limited to mainframes, edge computing nodes, computing devices in cloud environments, etc.

[0031] It should be understood that the structure and functionality of environment 100 are described for exemplary purposes only and do not imply any limitation on the scope of the present disclosure.

[0032] As mentioned above, the content matching task is to use a model to determine the matching relationship between input pairs (such as text pairs, image pairs, or text and images, etc.). This type of task has important application value in various application scenarios such as information retrieval, machine translation, and dialogue systems. In the traditional training method for this type of model, the similarity between positive sample pairs is ensured to be higher than that of negative sample pairs, so that the model can capture the similarity between paired samples. However, the traditional model training process usually does not clearly distinguish between positive and negative sample pairs, nor does it consider the inherent differences between sample pairs. As a result, the performance of traditional models in content matching tasks still needs to be improved.

[0033] In view of this, an embodiment of the present disclosure proposes an improved scheme for content comparison. In the improved scheme, the multiple content sample pairs for the target machine learning model to be trained include positive sample pairs and negative sample pairs. During the training process of the target machine learning model, the target machine learning model is used to determine a training index indicating the predicted difference of the content samples in the content sample pair. A reference index indicating the reference difference degree of the content samples in the content sample pair is obtained. Based on the reference index for the positive sample pair, the difference margin between the positive sample pair and at least one negative sample pair is determined. Based on the training index and the difference margin of the multiple content sample pairs, the corresponding similarity metrics of the multiple content sample pairs are determined, the similarity metrics of the positive sample pairs are determined by adding the difference margin to the corresponding training index, and the similarity metrics of the at least one negative sample pair are determined by deducting the difference margin from the corresponding training index. Thereafter, based on the corresponding similarity metrics of the multiple content sample pairs, the parameters of the target machine learning model are updated to obtain a trained target machine learning model.

[0034] In an embodiment of the present disclosure, a difference margin is introduced based on the degree of difference between the positive sample pairs. By adding a difference margin to the predicted difference of the positive sample pairs, the model is incentivized to assign a relatively low difference to the positive sample pairs with a higher reference similarity (that is, a lower reference difference), so as to improve the similarity measure (such as the similarity score) of the positive sample pairs. In contrast, by deducting the difference margin from the predicted difference of the negative sample pairs, the model is incentivized to assign a relatively high difference to the negative sample pairs with a lower reference similarity (that is, a higher reference difference), so as to reduce the similarity measure of the negative sample pairs. In this way, by introducing the margin space of two differences, the model is not only prompted to learn the difference between the positive sample pairs and the negative sample pairs, but also to learn the intrinsic differences of the sample pairs. The model thus obtained can more effectively distinguish between similar sample pairs and dissimilar sample pairs, thereby improving the model's ability to perform content matching tasks.

[0035] Some example embodiments of the present disclosure will be described below with continued reference to the accompanying drawings. Figure 2 A schematic diagram of an example architecture 200 for content comparison according to some embodiments of the present disclosure is shown. Figure 1 The improved solutions of the embodiments of the present disclosure are described using the environment 100 and the example architecture 200 in the example embodiment, but this is for illustrative purposes only. It should be understood that the improved solutions of the embodiments of the present disclosure are not limited to application in the environment 100 or the example architecture 200, but can also be applied to any other appropriate environment or architecture, and the embodiments of the present disclosure are not limited in this regard.

[0036] In some embodiments of the present disclosure, the model training system 120 obtains corresponding training indicators and corresponding reference indicators for multiple content sample pairs 210. The multiple content sample pairs 210 here can be referred to as a batch of sample pairs or a group of sample pairs, such as Figure 2 As shown, each batch of sample pairs may include content sample pair 210-1, content sample pair 210-2, ..., content sample pair 210-N, and so on, where N is a positive integer. The plurality of content sample pairs 210 may include a positive sample pair and at least one negative sample pair, the positive sample pair including two related content samples, and the negative sample pair including two unrelated content samples. In some examples, the positive sample pair may include a first content sample and a second content sample labeled as similar to the first content sample, and the negative sample pair may include a first content sample and a third content sample labeled as not similar to the first content sample. For example, the positive sample pair may include a text sample x i and with the text sample x i Related text sample x j . Negative sample pairs can include text samples x i and with the text sample x i Irrelevant text sample x j ′.

[0037] It is understood that content samples are not limited to text. Content samples can include content of any modality. Examples of content samples include, but are not limited to, text samples, image samples, video samples, audio samples, and the like. A content sample pair can include a pair of content samples of the same modality or different modalities. For example, a content sample pair can include a pair of text samples, a pair of image samples, or a pair of audio samples. For another example, a content sample pair can include a text sample and an image sample, a text sample and a video sample, a text sample and an audio sample, or an audio sample and an image sample, and the like.

[0038] In an embodiment of the present disclosure, target machine learning model 220 is a machine learning model to be trained. Model training system 120 trains target machine learning model 220 to perform content matching tasks. For example, target machine learning model 220 is used to determine whether input content pairs are related, the degree of relevance between content pairs, whether content pairs match, or the degree of matching between content pairs.

[0039] During the training process of the target machine learning model 220, the model training system 120 can use the target machine learning model 220 to determine the corresponding training indicators for each content sample pair 210 in the multiple content sample pairs 210. The training indicators indicate the predicted difference between the content samples 212 and 214 in the corresponding content sample pair 210. The model training system 120 can also determine the corresponding reference indicators for each content sample pair in the multiple content sample pairs 210. The reference indicators indicate the reference difference between the content samples 212 and 214 in the corresponding content sample pair 210. The method for determining the training indicators will be introduced first below, and then the method for determining the reference indicators will be introduced. It should be understood that the method for determining the training indicators and reference indicators below is only exemplary, and any other appropriate method can also be used to determine the training indicators and reference indicators, and the embodiments of the present disclosure are not limited to this.

[0040] In some embodiments, combined Figure 2 As shown, the model training system 120 uses the target machine learning model 220 to determine the corresponding predicted similarities 256 for multiple content sample pairs 210 along the feature consistency dimension. Subsequently, the model training system 120 can convert the corresponding predicted similarities 256 for the multiple content sample pairs 210 into corresponding training metrics for the multiple content sample pairs 210 based on the conversion relationship between the feature consistency dimension and the feature difference dimension. The predicted similarities 256 can be configured to indicate the degree of consistency between two content samples 212 and 214 along the feature dimension. For example, the predicted similarities 256 can be configured to indicate the degree of consistency between a pair of content feature representations 252 and 254 corresponding to the two content samples 212 and 214. The training metrics can be configured to indicate the degree of difference between the two content samples 212 and 214 along the feature dimension. For example, the training metrics can be configured to indicate the degree of difference between a pair of content feature representations 252 and 254 corresponding to the two content samples 212 and 214.

[0041] The target machine learning model 220 can adopt any appropriate model architecture capable of performing the matching task. Figure 2 As shown, the target machine learning model 210 may include a target encoder 232. The model training system may utilize the target encoder 232 to perform feature encoding on the plurality of content sample pairs 210 to determine a plurality of pairs of content feature representations corresponding to the plurality of content sample pairs 210. Each content sample pair 210 may include a content sample 212 and a content sample 214. Each pair of content feature representations may include a content feature representation 252 corresponding to the content sample 212 and a content feature representation 254 corresponding to the content sample 214. The model training system 120 may determine a similarity between the content feature representations 252 and 254 as a corresponding predicted similarity 256 for the plurality of content sample pairs 210.

[0042] In some embodiments, continued binding Figure 2 As shown, the target machine learning model 220 may include a base model 225 and an additional model 230, and the additional model 230 may include a target encoder 232 and a target decoder 234. In this case, the model training system 120 may determine the model input of the target machine learning model 220 based on the content sample pair 210. Feature encoding is performed on the model input using the target encoder 232 to determine a corresponding sample feature representation sequence. The model training system 120 may extract a feature representation subsequence corresponding to the content sample 212 and a feature representation subsequence corresponding to the content sample 214 from the sample feature representation sequence. Thereafter, the model training system 120 may determine a pair of content feature representations 252 and 254 corresponding to the content sample pair 210 based on the pair of feature representation subsequences.

[0043] As an example, the base model 225 may be a large language model (LLMs), and the additional model 230 may be an adaptable model that can adapt the pre-trained model to one or more specific tasks. The additional model 230 may include a target encoder 232 and a target decoder 234. The content sample pair 210 may include a text sample x i and text sample x j The model training system 120 can be based on the text sample x i , text sample x j And the prompt word information, determine the corresponding embedding representation X l Utilize the target encoder 232 to embed the representation X l Convert the original k-dimensional space to a low-dimensional space to obtain a sample feature representation sequence The model training system 120 can be used to represent the feature sequence r l Extract and text sample x i The corresponding m sample feature representations are averaged to obtain the content feature representation The model training system 120 can also train the text sample x j The corresponding n sample feature representations are averaged to obtain the content feature representation

[0044] It should be understood that the model architecture of the target machine learning model 220 described above is merely exemplary, and any other appropriate model architecture may be adopted according to actual needs. In the case of different model architectures, the manner of performing feature encoding on the content sample pair may be different. For example, the model training system 120 may also utilize the target encoder 232 to perform feature encoding on the content sample 212 and the content sample 214, respectively, to obtain a pair of content feature representations. The embodiments of the present disclosure do not limit the feature encoding method of the target machine learning model 220.

[0045] The similarity between the content feature representations 252 and 254 can be determined in a variety of ways. In some examples, the model training system can determine the cosine similarity between a pair of content feature representations 252 and 254. As an example, the model training system 120 can determine the cosine similarity between a pair of content feature representations using the following formula:

[0046]

[0047] in Represents the text sample x i The corresponding content feature representation is, Represents the text sample x j The corresponding content feature representation is, Content feature representation Content Feature Representation It should be understood that the model training system 120 is not limited to determining the cosine similarity between content feature representations, but can also determine the Euclidean distance, Pearson correlation coefficient, KL divergence, etc. between content feature representations. The embodiments of the present disclosure are not limited to this.

[0048] The conversion relationship between the feature consistency dimension and the feature difference dimension can indicate the conversion relationship between the degree of consistency (e.g., similarity) and the degree of difference (e.g., difference) of the content sample pair 210 in the feature dimension. The above conversion relationship may be different when the similarity or difference between feature representations is determined differently. The following describes some examples of this conversion relationship and the conversion of the predicted similarity 256 and the training indicator based on this conversion relationship.

[0049] In some embodiments, the training metric may include the predicted angle between the two content samples 212 and 214 in the corresponding content sample pair 210. The predicted angle may indicate the angular difference between the two content samples 212 and 214 in the feature space of the target machine learning model 220. In this case, the model training system 120 may convert the corresponding predicted similarities 256 of the multiple content sample pairs 210 into the corresponding predicted angles of the multiple content sample pairs 210 based on the conversion relationship between the feature consistency dimension and the feature difference dimension, and use them as the corresponding training metrics.

[0050] As an example, the model training system 120 may use the cosine similarity between a pair of content feature representations 252 and 254 as the predicted similarity 256 of the content sample pair 210 on the feature consistency dimension. The training indicator may include the angular difference between the pair of content feature representations 252 and 254 corresponding to the two content samples 212 and 214. In this case, the conversion relationship between the feature consistency dimension and the feature difference dimension may include an inverse cosine conversion relationship from the feature consistency dimension to the feature difference dimension. The model training system 120 may perform an inverse cosine transformation on the predicted similarity 256 based on the formula shown below to convert the predicted similarity 256 into a predicted angle:

[0051]

[0052] in represents the prediction angle, Content feature representation Content Feature Representation The model training system 120 can predict the angle As a training indicator for content sample pair 210, by predicting the angle to indicate the predicted difference between content sample 212 and content sample 214 .

[0053] It should be understood that the conversion relationship between the above-mentioned feature consistency dimension and the feature difference dimension is only exemplary. In the case of different methods for determining similarity or different definitions of difference, the conversion relationship may also be different. For example, if the predicted similarity 256 is determined by methods such as KL divergence or Euclidean distance, or if other indicators other than angular difference are used to indicate the predicted difference, the conversion relationship may be different. In actual application scenarios, the corresponding conversion relationship can be determined according to the selected similarity determination method and difference determination method.

[0054] In some embodiments, combined Figure 2As shown, the model training system 120 can use the trained reference machine learning model 240 to train the target machine learning model 220 using a distillation learning method. The reference machine learning model 240 can be trained to be able to perform content matching tasks, such as determining whether the input content pairs are related, the relevance between the content pairs, whether the content pairs match, or the matching degree between the content pairs, etc. In this case, the reference machine learning model 240 can be called a "teacher model" and the target machine learning model 220 can be called a "student model". The model training system 120 can use the reference machine learning model 240 to determine the corresponding reference similarities 266 of multiple content sample pairs 210 on the feature consistency dimension. Afterwards, the model training system 120 can convert the corresponding reference similarities 266 of multiple content sample pairs 210 into corresponding reference indicators of multiple content sample pairs based on the conversion relationship between the feature consistency dimension and the feature difference dimension.

[0055] The reference machine learning model 240 may employ any suitable model architecture capable of performing content matching tasks. Figure 2 As shown, the reference machine learning model 240 may include a reference encoder 242. The model training system 120 may utilize the reference encoder 242 to perform feature encoding on the plurality of content sample pairs 210 to determine a plurality of pairs of reference feature representations corresponding to the plurality of content sample pairs 210. Each pair of reference feature representations includes a reference feature representation 262 corresponding to the content sample 212 and a reference feature representation 264 corresponding to the content sample 214. The model training system 120 may determine a similarity between each pair of reference feature representations 262 and 264 in the plurality of pairs of reference feature representations as a corresponding reference similarity 266 for the plurality of content sample pairs 210.

[0056] The model training system 120 may determine the reference similarity between the reference feature representations 262 and 264 using the same or different method as the method for determining the predicted similarity between the content feature representations 252 and 254. As an example, the reference machine learning model 210 may include a small language model (SLMs) or be obtained based on an SLM. The content sample 212 may include a text sample x i , the content sample 214 may include a text sample x j The model training system 120 can determine the text samples x i and text sample x j The corresponding embedding representation and embedding representation Where m and n represent the number of words in the corresponding embedding representation. The model training system 120 can use the reference encoder 242 to respectively iand embedding representation X j Perform feature encoding to obtain reference feature representation and reference feature representation The model training system 120 can use formula (1) to determine the reference feature representation and reference feature representation The cosine similarity between

[0057] It should be understood that the model architecture of the reference machine learning model 210 is merely exemplary, and any other appropriate model architecture may be selected based on actual needs. Furthermore, the method for determining the similarity between the reference feature representations 262 and 264 is also exemplary, and the Euclidean distance, Pearson correlation coefficient, KL divergence, etc., between the reference feature representations 262 and 264 may also be determined. The embodiments of the present disclosure are not limited to this.

[0058] In some embodiments, the reference indicator may include a reference angle of the corresponding content sample pair 210. The reference angle may indicate the angular difference between the two content samples 212 and 214 in the corresponding content sample pair 210 in the feature space of the reference machine learning model 240. In this case, the model training system 120 may convert the corresponding reference similarities 266 of the multiple content sample pairs 210 into corresponding reference angles of the multiple content sample pairs 210 based on the conversion relationship between the feature consistency dimension and the feature difference dimension, to serve as the corresponding reference indicators.

[0059] The conversion relationship between the feature consistency dimension and the feature difference dimension has been described above and will not be elaborated here. Please refer to the above introduction. As an example, the conversion relationship between the feature consistency dimension and the feature difference dimension may include an inverse cosine conversion relationship. The model training system 120 may perform an inverse cosine conversion on the reference similarity 266 based on the formula shown below to convert the reference similarity 266 into a reference angle:

[0060]

[0061] in represents the reference angle, Reference feature representation Represented with reference features The model training system 120 can use the reference angle As a reference indicator of content samples to 210, through the reference angle to indicate the reference difference between content samples 212 and 214 in content sample pair 210. Thus, the cosine similarity can be converted into a reference angle (also referred to as "angular distance") between content samples 212 and 214 using the inverse cosine function. This conversion can amplify subtle differences in similarity and enhance the model's ability to distinguish, making it easier for the model to distinguish between similar and dissimilar samples.

[0062] It should be understood that the above-mentioned method of determining training indicators and reference indicators is merely exemplary. The model training system 120 is not limited to using the reference machine learning model 240 to determine the reference indicators, and any other appropriate method may be selected to determine the reference indicators according to actual needs. In some examples, the model training system 120 may also determine the similarity between content sample pairs based on a similarity determination algorithm, and then determine the reference indicators based on the similarity. In other examples, the model training system 120 may also map the content sample pairs to a vector space and obtain sample vectors corresponding to the content sample pairs. The reference indicators are determined by determining the distance between the sample vectors.

[0063] In some embodiments of the present disclosure, the model training system 120 determines the difference margin between the positive sample pair and at least one negative sample pair based on the reference index for the positive sample pair. The difference margin is configured to adjust the relative distance between the positive sample pair and the negative sample pair in the feature space of the target machine learning model 220. In some examples, the difference margin can be configured to be in direct proportion to the reference index. That is, if the reference difference between the content samples of the positive sample pair is greater (that is, the lower the reference similarity 266 is), the greater the difference margin. If the reference difference between the content samples of the positive sample pair is smaller (that is, the higher the reference similarity 266 is), the difference margin is small. Thus, the difference margin can be dynamically adjusted based on the reference similarity 266 between the positive sample pairs, thereby motivating the model to recognize the intrinsic differences between the sample pairs.

[0064] In some embodiments, the model training system 120 determines the difference margin based on the reference metric for the positive sample pair and a predetermined scaling factor. The predetermined scaling factor is configured to adjust the effect of the reference metric on the target machine learning model 220. For example, if the reference metric includes a reference angle The difference margin can be expressed as where m c Represents a predetermined scaling factor. It will be understood that the above-mentioned method of determining the difference margin is merely exemplary. In actual application scenarios, the model training system 120 may select any other appropriate method to determine the difference margin based on the reference indicator. For example, the model training system 120 may also determine the difference margin based on other functional relationships. The embodiments of the present disclosure do not limit the method for determining the difference margin.

[0065] In some embodiments of the present disclosure, the model training system 120 determines corresponding similarity metrics for the plurality of content sample pairs 210 based on the training metrics and difference margins of the plurality of content sample pairs 210. The similarity metrics may indicate the degree of similarity between the content samples 212 and 214 in the corresponding content sample pairs 210. Generally speaking, a larger similarity metric indicates a higher degree of similarity between the pair of content samples 212 and 214. A smaller similarity metric indicates a lower degree of similarity between the pair of content samples 212 and 214.

[0066] The similarity measure of the positive sample pair is determined by adding a difference margin to the corresponding training indicator. Since the training indicator and the difference margin are indicators on the feature difference dimension, and the similarity measure is an indicator on the feature consistency dimension, the similarity measure of the positive sample pair can be inversely proportional to the result after adding the difference margin to the training indicator. In other words, if the result after adding the difference margin to the predicted difference of the positive sample pair is larger, the similarity measure of the positive sample pair is smaller, indicating that the similarity between the two content samples in the positive sample pair is lower. If the result after adding the difference margin to the predicted difference of the positive sample pair is smaller, the similarity of the positive sample pair is larger, indicating that the similarity between the two content samples in the positive sample pair is higher.

[0067] In some embodiments, the model training system 120 may determine a first intermediate result obtained by adding a difference margin to the training index of the positive sample pair. The first intermediate result may indicate the degree of difference after adjustment for the difference margin based on the predicted difference of the positive sample pair. The model training system 120 may determine a first feature consistency measure corresponding to the first intermediate result on the feature consistency dimension. The first feature consistency measure may indicate an adjusted degree of similarity corresponding to the adjusted degree of difference. Thereafter, the model training system 120 may determine a similarity measure for the positive sample pair based on the first feature consistency measure. The similarity measure may be understood as a quantitative indicator of the similarity of the positive sample pair.

[0068] As an example, if the training metric of the positive sample pair includes the predicted angle of the content sample pair 210 And the difference margin is The first intermediate result of the positive sample pair can be expressed as The model training system 120 may determine the cosine value of the first intermediate result As the first feature consistency measure. Afterwards, the model training system 120 can use the natural exponential function to determine the exponential of the first feature consistency measure with the natural constant as the base As a similarity measure for positive sample pairs.

[0069] The similarity measure for each of the at least one negative sample pair is determined by deducting the difference margin from the corresponding training metric. Combined with the analysis of the similarity measure for the positive sample pair described above, it can be seen that the similarity measure for the negative sample pair can also be inversely proportional to the result after deducting the difference margin from the training metric. Model training system 120 can convert the result after deducting the difference margin from the training metric into a similarity measure using various conversion methods.

[0070] In some embodiments, the model training system 120 may determine a second intermediate result obtained by deducting the difference margin from the training index of the negative sample pair. The second intermediate result indicates the degree of difference adjusted by the difference margin based on the predicted difference of the negative sample pair. The model training system 120 may determine a second feature consistency measure corresponding to the second intermediate result on the feature consistency dimension. The second feature consistency measure may indicate an adjusted degree of similarity corresponding to the adjusted degree of difference of the negative sample pair. Thereafter, the model training system 120 may determine a similarity measure of the negative sample pair based on the second feature consistency measure. The similarity measure may be understood as a quantitative indicator of the similarity of the negative sample pair.

[0071] As an example, if the training metric of the negative sample pair includes the predicted angle of the content sample pair 210 And the difference margin is The second intermediate result of the negative sample pair can be expressed as The model training system 120 may determine a second intermediate result The cosine value of As the second feature consistency measure. Afterwards, the model training system 120 can use the natural exponential function to determine the exponential of the second feature consistency measure with the natural constant as the base As a similarity measure for negative sample pairs.

[0072] It should be understood that the above method for determining the similarity measure is merely exemplary, and any other appropriate method can be selected to determine the similarity measure between the positive sample pair and the negative sample pair, as long as the similarity measure is inversely proportional to the result after adding or subtracting the difference margin from the training index. The embodiments of the present disclosure are not limited to this.

[0073] In some embodiments of the present disclosure, the model training system 120 updates the parameters of the target machine learning model 220 based on the corresponding similarity metrics of the plurality of content sample pairs 210 to obtain a trained target machine learning model 220. For a batch of samples, the model training system 120 may update the parameters of the target machine learning model 220 based on the similarity metrics of the positive sample pairs in the batch of samples and the similarity metrics of the at least one negative sample pair.

[0074] In some embodiments, the model training system 120 may determine a total similarity metric of the similarity metrics of the at least one negative sample pair. The model training system 120 may update the parameters of the target machine learning model 220 based on the similarity metric of the positive sample pair and the total similarity metric of the at least one negative sample pair using a contrastive loss function as shown below:

[0075]

[0076] As an example, the similarity measure of a positive sample pair can be expressed as The similarity metric of negative sample pairs can be expressed as In this case, the model training system 120 may determine the contrastive loss based on the following formula:

[0077]

[0078] Where i,j represents a positive sample pair, i,j ′ Denotes a negative sample pair. Combining formula (5), we can see that the contrast loss is affected by the reference angle of the positive sample pair. Impact. For positive sample pairs with higher reference similarity (that is, lower reference difference), a smaller angular distance margin (that is, difference margin) is added, resulting in a larger similarity measure. For positive sample pairs with lower reference similarity, a smaller angular distance margin is added, resulting in a relatively small similarity measure. For negative sample pairs, their similarity measure can be further reduced by reducing the angular distance margin. In this way, the target machine learning model 220 can effectively learn the relationship between positive and negative samples and the relative distance within the sample pair from the feature representation of the reference machine learning model 240, thereby improving the ability of the target machine learning model 220 to distinguish between positive and negative sample pairs.

[0079] In some embodiments, as Figure 2As shown, for a content sample pair 210 among multiple content sample pairs 210, the model training system 120 can obtain the annotation information 260 for the content sample pair 210. The annotation information 260 indicates whether the content samples in the content sample pair 210 are related, that is, the ground truth of the content sample pair 210. The model training system 120 can determine whether the reference similarity 266 of the content sample pair 210 corresponds to the annotation information 260. If the corresponding reference similarity 266 matches the corresponding annotation information 260, it means that the prediction result of the reference machine learning model 240 matches the ground truth, and the reference metric determined using the reference machine learning model 210 is credible. In this case, the model training system 120 can update the parameters of the target machine learning model 210 based on the corresponding similarity measure of the content sample pair 210. If the corresponding reference similarity 266 does not match the corresponding annotation information 260, it means that the prediction result of the reference machine learning model 240 does not match the ground truth. In this case, the reference metric determined using the reference machine learning model 210 may be unreliable. Accordingly, the model training system 120 may discard the result of the content sample pair 210. This ensures that the training process is more reliable.

[0080] In some embodiments, the model training system 120 may determine whether the reference similarity 266 and the annotation information 260 meet at least one of a first predetermined condition or a second predetermined condition. The first predetermined condition indicates that the reference similarity 266 does not exceed a first threshold and the annotation information 260 indicates that the content samples 212 and 214 in the content sample pair 210 are related. The second predetermined condition indicates that the reference similarity 266 exceeds a second threshold and the annotation information 260 indicates that the content samples in the content sample pair 210 are not related. The first threshold and the second threshold may indicate whether a pair of reference feature representations are similar. The first threshold and the second threshold may be the same or different.

[0081] If reference similarity 266 does not exceed the first threshold, it means that the pair of reference features are not similar, which in turn means that the prediction result of reference machine learning model 240 indicates that the content sample pair 210 is unrelated. If annotation information 260 indicates that the content samples in the content sample pair are related, it means that the prediction result of reference machine learning model 240 is inconsistent with the true value. In other words, if reference similarity 266 and annotation information 260 meet the first predetermined condition, it means that the prediction result of reference machine learning model 240 is inconsistent with the true value.

[0082] If reference similarity 266 exceeds the second threshold, it means that the pair of reference features are similar, which in turn means that the prediction result of reference machine learning model 240 indicates that the content sample pair is related. If annotation information 260 indicates that the content samples in the content sample pair are unrelated, it means that the prediction result of reference machine learning model 240 is inconsistent with the true value. In other words, if reference similarity 266 and annotation information 260 meet the second predetermined condition, it means that the prediction result of reference machine learning model 240 is inconsistent with the true value.

[0083] If reference similarity 266 and annotation information 260 do not meet the first predetermined condition and do not meet the second predetermined condition, it means that the prediction result of reference machine learning model 240 for the content sample pair is consistent with the true value. In this case, model training system 120 can determine that reference similarity 266 matches annotation information 260. By introducing a dual threshold strategy to filter noise, the training process can be ensured to be more reliable.

[0084] As an example, the content sample pair 210 may include a text sample x i and text sample x j The model training system 120 may obtain the annotation information 260, which may include an indication text sample x i and text sample x j Are there related labels y ij If the label y ij =1, indicating that the text sample x i With text sample x j Related, if the label y ij =0, indicating that the text sample x i With text sample x j The model training system 120 can filter out untrustworthy content sample pairs 210 using the following filtering function:

[0085]

[0086] Where θ represents the first threshold and 1-θ represents the second threshold. Combining formula (3), we can see that if the text sample x i and text sample x j The cosine similarity between a corresponding pair of reference feature representations And label y ij =1 indicates text sample x i With text sample x j Correlation means that the prediction result of the reference machine learning model 240 does not match the true value, and the result of the filter function Text sample x i and text sample x jThe cosine similarity between a corresponding pair of reference feature representations And label y ij =0 indicates text sample x i With text sample x j Irrelevant, also means that the prediction result of the reference machine learning model 220 does not match the true value, and the result of the filter function In other cases,

[0087] If the model training system 120 filters untrustworthy content sample pairs 210 based on formula (6), and the model training system 120 updates the parameters of the target machine learning model 220 based on the contrastive loss function shown in formula (5), then formula (5) can be rewritten as:

[0088]

[0089] That is, the model training system 120 can update the parameters of the target machine learning model 220 based on the contrast loss function shown in formula (7).

[0090] In some embodiments, as Figure 2 As shown, the model training system 120 can also update the parameters of the target machine learning model 220 based on the difference between the corresponding reference similarities 256 and the corresponding predicted similarities 266 of the multiple content sample pairs 210. In this way, the predicted similarities of a pair of content feature representations 252 and 254 generated by the target machine learning model 220 can be aligned with the reference similarities of a pair of reference feature representations 262 and 264 generated by the reference machine learning model 240, so that the target machine learning model 220 can effectively learn the representation capabilities from the reference machine learning model 240, thereby improving the ability of the target machine learning model 220 to perform content matching tasks.

[0091] As an example, for a batch of sample pairs, the model training system 120 may determine the cosine similarity between a pair of content feature representations without distinguishing between positive sample pairs and negative sample pairs. and the cosine similarity between a pair of reference feature representations The model training system 120 may update the parameters of the target machine learning model 220 based on the distillation loss function as shown below:

[0092]

[0093] Where N represents the number of content sample pairs 210 in a batch of sample pairs.

[0094] In some embodiments, as Figure 2As shown, the model training system 120 uses the target machine learning model 220 to determine a prediction result 258 indicating whether the content samples 212 and 214 in the content sample pair 210 are related based on at least a pair of content feature representations 252 and 254. The model training system 120 can also update the parameters of the target machine learning model 220 based on the difference between the prediction result 258 and the corresponding annotation information 260 of the content sample pair 210. In other words, the model training system 120 can also update the parameters of the target machine learning model 220 based on the supervision loss between the prediction result 258 and the true value. In this way, the prediction result 258 of the target machine learning model 220 can be aligned with the true value result.

[0095] As an example, the model training system 120 can obtain the model output a of the target machine learning model 220 = [a yes ,a no ]. The model training system 120 can determine the probability of correlation between the content samples in the content sample pair 210 based on the model output a As the prediction result 258, the model training system can update the parameters of the target machine learning model 220 based on the supervised loss function as shown below:

[0096]

[0097] Where y represents the annotation information 260, which can indicate the text sample x i With text sample x j Are there any correlations between them?

[0098] In some embodiments, the target machine learning model 220 may include a base model 225 and an additional model 230. The additional model 230 includes a target encoder 232 and a target decoder 234. The base model 225 may be a pre-trained model, and the model training system 120 may freeze the parameters of the base model 225. The model training system 120 may update the parameters of the additional model 230 based on at least one of the corresponding similarity metrics of the plurality of content sample pairs 210, the difference between the predicted similarity 256 and the reference similarity 266, or the difference between the predicted result 258 of the target machine learning model 220 and the annotation information 260. Thus, the additional model 230 can be used to learn the ability to perform matching tasks from the reference machine learning model 240, thereby not only retaining the task capabilities of the base model 225, but also improving the ability of the target machine learning model 220 to perform matching tasks.

[0099] As an example, the reference machine learning model 240 may be a small language model (SLMs). The base model 225 may be a pre-trained large language model (LLMs), which may have a corresponding pre-trained weight matrix The additional model 230 may include a target encoder 232 and a target decoder 234, and the target encoder 232 may have a corresponding weight matrix The target decoder 234 may have a corresponding weight matrix where r << min(d, k). The model training system 120 may freeze the weight matrix W0 and update the weight matrix A and the weight matrix B corresponding to the target encoder 232 and the target decoder 234 to utilize the ability of the additional model 230 to perform matching tasks by distilling learning from a small language model. In this way, by using the additional model 230 to redesign the LLMs into an encoder-decoder architecture, the structural differences between decoder-based LLMs and encoder-based SLMs can be bridged, which can not only make full use of the powerful semantic understanding ability of LLMs, but also enable LLMs to distill the ability to perform matching tasks from SLMs.

[0100] It should be noted that the above target machine learning model 220 and reference machine learning model 240 are only exemplary. In actual application scenarios, the target machine learning model 220 and the reference machine learning model 240 may also adopt any other appropriate model structures. In some examples, the target machine learning model 220 may also include a target encoder and a target decoder. That is, the target machine learning model 220 may be based on an encoder-decoder architecture. In other examples, the target machine learning model 220 may only include a target encoder. That is, the target machine learning model 220 may be an encoder-based model. The embodiments of the present disclosure do not limit the model architectures of the target machine learning model 220 and the reference machine learning model 210.

[0101] In this way, by introducing two margin spaces of difference degrees, not only can the model learn the differences between positive sample pairs and negative sample pairs, but also the model can learn the inherent differences of sample pairs. The resulting model can more effectively distinguish similar sample pairs and dissimilar sample pairs, thereby improving the ability of the model to distinguish positive sample pairs and negative sample pairs. ​​​​​​​

[0104] In block 320 , the model training system 120 determines a difference margin between the positive sample pair and at least one negative sample pair based on the reference metric for the positive sample pair.

[0105] At block 330, the model training system 120 determines corresponding similarity metrics for the plurality of content sample pairs based on the training metrics and the difference margins for the plurality of content sample pairs. The similarity metrics for the positive sample pairs are determined by adding the difference margins to the corresponding training metrics, and the similarity metrics for each of the at least one negative sample pair are determined by subtracting the difference margins from the corresponding training metrics.

[0106] In box 340, the model training system 120 updates the parameters of the target machine learning model based on the corresponding similarity metrics of the multiple content sample pairs to obtain a trained target machine learning model.

[0107] In some embodiments, obtaining corresponding reference indicators and corresponding training indicators for multiple content sample pairs includes: using a trained reference machine learning model to determine the corresponding reference similarities of multiple content sample pairs in the feature consistency dimension; using a target machine learning model to determine the corresponding predicted similarities of multiple content sample pairs in the feature consistency dimension; and based on the conversion relationship between the feature consistency dimension and the feature difference dimension, converting the corresponding reference similarities and corresponding predicted similarities of multiple content sample pairs into corresponding reference indicators and corresponding training indicators of multiple content sample pairs, respectively.

[0108] In some embodiments, determining the corresponding reference similarities of multiple content sample pairs includes: performing feature encoding on the multiple content sample pairs using a reference encoder of a reference machine learning model to determine multiple pairs of reference feature representations corresponding to the multiple content sample pairs; and determining the similarity between each pair of reference feature representations in the multiple pairs of reference feature representations as the corresponding reference similarities of the multiple content sample pairs.

[0109] In some embodiments, determining the corresponding predicted similarities of multiple content sample pairs includes: performing feature encoding on the multiple content sample pairs using a target encoder of a target machine learning model to determine multiple pairs of content feature representations corresponding to the multiple content sample pairs; and determining the similarity between each pair of content feature representations in the multiple pairs of content feature representations as the corresponding predicted similarities of the multiple content sample pairs.

[0110] In some embodiments, converting the corresponding reference similarities and corresponding predicted similarities of multiple content sample pairs into corresponding reference indicators and corresponding training indicators of the multiple content sample pairs respectively includes: according to the conversion relationship, converting the corresponding reference similarities of the multiple content sample pairs into corresponding reference angles of the multiple content sample pairs as corresponding reference indicators, the reference angle indicating the angular difference of the content samples in the corresponding content sample pairs in the feature space of the reference machine learning model; and according to the conversion relationship, converting the corresponding predicted similarities of the multiple content sample pairs into corresponding predicted angles of the multiple content sample pairs as corresponding training indicators, the predicted angle indicating the angular difference of the content samples in the corresponding content samples in the feature space of the target machine learning model.

[0111] In some embodiments, updating the parameters of the target machine learning model includes: determining, for a content sample pair among multiple content sample pairs, whether a reference similarity of the content sample pair matches the annotation information of the content sample pair, the annotation information indicating whether the content samples in the content sample pair are related; and updating the parameters of the target machine learning model based on the corresponding similarity measure of the content sample pair in response to the corresponding reference similarity matching the corresponding annotation information.

[0112] In some embodiments, parameters of the target machine learning model are further updated based on the differences between corresponding reference similarities and corresponding predicted similarities of multiple content sample pairs.

[0113] In some embodiments, determining the difference margin includes determining the difference margin based on a reference indicator for the positive sample pair and a predetermined scaling factor.

[0114] In some embodiments, the similarity measure of the positive sample pair is determined by: determining a first intermediate result obtained by adding a difference margin to the training indicators of the positive sample pair; determining a first feature consistency measure corresponding to the first intermediate result in the feature consistency dimension; and determining the similarity measure of the positive sample pair based on the first feature consistency measure.

[0115] In some embodiments, the similarity measure of the negative sample pair is determined by: determining a second intermediate result obtained by deducting a difference margin from the training indicator of the negative sample pair; determining a second feature consistency measure corresponding to the second intermediate result in the feature consistency dimension; and determining the similarity measure of the negative sample pair based on the second feature consistency measure.

[0116] In some embodiments, the target machine learning model includes a base model and an additional model, and updating the parameters of the target machine learning model includes: updating the parameters of the additional model based on a similarity measure of multiple content sample pairs.

[0117] The embodiments of the present disclosure also provide corresponding devices for implementing the above methods or processes. Figure 4 FIG4 is a schematic block diagram of an example apparatus 400 for content comparison according to certain embodiments of the present disclosure. The apparatus 400 may be implemented as or included in the model training system 120. Each module / component in the apparatus 400 may be implemented by hardware, software, firmware, or any combination thereof.

[0118] like Figure 4 As shown, the device 400 includes: an acquisition module 410, configured to acquire corresponding reference indicators and corresponding training indicators for multiple content sample pairs, the reference indicators indicate the reference difference of the content samples in the corresponding content sample pairs, and the training indicators indicate the predicted difference of the content samples in the corresponding content sample pairs determined via the target machine learning model, and the multiple content sample pairs include positive sample pairs and at least one negative sample pair; a first determination module 420, configured to determine the difference margin between the positive sample pair and the at least one negative sample pair based on the reference indicators for the positive sample pairs; a second determination module 430, configured to determine the corresponding similarity metrics of the multiple content sample pairs based on the training indicators and the difference margin of the multiple content sample pairs, the similarity metrics of the positive sample pairs are determined by adding the difference margin to the corresponding training indicators, and the similarity metrics of the at least one negative sample pair are determined by deducting the difference margin from the corresponding training indicators; and an update module 440, configured to update the parameters of the target machine learning model based on the corresponding similarity metrics of the multiple content sample pairs to obtain a trained target machine learning model.

[0119] In some embodiments, the acquisition module 410 is further configured to: use a trained reference machine learning model to determine the corresponding reference similarities of multiple content sample pairs in the feature consistency dimension; use a target machine learning model to determine the corresponding predicted similarities of multiple content sample pairs in the feature consistency dimension; and based on the conversion relationship between the feature consistency dimension and the feature difference dimension, convert the corresponding reference similarities and corresponding predicted similarities of multiple content sample pairs into corresponding reference indicators and corresponding training indicators of multiple content sample pairs, respectively.

[0120] In some embodiments, the acquisition module 410 is further configured to: perform feature encoding on multiple content sample pairs using a reference encoder of a reference machine learning model to determine multiple pairs of reference feature representations corresponding to the multiple content sample pairs; and determine the similarity between each pair of reference feature representations in the multiple pairs of reference feature representations as the corresponding reference similarities of the multiple content sample pairs.

[0121] In some embodiments, the acquisition module 410 is further configured to: perform feature encoding on multiple content sample pairs using a target encoder of a target machine learning model to determine multiple pairs of content feature representations corresponding to the multiple content sample pairs; and determine the similarity between each pair of content feature representations in the multiple pairs of content feature representations as the corresponding predicted similarities of the multiple content sample pairs.

[0122] In some embodiments, the acquisition module 410 is further configured to: convert the corresponding reference similarities of multiple content sample pairs into corresponding reference angles of multiple content sample pairs as corresponding reference indicators based on the conversion relationship, and the reference angle indicates the angular difference of the content samples in the corresponding content sample pairs in the feature space of the reference machine learning model; and convert the corresponding predicted similarities of multiple content sample pairs into corresponding predicted angles of multiple content sample pairs as corresponding training indicators based on the conversion relationship, and the predicted angle indicates the angular difference of the content samples in the corresponding content samples in the feature space of the target machine learning model.

[0123] In some embodiments, the update module 440 is further configured to: determine, for a content sample pair among multiple content sample pairs, whether the reference similarity of the content sample pair matches the annotation information of the content sample pair, the annotation information indicating whether the content samples in the content sample pair are related; and in response to the corresponding reference similarity matching the corresponding annotation information, update the parameters of the target machine learning model based on the corresponding similarity measure of the content sample pair.

[0124] In some embodiments, parameters of the target machine learning model are further updated based on the differences between corresponding reference similarities and corresponding predicted similarities of multiple content sample pairs.

[0125] In some embodiments, the first determination module 420 is further configured to determine a difference margin based on a reference indicator for the positive sample pair and a predetermined scaling factor.

[0126] In some embodiments, the second determination module 430 is further configured to: determine a first intermediate result obtained by adding the difference margin to the training indicator of the positive sample pair; determine a first feature consistency measure corresponding to the first intermediate result in the feature consistency dimension; and determine a similarity measure of the positive sample pair based on the first feature consistency measure.

[0127] In some embodiments, the second determination module 430 is further configured to: determine a second intermediate result obtained by deducting the difference margin from the training index of the negative sample pair; determine a second feature consistency measure corresponding to the second intermediate result in the feature consistency dimension; and determine the similarity measure of the negative sample pair based on the second feature consistency measure.

[0128] In some embodiments, the target machine learning model includes a base model and an additional model, and wherein the update module 440 is further configured to update parameters of the additional model based on a similarity measure of multiple content sample pairs.

[0129] The units and / or modules included in the device 400 can be implemented in various ways, including software, hardware, firmware, or any combination thereof. In some embodiments, one or more units and / or modules can be implemented using software and / or firmware, such as machine executable instructions stored on a storage medium. In addition to or as an alternative to machine executable instructions, some or all of the units and / or modules in the device 400 can be implemented at least in part by one or more hardware logic components. By way of example and not limitation, exemplary types of hardware logic components that can be used include field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chip (SOCs), complex programmable logic devices (CPLDs), and the like.

[0130] Figure 5 1 shows a block diagram of an electronic device 500 in which one or more embodiments of the present disclosure may be implemented. It should be understood that Figure 5 The illustrated electronic device 500 is merely exemplary and should not be construed as limiting the functionality and scope of the embodiments described herein. Figure 5 The electronic device 500 shown may include or be implemented as Figure 1 Model training system 120, or Figure 4 device 400.

[0131] like Figure 5 As shown, electronic device 500 is in the form of a general electronic device. Components of electronic device 500 may include, but are not limited to, one or more processors or processing units 510, memory 520, storage device 530, one or more communication units 540, one or more input devices 550, and one or more output devices 560. Processor 510 may be a real or virtual processor and is capable of performing various processes according to computer-executable instructions stored in memory 520. In a multi-processor system, multiple processors execute computer-executable instructions in parallel to increase the parallel processing capabilities of electronic device 500.

[0132] The electronic device 500 typically includes a plurality of computer storage media. Such media can be any accessible media that can be obtained by the electronic device 500, including but not limited to volatile and non-volatile media, removable and non-removable media. The memory 520 can be a volatile memory (e.g., registers, cache, random access memory (RAM)), a non-volatile memory (e.g., read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory), or some combination thereof. The storage device 530 can be a removable or non-removable medium and can include a machine-readable medium, such as a flash drive, a disk, or any other medium that can be used to store information and / or data and can be accessed within the electronic device 500.

[0133] The electronic device 500 may further include additional removable / non-removable, volatile / non-volatile storage media. Figure 5 As shown in FIG, a disk drive for reading from or writing to a removable, non-volatile disk (e.g., a "floppy disk") and an optical drive for reading from or writing to a removable, non-volatile optical disk may be provided. In these cases, each drive may be connected to a bus (not shown) by one or more data media interfaces. The memory 520 may include a computer program product 525 having one or more computer-executable instruction modules configured to perform various methods or actions of various embodiments of the present disclosure.

[0134] The communication unit 540 enables communication with other electronic devices via a communication medium. Additionally, the functions of the components of the electronic device 500 can be implemented in a single computing cluster or multiple computing machines that can communicate via a communication connection. Thus, the electronic device 500 can operate in a networked environment using a logical connection with one or more other servers, a network personal computer (PC), or another network node.

[0135] Input device 550 may be one or more input devices, such as a mouse, keyboard, or trackball. Output device 560 may be one or more output devices, such as a display, a speaker, or a printer. Electronic device 500 may also communicate with one or more external devices (not shown) via communication unit 540 as needed, such as a storage device, a display device, or the like, with one or more devices that allow a user to interact with electronic device 500, or with any device that allows electronic device 500 to communicate with one or more other electronic devices (e.g., a network card, a modem, etc.). Such communication may be performed via an input / output (I / O) interface (not shown).

[0136] According to an exemplary implementation of the present disclosure, a computer-readable storage medium is provided, on which computer-executable instructions are stored, wherein the computer-executable instructions are executed by a processor to implement the method described above. According to an exemplary implementation of the present disclosure, a computer program product is also provided, which is tangibly stored on a non-transitory computer-readable storage medium and includes computer-executable instructions, and the computer-executable instructions are executed by a processor to implement the method described above.

[0137] Various aspects of the present disclosure are described herein with reference to flowcharts and / or block diagrams of methods, apparatuses, devices, and computer program products implemented according to the present disclosure. It should be understood that each block of the flowcharts and / or block diagrams, and combinations of blocks in the flowcharts and / or block diagrams, can be implemented by computer-executable instructions.

[0138] These computer-executable instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processor of the computer or other programmable data processing device, a device is generated to implement the functions / actions specified in one or more blocks in the flowchart and / or block diagram. These computer-executable instructions can also be stored in a computer-readable storage medium, where these instructions cause the computer, programmable data processing device, and / or other device to operate in a specific manner. Thus, the computer-readable storage medium storing the instructions comprises an article of manufacture, which includes instructions for implementing various aspects of the functions / actions specified in one or more blocks in the flowchart and / or block diagram.

[0139] Computer-executable instructions can be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operational steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, so that the instructions executed on the computer, other programmable data processing apparatus, or other device implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.

[0140] The flowcharts and block diagrams in the accompanying drawings show the possible architectures, functions and operations of the systems, methods and computer-executable instruction products according to multiple implementations of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, executable instruction or part of an instruction, and the module, executable instruction or part of an instruction contains one or more executable instructions for implementing the specified logical function. In some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or action, or can be implemented using a combination of dedicated hardware and computer instructions.

[0141] While various implementations of the present disclosure have been described above, the foregoing description is intended to be illustrative, not exhaustive, and not limited to the disclosed implementations. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described implementations. The terminology used herein is selected to best explain the principles of the implementations, their practical applications, or improvements to existing technologies, or to enable others skilled in the art to understand the various implementations disclosed herein.

Claims

1. A method for content comparison, comprising: Obtaining corresponding reference indicators and corresponding training indicators for a plurality of content sample pairs, the reference indicators indicating reference differences of content samples in the corresponding content sample pairs, and the training indicators indicating predicted differences of the content samples in the corresponding content sample pairs determined via a target machine learning model, the plurality of content sample pairs including positive sample pairs and at least one negative sample pair; Determining a difference margin between the positive sample pair and the at least one negative sample pair based on the reference indicator for the positive sample pair; Determining corresponding similarity metrics for the plurality of content sample pairs based on the training metrics and the difference margins for the plurality of content sample pairs, wherein the similarity metrics for the positive sample pairs are determined by adding the difference margins to the corresponding training metrics, and the similarity metrics for each of the at least one negative sample pairs are determined by deducting the difference margins from the corresponding training metrics; and Based on the corresponding similarity metrics of the multiple content sample pairs, the parameters of the target machine learning model are updated to obtain a trained target machine learning model.

2. The method according to claim 1, wherein obtaining corresponding reference indicators and corresponding training indicators of the plurality of content sample pairs comprises: Determining corresponding reference similarities of the plurality of content sample pairs on a feature consistency dimension using a trained reference machine learning model; Determining, using the target machine learning model, corresponding predicted similarities of the plurality of content sample pairs on the feature consistency dimension; and Based on the conversion relationship between the feature consistency dimension and the feature difference dimension, the corresponding reference similarities and the corresponding predicted similarities of the multiple content sample pairs are converted into corresponding reference indicators and corresponding training indicators of the multiple content sample pairs, respectively.

3. The method of claim 2 , wherein determining the respective reference similarities of the plurality of content sample pairs comprises: performing feature encoding on the plurality of content sample pairs using a reference encoder of the reference machine learning model to determine a plurality of pairs of reference feature representations corresponding to the plurality of content sample pairs; as well as A similarity between each pair of reference feature representations in the plurality of pairs of reference feature representations is determined as a corresponding reference similarity of the plurality of content sample pairs.

4. The method of claim 2 , wherein determining the respective predicted similarities of the plurality of content sample pairs comprises: performing feature encoding on the plurality of content sample pairs using a target encoder of the target machine learning model to determine a plurality of pairs of content feature representations corresponding to the plurality of content sample pairs; as well as A similarity between each pair of the plurality of pairs of content feature representations is determined as the corresponding predicted similarities of the plurality of content sample pairs.

5. The method according to claim 2, wherein converting the corresponding reference similarities and the corresponding predicted similarities of the plurality of content sample pairs into corresponding reference indices and corresponding training indices of the plurality of content sample pairs, respectively, comprises: According to the conversion relationship, converting the corresponding reference similarities of the multiple content sample pairs into corresponding reference angles of the multiple content sample pairs as the corresponding reference indicators, the reference angles indicating angular differences of the content samples in the corresponding content sample pairs in the feature space of the reference machine learning model; as well as According to the conversion relationship, the corresponding predicted similarities of the multiple content sample pairs are converted into corresponding predicted angles of the multiple content sample pairs as the corresponding training indicators, and the predicted angles indicate the angular differences of the content samples in the feature space of the target machine learning model.

6. The method of claim 2, wherein updating the parameters of the target machine learning model comprises: determining, for a content sample pair among the plurality of content sample pairs, whether the reference similarity of the content sample pair matches tag information of the content sample pair, the tag information indicating whether the content samples in the content sample pair are related; as well as In response to the corresponding reference similarity matching the corresponding annotation information, the parameters of the target machine learning model are updated based on the corresponding similarity measure of the content sample pair.

7. The method of claim 2, wherein the parameters of the target machine learning model are further updated based on the difference between the corresponding reference similarities and the corresponding predicted similarities of the multiple content sample pairs.

8. The method of claim 1 , wherein determining the difference margin comprises: The difference margin is determined based on the reference indicator and a predetermined scaling factor for the positive sample pair.

9. The method according to claim 1, wherein the similarity measure of the positive sample pair is determined by: Determining a first intermediate result obtained by adding the difference margin to a training indicator of the positive sample pair; Determining a first feature consistency metric corresponding to the first intermediate result in a feature consistency dimension; and Based on the first feature consistency measure, a similarity measure of the positive sample pair is determined.

10. The method according to claim 1, wherein the similarity metric of the negative sample pair is determined by: Determining a second intermediate result obtained by deducting the difference margin from the training indicator of the negative sample pair; Determining a second feature consistency metric corresponding to the second intermediate result in the feature consistency dimension; and Based on the second feature consistency measure, a similarity measure of the negative sample pair is determined.

11. The method of claim 1 , wherein the target machine learning model comprises a base model and an additional model, and wherein updating parameters of the target machine learning model comprises: Parameters of the additional model are updated based on the similarity measures of the plurality of content sample pairs.

12. A device for content comparison, comprising: an acquisition module configured to acquire corresponding reference indicators and corresponding training indicators for a plurality of content sample pairs, the reference indicators indicating reference differences of content samples in the corresponding content sample pairs, the training indicators indicating predicted differences of the content samples in the corresponding content sample pairs determined via a target machine learning model, the plurality of content sample pairs including positive sample pairs and at least one negative sample pair; A first determining module is configured to determine a difference margin between the positive sample pair and the at least one negative sample pair based on the reference indicator for the positive sample pair; a second determining module configured to determine corresponding similarity metrics of the plurality of content sample pairs based on the training metrics and the difference margins of the plurality of content sample pairs, wherein the similarity metrics of the positive sample pairs are determined by adding the difference margins to the corresponding training metrics, and the similarity metrics of each of the at least one negative sample pairs are determined by deducting the difference margins from the corresponding training metrics; as well as An updating module is configured to update the parameters of the target machine learning model based on the corresponding similarity metrics of the multiple content sample pairs to obtain a trained target machine learning model.

13. An electronic device comprising: at least one processor; as well as At least one memory coupled to the at least one processor and storing instructions for execution by the at least one processor, the instructions causing the electronic device to perform the method according to any one of claims 1 to 11 when executed by the at least one processor.

14. A computer-readable storage medium having computer-executable instructions stored thereon, wherein the computer-executable instructions can be executed by a processor to implement the method according to any one of claims 1 to 11.

15. A computer program product comprising computer executable instructions, wherein the computer executable instructions, when executed by a processor, implement the method according to any one of claims 1 to 11.