Large model recommendation method based on cross-modal semantic extraction
Through cross-modal feature interaction and alignment between language models and CTR models, the "illusion" problem and feature interaction neglect problem in text data processing in the existing technology are solved, and more accurate recommendation tasks and more efficient are achieved. Model training improves the understanding and flexibility of the model.
Patent Information
- Application Number
- CN202410752746.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-12
- Publication Date
- 2024-09-27
AI Technical Summary
Existing language models (LLM) and CTR models have "illusion" problems and neglect of feature interaction and collaboration information when processing text data. Moreover, cross-modal semantic extraction research is relatively backward, making it difficult to effectively understand and process multiple perceptual forms. information.
Through joint pre-training tasks, we design cross-modal feature representations, use mask features to reconstruct information, achieve feature interaction and alignment between different modalities, and fine-tune the model in downstream recommendation tasks, integrating the advantages of text and ID modalities.
It improves the accuracy of recommendation tasks, enhances the model's understanding ability and flexibility, reduces training time, realizes fine-grained feature-level interaction and alignment, and is suitable for a variety of recommendation scenarios.
Smart Images

Figure CN118709131A
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of artificial intelligence and relates to a large model recommendation method based on cross-modal semantic extraction. Background Art
[0002] With the development of deep learning technology, especially the rise of pre-trained large-scale language models (LLM), such as BERT and GPT, a new paradigm for processing text data has begun to attract the attention of researchers. These models can understand and extract deep semantic relationships in text data through pre-training on large-scale corpora. On the other hand, based on deep learning technology and a large amount of user behavior data collected online, click-through rate (CTR) prediction can estimate the probability of user clicks in a given specific situation, and plays a fundamental role in various personalized online recommendation services, including ad clicks, web searches, short video streaming, etc.
[0003] For language models, LLM can extract personalized information from text feature descriptions and use its external knowledge and semantic reasoning capabilities to achieve generalization performance in sparse user behavior data. However, LLM has the "hallucination" problem, that is, it may generate inaccurate or completely fictitious information when generating text. In addition, since text sentences will be decomposed into token form by the word segmenter, LLM usually ignores the interactive and collaborative information between multiple features. These problems seriously limit the development of LLM's practical application. For data models, traditional CTR prediction models are mainly based on the one-hot encoding form of ID features. They capture the synergy between user behavior and item characteristics by establishing a real and reliable interaction record between features. However, it ignores the rich semantic information contained in the text itself behind the ID feature attributes and only regards the features as discrete symbols. Regarding the cross-modal representation of feature input, namely text modality and ID modality, the LLM and CTR models have their own advantages. The LLM focuses on the semantic features of the text, while the CTR model focuses on the structured discrete identifier features. There is also a complementary relationship between the two. The LLM can provide a deeper understanding of text semantics than the traditional one-hot encoding, while the CTR model gives LLM more real and reliable information as well as interactive and collaborative relationships between features.
[0004] Despite the increasing application of LLM in various tasks and fields, the research on cross-modal semantic extraction is relatively backward. Cross-modal semantic extraction involves extracting and fusing information from different types of data (such as text, images, and IDs, etc.), which places higher requirements on the understanding ability and flexibility of the model. Current research mainly focuses on a single modality or limited modal fusion, while the exploration of deep semantic associations and knowledge transfer between multimodal data is still insufficient. This field has great development potential, and it is crucial to be able to understand and process information in multiple perceptual forms for the realization of true artificial intelligence systems. Summary of the invention
[0005] In view of this, the purpose of the present invention is to provide a large model recommendation method based on cross-modal semantic extraction. The method aims to perform fine-grained feature-level alignment between the CTR model based on ID features and the LLM based on text features to improve the accuracy of downstream recommendation tasks. Through joint pre-training tasks, the present invention allows the mask features of one modality to be used with the help of information from another modality when reconstructing information, thereby establishing feature interaction and alignment between different modalities. In addition, the present invention jointly fine-tunes these two models on downstream recommendation tasks to combine their advantages in processing different modal features.
[0006] In order to achieve the above object, the present invention provides the following technical solutions:
[0007] A large model recommendation method based on cross-modal semantic extraction, the method comprising the following steps:
[0008] S1: Design cross-modal feature representation based on the original data features, which are ID features and text features;
[0009] S2: Model the recommendation problem as a binary classification problem and build a basic model for click-through rate prediction based on ID features;
[0010] S3: Use the pre-trained large model to process text features and perform binary classification prediction;
[0011] S4: Perform modal feature alignment pre-training to parameterize the large model and click-through rate model, that is, reconstruct cross-modal features based on mask ID features and mask text features to achieve fine-grained feature alignment, and coarsely align feature representations of different modalities based on instance-level contrastive learning methods;
[0012] S5: Apply the aligned large model and click-through rate model to downstream tasks and complete the final recommendation prediction after fine-tuning.
[0013] Further, in step S1, the following steps are included:
[0014] S11: The original data features are presented in the form of a two-dimensional data table, and the dimension of the two-dimensional data table is set to R N×F , each row represents an instance data n, N represents the number of instances, each column represents a feature domain f, F represents the number of feature domains;
[0015] S12: Based on the original data features, one-hot encoding is used to generate the corresponding ID feature representation, that is,
[0016]
[0017] Among them, x v is the mark indication of the feature value text v in the feature domain, x f is the one-hot representation vector of the feature domain f, is the ID feature representation vector, whose dimension is R V , V is the total number of features, v f is the number of features in the feature domain f, then
[0018] S13: Generate the corresponding text feature representation based on the original data features using a hard prompt template, i.e.
[0019]
[0020] Among them, k f The text name of the feature domain f, w f Indicates the feature value text corresponding to the feature domain f in each instance input, operator Represents the concatenation operation between texts.
[0021] Further, in step S2, the following steps are included:
[0022] S21: The recommendation problem is modeled as a binary classification problem, namely, the click-through rate prediction problem. Its basic form is to use data from multiple feature domains for binary classification, where y n ∈{0,1} is the true label of the user click behavior in instance n. When the user clicks on the content in instance n, y n =1, otherwise y n =0;
[0023] S22: Click-through rate model to estimate the probability of each sample being clicked For this purpose, according to the network structure classification of the click rate model, it is abstracted into a three-layer network, namely the embedding layer, the feature interaction layer and the prediction layer;
[0024] Among them, in the embedding layer, the high-dimensional sparse ID feature vector Converted into a low-dimensional dense embedding matrix E n, the features in the feature domain f are converted from their corresponding representation matrices into embedded vectors by table lookup, expressed as:
[0025]
[0026] in, represents the one-hot vector of the eigenvalues in the feature domain f, is the representation matrix of feature domain f, D is the embedding dimension, and the complete embedding matrix is expressed as E = [e1; e2; ...; e f ;…;e F ]∈R F×D ;
[0027] In the feature interaction layer, the embedding matrix E is taken as input to generate a dense representation vector v for each instance n n ; A high-low order cross model with a dual-tower structure is used to design complex interactive operations for each feature to obtain low-order or high-order feature cross terms;
[0028] In the prediction layer, the representation vectors of high- and low-order cross outputs are concatenated and input into the neural network or linear regression module, and then connected to the sigmoid function to adjust the range to obtain the final user click probability.
[0029] S23: The click-through rate model is trained in an end-to-end manner using binary cross entropy loss, expressed as:
[0030]
[0031] Further, in step S3, the following steps are included:
[0032] S31: Select a pre-trained large language model as text features Feature processing model;
[0033] S32: Text features based on pre-trained large models Convert to token form;
[0034] S33: Then use the transformer-based neural network to process the token embedding obtained in the previous step to generate a context-consistent representation w n ;
[0035] S34: In the expression w n Add a randomly initialized classification head to perform binary classification and predict the click label
[0036] Further, in step S4, the following steps are included:
[0037] S41: Select the data masking method at the feature domain level to obtain the interference form of ID features and text features, which are respectively recorded as and For Mask ID Features The generation of unified from the original A certain proportion of the feature domain is extracted from the mask for masking operation; for masked text features The generation of unified from the original Extract a certain proportion of the feature domain for mask operation;
[0038] S42: taking the feature vector of the ID modality as input and using the click rate model to encode the data; taking the feature vector of the text modality as input and using the large model to encode the data;
[0039] S43: Output the mask ID feature after data encoding And the text feature output w n Perform joint reconstruction; output v according to the ID feature after data encoding n And mask text feature output Conduct joint reconstruction;
[0040] S44: Establish coarse-grained feature alignment between modalities based on instance-level contrastive learning method; combine the optimization objectives in the joint reconstruction and coarse-grained feature alignment process, and train based on the overall loss function of the cross-modal alignment pre-training stage of the click-through rate model and the large model.
[0041] Further, in step S41, in the mask ID feature In the generation process of , an additional mask symbol [MASK] is used to replace the corresponding feature. The mask symbol is shared by all feature domains, and the masked feature domain index set is recorded as The one-hot encoded ID feature vector uses the symbol 0 to mask the feature, so It is expressed as follows:
[0042]
[0043] in, is a dimension v f The zero vector of .
[0044] In the mask text feature In the process of generating It is expressed as follows:
[0045]
[0046] Among them, the text feature uses the symbol <unknown> mask feature, then The feature f is unknown. ", and the masked token index set is recorded as
[0047] Further, in step S42, the feature vector of the ID mode is used as input, and the data is encoded using the click rate model, which is expressed as:
[0048]
[0049] Among them, f CTR (·) represents the click-through rate model that only contains the embedding layer and the feature interaction layer, The output representation vector after high- and low-order crossover, D ID Represents the output dimension of the feature interaction layer;
[0050] The feature vector of the text modality is used as input and the data is encoded using a large model, which is expressed as:
[0051]
[0052] Among them, f LLM (·) represents the pre-trained large model, Represents the hidden layer state set of the last layer of the large model, and L is the text feature The number of tokens, D text Represents the output dimension of the hidden layer of the large model, w n,1 A [CLS] token vector representing a compressed representation of the entire text input.
[0053] Further, in step S43, the mask ID feature output after data encoding is And the text feature output w n The process of performing a joint reconstruction includes:
[0054] Output the encoded As input, design the self-attention mechanism module aggregation and w n , the output is expressed as:
[0055]
[0056] in K=V=w n , represents the trainable attention parameter matrix, Represents the scaling factor. The multi-head attention mechanism is integrated by h different self-attention mechanism modules, and its aggregate output process is:
[0057] u n =MultiHead(Q,K,V)=[head1||head2||…||head h ]WO
[0058] head i =Attention(QW i Q ,KW i K ,VW i V )
[0059] Among them, the symbol || represents the concatenation operation between vectors, W i Q , W i K , W i V and W O Represent Q, K, V and the parameter matrix of the aggregation representation mapping respectively;
[0060] For each mask ID feature Design an independent multilayer perceptron network g f (·), followed by a softmax function to calculate the distribution p on the candidate features n,f ∈R V , expressed as:
[0061] z n,f =g f (u n ),z n,f ∈R V
[0062]
[0063] Among them, V represents the size of the entire feature space;
[0064] Then, the cross entropy loss function is used to calculate the ID feature reconstruction loss for all mask features, which is expressed as:
[0065]
[0066] in, Indicates the number of mask features, loss BCE (·) represents the cross entropy loss function;
[0067] The reconstruction loss is calculated using the noise contrast estimation function, which is expressed as:
[0068]
[0069] Among them, δ(·) represents the sigmoid function, t represents the positive characteristic index, and q represents the sampled noise characteristic index;
[0070] Output v according to the ID feature after data encoding n And mask text feature output The process of performing a joint reconstruction includes:
[0071] Output the encoded As input, for each mask token feature The splicing operation is:
[0072]
[0073] Then, the concatenated vector Input to the prediction layer to obtain the reconstructed feature distribution, expressed as:
[0074]
[0075] Among them, M represents the vocabulary size, g LLM (·) represents the two-layer perceptron module at the decoder end of the large language model;
[0076] Finally, the cross entropy loss function is used to perform pre-training optimization of the large model, expressed as:
[0077]
[0078] in, is the original lth token.
[0079] Further, in step S43, the process of establishing coarse-grained feature alignment between modalities according to the instance-level contrastive learning method includes:
[0080] Use [CLS] token vector to represent text input w n,1 , two independent linear layers and normalization layers are used to transform the [CLS] token output and ID feature output v n Projected into d-dimensional vectors, respectively and
[0081] The InfoNCE function is used to calculate the instance-level contrast loss, expressed as:
[0082]
[0083] Where B represents the size of the training batch, τ represents the temperature hyperparameter, and sim(·) represents the similarity function;
[0084] The final loss is obtained by summing and averaging the two instance-level loss functions, expressed as:
[0085]
[0086] The overall loss of the cross-modal alignment pre-training phase based on the click-through rate model and the large model is expressed as:
[0087]
[0088] Further, in step S5, the following steps are included:
[0089] S51: In downstream CTR prediction or recommendation tasks, use supervised click signals to jointly fine-tune the CTR model and the big model;
[0090] S52: Deploy a randomly initialized linear layer on the large model and the click rate model, and output the estimated click probability respectively, expressed as:
[0091]
[0092] Among them, linear(·) represents the linear layer of the corresponding model;
[0093] S53: The final click probability is estimated by the weighted sum of the outputs of the two models, expressed as:
[0094]
[0095] Among them, λ∈[0,1] is a learnable parameter used to balance the weights of the two model losses;
[0096] S54: Compare the click rate estimation results with the true labels respectively, and use the cross entropy loss function to measure the gap to fine-tune and optimize the model, which is expressed as:
[0097]
[0098] The beneficial effects of the present invention are:
[0099] The present invention has many advantages. First, the model of the present invention is an agnostic framework, that is, the proposed framework is applicable to all CTR models and LLMs, and appropriate models can be selected according to different scenarios, which helps to enhance the versatility and scalability of the framework. Secondly, the parameterized model can be plug-and-play, and through the joint reconstruction of feature levels across modalities, the model pre-training task of fine-grained feature-level interaction and alignment is realized, and the parameterized model can be well inserted into the downstream recommendation task for fine-tuning. Third, the number of parameters and time of the LLM and CTR models in the training process are reduced, because the LLM and CTR models will provide more different modal information during joint reconstruction, which helps the model to converge quickly. In downstream recommendation tasks, the model fine-tuning process will greatly reduce the training time compared to the original supervised learning.
[0100] Other advantages, objectives and features of the present invention will be described in the following description to some extent, and to some extent, will be obvious to those skilled in the art based on the following examination and study, or can be taught from the practice of the present invention. The objectives and other advantages of the present invention can be realized and obtained through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0101] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention will be described in detail below in conjunction with the accompanying drawings, wherein:
[0102] Figure 1 A block diagram of a large model recommendation algorithm for cross-modal semantic extraction provided by an embodiment of the present invention;
[0103] Figure 2 A block diagram of fine-tuning downstream recommendation tasks provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0104] The following describes the embodiments of the present invention by specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the illustrations provided in the following embodiments only illustrate the basic concept of the present invention in a schematic manner, and the following embodiments and features in the embodiments can be combined with each other without conflict.
[0105] Among them, the drawings are only used for illustrative explanations, and they only represent schematic diagrams rather than actual pictures, and should not be understood as limitations on the present invention. In order to better illustrate the embodiments of the present invention, some parts of the drawings may be omitted, enlarged or reduced, and do not represent the size of actual products. For those skilled in the art, it is understandable that some well-known structures and their descriptions in the drawings may be omitted.
[0106] The same or similar numbers in the drawings of the embodiments of the present invention correspond to the same or similar parts; in the description of the present invention, it should be understood that if the terms "upper", "lower", "left", "right", "front", "rear", etc. indicate the orientation or position relationship, they are based on the orientation or position relationship shown in the drawings, which is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operate in a specific orientation. Therefore, the terms describing the position relationship in the drawings are only used for illustrative purposes and cannot be understood as limiting the present invention. For ordinary technicians in this field, the specific meanings of the above terms can be understood according to specific circumstances.
[0107] See also Figure 1-2 , which is a large model recommendation method based on cross-modal semantic extraction.
[0108] In most recommendation tasks, such as CTR prediction, the focus is on designing various complex network structures to enhance the expressiveness of the model, but the efficient and deep semantic extraction of different modalities and the knowledge transfer and fusion across multiple modalities are ignored. Therefore, the present invention implements a large model recommendation method for cross-modal semantic extraction, such as Figure 1 The block diagram of the big model recommendation algorithm for cross-modal semantic extraction is shown. Specifically, a cross-modal feature representation is designed based on the original feature data, which are ID features and text features respectively; the recommendation problem is converted into a downstream click-through rate prediction problem considering the actual scenario of the recommendation task; click-through rate prediction can be performed for different modal features, where the traditional high- and low-order feature cross-model uses ID features as input to predict click-through rate, and the pre-trained LLM uses text features as input to predict click-through rate; cross-modal feature alignment pre-training is performed to parameterize the big model and click-through rate model, that is, cross-modal features are reconstructed according to masked ID features and masked text features to achieve fine-grained feature interaction and alignment, and feature representations of different modalities are coarsely aligned according to the instance-level contrastive learning method; the aligned big model and click-through rate model are adapted to downstream tasks, and the final recommendation prediction is completed after fine-tuning.
[0109] The present invention provides a large model recommendation method for cross-modal semantic extraction, comprising:
[0110] Step 1: Design cross-modal feature representation based on the original data features, which are ID features and text features, including the following steps:
[0111] Step 1.1: The original data features are generally presented in the form of a two-dimensional data table, represented as
[0112]
[0113] The dimension of the two-dimensional data table is set to R N×F , each row represents an instance data n, N represents the number of instances, each column represents a feature domain f, F represents the number of feature domains.
[0114] Step 1.2: Based on the original data features, one-hot encoding is used to generate the corresponding ID feature representation, that is,
[0115]
[0116] Among them, x v is the mark indication of the feature value text v in the feature domain, x f is the one-hot representation vector of the feature domain f, is the ID feature representation vector, whose dimension is R V , V is the total number of features, v f is the number of features in the feature domain f, then
[0117] Step 1.3: Generate the corresponding text feature representation based on the original data features using a hard prompt template, that is,
[0118]
[0119] Among them, k f The text name of the feature domain f, w f Indicates the feature value text corresponding to the feature domain f in each instance input, operator Represents the concatenation operation between texts.
[0120] Step 2: Model the recommendation problem as a binary classification problem and build a basic model for click-through rate prediction based on ID features. Specifically, the following steps are included:
[0121] Step 2.1: Model the recommendation problem as a binary classification problem, that is, the click-through rate prediction problem. Its basic form is to use data from multiple feature domains for binary classification, where y n ∈{0,1} is the true label of the user click behavior in instance n. When the user clicks on the content in instance n, y n =1, otherwise y n =0.
[0122] Step 2.2: The purpose of the click-through rate model is to estimate the probability of each sample being clicked According to the network structure classification of the click-through rate model, it is abstracted into a three-layer network, namely the embedding layer, the feature interaction layer and the prediction layer.
[0123] Step 2.3: Embedding layer: embedding high-dimensional sparse ID feature vector Converted into a low-dimensional dense embedding matrix E n The features in the feature domain f are converted from their corresponding representation matrices into embedded vectors by table lookup, expressed as:
[0124]
[0125] in, represents the one-hot vector of the eigenvalues in the feature domain f, is the representation matrix of feature domain f, D is the embedding dimension, and the complete embedding matrix is expressed as E = [e1; e2; ...; e f ;…;e F ]∈R F×D .
[0126] Step 2.4: Feature Interaction Layer: Take the embedding matrix E as input and generate a dense representation vector v for each instance n n The purpose of the feature interaction layer is to design complex interactive operations for each feature to obtain low-order or high-order feature cross-items. Common cross-models include factorization machines (low-order interactions), multi-layer perceptrons (high-order interactions), etc. In addition, the click-through rate model in the method of the present invention is generally a high-low order cross-model using a double-tower structure.
[0127] Step 2.5: Prediction layer: After concatenating the representation vectors of the high- and low-order cross outputs, input them into the neural network or linear regression module, and then connect the sigmoid function to adjust the range to obtain the final user click probability
[0128] Step 2.5: Finally, the CTR model is trained in an end-to-end manner using a binary cross entropy loss, expressed as:
[0129]
[0130] Step 3: Use the pre-trained large model to process text features and perform binary classification prediction, which includes the following steps:
[0131] Step 3.1: Select a pre-trained large language model as text features feature processing models, such as GPT3, CTR-BERT, T5 and other models.
[0132] Step 3.2: Text features based on the pre-trained large model Convert to token form.
[0133] Step 3.3: Then use the transformer-based neural network to process the token embedding obtained in the previous step to generate a context-consistent representation w n .
[0134] Step 3.4: In the representation w n Add a randomly initialized classification head to perform binary classification and predict the click label
[0135] Step 4: Perform modal feature alignment pre-training to parameterize the large model and click-through rate model, that is, reconstruct cross-modal features based on mask ID features and mask text features to achieve fine-grained feature alignment, and coarsely align feature representations of different modalities based on instance-level contrastive learning methods. Specifically, the following steps are included:
[0136] Step 4.1: Select the data masking method at the feature domain level to obtain the interference form of ID features and text features, which are recorded as and The click rate model based on ID features and the large model based on text features are independent and parallel workflows, so the selected mask features do not need to be the same.
[0137] Step 4.2: For the Mask ID Feature The generation of unified from the original A certain proportion of feature domains are extracted from the mask operation, that is, an additional mask symbol [MASK] is used to replace the corresponding features. The mask symbol is shared by all feature domains, and the masked feature domain index set is recorded as Generally, the one-hot encoded ID feature vector uses the symbol 0 to mask the feature, so It is expressed as follows
[0138]
[0139] in, is a dimension v f The zero vector of .
[0140] Step 4.3: For masked text features The generation is similar to the S42 operation. It is expressed as follows
[0141]
[0142] Among them, the text feature uses the symbol <unknown> mask feature, then The masked token index set is recorded as
[0143] Step 4.4: Take the feature vector of ID mode as input and use the click rate model to encode the data, expressed as
[0144]
[0145] Among them, f CTR (·) represents the click-through rate model (including only the embedding layer and the feature interaction layer), The output representation vector after high- and low-order crossover, D ID Represents the output dimension of the feature interaction layer.
[0146] Step 4.5: Take the feature vector of the text modality as input and use the large model to encode the data, expressed as
[0147]
[0148] Among them, f LLM (·) represents the pre-trained large model, Represents the hidden layer state set of the last layer of the large model, and L is the text feature The number of tokens, D text Represents the output dimension of the hidden layer of the large model. Note that w n,1 A [CLS] token vector representing a compressed representation of the entire text input.
[0149] Step 4.6: Output the mask ID feature after data encoding And the text feature output w n To dynamically capture basic knowledge from the large model output token corresponding to the mask feature, the output encoding pair As input, design the self-attention mechanism module aggregation and w n , then the output is expressed as
[0150]
[0151] in, K=V=w n , represents the trainable attention parameter matrix, Represents the scaling factor. The multi-head attention mechanism is integrated by h different self-attention mechanism modules, and its aggregate output process is
[0152] u n =MultiHead(Q,K,V)=[head1||head2||…||head h ]W O
[0153] head i =Attention(QW i Q ,KW i K ,VW i V )
[0154] Among them, the symbol || represents the concatenation operation between vectors, W i Q , W i K , W i V and W O Represent Q, K, V and the parameter matrix of the aggregation representation mapping respectively.
[0155] For each mask ID feature Design an independent multilayer perceptron network g f (·), followed by a softmax function to calculate the distribution p on the candidate features n,f ∈R V , expressed as
[0156] z n,f =g f (u n ),z n,f ∈R V
[0157]
[0158] Among them, V represents the size of the entire feature space.
[0159] Then, the cross entropy loss function is used to calculate the ID feature reconstruction loss for all mask features, which is expressed as
[0160]
[0161] in, Indicates the number of mask features, loss BCE (·) represents the cross entropy loss function. Note that the above formula is applicable to models with small feature space dimensions.
[0162] Finally, considering that the ID feature space dimension is generally high, the calculation of the softmax function is very expensive. In order to optimize the loss function calculation, the noise contrast estimation function is used to universally calculate the reconstruction loss, which is expressed as
[0163]
[0164] Among them, δ(·) represents the sigmoid function, t represents the positive characteristic index, and q represents the sampled noise characteristic index.
[0165] Step 4.7: Output v according to the ID feature after data encoding n And mask text feature output To dynamically capture the basic knowledge from the CTR model output vector corresponding to the mask feature, the output encoding pair As input, for each mask token feature The splicing operation is
[0166]
[0167] Then, the concatenated vector Input to the prediction layer to obtain the reconstructed feature distribution, expressed as
[0168]
[0169] Among them, M represents the vocabulary size, g LLM (·) represents a two-layer MLP module at the decoder end of the large language model.
[0170] Finally, the cross entropy loss function is used to perform pre-training optimization of the large model, expressed as
[0171]
[0172] in, is the original lth token.
[0173] Step 4.8: Establish coarse-grained feature alignment between modalities based on instance-level contrastive learning method. First, use [CLS] token vector to represent text input w n,1 To maintain dimensional consistency, two independent linear layers and normalization layers are used to transform the [CLS] token output and ID feature output v n Projected into d-dimensional vectors, respectively and Then, the InfoNCE function is used to calculate the instance-level contrast loss, expressed as
[0174]
[0175] Among them, B represents the size of the training batch, τ represents the temperature hyperparameter, and sim(·) represents the similarity function. Finally, the two instance-level loss functions are summed and averaged to obtain the final loss, which is expressed as
[0176]
[0177] Step 4.9: Putting the three objectives S46-S48 together, the overall loss of the cross-modal alignment pre-training phase based on the click-through rate model and the large model is expressed as
[0178]
[0179] Step 5: Adapt the aligned large model and click-through rate model to the downstream task and complete the final recommendation prediction after fine-tuning, such as Figure 2 The downstream recommendation task fine-tuning block diagram shown includes the following steps:
[0180] Step 5.1: After the pre-training stage, the large model and the click rate model are better initialized through cross-modal alignment. In the downstream click rate prediction task (recommendation task), the two models are jointly fine-tuned using supervised click signals.
[0181] Step 5.2: Deploy a randomly initialized linear layer on the large model and the click rate model, and output the estimated click probability, expressed as
[0182]
[0183] Among them, linear(·) represents the linear layer of the corresponding model.
[0184] Step 5.3: The final click probability is estimated by the weighted sum of the outputs of the two models, expressed as
[0185]
[0186] Among them, λ∈[0,1] is a learnable parameter used to balance the weights of the two model losses.
[0187] Step 5.4: Compare the three CTR estimation results with the true labels respectively, and use the cross entropy loss function to measure the gap for model fine-tuning optimization, expressed as
[0188]
[0189] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the purpose and scope of the technical solution, which should be included in the scope of the claims of the present invention.
Claims
1. A large model recommendation method based on cross-modal semantic extraction, characterized by: The method comprises the following steps: S1: Design cross-modal feature representation based on the original data features, which are ID features and text features; S2: Model the recommendation problem as a binary classification problem and build a basic model for click-through rate prediction based on ID features; S3: Use the pre-trained large model to process text features and perform binary classification prediction; S4: Perform modal feature alignment pre-training to parameterize the large model and click-through rate model, that is, reconstruct cross-modal features based on mask ID features and mask text features to achieve fine-grained feature alignment, and coarsely align feature representations of different modalities based on instance-level contrastive learning methods; S5: Apply the aligned large model and click-through rate model to downstream tasks and complete the final recommendation prediction after fine-tuning.
2. The large model recommendation method based on cross-modal semantic extraction according to claim 1 is characterized in that: In step S1, the following steps are included: S11: The original data features are presented in the form of a two-dimensional data table, and the dimension of the two-dimensional data table is set to R N×F , each row represents an instance data n, N represents the number of instances, each column represents a feature domain f, F represents the number of feature domains; S12: Based on the original data features, one-hot encoding is used to generate the corresponding ID feature representation, that is, Among them, x v is the mark indication of the feature value text v in the feature domain, x f is the one-hot representation vector of the feature domain f, x I n D is the ID feature representation vector, whose dimension is R V , V is the total number of features, v f is the number of features in the feature domain f, then S13: Generate the corresponding text feature representation based on the original data features using a hard prompt template, i.e. "yes ", Among them, k f The text name of the feature domain f, w f Indicates the feature value text corresponding to the feature domain f in each instance input, operator Represents the concatenation operation between texts.
3. The large model recommendation method based on cross-modal semantic extraction according to claim 2 is characterized in that: In step S2, the following steps are included: S21: The recommendation problem is modeled as a binary classification problem, namely, the click-through rate prediction problem. Its basic form is to use data from multiple feature domains for binary classification, where y n ∈{0,1} is the true label of the user click behavior in instance n. When the user clicks on the content in instance n, y n =1, otherwise y n =0; S22: Click-through rate model to estimate the probability of each sample being clicked For this purpose, according to the network structure classification of the click rate model, it is abstracted into a three-layer network, namely the embedding layer, the feature interaction layer and the prediction layer; Among them, in the embedding layer, the high-dimensional sparse ID feature vector Converted into a low-dimensional dense embedding matrix E n , the features in the feature domain f are converted from their corresponding representation matrices into embedded vectors by table lookup, expressed as: in, represents the one-hot vector of the eigenvalues in the feature domain f, is the representation matrix of feature domain f, D is the embedding dimension, and the complete embedding matrix is expressed as E = [e1; e2; ...; e f ;…;e F ]∈R F×D ; In the feature interaction layer, the embedding matrix E is taken as input to generate a dense representation vector v for each instance n n ; A high-low order cross model with a dual-tower structure is used to design complex interactive operations for each feature to obtain low-order or high-order feature cross terms; In the prediction layer, the representation vectors of high- and low-order cross outputs are concatenated and input into the neural network or linear regression module, and then connected to the sigmoid function to adjust the range to obtain the final user click probability. S23: The click-through rate model is trained in an end-to-end manner using binary cross entropy loss, expressed as:
4. The large model recommendation method based on cross-modal semantic extraction according to claim 3 is characterized in that: In step S3, the following steps are included: S31: Select a pre-trained large language model as text features Feature processing model; S32: Text features based on pre-trained large models Convert to token form; S33: Then use the transformer-based neural network to process the token embedding obtained in the previous step to generate a context-consistent representation w n ; S34: In the expression w n Add a randomly initialized classification head to perform binary classification and predict the click label 5. The large model recommendation method based on cross-modal semantic extraction according to claim 4 is characterized in that: In step S4, the following steps are included: S41: Select the data masking method at the feature domain level to obtain the interference form of ID features and text features, which are respectively recorded as and For Mask ID Features The generation of unified from the original A certain proportion of the feature domain is extracted from the mask for masking operation; for masked text features The generation of unified from the original Extract a certain proportion of the feature domain for mask operation; S42: taking the feature vector of the ID modality as input and using the click rate model to encode the data; taking the feature vector of the text modality as input and using the large model to encode the data; S43: Output the mask ID feature after data encoding And the text feature output w n Perform joint reconstruction; output v according to the ID feature after data encoding n And mask text feature output Conduct joint reconstruction; S44: Establish coarse-grained feature alignment between modalities based on instance-level contrastive learning method; combine the optimization objectives in the joint reconstruction and coarse-grained feature alignment process, and train based on the overall loss function of the cross-modal alignment pre-training stage of the click-through rate model and the large model.
6. The large model recommendation method based on cross-modal semantic extraction according to claim 5 is characterized in that: In step S41, the mask ID feature In the generation process of , an additional mask symbol [MASK] is used to replace the corresponding feature. The mask symbol is shared by all feature domains, and the masked feature domain index set is recorded as The one-hot encoded ID feature vector uses the symbol 0 to mask the feature, so It is expressed as follows: in, is a dimension v f The zero vector of ; In the mask text feature In the process of generating It is expressed as follows: Among them, the text feature uses the symbol <unknown> mask feature, then "Feature f is unknown", the masked token index set is recorded as 7. The large model recommendation method based on cross-modal semantic extraction according to claim 5 is characterized in that: In step S42, the feature vector of the ID modality is used as input and the data is encoded using the click rate model, which is expressed as: Among them, f CTR (·) represents the click-through rate model that only contains the embedding layer and the feature interaction layer, The output representation vector after high- and low-order crossover, D ID Represents the output dimension of the feature interaction layer; The feature vector of the text modality is used as input and the data is encoded using a large model, which is expressed as: Among them, f LLM (·) represents the pre-trained large model, Represents the hidden layer state set of the last layer of the large model, and L is the text feature The number of tokens, D text Represents the output dimension of the hidden layer of the large model, w n,1 A [CLS] token vector representing a compressed representation of the entire text input.
8. The large model recommendation method based on cross-modal semantic extraction according to claim 5 is characterized in that: In step S43, the mask ID feature after data encoding is output And the text feature output w n The process of performing a joint reconstruction includes: Output the encoded As input, design the self-attention mechanism module aggregation and w n , the output is expressed as: in, K=V=w n , represents the trainable attention parameter matrix, Represents the scaling factor. The multi-head attention mechanism is integrated by h different self-attention mechanism modules, and its aggregate output process is: u n =MultiHead(Q,K,V)=[head1||head2||…||head h ]W O head i =Attention(QW i Q ,KW i K ,VW i V ) Among them, the symbol || represents the concatenation operation between vectors, W i Q , W i K , W i V and W O Represent Q, K, V and the parameter matrix of the aggregation representation mapping respectively; For each mask ID feature Design an independent multilayer perceptron network g f (·), followed by a softmax function to calculate the distribution p on the candidate features n,f ∈R V , expressed as: z n,f =g f (u n ),z n,f ∈R V Among them, V represents the size of the entire feature space; Then, the cross entropy loss function is used to calculate the ID feature reconstruction loss for all mask features, which is expressed as: in, Indicates the number of mask features, loss BCE (·) represents the cross entropy loss function; The reconstruction loss is calculated using the noise contrast estimation function, which is expressed as: Among them, δ(·) represents the sigmoid function, t represents the positive characteristic index, and q represents the sampled noise characteristic index; Output v according to the ID feature after data encoding n And mask text feature output The process of performing a joint reconstruction includes: Output the encoded As input, for each mask token feature The splicing operation is: Then, the concatenated vector Input to the prediction layer to obtain the reconstructed feature distribution, expressed as: Among them, M represents the vocabulary size, g LLM (·) represents the two-layer perceptron module at the decoder end of the large language model; Finally, the cross entropy loss function is used to perform pre-training optimization of the large model, expressed as: in, is the original lth token.
9. The large model recommendation method based on cross-modal semantic extraction according to claim 5, characterized in that: In step S43, the process of establishing coarse-grained feature alignment between modalities according to the instance-level contrastive learning method includes: Use [CLS] token vector to represent text input w n,1 , two independent linear layers and normalization layers are used to transform the [CLS] token output and ID feature output v n Projected into d-dimensional vectors, respectively recorded as and The InfoNCE function is used to calculate the instance-level contrast loss, expressed as: Where B represents the size of the training batch, τ represents the temperature hyperparameter, and sim(·) represents the similarity function; The final loss is obtained by summing and averaging the two instance-level loss functions, expressed as: The overall loss of the cross-modal alignment pre-training phase based on the click-through rate model and the large model is expressed as:
10. The large model recommendation method based on cross-modal semantic extraction according to claim 5, characterized in that: In step S5, the following steps are included: S51: In downstream CTR prediction or recommendation tasks, use supervised click signals to jointly fine-tune the CTR model and the big model; S52: Deploy a randomly initialized linear layer on the large model and the click rate model, and output the estimated click probability respectively, expressed as: Among them, linear(·) represents the linear layer of the corresponding model; S53: The final click probability is estimated by the weighted sum of the outputs of the two models, expressed as: Among them, λ∈[0,1] is a learnable parameter used to balance the weights of the two model losses; S54: Compare the click rate estimation results with the true labels respectively, and use the cross entropy loss function to measure the gap to fine-tune and optimize the model, which is expressed as:
Citation Information
Cited By
Power distribution network fault identification method and device and electronic equipment
CN119125764A
Distribution network fault identification method, device and electronic equipment
CN119125764B
Object recommendation method and device
CN119377485A
Object Recommendation Method and Device
CN119377485B
Cross-modal water volume prediction method based on large model
CN119623704A
