Method and device for content characterization, equipment and storage medium
By updating the parameters in the target machine learning model and utilizing the feature representation differences of the reference model, the problem of poor performance of the machine learning model in content matching tasks in specific fields is solved, and the matching ability of the model in specific fields is improved.
Patent Information
- Application Number
- CN202510819670.4
- 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
Existing machine learning models perform poorly on domain-specific content matching tasks, but excel in general tasks despite having smaller parameter sizes.
By leveraging the difference between the reference feature representation generated by the reference machine learning model and the content feature representation generated by the target machine learning model, the parameters of the target machine learning model are updated to improve its performance in the content matching task.
It enhances the performance of the target machine learning model in content matching tasks, utilizes the knowledge and representation of the reference model, and improves the matching ability of the model in specific fields.
Smart Images

Figure CN120705599A_ABST
Abstract
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 representation. Background Art
[0002] With the rapid development of machine learning technologies, the parameter size of machine learning models has increased significantly, enabling them to acquire extensive knowledge and perform well on a variety of general tasks. However, the performance of machine learning models trained for general tasks in specific domains still needs to be improved. Summary of the Invention
[0003] In a first aspect of the present disclosure, a method for content representation is provided. The method includes: based on a content sample pair, using a reference encoder in a trained reference machine learning model to generate a pair of reference feature representations corresponding to the content sample pair, wherein the reference machine learning model is configured to generate a first prediction result indicating whether the content samples in the content sample pair are related; based on the content sample pair, using an encoding portion of a target machine learning model to be trained to generate a pair of content feature representations corresponding to the content sample pair, wherein the scale of the target machine learning model is larger than that of the reference machine learning model; and updating parameters of the target machine learning model based on at least a difference between the pair of reference feature representations and the pair of content feature representations to obtain a trained target machine learning model.
[0004] In a second aspect of the present disclosure, a device for content representation is provided. The device includes: a first generation module configured to generate a pair of reference feature representations corresponding to the content sample pair based on the content sample pair using a reference encoder in a trained reference machine learning model, wherein the reference machine learning model is configured to generate a first prediction result indicating whether the content samples in the content sample pair are related; a second generation module configured to generate a pair of content feature representations corresponding to the content sample pair based on the content sample pair using an encoding portion of a target machine learning model to be trained, wherein the scale of the target machine learning model is larger than that of the reference machine learning model; and an update module configured to update parameters of the target machine learning model based on at least a difference between a pair of reference feature representations and a pair of content feature representations 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 representation according to some embodiments of the present disclosure is shown;
[0012] Figure 3 A flowchart illustrating a process for content characterization according to some embodiments of the present disclosure is shown;
[0013] Figure 4 A schematic structural block diagram showing an example apparatus for content representation 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 1In 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 1In 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, with the rapid development of machine learning technologies, the parameter size of machine learning models has increased. This allows machine learning models to possess extensive knowledge and excel in a variety of general-purpose tasks. However, machine learning models trained for specific tasks in specific domains, while typically having relatively small parameter sizes, often outperform larger models trained for general-purpose tasks on these specific tasks.
[0033] For example, large language models (LLMs) can acquire rich knowledge and have excellent natural language understanding capabilities, making them extremely effective in a variety of general tasks. However, in content matching tasks (such as text matching, image matching, or text-image matching), small language models (SLMs) are typically trained to make content pairs more similar in representation, allowing them to better distinguish synonyms and perform more effectively. In view of this, small models can be used to optimize the performance of large models in content matching tasks.
[0034] The embodiments of the present disclosure propose an improved scheme for content characterization. In this improved scheme, it mainly involves a trained reference machine learning model and a target machine learning model to be trained. The reference machine learning model is configured to generate a prediction result indicating whether the content samples in the content sample pair are related. The scale of the target machine learning model is larger than the scale of the reference machine learning model. During the training process of the target machine learning model, a reference encoder in the reference machine learning model is used to generate a pair of reference feature representations corresponding to the content sample pair based on the content sample pair. A pair of content feature representations corresponding to the content sample pair is generated based on the content sample pair using the encoding part of the target machine learning model. Afterwards, based at least on the difference between the pair of reference feature representations and the pair of content feature representations, the parameters of the target machine learning model are updated to obtain a trained target machine learning model.
[0035] In an embodiment of the present disclosure, the content feature representation generated by the target machine learning model is aligned with the reference feature representation generated by the reference machine learning model, so that the target machine learning model can not only learn the matching relationship between sample pairs from the reference machine learning model, but also learn the representation of the sample pairs by the reference machine learning model. In this way, a relatively large-scale model (i.e., the target machine learning model) can learn more detailed knowledge from a relatively small-scale model (i.e., the reference machine learning model), which is conducive to improving the performance of the large model in content matching tasks.
[0036] 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 representation 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.
[0037] In some embodiments of the present disclosure, Figure 2 As shown, the model training system 120 generates a pair of reference feature representations 262 and 264 corresponding to the content sample pair 210 based on the content sample pair 210 using the reference encoder 242 in the trained reference machine learning model 240. The model training system 120 also generates a pair of content feature representations 252 and 254 corresponding to the content sample pair 210 based on the content sample pair 210 using the encoded portion of the target machine learning model 220 to be trained.
[0038] The reference machine learning model 240 is configured to generate a first prediction result indicating whether the content samples in the content sample pair are related. That is, the reference machine learning model 240 is trained to perform the matching task of the content sample pair. For example, the first prediction result can indicate whether the content sample pairs are similar, the similarity between the content sample pairs, whether the content sample pairs match, or the matching degree between the content sample pairs, etc. The content sample may include content of any modality. Examples of content samples may include but are not limited to text samples, image samples, video samples, audio samples, etc. The content sample pair may include a pair of content samples of the same modality or different modalities. For example, the content sample pair may include a pair of text samples, a pair of image samples, or a pair of audio samples. For another example, the content sample pair may 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, etc.
[0039] The target machine learning model 220 is a model to be trained. The model training system 120 can use the reference machine learning model 240 to train the target machine learning model 220 to perform the matching task. In this case, the target machine learning model 220 can be referred to as a "student model" and the reference machine learning model 240 can be referred to as a "teacher model." For example, a content sample pair can include a content sample 212 and a text sample x. i , the content sample 214 may include a text sample x j , x i represents the i-th text sample, x j Represents the jth text sample. Teacher model can be trained to predict the i and text sample x j Corresponding annotation information y ij , marking information y ij Can indicate text sample x i With text sample x j The model training system 120 can use the training set and teacher model Training the student model
[0040] The scale of the target machine learning model 220 is greater than the scale of the reference machine learning model 240. The scale here can be measured by at least one of the number of parameters, number of layers, number of neurons, amount of memory space occupied, or computational complexity of the model. For example, the parameter scale of the target machine learning model 220 can be greater than the parameter scale of the reference machine learning model 240.
[0041] The reference machine learning model 240 can adopt any suitable model architecture with an encoder. In some embodiments, Figure 2 As shown, reference machine learning model 240 may include reference encoder 242. A content sample pair may include content sample 212 and content sample 214. Model training system 120 may determine two embedding representations corresponding to content sample 212 and content sample 214, respectively. Reference encoder 242 may perform feature encoding on the two embedding representations, respectively, to determine reference feature representation 262 and reference feature representation 264.
[0042] In some examples, the reference machine learning model 240 may include a small language model (SLMs) or be derived based on an SLM. As an example, the reference machine learning model 240 may adopt a Bidirectional Encoder Representation from Transformer (BERT) model. 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 i and embedding representation X j Perform feature encoding to obtain reference feature representation and reference feature representation It should be understood that the model architecture of the above-mentioned reference machine learning model 240 is only exemplary. In actual application scenarios, any other appropriate model architecture can be selected according to actual needs, and the embodiments of the present disclosure are not limited to this.
[0043] The encoding portion of the target machine learning model 220 is configured to perform feature encoding on the input. The encoding portion may include various encoding structures in the target machine learning model 220 that can perform feature encoding. Examples of the encoding portion may include, but are not limited to, one or more encoders, or one or more network layers. The target machine learning model 220 may adopt any appropriate model architecture that includes an encoding structure.
[0044] In some embodiments, as Figure 2 As shown, 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, and the encoding part may include the target encoder 232. The base model 225 may be a pre-trained model. The model training system 120 may freeze the parameters of the base model 225. The model training system 120 may use the target encoder 232 to perform feature encoding on the content sample pair 210 to generate a pair of content feature representations 252 and 254. Thus, the additional model 230 may be trained using the reference machine learning model 240. The additional model 230 can learn the ability to perform matching tasks from the reference machine learning model 240, which not only retains the task capabilities of the base model 225, but also improves the ability of the target machine learning model 220 to perform matching tasks.
[0045] 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 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 target encoder 232 may have a corresponding weight matrix The target decoder 234 may have a corresponding weight matrix Where r << min(d, k). Model training system 120 can utilize additional model 230 to distill learning capabilities for matching tasks from small language models. In this way, additional model 230 is utilized to redesign LLMs into an encoder-decoder architecture, bridging the structural differences between decoder-based LLMs and encoder-based SLMs. This not only fully utilizes the powerful semantic understanding capabilities of LLMs, but also enables LLMs to distill learning capabilities for matching tasks in specific domains from SLMs, thereby improving their matching capabilities.
[0046] It should be noted that the above-mentioned target machine learning model 220 and reference machine learning model 240 are merely 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 structure. 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 architecture of the target machine learning model 220 and the reference machine learning model 240.
[0047] In some embodiments, the model training system 120 may use the encoding portion to perform feature encoding on the content sample pair 210 to determine two feature representation subsequences corresponding to the two content samples 212 and 214 in the content sample pair 210. Thereafter, the model training system 120 may determine a pair of content feature representations 252 and 254 based on the two feature representation subsequences. In some examples, such as Figure 2As shown, model training system 120 can determine the model input of target machine learning model 220 based on content sample 212, content sample 214, and prompt word information 216. Model training system 120 can use target encoder 232 to perform feature encoding on the model input to determine a sample feature representation sequence corresponding to the model content. Two feature representation subsequences corresponding to content sample 212 and content sample 214, respectively, are determined from the sample feature representation sequence.
[0048] In some embodiments, each feature representation subsequence in the two feature representation subsequences includes multiple sample feature representations. For a content sample in the two content samples 212 and 214, the model training system 120 determines a content feature representation corresponding to the content sample in a pair of content feature representations 252 and 254 based on an average of multiple sample feature representations in the feature representation subsequences corresponding to the content sample. 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 can be based on the text sample x i , text sample x j and the prompt word information 216, 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
[0049] It should be noted that the above process of determining the content feature representation is only exemplary. When the architecture of the encoding part of the target machine learning model 220 is different, any other appropriate method can be selected to determine the content feature representation according to actual needs. For example, the model training system 120 can also provide content samples to the encoding part respectively, and the encoding part performs encoding on the content samples respectively to determine the corresponding content feature representation. For example, when the encoding part includes multiple encoding structures, the content samples can be encoded separately using multiple encoding results. The model training system 120 can merge multiple encoding results to obtain content feature representation. The embodiments of the present disclosure are not limited to this.
[0050] In some embodiments of the present disclosure, Figure 2 As shown, the model training system 120 updates the parameters of the target machine learning model 220 based on at least the difference between the pair of reference feature representations 262 and 264 and the pair of content feature representations 252 and 254 to obtain a trained target machine learning model 220. In this way, the content feature representation generated by the target machine learning model 220 can be aligned with the reference feature representation generated by the reference machine learning model 240, so that the target machine learning model 220 can obtain more detailed representation information from the reference machine learning model 240, thereby capturing more detailed knowledge.
[0051] In some embodiments, if the target machine learning model 220 includes a base model 225 and an additional model 230, the model training system 120 may freeze the parameters of the base model 225 and update the additional model 230 based on the difference between the pair of reference feature representations 262, 264 and the pair of content feature representations 252, 254. Thus, while retaining the task capabilities of the base model 225, the ability to perform the matching task is learned by distilling from the reference machine learning model 240 through the additional model 230. As an example, the model training system 230 may update the weight matrix A and weight matrix B corresponding to the target encoder 232 and the target decoder 234 based on the difference between the pair of reference feature representations 262, 264 and the pair of content feature representations 252, 254.
[0052] In some embodiments, as Figure 2 As shown, the model training system 120 can determine a first similarity 272 between a pair of reference feature representations 262 and 264 and a second similarity 274 between a pair of content feature representations 252 and 254. The model training system 120 can then update the parameters of the target machine learning model 120 based on the difference between the first similarity 272 and the second similarity 274. In this way, the similarity between the pair of content feature representations 252 and 254 can be aligned with the similarity between the pair of reference feature representations 262 and 264, thereby more effectively capturing semantic similarity.
[0053] The similarity between feature representations can be determined in a variety of ways. In some examples, model training system 120 can determine the cosine similarity between a pair of reference feature representations 262 and 264 as first similarity 272. Model training system 120 can also determine the cosine similarity between a pair of content feature representations 252 and 254 as second similarity 274.
[0054] As an example, the model training system 120 may determine the cosine similarity between a pair of reference feature representations 262 and 264 using the following formula:
[0055]
[0056] in Represents the text sample x i The corresponding reference feature representation is, Represents the text sample x j The corresponding reference feature representation is, Reference feature representation Represented with reference features It is understandable that the model training system 120 can also determine the cosine similarity between a pair of content feature representations 252 and 254 based on the above formula (1):
[0057] In determining cosine similarity and cosine similarity In the case of , the model training system 120 can update the parameters of the target machine learning model 220 based on the distillation loss function as shown below:
[0058]
[0059] Where N represents the number of content sample pairs 210 in a batch of sample pairs. It should be understood that the model training system 120 is not limited to determining the cosine similarity between feature representations, but can also determine the Euclidean distance, Pearson correlation coefficient, KL divergence, etc. between feature representations. The embodiments of the present disclosure are not limited to this.
[0060] In actual application scenarios, the reference machine learning model 240, acting as a teacher model, may also produce inaccurate prediction results for some content sample pairs 210. To prevent the target machine learning model 220 from learning these inaccurate prediction results, the model training system 120 can obtain annotation information 278 corresponding to the content sample pairs 210. The annotation information 278 indicates whether the content samples in the content sample pairs 210 are related. The model training system 120 can determine whether the first similarity 272 between a pair of reference feature representations 262 and 264 matches the corresponding annotation information 278 of the content sample pair 210. If the first similarity 272 matches the annotation information 278, it means that the prediction result of the reference machine learning model 240 matches the true value, and the prediction result of the reference machine learning model 240 for the content sample pair 210 is credible. The model training system 120 can then update the parameters of the target machine learning model 220 based on the difference between the pair of reference feature representations 262 and 264 and the pair of content feature representations 252 and 254 corresponding to the content sample pair 210. If the first similarity 272 does not match the annotation information 278, it means that the prediction result of the reference machine learning model 240 does not match the true value, and the prediction result of the reference machine learning model 240 for the content sample pair 210 is unreliable. The model training system 120 can discard the result related to the content sample pair. This ensures that the learning process is more reliable.
[0061] In some embodiments, the model training system 120 may determine whether the first similarity 272 and the annotation information 278 meet at least one of a first predetermined condition or a second predetermined condition. The first predetermined condition indicates that the first similarity 272 does not exceed a first threshold and the annotation information 278 indicates that the content samples in the content sample pair are related. The second predetermined condition indicates that the first similarity 272 exceeds a second threshold and the annotation information 278 indicates that the content samples in the content sample pair are not related. The first threshold and the second threshold may indicate whether a pair of reference feature representations 262 and 264 are similar. The first threshold and the second threshold may be the same or different.
[0062] If first similarity 272 does not exceed the first threshold, it means that the pair of reference feature representations 262 and 264 are dissimilar, and thus, the prediction result of reference machine learning model 240 indicates that the content sample pair is unrelated. If annotation information 278 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 first similarity 272 and annotation information 278 meet the first predetermined condition, it means that the prediction result of reference machine learning model 240 is inconsistent with the true value.
[0063] If first similarity 272 exceeds the second threshold, it means that the pair of reference feature representations 262 and 264 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 278 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 first similarity 272 and annotation information 278 meet the second predetermined condition, it means that the prediction result of reference machine learning model 240 is inconsistent with the true value.
[0064] If the first similarity 272 and the annotation information 278 do not meet the first predetermined condition and do not meet the second predetermined condition, it means that the prediction result of the reference machine learning model 240 for the content sample pair is consistent with the true value, and the model training system 120 can determine that the first similarity 272 matches the annotation information 278. By introducing a dual threshold strategy to filter noise, the learning process can be ensured to be more reliable.
[0065] 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 can obtain the instruction text sample x i and text sample x j Is there a correlation between the labels y ij If the label y ij =1, indicating that the text sample x i With text sample x j Related, if marked 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:
[0066]
[0067] 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 corresponding pair of reference features represents the similarity between 262 and 264 And mark 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 220 does not match the true value, and the result of the filtering function Text sample x i and text sample x j The corresponding pair of reference features represents the similarity between 262 and 264 And mark 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,
[0068] If the model training system 120 filters untrustworthy content sample pairs based on formula (3), and the model training system 120 updates the parameters of the additional model 230 based on the distillation loss function of formula (2), then formula (2) can be rewritten as:
[0069]
[0070] In some embodiments, the model training system 120 uses the target machine learning model 220 to determine a second prediction result 276 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 second prediction result 276 and the corresponding annotation information 278 of the content sample pair 210. That is, the model training system 120 can also update the parameters of the target machine learning model 220 based on the supervision loss between the second prediction result 276 and the true value. In this way, not only can the feature representation of the target machine learning model 220 be aligned with the feature representation of the reference machine learning model 230, but the prediction results of the target machine learning model 220 can also be aligned with the true value results, which is conducive to improving the learning effect of distillation learning.
[0071] As an example, the target machine learning model 220 may include a base model 225 and an additional model 230. The model training system 120 may obtain a model output a=[a yes ,a no The model training system 120 can determine the probability of correlation between the content samples in the content sample pair based on the model output a. As the second prediction result 276. The model training system can determine the difference between the second prediction result 276 of the target machine learning model 220 and the annotation information 278 based on the supervised loss function as shown below:
[0072]
[0073] Where y represents the annotation information, which can indicate the text sample x i With text sample x jThe model training system 120 can update the parameters of the additional model 230 based on the supervision loss shown in formula (5).
[0074] In some embodiments, the model training system 120 may determine corresponding reference angles for multiple pairs of reference feature representations 262 and 264 for multiple content sample pairs 210. The reference angles indicate angular differences between the corresponding pair of reference feature representations 262 and 264 in the feature space of the reference machine learning model 240. The model training system 120 may determine corresponding predicted angles for multiple pairs of content feature representations 252 and 254 for the multiple content sample pairs 210. The predicted angles indicate angular differences between the corresponding pair of content feature representations 252 and 254 in the feature space of the target machine learning model 220. The model training system 120 may determine corresponding similarity metrics for the multiple content sample pairs 210 based on the corresponding reference angles and the corresponding predicted angles. The model training system may also update parameters of the target machine learning model 220 based on the corresponding similarity metrics for the multiple content sample pairs. The angular differences can amplify subtle differences between the feature representations and enhance the discriminative ability of the target machine learning model 220, making it easier to distinguish between similar and dissimilar sample pairs.
[0075] In some embodiments, the model training system 120 may convert the first similarity 272 into a corresponding reference angle of the pair of reference feature representations 262, 264. As an example, the first similarity 272 may include a cosine similarity between the pair of reference feature representations 262, 264. The model training system 120 may convert the first similarity 272 into a reference angle based on the following formula:
[0076]
[0077] in Represents a reference angle. The cosine similarity is converted into a reference angle (also referred to as "angle distance") between the content samples 212 and 214 through the inverse cosine function. The conversion can amplify the difference in similarity and enhance the distinguishing ability of the target machine learning model 220, thereby enabling the model to more easily distinguish between similar and dissimilar samples. It should be understood that converting the first similarity 272 into a reference angle through the inverse cosine function is only exemplary. In actual application scenarios, the first similarity 272 can also be converted into a reference angle through other functions, such as other trigonometric functions. The embodiments of the present disclosure are not limited to this.
[0078] In some embodiments, the model training system 120 may convert the second similarity 274 into the corresponding prediction angle of the pair of content feature representations 252, 254. As an example, the second similarity 274 may include the cosine similarity between the pair of content feature representations 252, 254. In this case, the model training system 120 may convert the second similarity 274 into a prediction angle based on the following formula:
[0079]
[0080] in It should be understood that converting the second similarity 274 into the predicted angle using the arccosine function is merely exemplary. In actual application scenarios, the second similarity 274 may also be converted into the predicted angle using other functions, such as other trigonometric functions. The embodiments of the present disclosure are not limited thereto.
[0081] In some embodiments, the plurality of content sample pairs include a positive sample pair and at least one negative sample pair. The plurality of content sample pairs 210 herein may be referred to as a batch of sample pairs or a group of sample pairs. A positive sample pair may include two related content samples, and a negative sample pair may include two unrelated content samples. In some examples, a positive sample pair may include a first content sample and a second content sample that is labeled as similar to the first content sample, and a negative sample pair may include a first content sample and a third content sample that is labeled as not similar to the first content sample. For example, a 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 ′.
[0082] The model training system 120 may determine an angular difference margin between the positive sample and at least one negative sample pair based on the reference angle of the positive sample pair. Subsequently, the model training system 120 may determine corresponding similarity metrics for multiple content sample pairs based on the corresponding predicted angles and the angular difference margins for the multiple content sample pairs, where the similarity metrics for the positive sample pairs are determined by adding the angular difference margin to the corresponding predicted angles, and the similarity metrics for the negative sample pairs are determined by subtracting the angular difference margin from the corresponding predicted angles. The angular 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.
[0083] By adding an angle difference margin to the angle difference of the positive sample pairs, the model is incentivized to assign a relatively small angle difference to the positive sample pairs with a smaller reference angle, so as to improve the similarity measure (such as the similarity score) of the positive sample pairs. In contrast, by deducting the angle difference margin from the angle difference of the negative sample pairs, the model is incentivized to assign a relatively large angle difference to the negative sample pairs with a larger reference angle, so as to reduce the similarity measure of the negative sample pairs. Thus, the margin space of the two angle differences can be introduced, which not only prompts the target machine learning model 220 to learn the difference between the positive sample pairs and the negative sample pairs, but also prompts the model 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.
[0084] In some embodiments, the model training system 120 may determine the angle difference margin based on the reference angle of the positive sample pair and a predetermined scaling factor. The predetermined scaling factor is configured to adjust the effect of the reference angle on the target machine learning model 220. For example, if the reference angle is represented as The angular 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 angle difference margin is merely exemplary. In actual application scenarios, the model training system 120 may select any other appropriate method to determine the angle difference margin based on the reference angle. For example, the model training system 120 may also determine the angle difference margin based on other functional relationships. The embodiments of the present disclosure do not limit the method for determining the angle difference margin.
[0085] In some embodiments, the model training system 120 may determine a first intermediate result obtained by adding an angle difference margin to the predicted angle of the positive sample pair. The first intermediate result may indicate the angle difference adjusted for the angle difference margin based on the predicted angle 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 angle 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.
[0086] As an example, 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.
[0087] In some embodiments, the model training system 120 may determine a second intermediate result obtained by deducting the angle difference margin from the predicted angle of the negative sample pair. The second intermediate result indicates the angle difference adjusted using the angle difference margin based on the predicted angle 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 the adjusted degree of similarity corresponding to the adjusted angle 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.
[0088] As an example, 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.
[0089] 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 angle difference margin from the predicted angle. The embodiments of the present disclosure are not limited to this.
[0090] 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:
[0091]
[0092] 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:
[0093]
[0094] Where i,j represents a positive sample pair, i,j ′Denotes a negative sample pair. Combined with formula (9), we can see that the contrast loss is affected by the reference angle of the positive sample pair Impact. For positive sample pairs with a higher first similarity 272 (that is, a lower reference angle), a smaller angle difference margin is added, resulting in a larger similarity measure. For positive sample pairs with a lower first similarity 272, a smaller angle difference margin is added, resulting in a relatively small similarity measure. For negative sample pairs, their similarity measure can be further reduced by deducting the angle difference margin from the predicted angle. 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.
[0095] It should be noted that the training process of the target machine learning model 220 often requires multiple rounds of iterative training. Therefore, during the training process of the target machine learning model 220, it is often necessary to repeat the above process until the target machine learning model 220 meets pre-set conditions, such as the output result of the target machine learning model 220 meets the predetermined requirements, or the iterative training rounds of the target machine learning model 220 reach the predetermined rounds, etc.
[0096] In this way, in an embodiment of the present disclosure, the content feature representation generated by the target machine learning model is aligned with the reference feature representation generated by the reference machine learning model, so that the target machine learning model can not only learn the matching relationship between sample pairs from the reference machine learning model, but also learn the reference machine learning model's representation of sample pairs. As a result, a relatively large-scale model (i.e., the target machine learning model) can learn more detailed professional domain knowledge from a relatively small-scale model (i.e., the reference machine learning model), which is conducive to improving the performance of the large model in content matching tasks.
[0097] Figure 3 A flowchart of an example process 300 for content characterization according to some embodiments of the present disclosure is shown. The process 300 can be implemented in the model training system 120.
[0098] At block 310, the model training system 120 generates a pair of reference feature representations corresponding to the content sample pair using a reference encoder in a trained reference machine learning model based on the content sample pair. The reference machine learning model is configured to generate a first prediction result indicating whether the content samples in the content sample pair are related.
[0099] At block 320 , the model training system 120 generates a pair of content feature representations corresponding to the content sample pair using the encoding portion of the target machine learning model to be trained based on the content sample pair. The scale of the target machine learning model is larger than that of the reference machine learning model.
[0100] In box 330, the model training system 120 updates the parameters of the target machine learning model based on at least the difference between the pair of reference feature representations and the pair of content feature representations to obtain a trained target machine learning model.
[0101] In some embodiments, the target machine learning model includes a base model and an additional model, the additional model includes a target encoder and a target decoder, the encoding part includes a target encoder, and wherein generating a pair of content feature representations includes: using the target encoder to perform feature encoding on the content sample pair to generate a pair of content feature representations.
[0102] In some embodiments, updating the parameters of the target machine learning model includes updating the parameters of the additional model based at least on a difference between a pair of reference feature representations and a pair of content feature representations.
[0103] In some embodiments, generating a pair of content feature representations includes: performing feature encoding on the content sample pair using an encoding portion to determine two feature representation subsequences corresponding to the two content samples in the content sample pair, respectively; and determining a pair of content feature representations based on the two feature representation subsequences.
[0104] In some embodiments, each feature representation subsequence in the two feature representation subsequences includes multiple sample feature representations, and determining a pair of content feature representations based on the two feature representation subsequences includes: for a content sample in the two content samples, based on averaging processing of multiple sample feature representations in the feature representation subsequence corresponding to the content sample, determining a content feature representation corresponding to the content sample in a pair of content feature representations.
[0105] In some embodiments, updating the parameters of the target machine learning model includes: determining a first similarity between a pair of reference feature representations and a second similarity between a pair of content feature representations; and updating the parameters of the target machine learning model based on the difference between the first similarity and the second similarity.
[0106] In some embodiments, updating the parameters of the target machine learning model includes: determining a first similarity between a pair of reference feature representations; determining whether the first similarity matches corresponding 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 first similarity matching the annotation information, updating the parameters of the target machine learning model based on the difference between a pair of reference feature representations and a pair of content feature representations corresponding to the content sample pair.
[0107] In some embodiments, determining whether the first similarity matches the annotation information includes: determining whether the first similarity and the annotation information meet at least one of a first predetermined condition or a second predetermined condition, the first predetermined condition indicating that the first similarity does not exceed a first threshold and the annotation information indicates that the content samples in the content sample pair are related, and the second predetermined condition indicating that the first similarity exceeds a second threshold and the annotation information indicates that the content samples in the content sample pair are not related; and in response to the first similarity and the annotation information not meeting the first predetermined condition and not meeting the second predetermined condition, determining that the first similarity matches the annotation information.
[0108] In some embodiments, process 300 also includes: based on at least one pair of content feature representations, using a target machine learning model, determining a second prediction result indicating whether the content samples in the content sample pair are related, and wherein the parameters of the target machine learning model are further updated based on the difference between the second prediction result and the corresponding annotation information of the content sample pair, and the annotation information indicates whether the content samples in the content sample pair are related.
[0109] In some embodiments, process 300 also includes: determining corresponding reference angles of multiple pairs of reference feature representations corresponding to multiple content sample pairs, respectively, the reference angles indicating the angular differences of the corresponding pair of reference feature representations in the feature space of the reference machine learning model; determining corresponding prediction angles of multiple pairs of content feature representations corresponding to multiple content sample pairs, respectively, the prediction angles indicating the angular differences of the corresponding pair of content feature representations in the feature space of the target machine learning model; determining corresponding similarity measures of the multiple content sample pairs based on the corresponding reference angles and corresponding prediction angles of the multiple content sample pairs, and wherein the parameters of the target machine learning model are further updated based on the corresponding similarity measures of the multiple content sample pairs.
[0110] In some embodiments, determining corresponding reference angles of multiple content sample pairs includes: determining a first similarity between a pair of reference feature representations among multiple pairs of reference feature representations; and converting the first similarity into corresponding reference angles of the pair of reference feature representations.
[0111] In some embodiments, determining corresponding prediction angles for multiple pairs of content samples includes: determining, for a pair of content feature representations among the multiple pairs of content feature representations, a second similarity between the pair of content feature representations; and converting the second similarity into corresponding prediction angles for the pair of content feature representations.
[0112] In some embodiments, the plurality of content sample pairs include a positive sample pair and at least one negative sample pair, and wherein determining corresponding similarity metrics of the plurality of content sample pairs includes: determining an angle difference margin between the positive sample pair and at least one negative sample pair based on a reference angle of the positive sample pair; and determining corresponding similarity metrics of the plurality of content sample pairs based on corresponding predicted angles and the angle difference margins of the plurality of content sample pairs, the similarity metrics of the positive sample pairs being determined by adding the angle difference margin to the corresponding predicted angles, and the similarity metrics of the negative sample pairs being determined by deducting the angle difference margin from the corresponding predicted angles.
[0113] In some embodiments, determining the angle difference margin includes determining the angle difference margin based on a reference angle of the positive sample pair and a predetermined scaling factor.
[0114] The embodiments of the present disclosure also provide corresponding devices for implementing the above methods or processes. Figure 4 : A schematic structural block diagram of an example apparatus 400 for content representation according to certain embodiments of the present disclosure is shown. 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.
[0115] like Figure 4 As shown, the device 400 includes: a first generation module 410, which is configured to generate a pair of reference feature representations corresponding to the content sample pair based on the content sample pair using a reference encoder in a trained reference machine learning model, and the reference machine learning model is configured to generate a first prediction result indicating whether the content samples in the content sample pair are related; a second generation module 420, which is configured to generate a pair of content feature representations corresponding to the content sample pair based on the content sample pair using an encoding part of a target machine learning model to be trained, and the scale of the target machine learning model is larger than the scale of the reference machine learning model; and an update module 430, which is configured to update the parameters of the target machine learning model based on at least the difference between a pair of reference feature representations and a pair of content feature representations to obtain a trained target machine learning model.
[0116] In some embodiments, the target machine learning model includes a base model and an additional model, the additional model includes a target encoder and a target decoder, the encoding part includes a target encoder, and wherein the second generation module 420 is further configured to: perform feature encoding on the content sample pair using the target encoder to generate a pair of content feature representations.
[0117] In some embodiments, the updating module 430 is further configured to update parameters of the additional model based on at least a difference between a pair of reference feature representations and a pair of content feature representations.
[0118] In some embodiments, the second generation module 420 is further configured to: perform feature encoding on the content sample pair using the encoding part to determine two feature representation subsequences corresponding to the two content samples in the content sample pair respectively; and determine a pair of content feature representations based on the two feature representation subsequences.
[0119] In some embodiments, each feature representation subsequence in the two feature representation subsequences includes multiple sample feature representations, and the second generation module 420 is further configured to: for a content sample in the two content samples, determine a content feature representation corresponding to the content sample in a pair of content feature representations based on averaging processing of multiple sample feature representations in the feature representation subsequence corresponding to the content sample.
[0120] In some embodiments, the update module 430 is further configured to: determine a first similarity between a pair of reference feature representations and a second similarity between a pair of content feature representations; and update the parameters of the target machine learning model based on the difference between the first similarity and the second similarity.
[0121] In some embodiments, the update module 430 is further configured to: determine a first similarity between a pair of reference feature representations; determine whether the first similarity matches corresponding 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 first similarity matching the annotation information, update the parameters of the target machine learning model based on the difference between the pair of reference feature representations and the pair of content feature representations corresponding to the content sample pair.
[0122] In some embodiments, the update module 430 is further configured to: determine whether the first similarity and the annotation information meet at least one of a first predetermined condition or a second predetermined condition, the first predetermined condition indicating that the first similarity does not exceed a first threshold and the annotation information indicates that the content samples in the content sample pair are related, and the second predetermined condition indicating that the first similarity exceeds a second threshold and the annotation information indicates that the content samples in the content sample pair are not related; and in response to the first similarity and the annotation information not meeting the first predetermined condition and not meeting the second predetermined condition, determine that the first similarity matches the annotation information.
[0123] In some embodiments, the device 400 also includes: a first determination module, configured to determine, based at least on a pair of content feature representations, using a target machine learning model, a second prediction result indicating whether the content samples in the content sample pair are related, and wherein the update module 430 is further configured to: update the parameters of the target machine learning model based on the difference between the second prediction result and the corresponding annotation information of the content sample pair, and the annotation information indicates whether the content samples in the content sample pair are related.
[0124] In some embodiments, the device 400 also includes: a second determination module, configured to determine corresponding reference angles of multiple pairs of reference feature representations corresponding to multiple content sample pairs, respectively, the reference angle indicating the angular difference of the corresponding pair of reference feature representations in the feature space of the reference machine learning model; determine corresponding prediction angles of multiple pairs of content feature representations corresponding to multiple content sample pairs, respectively, the prediction angle indicating the angular difference of the corresponding pair of content feature representations in the feature space of the target machine learning model; determine corresponding similarity measures of the multiple content sample pairs based on the corresponding reference angles and corresponding prediction angles of the multiple content sample pairs, and wherein the update module 430 is further configured to: update the parameters of the target machine learning model based on the corresponding similarity measures of the multiple content sample pairs.
[0125] In some embodiments, the second determination module is further configured to: determine a first similarity between a pair of reference feature representations among multiple pairs of reference feature representations; and convert the first similarity into a corresponding reference angle of the pair of reference feature representations.
[0126] In some embodiments, the second determination module is further configured to: determine a second similarity between a pair of content feature representations among the multiple pairs of content feature representations; and convert the second similarity into a corresponding prediction angle of the pair of content feature representations.
[0127] In some embodiments, the multiple content sample pairs include a positive sample pair and at least one negative sample pair, and the second determination module is further configured to: determine an angle difference margin between the positive sample pair and the at least one negative sample pair based on a reference angle of the positive sample pair; and determine corresponding similarity metrics of the multiple content sample pairs based on the corresponding predicted angles and the angle difference margins of the multiple content sample pairs, the similarity metrics of the positive sample pairs being determined by adding the angle difference margin to the corresponding predicted angles, and the similarity metrics of the negative sample pairs being determined by deducting the angle difference margin from the corresponding predicted angles.
[0128] In some embodiments, the second determination module is further configured to determine an angle difference margin based on a reference angle of the positive sample pair and a predetermined scaling factor.
[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 5As 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 representation, comprising: generating, based on a content sample pair, a pair of reference feature representations corresponding to the content sample pair using a reference encoder in a trained reference machine learning model, the reference machine learning model being configured to generate a first prediction result indicating whether the content samples in the content sample pair are related; generating, based on the content sample pair, a pair of content feature representations corresponding to the content sample pair using an encoded portion of a target machine learning model to be trained, wherein the scale of the target machine learning model is larger than the scale of the reference machine learning model; as well as Based at least on the difference between the pair of reference feature representations and the pair of content feature representations, the parameters of the target machine learning model are updated to obtain the trained target machine learning model.
2. The method of claim 1 , wherein the target machine learning model comprises a base model and an additional model, the additional model comprises a target encoder and a target decoder, the encoding portion comprises the target encoder, and wherein generating the pair of content feature representations comprises: Feature encoding is performed on the pair of content samples using the target encoder to generate the pair of content feature representations.
3. The method of claim 2, wherein updating the parameters of the target machine learning model comprises: Parameters of the additional model are updated based on at least a difference between the pair of reference feature representations and the pair of content feature representations.
4. The method according to claim 1, wherein generating the pair of content feature representations comprises: performing feature encoding on the content sample pair using the encoding part to determine two feature representation subsequences corresponding to two content samples in the content sample pair respectively; as well as The pair of content feature representations is determined based on the two feature representation subsequences.
5. The method of claim 4 , wherein each of the two feature representation subsequences comprises a plurality of sample feature representations, and wherein determining the pair of content feature representations based on the two feature representation subsequences comprises: For a content sample in the two content samples, based on averaging processing of the multiple sample feature representations in the feature representation subsequence corresponding to the content sample, a content feature representation corresponding to the content sample in the pair of content feature representations is determined.
6. The method of claim 1 , wherein updating the parameters of the target machine learning model comprises: determining a first similarity between the pair of reference feature representations and a second similarity between the pair of content feature representations; as well as Based on the difference between the first similarity and the second similarity, update the parameters of the target machine learning model.
7. The method of claim 1 , wherein updating the parameters of the target machine learning model comprises: determining a first similarity between the pair of reference feature representations; determining whether the first similarity matches corresponding tag information of the content sample pair, the tag information indicating whether content samples in the content sample pair are related; and In response to the first similarity matching the annotation information, the parameters of the target machine learning model are updated based on the difference between the pair of reference feature representations and the pair of content feature representations corresponding to the content sample pair.
8. The method according to claim 7, wherein determining whether the first similarity matches the annotation information comprises: determining whether the first similarity and the annotation information meet at least one of a first predetermined condition or a second predetermined condition, the first predetermined condition indicating that the first similarity does not exceed a first threshold and the annotation information indicates that the content samples in the content sample pair are related, and the second predetermined condition indicating that the first similarity exceeds a second threshold and the annotation information indicates that the content samples in the content sample pair are not related; as well as In response to the first similarity and the annotation information not meeting the first predetermined condition and not meeting the second predetermined condition, it is determined that the first similarity matches the annotation information.
9. The method according to claim 1, further comprising: determining, based at least on the pair of content feature representations, using the target machine learning model, a second prediction result indicating whether the content samples in the content sample pair are related, and The parameters of the target machine learning model are further updated based on the difference between the second prediction result and the corresponding annotation information of the content sample pair, and the annotation information indicates whether the content samples in the content sample pair are related.
10. The method according to claim 1, further comprising: determining corresponding reference angles of a plurality of pairs of reference feature representations corresponding to a plurality of content sample pairs, respectively, the reference angles indicating angular differences of the corresponding pair of reference feature representations in a feature space of the reference machine learning model; determining corresponding prediction angles of a plurality of pairs of content feature representations corresponding to the plurality of content sample pairs, respectively, the prediction angles indicating angular differences of the corresponding pairs of content feature representations in a feature space of the target machine learning model; determining respective similarity metrics for the plurality of content sample pairs based on respective reference angles and respective predicted angles for the plurality of content sample pairs, and The parameters of the target machine learning model are further updated based on the corresponding similarity metrics of the multiple content sample pairs.
11. The method of claim 10, wherein determining the respective reference angles of the plurality of content sample pairs comprises: For a pair of reference feature representations among the plurality of pairs of reference feature representations, determining a first similarity between the pair of reference feature representations; as well as The first similarity is converted into a corresponding reference angle represented by the pair of reference features.
12. The method of claim 10, wherein determining the corresponding prediction angles for the plurality of content sample pairs comprises: For a pair of content feature representations among the plurality of pairs of content feature representations, determining a second similarity between the pair of content feature representations; as well as The second similarity is converted into a corresponding prediction angle of the pair of content feature representations.
13. The method of claim 10, wherein the plurality of content sample pairs comprises a positive sample pair and at least one negative sample pair, and wherein determining respective similarity metrics for the plurality of content sample pairs comprises: determining an angle difference margin between the positive sample pair and the at least one negative sample pair based on a reference angle of the positive sample pair; as well as Based on the corresponding prediction angles of the multiple content sample pairs and the angle difference margins, 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 angle difference margins to the corresponding prediction angles, and the similarity metrics of the negative sample pairs are determined by deducting the angle difference margins from the corresponding prediction angles.
14. The method of claim 13, wherein determining the angular discrepancy margin comprises: The angle difference margin is determined based on a reference angle of the positive sample pair and a predetermined scaling factor.
15. An apparatus for content representation, comprising: a first generation module configured to generate, based on a content sample pair, a pair of reference feature representations corresponding to the content sample pair using a reference encoder in a trained reference machine learning model, wherein the reference machine learning model is configured to generate a first prediction result indicating whether the content samples in the content sample pair are related; a second generating module configured to generate, based on the content sample pair, a pair of content feature representations corresponding to the content sample pair using an encoded portion of a target machine learning model to be trained, wherein the scale of the target machine learning model is larger than the scale of the reference machine learning model; as well as An updating module is configured to update the parameters of the target machine learning model based at least on the difference between the pair of reference feature representations and the pair of content feature representations to obtain the trained target machine learning model.
16. 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 14 when executed by the at least one processor. 17 . 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 claim 1 .
18. 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 14.