Model training method and device, recommendation method and device, electronic equipment, computer program product and computer readable storage medium
By sharing dynamic embedding tables, the feature fusion mapping of click message sequences of target scenarios and source scenarios is solved, and the training efficiency and accuracy of the recommended model are improved.
Patent Information
- Application Number
- CN202410191509.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-20
- Publication Date
- 2025-08-22
AI Technical Summary
It is difficult for existing recommendation models to accurately determine the preferences of recommended objects in different recommendation scenarios, resulting in low modeling accuracy.
By sharing a dynamic embedding table, the feature fusion mapping of click message sequences in the target scene and the source scene is obtained, and the feature extraction is performed to obtain the trained recommended model.
It improves the training efficiency and recommendation accuracy of the recommended model, can capture the differences in preferences of recommended objects in different scenarios, and improves the accuracy of recommendations.
Smart Images

Figure CN120524221A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to computer technology, and in particular to a model training method, a recommendation method, an apparatus, an electronic device, a computer program product, and a computer-readable storage medium. Background Art
[0002] Accurate modeling of recommended items is crucial for online personalized recommendation services. Generally speaking, recommended items have diverse interests and are not limited to a single aspect. Recommended items exhibit different behavioral patterns in different recommendation scenarios, expressing their varying interests and preferences. Furthermore, recommended item behavior in different scenarios can be qualitatively different. For example, an item that is seen in the source scenario and triggers clicks from the recommended item may not necessarily generate the same click-through rate when seen in the target scenario. Consequently, accurate modeling of recommended items is often limited. Summary of the Invention
[0003] The embodiments of the present application provide a model training method, a recommendation method, an apparatus, an electronic device, a computer program product, and a computer-readable storage medium, which can improve the training efficiency and recommendation accuracy of the recommendation model.
[0004] The technical solution of the embodiment of the present application is implemented as follows:
[0005] The present invention provides a model training method, which includes:
[0006] Obtaining a recommendation model to be trained, and obtaining multiple training samples and label information of each training sample, wherein the training samples include basic sample features, a first click message sequence in a target scenario, and a second click message sequence in a source scenario;
[0007] For each training sample, feature mapping is performed on the training sample to obtain a training sample embedding vector;
[0008] Performing feature fusion mapping on the first click message sequence and the second click message sequence through a shared dynamic embedding table to obtain a fused embedding vector;
[0009] Performing feature extraction on the training sample embedding vector and the fused embedding vector respectively to obtain a training sample feature vector and a fused feature vector respectively;
[0010] The recommendation model to be trained is trained using the training sample feature vectors, fusion feature vectors and label information of each training sample to obtain a trained recommendation model.
[0011] This embodiment of the present application provides a recommendation method, which includes:
[0012] Obtaining a trained recommendation model, wherein the trained recommendation model is obtained by training using the model training method according to any one of claims 1 to 10;
[0013] Obtain a set of information to be recommended for the target recommendation object;
[0014] For each piece of information to be recommended in the set of information to be recommended, obtaining input features of the information to be recommended, the input features including a second information feature of the information to be recommended, a second object feature of the target recommended object, a second intersection feature of the information to be recommended and the target recommended object, a first historical click message sequence of the target recommended object in a target scenario, and a second historical click message sequence of the target recommended object in a source scenario;
[0015] Using the trained recommendation model to perform prediction processing on the input features to obtain a predicted click probability of the information to be recommended;
[0016] Sorting each of the to-be-recommended information in descending order of predicted click probability to obtain sorted to-be-recommended information;
[0017] The sorted information to be recommended is sent to the terminal corresponding to the target recommendation object.
[0018] The present invention provides a model training device, comprising:
[0019] A first acquisition module is used to acquire a recommendation model to be trained and obtain multiple training samples and label information of each training sample, wherein the training samples include basic sample features, a first click message sequence in a target scenario, and a second click message sequence in a source scenario;
[0020] A feature mapping module is used to perform feature mapping on each training sample to obtain a training sample embedding vector;
[0021] a feature fusion mapping module, configured to perform feature fusion mapping on the first click message sequence and the second click message sequence through a shared dynamic embedding table to obtain a fused embedding vector;
[0022] A feature extraction module is used to extract features from the training sample embedding vector and the fused embedding vector respectively, and obtain a training sample feature vector and a fused feature vector respectively;
[0023] The training module is used to train the recommendation model to be trained by using the training sample feature vector, the fusion feature vector and the label information of each training sample to obtain a trained recommendation model.
[0024] The feature fusion mapping module is also used to obtain a shared dynamic embedding table, which includes multiple shared embedding vectors; divide the multiple shared embedding vectors into a first embedding queue and a second embedding queue; determine the queue change amount based on the first click message sequence, the second click message sequence, the first embedding queue and the second embedding queue; update the first embedding queue and the second embedding queue based on the queue change amount to obtain an updated first embedding queue and an updated second embedding queue; perform feature mapping on each first message identifier in the first click message sequence through the updated first embedding queue to obtain a first shared embedding vector, and perform feature mapping on each second message identifier in the second click message sequence through the updated second embedding queue to obtain a second shared embedding vector; fuse the first shared embedding vector and the second shared embedding vector to obtain a fused embedding vector.
[0025] The feature fusion mapping module is also used to perform feature mapping on each first message identifier in the first click message sequence through the first embedding queue to obtain a first initial embedding vector corresponding to each first message identifier; perform feature mapping on each second message identifier in the second click message sequence through the second embedding queue to obtain a second initial embedding vector corresponding to each second message identifier; use the trained weight prediction model to perform prediction processing on each first initial embedding vector and each second initial embedding vector to obtain an attention weight; obtain the total number of embedding vectors in the shared dynamic embedding table, and determine the queue change amount based on the attention weight and the total number of embedding vectors.
[0026] The feature fusion mapping module is further used to obtain shared embedding vectors corresponding to multiple first new message identifiers when the queue change amount is greater than 0; update the first embedding queue based on the queue change amount and the shared embedding vectors corresponding to the multiple first new message identifiers to obtain an updated first embedding queue; and delete the shared embedding vectors corresponding to the queue change amount from the second embedding queue to obtain an updated second embedding queue.
[0027] The feature fusion mapping module is also used to, when the queue change amount is less than 0, delete the shared embedding vectors corresponding to the queue change amount from the first embedding queue to obtain an updated first embedding queue; obtain the shared embedding vectors corresponding to multiple second new message identifiers; and update the second embedding queue based on the queue table change amount and the shared embedding vectors corresponding to the multiple second new message identifiers to obtain an updated second embedding queue.
[0028] The feature fusion mapping module is also used to, when the number of first identifiers of the first new message identifiers is less than or equal to the queue change amount, add all the shared embedding vectors corresponding to the multiple first new message identifiers to the first embedding queue to obtain an updated first embedding queue; when the number of first identifiers is greater than the queue change amount, select shared embedding vectors of the number of queue change amount from the shared embedding vectors corresponding to the multiple first new message identifiers, and add the shared embedding vectors of the number of queue change amount to the first embedding queue to obtain an updated first embedding queue.
[0029] The feature extraction module is further used to use the first feature extraction module in the recommendation model to perform feature extraction on the basic embedding vector to obtain a basic feature vector; use the second feature extraction module in the recommendation model to perform feature extraction on the first identifier embedding vector to obtain a first preference vector; use the third feature extraction module in the recommendation model to perform feature extraction on the second identifier embedding vector to obtain a second preference vector; determine the basic feature vector, the first preference vector and the second preference vector as training sample feature vectors; use the fourth feature extraction module in the recommendation model to perform feature extraction on the fused embedding vector to obtain a fused feature vector.
[0030] The feature extraction module is further used to use the fourth feature extraction module in the recommendation model to determine the vector difference between the first shared embedding vector and the second shared embedding vector; splice the fused feature vector, the vector difference and the information feature vector to obtain a first spliced feature vector; perform feature cross-processing on the first spliced feature vector to obtain an attention weight vector; and use the attention weight vector to weight the fused embedding vector to obtain a fused feature vector.
[0031] The training module is further used to, for each training sample, concatenate the training sample feature vector of the training sample and the fusion feature vector to obtain a second concatenated feature vector; use the recommendation model to be trained to perform prediction processing on each second concatenated feature vector to obtain prediction information of each training sample; and perform backpropagation training on the recommendation model to be trained based on the prediction information and label information of each training sample to obtain a trained recommendation model.
[0032] The present invention provides a recommendation device, including:
[0033] A second acquisition module is used to acquire a trained recommendation model, where the trained recommendation model is obtained by training using the model training method provided in the embodiments of the present application;
[0034] The second acquisition module is further configured to acquire a set of information to be recommended for a target recommendation object;
[0035] The second acquisition module is further configured to acquire, for each piece of information to be recommended in the set of information to be recommended, input features of the information to be recommended, the input features including a second information feature of the information to be recommended, a second object feature of the target recommended object, a second intersection feature of the information to be recommended and the target recommended object, a first historical click message sequence of the target recommended object in a target scenario, and a second historical click message sequence of the target recommended object in a source scenario;
[0036] A prediction module, configured to use the trained recommendation model to perform prediction processing on the input features to obtain a predicted click probability of the information to be recommended;
[0037] A sorting module is used to sort each of the to-be-recommended information in descending order of predicted click probability to obtain sorted to-be-recommended information;
[0038] The sending module is used to send the sorted information to be recommended to the terminal corresponding to the target recommendation object.
[0039] The prediction module is also used to use the trained recommendation model to perform feature mapping on the input features to obtain the embedding vector of the information to be recommended; perform feature fusion mapping on the first historical click message sequence and the second historical click message sequence through a shared dynamic embedding table to obtain a historical fusion embedding vector; perform feature extraction on the embedding vector of the information to be recommended and the historical fusion embedding vector respectively to obtain the feature vector of the information to be recommended and the historical fusion feature vector accordingly; perform prediction based on the feature vector of the information to be recommended and the historical fusion feature vector to obtain the predicted click probability of the information to be recommended.
[0040] An embodiment of the present application provides an electronic device, comprising:
[0041] a memory for storing computer-executable instructions;
[0042] The processor is used to implement the method provided in the embodiment of the present application when executing the computer-executable instructions stored in the memory.
[0043] An embodiment of the present application provides a computer-readable storage medium storing a computer program or computer-executable instructions for implementing the model training method or recommendation method provided in an embodiment of the present application when executed by a processor.
[0044] An embodiment of the present application provides a computer program product, including a computer program or computer-executable instructions. When the computer program or computer-executable instructions are executed by a processor, the model training method or recommendation method provided in the embodiment of the present application is implemented.
[0045] The embodiments of the present application have the following beneficial effects:
[0046] First, a recommendation model to be trained is obtained, along with multiple training samples and label information for each training sample. Feature mapping is then performed on each training sample to obtain a training sample embedding vector. Feature fusion mapping is then performed on the first click message sequence in the target scenario and the second click message sequence in the source scenario in the training sample using a shared dynamic embedding table to obtain a fused embedding vector. Feature extraction is then performed on the training sample embedding vector and the fused embedding vector to obtain a training sample feature vector and a fused feature vector, thereby training the recommendation model to be trained and obtaining a trained recommendation model. In this way, by performing feature fusion mapping on the first click message sequence and the second click message sequence in the training sample using a shared dynamic embedding table, the fused recommendation object preferences in the target and source scenarios can be captured, fully utilizing the recommendation object information in different scenarios, improving the richness of the training samples, and thereby improving the training efficiency of the recommendation model. Furthermore, the fused feature vectors in the target and source scenarios can reflect the differences in the recommendation object preferences in different scenarios, resolving the issue of inability to accurately determine the recommendation object preferences due to differences in the recommendation object preference information in the source and target scenarios. This improves the accuracy of determining the recommendation object preferences, thereby improving the recommendation accuracy of the recommendation model. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 1 is a schematic diagram of the architecture of the recommendation system 100 provided in an embodiment of the present application;
[0048] Figure 2 This is a schematic diagram of the server structure provided in an embodiment of the present application;
[0049] Figure 3 This is another server structure diagram provided in an embodiment of the present application;
[0050] Figure 4A This is a first flow chart of the model training method provided in an embodiment of the present application;
[0051] Figure 4B This is a second flow chart of the model training method provided in an embodiment of the present application;
[0052] Figure 4C This is a third flow chart of the model training method provided in an embodiment of the present application;
[0053] Figure 4D This is a fourth flow chart of the model training method provided in an embodiment of the present application;
[0054] Figure 4E This is a fifth flow chart of the model training method provided in an embodiment of the present application;
[0055] Figure 4F This is a sixth flow chart of the model training method provided in an embodiment of the present application;
[0056] Figure 4G This is a seventh flow chart of the model training method provided in an embodiment of the present application;
[0057] Figure 4H This is an eighth flow chart of the model training method provided in an embodiment of the present application;
[0058] Figure 4I This is a ninth flow chart of the model training method provided in an embodiment of the present application;
[0059] Figure 5A This is a first flow chart of the recommended method provided in the embodiment of the present application;
[0060] Figure 5B This is a second flow chart of the recommended method provided in the embodiments of the present application;
[0061] Figure 6 This is a first schematic diagram of the message recommendation display interface provided in an embodiment of the present application;
[0062] Figure 7 This is a second schematic diagram of the message recommendation display interface provided in an embodiment of the present application;
[0063] Figure 8 This is a schematic diagram of the recommendation model structure provided by the embodiment of the present application;
[0064] Figure 9 This is a schematic diagram of the cross-scenario behavior sequence fusion provided in an embodiment of the present application. DETAILED DESCRIPTION
[0065] In order to make the purpose, technical solutions and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limiting this application. All other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0066] In the following description, reference is made to “some embodiments”, which describes a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0067] In the following description, the terms "first\second\third" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second\third" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.
[0068] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program that has a predetermined function and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.
[0069] Unless otherwise defined, all technical and scientific terms used in the embodiments of the present application have the same meanings as those commonly understood by those skilled in the art. The terms used in the embodiments of the present application are only for the purpose of describing the embodiments of the present application and are not intended to limit the present application.
[0070] Before further explaining the embodiments of the present application in detail, the nouns and terms involved in the embodiments of the present application are explained. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations.
[0071] 1) Click Through Rate (CTR): refers to the ratio of the number of times a certain content on a page is clicked to the number of times it is displayed.
[0072] 2) Label: The labeled data relied upon when training deep neural networks, such as "0" representing "not belonging" to a certain category and "1" representing "belonging" to a certain category.
[0073] 3) Embedding: A numerical vector composed of multiple floating-point numbers that maps the original features of the data. Through end-to-end learning by a neural network, it describes the various attributes and properties of items or recommended objects in a high-dimensional space.
[0074] 4) Area Under Curve (AUC): The area under the Receiver Operating Characteristic Curve (ROC). This is an evaluation metric used to assess the performance of click-through rate prediction models. Higher values are better.
[0075] 5) Multi-Layer Perceptron (MLP): A basic feedforward neural network consisting of at least three layers of neurons: an input layer, a hidden layer, and an output layer. Each layer combines linear and nonlinear transformations.
[0076] 6) Behavior sequence: For each recommended object, a collection of all item IDs (or other supplementary information) clicked within a certain time window is stored. The sequence is generally sorted by the time when the click occurred.
[0077] 7) Embedding Lookup: This technique is used in recommender neural networks to process discrete features (such as category features and IDs). Its primary function is to map discrete features into a continuous vector space, enabling the neural network to better process and learn these features. This mapping process is typically achieved by looking up a predefined embedding matrix. Specifically, the Embedding Lookup operation consists of the following steps: 1) Initialization: First, an embedding matrix of size (V, D) is defined, where V represents the number of possible feature values (such as the number of recommended object IDs) and D represents the dimension of the embedding vector. 2) Discrete Feature Encoding: Discrete features are converted to integer encodings, typically by mapping feature values to a continuous integer range (such as 0 to V-1). For example, movie IDs can be assigned an integer code, such as 0 for movie 1, 1 for movie 2, and so on. 3) Embedding Vector Lookup: For each discrete feature value, the corresponding row in the embedding matrix is searched, resulting in a D-dimensional vector. This vector serves as the embedding representation for that feature value.
[0078] 8) Cross-scenario recommendation ranking technology: Data from another scenario (source scenario) can be used to assist in enhancing the training of the model for the current scenario (target scenario), that is, a cross-scenario recommendation ranking method.
[0079] 9) Behavior Sequence Representation Modeling: A key technology in recommendation systems, it is primarily used to extract useful information from the historical behavior sequences of recommended items to better understand their interests and needs, thereby providing more accurate recommendations. In practical applications, the behavior sequences of recommended items often include the ID information of previously clicked items. The co-occurrence pattern of this information and the click tags of the current item can be captured by the sequence representation extraction model, thereby linking the prediction of whether the item will be clicked with the historical clicks on the items, helping the recommendation system to better explore the potential needs of the recommended item.
[0080] 10) Deep Interest Network (DIN) Model: A commonly used deep learning-based behavior sequence representation extraction model in the industry, it is primarily used to address the issue of interest drift in the behavior sequences of recommended items. Interest drift refers to the fact that the interests of recommended items change over time. Therefore, a method that can capture this drift in recommended items is needed to improve the accuracy of recommendation systems. The core concept of the DIN model is to calculate the interest representation of recommended items by introducing local activation units (LAUs), thereby capturing this drift in recommended items. Specifically, the DIN model consists of the following processing steps: 1) Embedding Layer: This maps the historical behavior sequence of recommended items (such as product IDs) into low-dimensional dense vectors that represent the behavioral characteristics of the recommended items. 2) Attention Mechanism: This layer uses local activation units to calculate the relevance weight of each behavior in the recommended item's historical behavior sequence with the candidate items. This gives higher weights to historical behaviors that are more relevant to the candidate items, thereby capturing the drift in recommended items' interests. 3) Weighted Aggregation Layer: This layer performs weighted aggregation on multiple items in the recommended item's historical behavior sequence based on the calculated weights to obtain a single interest representation vector for the recommended item. Generally, the extracted interest representation vector is spliced with other features (such as recommended object features, product features, etc.), input into a deep neural network, and finally outputs a prediction score, which represents the estimated CTR of the recommended object for the candidate product.
[0081] In related art, recommendation model training primarily focuses on cross-scenario enhancement at the data sample level. Data samples from the source scenario are processed and then added to the training sample set for the target scenario. The source scenario's behavior sequence is used as auxiliary information for the same recommended object in the target scenario. The source and target scenario behavior sequences are then run through a sequence representation extraction model (such as DIN) to obtain two recommended object representation vectors. These two recommended object representation vectors are then indiscriminately added to the recommended object features for subsequent feature cross-pollination and click-through rate estimation. This approach fails to account for the heterogeneous behavior of recommended objects in the source and target scenarios. An item that is exposed in the source scenario and triggers clicks from the recommended object may not necessarily receive the same click-through rate when exposed in the target scenario. For example, when browsing recommended content, the recommended object may prefer to click on "fresh" technology articles with the goal of expanding their knowledge; whereas, when browsing subscription content, the recommended object may prefer to click on "traditional" news articles with the goal of understanding current events. Consequently, an article that is clicked in the recommendation scenario may not receive clicks when pushed to the subscription scenario. Furthermore, the recommendation system can never collect feedback information from the same recommended subject regarding the same item in two different scenarios. Therefore, when cross-scenario behavior sequences exist, it is necessary to optimize the behavior sequence representation modeling scheme, taking into account the differences between scenarios while fully utilizing information.
[0082] Based on the above problems, the embodiments of the present application provide a model training method, a recommendation method, an apparatus, an electronic device, a computer program product, and a computer-readable storage medium, which can improve the training efficiency and recommendation accuracy of the recommendation model. The exemplary application of the electronic device provided by the embodiment of the present application is described below. The device provided by the embodiment of the present application can be implemented as various types of user terminals such as laptop computers, tablet computers, desktop computers, set-top boxes, mobile devices (for example, mobile phones, portable music players, personal digital assistants, dedicated messaging devices, portable gaming devices), smart phones, smart speakers, smart watches, smart TVs, and vehicle-mounted terminals, and can also be implemented as servers. Below, an exemplary application when the device is implemented as a server will be described.
[0083] See also Figure 1 , Figure 1 is a schematic diagram of the architecture of the recommendation system 100 provided in an embodiment of the present application. Figure 1The server 200, the network 300 and the terminal 400 are involved. Exemplarily, the terminal 400 can be a smart phone, and the terminal 400 can be connected to the server 200 through the network 300. The network 300 can be a wide area network or a local area network, or a combination of the two. Among them, the recommendation model to be trained can be obtained through the server 200, and multiple training samples and label information of each training sample can be obtained. Feature mapping is performed on each training sample to obtain a training sample embedding vector; feature fusion mapping is performed on the first click message sequence and the second click message sequence in the training sample through a shared dynamic embedding table to obtain a fused embedding vector; feature extraction is performed on the training sample embedding vector and the fused embedding vector respectively to obtain a training sample feature vector and a fused feature vector, and the training sample feature vector, the fused feature vector and the label information of each training sample are used to train the recommendation model to obtain a trained recommendation model, and the server 200 uses the trained recommendation model to sort the recommended information set, and then the sorted information to be recommended is sent to the terminal 400, thereby realizing message recommendation. In this way, by sharing the dynamic embedding table to perform feature fusion mapping on the first click message sequence and the second click message sequence in the training sample, the common recommendation object preferences in the target scenario and the source scenario can be captured, thereby improving the training efficiency of the recommendation model and the accuracy of message recommendation.
[0084] In some embodiments, the terminal 400 can be implemented as various types of user terminals such as a laptop computer, a tablet computer, a desktop computer, a set-top box, a mobile device (for example, a mobile phone, a portable music player, a personal digital assistant, a dedicated messaging device, a portable gaming device), a smart phone, a smart speaker, a smart watch, a smart TV, a car terminal, etc.
[0085] In some embodiments, the server 200 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.
[0086] In some embodiments, multiple servers may be organized into a blockchain, with server 200 being a node on the blockchain. Each server is used to implement a different step in training a recommendation model. Information connections may exist between each node in the blockchain, and information may be transmitted between nodes via such connections. Data related to the model training method or recommendation method provided in the embodiments of the present application may be stored on the blockchain.
[0087] For example, the electronic device that makes recommendations based on the recommendation model is the server mentioned above. Figure 2 , Figure 2 This is a schematic diagram of the server structure provided by the embodiment of the present application. Figure 2 The server 200-1 shown includes: at least one processor 210-1, a memory 230-1 and at least one network interface 220-1. The various components in the server 200-1 are coupled together via a bus system 240-1. It is understood that the bus system 240-1 is used to achieve connection and communication between these components. In addition to including a data bus, the bus system 240-1 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, the bus system 240-1 is not described in detail. Figure 2 Various buses are labeled as bus system 240 - 1 .
[0088] Processor 210-1 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.
[0089] The memory 230-1 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, a hard drive, an optical drive, etc. The memory 230-1 may optionally include one or more storage devices that are physically remote from the processor 210-1.
[0090] The memory 230-1 includes volatile memory or nonvolatile memory, or may include both volatile and nonvolatile memory. The nonvolatile memory may be read-only memory (ROM), and the volatile memory may be random access memory (RAM). The memory 230-1 described in the embodiments of the present application is intended to include any suitable type of memory.
[0091] In some embodiments, the memory 230 - 1 can store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplified below.
[0092] Operating system 231-1, including system programs for processing various basic system services and performing hardware-related tasks, such as the framework layer, core library layer, and driver layer, which are used to implement various basic services and process hardware-based tasks;
[0093] The network communication module 232-1 is used to reach other electronic devices via one or more (wired or wireless) network interfaces 220-1. Exemplary network interfaces 220-1 include Bluetooth, Wireless LAN (WiFi), and Universal Serial Bus (USB).
[0094] In some embodiments, the apparatus provided in the embodiments of the present application may be implemented in software. Figure 2 The model training device 233 stored in the memory 230-1 is shown. This device can be software in the form of a program or plug-in, and includes the following software modules: a first acquisition module 2331, a feature mapping module 2332, a feature fusion mapping module 2333, a feature extraction module 2334, and a training module 2335. These modules are logical and can be arbitrarily combined or further separated according to the functions they implement. The functions of each module will be described below.
[0095] See also Figure 3 , Figure 3 This is another server structure diagram provided in an embodiment of the present application. Figure 3 The server 200-2 shown includes: at least one processor 210-2, a memory 230-2, and at least one network interface 220-2. The various components in the server 200-2 are coupled together via a bus system 240-2. It is understood that the bus system 240-2 is used to achieve connection and communication between these components. In addition to including a data bus, the bus system 240-2 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, the bus system 240-2 is not described in detail. Figure 3 In the figure, various buses are labeled as bus system 240-2. The detailed description of processor 210-2 and memory 230-2 is as above, which will not be repeated here.
[0096] In some embodiments, the apparatus provided in the embodiments of the present application may be implemented in software. Figure 3 The recommendation device 234, which contains a recommendation model stored in memory 230-2, can be software in the form of a program or plug-in, and includes the following software modules: a second acquisition module 2341, a prediction module 2342, a ranking module 2343, and a sending module 2344. These modules are logically organized and can be arbitrarily combined or further separated depending on the functionality they implement. The recommendation model adapted to the server platform in the recommendation device 234 enables the server to predict the click probability of recommended information, thereby ranking it according to the predicted click probability. The functions of each module are described below.
[0097] The following will describe the model training method provided by the embodiment of the present application in conjunction with the exemplary application and implementation of the server and terminal provided by the embodiment of the present application. Figure 4A , Figure 4A This is a first flow chart of the model training method provided in the embodiment of the present application, which will be combined with Figure 4A As described above, the electronic device used to complete the model training method can be the server or terminal described above, and the following description will not be repeated.
[0098] In step 101, a recommendation model to be trained is obtained, and a plurality of training samples and label information of each training sample are obtained.
[0099] Among them, the training sample includes the basic features of the sample, the first click message sequence in the target scenario and the second click message sequence in the source scenario. The basic features of the sample include the first object features of the recommended object, the first information features of the information to be recommended and the first cross-features of the recommended object and the information to be recommended. Exemplarily, the first object features include: the ID of the recommended object, the age of the recommended object, the gender of the recommended object, the region of the recommended object, the number of exposed messages of the recommended object in the past period of time (such as 1 day) (the number of exposed messages is the number of information recommended to the recommended object), the number of exposed messages of the recommended object in the past period of time (such as 7 days), etc. The information to be recommended is information that needs to be recommended to the recommended object, such as newly published articles in the subscription account followed by the target recommended object, or newly published articles in other subscription accounts that are not followed. The first information features of the information to be recommended include: features related to the subscription account to which the information is to be recommended, and features related to the information itself. Features related to the subscription account to which the information is to be recommended include: the subscription account ID, number of followers of the subscription account, number of messages created by the subscription account within a certain period of time (e.g., 7 days), number of clicks and reads by the subscription account within a certain period of time (e.g., 7 days), etc.; features related to the information to be recommended include: the message ID, number of hours since the message was sent, number of impressions of the message within a certain period of time (e.g., 1 hour), number of clicks on the message within a certain period of time (e.g., 1 hour), etc. The first intersection features of the recommended object and the information to be recommended include: number of impressions of the recommended object to the subscription account within the past 28 days, number of clicks of the recommended object to the subscription account within the past 28 days, etc. The target scenario is the scenario where message recommendation is currently required, and the source scenario is another scenario where message recommendation has been made. The first click message sequence is the sequence of first identification information of the recommended object that generated clicks in the target scenario within a certain period of time (e.g., 30 days); the second click message sequence is the sequence of first identification information of the recommended object that generated clicks in the source scenario within a certain period of time (e.g., 30 days). The first identification information includes the subscription ID and the information ID, which is obtained by combining the subscription ID and the information ID. The label information of each training sample is the exposure and click data of the recommended object.
[0100] In step 102, for each training sample, feature mapping is performed on the training sample to obtain a training sample embedding vector.
[0101] Here, the training sample embedding vector includes a base embedding vector, a first identification embedding vector, and a second identification embedding vector. In some embodiments, see Figure 4B , step 1021 can be implemented through the following steps 1021 to 1024, which are described in detail below.
[0102] In step 1021, feature mapping is performed on the first object feature, the first information feature, and the first cross feature through a basic shared embedding table to obtain a basic embedding vector.
[0103] Here, the basic shared embedding table is a shared feature space used to represent different types of data in the fields of deep learning and natural language processing, and is used to improve the parameter efficiency and generalization ability of the model. Through the basic shared embedding table, different features can be shared into the same underlying embedding table, achieving efficient parameter utilization and feature representation. The sample basic features use the same basic shared embedding table. The basic shared embedding table is used to perform feature mapping on the first object feature, the first information feature, and the first cross feature in the sample basic features to obtain the basic embedding vector corresponding to the sample basic features. The first object feature, the first information feature, and the first cross feature are vectorized using the basic embedding vector.
[0104] In step 1022, feature mapping is performed on each first message identifier in the first click message sequence using the first identifier embedding table to obtain a first identifier embedding vector.
[0105] Here, since the first message identifier in the first click message sequence often overlaps with the eigenvalue value in the sample basic feature. In order to avoid obtaining the same embedding vector for eigenvalues with very different actual meanings, other embedding tables are used for the first click message sequence, namely the first identifier embedding table. The first click message sequence includes multiple first message identifiers, and the first identifier embedding table includes multiple embedding vectors corresponding to the first message identifiers. The first identifier embedding table corresponds to the first click message sequence, and is used to perform feature mapping according to each first message identifier included in the first click message sequence, and obtain the embedding vector corresponding to each first message identifier, thereby obtaining the first identifier embedding vector.
[0106] In step 1023, feature mapping is performed on each second message identifier in the second click message sequence using the second identifier embedding table to obtain a second identifier embedding vector.
[0107] Here, since the second message identifier in the second click message sequence often overlaps with the eigenvalue value in the sample basic feature. In order to avoid obtaining the same embedding vector for eigenvalues with very different actual meanings, other embedding tables are also used for the second click message sequence, namely the second identifier embedding table. The second click message sequence includes multiple second message identifiers, and the second identifier embedding table includes multiple embedding vectors corresponding to the second message identifiers. The second identifier embedding table corresponds to the second click message sequence, and is used to perform feature mapping according to each second message identifier included in the second click message sequence, and obtain the embedding vector corresponding to each second message identifier, thereby obtaining the second identifier embedding vector.
[0108] In step 1024, a training sample embedding vector is constructed using the base embedding vector, the first identification embedding vector, and the second identification embedding vector.
[0109] Here, the training sample embedding vector includes a basic embedding vector, a first identifier embedding vector, and a second identifier embedding vector, and the training sample embedding vector is constructed by combining the basic embedding vector, the first identifier embedding vector, and the second identifier embedding vector.
[0110] In the embodiment of the present application, feature mapping is performed on the sample basic features, the first click message sequence, and the second click message sequence using the basic shared embedding table, the first identifier embedding table, and the second identifier embedding table, respectively, to obtain the corresponding basic embedding vector, the first identifier embedding vector, and the second identifier embedding vector, thereby constructing the training sample embedding vector. This avoids using the same embedding table for feature mapping, resulting in the same embedding vector being obtained for feature values with very different actual meanings, thereby improving the accuracy of feature mapping.
[0111] In step 103, feature fusion mapping is performed on the first click message sequence and the second click message sequence through a shared dynamic embedding table to obtain a fused embedding vector.
[0112] Here, in order to capture the common feature mappings in the target and source scenarios, we need to assume the existence of a latent shared space where the same message has a common representation vector in different scenarios. This latent space aligns different scenarios and differs from the mapping space specific to a single scenario. Therefore, we introduce a shared dynamic embedding table to capture cross-scenario features and obtain a fused embedding vector. For details, see Figure 4C , step 103 can be implemented through the following steps 1031 to 1036, which are described in detail below.
[0113] In step 1031 , a shared dynamic embedding table is obtained, where the shared dynamic embedding table includes a plurality of shared embedding vectors.
[0114] Exemplarily, the total size of the shared dynamic embedding table is set to M, and the shared dynamic embedding table includes M shared embedding vectors.
[0115] In step 1032 , the plurality of shared embedding vectors are divided into a first embedding queue and a second embedding queue.
[0116] For example, assuming that M is an even number, the first M / 2 shared embedding vectors of the M shared embedding vectors included in the shared dynamic embedding table can be divided into the first embedding queue, and the last M / 2 shared embedding vectors can be divided into the second embedding queue. Assuming that M is an odd number, the first (M-1) / 2 shared embedding vectors of the M shared embedding vectors included in the shared dynamic embedding table can be divided into the first embedding queue, and the last (M+1) / 2 shared embedding vectors can be divided into the second embedding queue. In some possible implementation methods, a specific shared embedding vector is set to initialize the message identifier not included in the shared dynamic embedding table.
[0117] In step 1033, a queue change amount is determined based on the first click message sequence, the second click message sequence, the first embedded queue, and the second embedded queue.
[0118] Here, the queue change amount is used to dynamically adjust the number of shared embedding vectors included in the first embedding queue and the second embedding queue. The queue change amount is determined based on the first click message sequence, the second click message sequence, the first embedding queue and the second embedding queue. Figure 4D , step 1033 can be implemented through the following steps 10331 to 10334, which are described in detail below.
[0119] In step 10331, feature mapping is performed on each first message identifier in the first click message sequence through the first embedding queue to obtain a first initial embedding vector corresponding to each first message identifier.
[0120] Here, the first initial embedding vector is the embedding vector corresponding to each first message identifier. Feature mapping is performed on each first message identifier in the first click message sequence using the first embedding queue to obtain the embedding vector corresponding to each first message identifier. If the embedding vector corresponding to the first message identifier cannot be found in the first embedding queue, feature mapping is performed on the first message identifier using a specific shared embedding vector reserved in advance to obtain the embedding vector corresponding to the first message identifier.
[0121] In step 10332, feature mapping is performed on each second message identifier in the second click message sequence through the second embedding queue to obtain a second initial embedding vector corresponding to each second message identifier.
[0122] Here, the second initial embedding vector is the embedding vector corresponding to each second message identifier. Feature mapping is performed on each second message identifier in the second click message sequence using the second embedding queue to obtain the embedding vector corresponding to each second message identifier. If no embedding vector corresponding to the second message identifier can be found in the second embedding queue, feature mapping is performed on the second message identifier using a pre-reserved specific shared embedding vector to obtain the embedding vector corresponding to the second message identifier.
[0123] In step 10333, each first initial embedding vector and each second initial embedding vector are predicted using the trained weight prediction model to obtain attention weights.
[0124] Here, the attention weight ranges from [-0.5, 0.5], indicating the importance of the first click message sequence relative to the second click message sequence. This can be achieved by introducing a small neural network (such as an MLP model) as a trained weight prediction model. The first initial embedding vector of the first click message sequence and the second initial embedding vector of the second click message sequence are input into the trained weight prediction model for prediction, outputting the attention weight.
[0125] In step 10334, the total number of embedding vectors in the shared dynamic embedding table is obtained, and the queue change amount is determined based on the attention weight and the total number of embedding vectors.
[0126] In some embodiments, the total size M of the shared dynamic embedding table is multiplied by the attention weight α. If the resulting product is an integer, the product is directly determined as the queue change amount. If the resulting product is not an integer, the product is rounded up to obtain the queue change amount. For example, if M is 100 and α is 0.1, the queue change amount is 10. If M is 100 and α is 0.032, the queue change amount is 4.
[0127] In an embodiment of the present application, a first initial embedding vector and a second initial embedding vector are obtained through feature mapping. A trained weight prediction model is used to predict each of the first and second initial embedding vectors to obtain an attention weight. The product of the attention weight and the total number of embedding vectors in the shared dynamic embedding table is used to determine the queue change amount. In this way, the queue change amount is determined based on the importance of the first click message sequence relative to the second click message sequence, and the shared dynamic embedding table can be dynamically adjusted, so that the sizes of the first and second embedding queues in the shared dynamic embedding table can be adaptively adjusted.
[0128] In step 1034 , the first embedded queue and the second embedded queue are updated based on the queue change amount to obtain an updated first embedded queue and an updated second embedded queue.
[0129] Here, the queue change amount can be an integer greater than 0, an integer less than 0, or 0. When the queue change amount is 0, no update is required. When the queue change amount is greater than 0, it indicates that new shared embedding vectors need to be added to the first queue and some shared embedding vectors need to be deleted from the second queue. When the queue change amount is less than 0, it indicates that some shared embedding vectors need to be removed from the first queue and some shared embedding vectors need to be added to the second queue.
[0130] In some embodiments, first, it is determined whether the queue change amount is greater than 0. When the queue change amount is greater than 0, see Figure 4E Step 1034 can be implemented through the following steps 10341 to 10343, which are described in detail below.
[0131] In step 10341, a shared embedding vector corresponding to multiple first new message identifiers is obtained.
[0132] Here, the first new message identifier is a new message identifier corresponding to the message to be recommended, and the corresponding shared embedding vector is obtained by performing feature mapping on the first new message identifier.
[0133] In step 10342, the first embedded queue is updated based on the queue change amount and the shared embedding vectors corresponding to the multiple first new message identifiers to obtain an updated first embedded queue.
[0134] Here, when the number of first identifiers of the first new message identifiers is less than or equal to the queue change amount, the shared embedding vectors corresponding to the multiple first new message identifiers are added to the first embedding queue to obtain an updated first embedding queue. For example, if the number of first identifiers is 5 and the queue change amount is 10, the shared embedding vectors corresponding to the five first new message identifiers are all added to the end of the first embedding queue to obtain an updated first embedding queue.
[0135] When the number of first identifiers is greater than the queue change amount, shared embedding vectors corresponding to the number of queue changes are selected from the shared embedding vectors corresponding to multiple first new message identifiers, and the shared embedding vectors corresponding to the number of queue changes are added to the first embedding queue to obtain an updated first embedding queue. For example, if the number of first identifiers is 15 and the queue change amount is 10, then 10 shared embedding vectors corresponding to the first new message identifiers are selected from the shared embedding vectors corresponding to the 15 first new message identifiers and added to the end of the first embedding queue to obtain an updated first embedding queue. Among them, the shared embedding vectors corresponding to the 10 first new message identifiers can be selected in order, or the shared embedding vectors corresponding to the 10 first new message identifiers can be manually selected.
[0136] In step 10343, the shared embedding vectors corresponding to the queue change amount are deleted from the second embedding queue to obtain an updated second embedding queue.
[0137] For example, if the queue change amount is 10, 10 shared embedding vectors are deleted in sequence starting from the head of the second embedding queue to obtain an updated second embedding queue.
[0138] When the queue change amount is less than 0, see Figure 4F Step 1034 can be implemented through the following steps 10344 to 10346, which are described in detail below.
[0139] In step 10344, the shared embedding vectors corresponding to the queue change amount are deleted from the first embedding queue to obtain an updated first embedding queue.
[0140] For example, if the queue change amount is 10, 10 shared embedding vectors are deleted in sequence starting from the head of the first embedding queue to obtain an updated first embedding queue.
[0141] In step 10345, a shared embedding vector corresponding to multiple second new message identifiers is obtained.
[0142] Here, the second new message identifier is a new message identifier corresponding to the message to be recommended, and the corresponding shared embedding vector is obtained by performing feature mapping on the second new message identifier.
[0143] In step 10346, the second embedding queue is updated based on the queue table change amount and the shared embedding vectors corresponding to the plurality of second new message identifiers to obtain an updated second embedding queue.
[0144] Here, when the number of second identifiers of the second new message identifiers is less than or equal to the queue change amount, the shared embedding vectors corresponding to the multiple second new message identifiers are added to the second embedding queue to obtain an updated second embedding queue. For example, if the number of second identifiers is 5 and the queue change amount is 10, the shared embedding vectors corresponding to the five second new message identifiers are all added to the end of the second embedding queue to obtain an updated second embedding queue.
[0145] When the number of second identifiers is greater than the queue change amount, a number of shared embedding vectors corresponding to the queue change amount is selected from the shared embedding vectors corresponding to multiple second new message identifiers, and the shared embedding vectors corresponding to the queue change amount are added to the second embedding queue to obtain an updated second embedding queue. For example, if the number of second identifiers is 15 and the queue change amount is 10, then 10 shared embedding vectors corresponding to the second new message identifiers are selected from the shared embedding vectors corresponding to the 15 second new message identifiers and added to the end of the second embedding queue to obtain an updated second embedding queue. Among them, the shared embedding vectors corresponding to the 10 second new message identifiers can be selected in order, or the shared embedding vectors corresponding to the 10 second new message identifiers can be manually selected.
[0146] In this embodiment of the present application, for the first embedded queue, if the queue change amount is positive, a new element is added to the end of the first embedded queue; if the queue change amount is negative, the extra element is deleted from the beginning. The opposite operation is performed for the second embedded queue. In this way, dynamic allocation of the shared dynamic embedded table is achieved, so that the sizes of the first embedded queue and the second embedded queue in the shared dynamic embedded table can be adaptively adjusted based on the estimated importance of the first click message sequence and the second click message sequence to the recommended messages.
[0147] In step 1035, feature mapping is performed on each first message identifier in the first click message sequence through the updated first embedding queue to obtain a first shared embedding vector, and feature mapping is performed on each second message identifier in the second click message sequence through the updated second embedding queue to obtain a second shared embedding vector.
[0148] Here, the first shared embedding vector and the second shared embedding vector are obtained by mapping through a shared latent space, using the same embedding table, so the same message in the target scene and the source scene has the same embedding vector.
[0149] In step 1036, the first shared embedding vector and the second shared embedding vector are fused to obtain a fused embedding vector.
[0150] Here, the first shared embedding vector and the second shared embedding vector are concatenated together to obtain a simple concatenated fused embedding vector. For example, the fused embedding vector is denoted as [A; B]. Assuming that the first shared embedding vector corresponding to the first click message sequence in the target scenario and the second shared embedding vector corresponding to the second click message sequence in the source scenario each have 256 dimensions, the concatenated fused embedding vector is 512 dimensions.
[0151] In an embodiment of the present application, a shared dynamic embedding table is obtained, and multiple shared embedding vectors included in the shared dynamic embedding table are divided into a first embedding queue and a second embedding queue; a queue change amount is determined, and then the first embedding queue and the second embedding queue are updated according to the queue change amount to obtain an updated first embedding queue and an updated second embedding queue; feature mapping is performed on the updated first embedding queue and the updated second embedding queue to obtain a first shared embedding vector and a second shared embedding vector, and fusion processing is performed to obtain a fused embedding vector. In this way, by dividing the shared dynamic embedding table into two parts and then dynamically adjusting the queues of the two parts according to the queue change amount, the shared dynamic embedding table can be adaptively updated, thereby improving the efficiency of feature mapping.
[0152] In step 104, feature extraction is performed on the training sample embedding vector and the fused embedding vector respectively, and a training sample feature vector and a fused feature vector are obtained accordingly.
[0153] Here, the training sample feature vector includes the basic feature vector, the first preference vector and the second preference vector. The feature extraction model is used to extract features from the training sample embedding vector and the fusion embedding vector, and the training sample feature vector and the fusion feature vector are obtained accordingly. Figure 4G , step 104 can be implemented through the following steps 1041 to 1045, which are described in detail below.
[0154] In step 1041, the first feature extraction module in the recommendation model is used to extract features from the basic embedding vector to obtain a basic feature vector.
[0155] Here, the basic feature vector represents the basic behavioral preferences of the recommended object. The basic special effect vector can be used to better understand the recommended object's behavioral habits. The first feature extraction module can be a factorization machine. The basic feature vector is obtained by inputting the basic embedding vector into the factorization machine of the recommendation model to extract high-order representations.
[0156] In step 1042, a second feature extraction module in the recommendation model is used to extract features from the first identifier embedding vector to obtain a first preference vector.
[0157] Here, the first preference vector represents the behavioral preference of the recommended object in the target scenario. The second feature extraction module can be a sequence representation extraction model. The first preference vector is obtained by inputting the first identifier embedding vector into the sequence representation extraction model for high-order representation extraction.
[0158] In step 1043, the third feature extraction module in the recommendation model is used to extract features from the second identifier embedding vector to obtain a second preference vector.
[0159] Here, the second preference vector represents the behavioral preference of the recommended object in the source scenario. The third feature extraction module can be a sequence representation extraction model. The second preference vector is obtained by inputting the second identifier embedding vector into the sequence representation extraction model for high-order representation extraction.
[0160] In step 1044 , the basic feature vector, the first preference vector, and the second preference vector are determined as training sample feature vectors.
[0161] Here, the basic feature vector, the first preference vector and the second preference vector are concatenated together as the training sample feature vector.
[0162] In step 1045, the fourth feature extraction module in the recommendation model is used to perform feature extraction on the fused embedding vector to obtain a fused feature vector.
[0163] Here, the fused feature vector represents the cross-scenario behavior preference of the recommended object in the target scenario and the source scenario. The fourth feature extraction module can be a hybrid sequence representation extraction model. By inputting the fused embedding vector into the hybrid sequence representation extraction model for high-order representation extraction, the fused feature vector is obtained. Figure 4H Step 1045 can be implemented by steps 10451 to 10454, which are described in detail below:
[0164] In step 10451, the fourth feature extraction module in the recommendation model is used to determine the vector difference between the first shared embedding vector and the second shared embedding vector.
[0165] Here, the fourth feature extraction module in the recommendation model is used to calculate the vector difference between the first shared embedding vector and the second shared embedding vector in the target scene and the source scene. Exemplarily, a subtraction operation is performed, which is recorded as AB.
[0166] In step 10452, the fused feature vector, the vector difference, and the information feature vector are concatenated to obtain a first concatenated feature vector.
[0167] Exemplarily, the first shared embedding vector and the second shared embedding vector are spliced together to obtain a simply spliced fusion embedding vector (denoted as [A; B], assuming that the first click message sequence in the target scene and the second click message sequence in the source scene each have 256 dimensions, then the splicing is 512 dimensions). Calculate the vector difference (subtraction calculation, denoted as AB) to obtain information such as "the differences and similarities between the most recent click on the target scene message and the most recent click on the source scene message", and also splice the vector difference into the merged sequence (denoted as [A; B; AB], which is 768 dimensions after splicing). Finally, the information feature vector of the current message to be recommended (denoted as T) is also spliced into the merged sequence (denoted as [A; B; AB; T], which is 769 dimensions after splicing) to obtain the first spliced feature vector.
[0168] In step 10453, feature cross processing is performed on the first concatenated feature vector to obtain an attention weight vector.
[0169] Here, the attention weight model is introduced, the first spliced feature vector is input, and the attention weight model is used to perform feature cross processing on the first spliced feature vector to obtain an attention weight vector (such as 512 dimensions).
[0170] In step 10454, the fused embedding vector is weighted using the attention weight vector to obtain a fused feature vector.
[0171] Here, the attention weight vector is used to perform weighted summation on the fused embedding vector [A; B] to obtain a fused feature vector (1-dimensional vector), where the fused feature vector represents the cross-domain recommendation object preference.
[0172] In an embodiment of the present application, the fourth feature extraction module in the recommendation model is used to determine the vector difference between the first shared embedding vector and the second shared embedding vector; the fused feature vector, the vector difference, and the information feature vector are concatenated to obtain a first concatenated feature vector; the first concatenated feature vector is subjected to feature cross-processing to obtain an attention weight vector; and the fused embedding vector is weighted using the attention weight vector to obtain a fused feature vector. In this way, by obtaining the fused feature vector to understand the cross-domain recommendation object preferences of the recommended object in different scenarios, it is possible to more accurately understand the recommendation object preference information, better perform information recommendations, and improve recommendation efficiency.
[0173] In step 105, the recommendation model to be trained is trained using the training sample feature vectors, fusion feature vectors and label information of each training sample to obtain a trained recommendation model. Figure 4I , step 105 can be implemented by the following steps 1051 to 1053, which are described in detail below:
[0174] In step 1051 , for each training sample, the training sample feature vector and the fusion feature vector of the training sample are concatenated to obtain a second concatenated feature vector.
[0175] Here, the training sample feature vector and the fusion feature vector of each training sample are spliced to obtain a second spliced feature vector for each training sample.
[0176] In step 1052, prediction processing is performed on each second concatenated feature vector using the recommendation model to be trained to obtain prediction information of each training sample.
[0177] Here, the prediction information is the predicted click-through rate output by the recommendation model, which is used to predict the probability of the recommended recipient clicking on the message. The recommendation model to be trained performs prediction processing on each second concatenated feature vector to obtain prediction information for each training sample, and then determines the probability of the recommended recipient clicking on the message corresponding to each training sample.
[0178] In step 1053 , based on the prediction information and label information of each training sample, the recommendation model to be trained is subjected to back propagation training to obtain a trained recommendation model.
[0179] Here, the recommendation model uses the exposure click data of the recommended object as label information, supervises the predicted click rate output by the recommendation model, and performs backpropagation training on the recommendation model to be trained by calculating the cross entropy loss function to obtain a trained recommendation model.
[0180] In an embodiment of the present application, a recommendation model to be trained is first obtained, and multiple training samples and label information of each training sample are obtained. Feature mapping is then performed for each training sample to obtain a training sample embedding vector. Feature fusion mapping is then performed on the first click message sequence and the second click message sequence in the training sample through a shared dynamic embedding table to obtain a fused embedding vector. Feature extraction is then performed on the training sample embedding vector and the fused embedding vector respectively to obtain a training sample feature vector and a fused feature vector, thereby training the recommendation model to be trained to obtain a trained recommendation model. In this way, by performing feature fusion mapping on the first click message sequence and the second click message sequence in the training sample through a shared dynamic embedding table, the fused recommendation object preferences in the target scene and the source scene can be captured, avoiding the inability to accurately determine the recommendation object preferences due to the difference between the preference information of the recommendation object in the source scene and the preference information in the target scene. Therefore, by improving the accuracy of determining the recommendation object preferences, the training efficiency of the recommendation model and the recommendation accuracy of the recommendation model are improved.
[0181] The following describes a specific example of the recommendation method described above. The electronic device that implements the recommendation method of the embodiment of the present application may be a terminal or a server. Figure 5A , Figure 5A This is a flow chart of the recommended method provided in the embodiment of the present application, which will be combined with Figure 5A The steps shown are explained.
[0182] In step 201, a trained recommendation model is obtained.
[0183] Here, the trained recommendation model is obtained by training using the model training method provided in the embodiment of the present application.
[0184] In step 202, a set of information to be recommended for a target recommendation object is obtained.
[0185] Here, each target recommendation object has a set of candidate messages waiting to be recommended (sorted), i.e., a set of information to be recommended. For example, the information to be recommended can be newly published articles in subscription accounts that the target recommendation object follows, or newly published articles in other subscription accounts that the target recommendation object does not follow.
[0186] In step 203, for each piece of information to be recommended in the set of information to be recommended, the input features of the information to be recommended are obtained.
[0187] Here, for each piece of information to be recommended, the feature system generates corresponding input features as input to the trained recommendation model. Exemplarily, the input features include: the second information feature of the information to be recommended, the second object feature of the target object, the second intersection feature of the information to be recommended and the target object, the first historical click message sequence of the target object in the target scenario, and the second historical click message sequence of the target object in the source scenario.
[0188] In step 204, the trained recommendation model is used to perform prediction processing on the input features to obtain the predicted click probability of the information to be recommended.
[0189] Here, the predicted click probability represents the probability of the recommended object clicking on each recommended information. The trained recommendation model is used for forward propagation to predict the input features and generate the corresponding predicted click probability. Figure 5B Step 204 can be implemented by steps 2041 to 2044, which are described in detail below:
[0190] In step 2041, the trained recommendation model is used to perform feature mapping on the input features to obtain an embedding vector of the information to be recommended.
[0191] Here, the embedding vector of the information to be recommended represents the embedding vector corresponding to the information to be recommended. The embedding vector of the information to be recommended is obtained by performing feature mapping on the input features using the embedding table in the trained recommendation model.
[0192] In step 2042, feature fusion mapping is performed on the first historical click message sequence and the second historical click message sequence through a shared dynamic embedding table to obtain a historical fusion embedding vector.
[0193] Here, the historical fusion embedding vector represents the corresponding embedding vector of the recommended object in the target scenario and the source scenario. The message identifiers in the first historical click message sequence and the second historical click message sequence are feature mapped by sharing the dynamic embedding table to obtain the corresponding embedding vectors in the two scenarios. Then, the corresponding embedding vectors in the two scenarios are fused to obtain the historical fusion embedding vector.
[0194] In step 2043, feature extraction is performed on the embedding vector of the information to be recommended and the historical fusion embedding vector respectively, and a feature vector of the information to be recommended and a feature vector of the historical fusion are obtained accordingly.
[0195] Here, the feature vector of the information to be recommended represents the feature information of the information to be recommended, and the historical fusion feature vector represents the recommendation object preference information of the target recommendation object in the target scenario and the source scenario. The feature extraction model performs high-order feature extraction on the embedding vector of the information to be recommended and the historical fusion embedding vector, respectively, to obtain the corresponding feature vector of the information to be recommended and the historical fusion feature vector. The implementation process of steps 2041 to 2043 is similar to the implementation process of steps 102 to 104 above, and has the same technical principles.
[0196] In step 2044, prediction is performed based on the feature vector of the information to be recommended and the historical fusion feature vector to obtain the predicted click probability of the information to be recommended.
[0197] Here, the recommendation model concatenates the feature vector of the information to be recommended and the historical fusion feature vector, inputs them into the fully connected network layer, and obtains the predicted click probability of the information to be recommended.
[0198] In step 205, each piece of information to be recommended is sorted in descending order of predicted click probability to obtain sorted information to be recommended.
[0199] Here, each piece of information to be recommended is sorted in descending order of predicted click probability, that is, each piece of information to be recommended is sorted from large to small according to predicted click probability to obtain sorted information to be recommended.
[0200] In step 206, the sorted information to be recommended is sent to the terminal corresponding to the target recommendation object.
[0201] Here, the sorted information to be recommended is sent to the terminal corresponding to the target recommendation object to be displayed to the target recommendation object, thereby realizing the recommendation of the message.
[0202] In an embodiment of the present application, for each piece of information to be recommended in the set of information to be recommended of the target recommended object, the input features of the information to be recommended are obtained, and then the trained recommendation model is used to perform feature mapping on the input feature pairs to obtain an embedding vector of the information to be recommended, and feature fusion mapping is performed through a shared dynamic embedding table to obtain a historical fusion embedding vector. Afterwards, feature extraction is performed on the embedding vector of the information to be recommended and the historical fusion embedding vector respectively to obtain a feature vector of the information to be recommended and a historical fusion feature vector, thereby performing prediction processing to obtain a predicted click probability of the information to be recommended. Finally, each piece of information to be recommended is sorted in descending order of the predicted click probability to obtain the sorted information to be recommended, and is sent to the terminal corresponding to the target recommended object. In this way, the messages with the highest probability of being clicked by the recommended object can be recommended first, thereby achieving accurate recommendation and improving the click rate of the information to be recommended.
[0203] The following describes an example application of the present invention in a practical application scenario, which is used to sort the message cards pushed by the subscription account message box in an instant messaging client. In the subscription account product, there are both content that the recommended object subscribes to and content that the platform actively recommends. The data distribution of the two scenarios is usually quite different, and the behavior habits of the recommended objects are also very different. Figure 6 , Figure 6 This is the first schematic diagram of the message recommendation display interface provided by an embodiment of the present application. The upper half of dividing line 601 represents subscription account content 602, while the lower half represents recommended content 603. Through data recycling, the subscription account content and recommended content are input into a sorting model 604 for sorting, and then messages are recommended based on the sorting.
[0204] The following describes the recommendation model provided in the embodiments of the present application.
[0205] First, the training data of the recommendation model:
[0206] Each training sample processed by the recommendation model represents the relevant features of a recommendation object for a subscription account message exposed to him / her. The training sample can be abstractly represented as: <the first object feature of the recommendation object, the first information feature of the information to be recommended, the first cross feature of the recommendation object and the information to be recommended, the first click message sequence (target scenario), the second click message sequence (source scenario)>. Among them, the first object feature of the recommendation object, the first information feature of the information to be recommended, and the first cross feature of the recommendation object and the information to be recommended are collectively referred to as sample basic features. The first information feature of the information to be recommended includes: relevant features of the subscription account to which the message to be recommended belongs, and relevant features of the message to be recommended (such as the subscription account message) itself. Figure 7 As shown, the relationship between the subscription number 701 and the subscription number message 702 is shown, wherein each subscription number message has a corresponding subscription number.
[0207] For example, the first object feature of the recommended object includes: the recommended object ID (recorded as uid), the recommended object age, the recommended object gender, the recommended object region, the number of exposure messages of the recommended object in the past day, the number of exposure messages of the recommended object in the past 7 days, etc.
[0208] The first information feature of the recommended information includes the following: subscription account ID, number of followers, number of messages created by the subscription account in the past 7 days, number of clicks and reads by the subscription account in the past 7 days, etc. The first information feature of the recommended information includes the following: information ID (item ID), number of hours since the information was sent, number of impressions in the past hour, number of clicks in the past hour, etc. The item ID is obtained by combining the subscription account ID with the information ID.
[0209] The first cross-features of the recommended object and the information to be recommended include: the number of exposures of the recommended object to the subscription account in the past 28 days, the number of clicks of the recommended object to the subscription account in the past 28 days, etc.
[0210] The first click message sequence includes: the ID sequence of items that were clicked in the subscription scenario within the past period of time (e.g., 30 days) of the recommended object;
[0211] The second click message sequence includes: the item ID sequence (source scene behavior sequence) of the recommended object that has been clicked in the recommendation scene within the past period of time (such as 30 days).
[0212] Second, the framework of the recommendation model:
[0213] Figure 8 A schematic diagram of the framework of the recommendation model provided in the embodiment of the present application is shown in FIG. Figure 8 As shown, the recommendation model includes: feature input layer 801, embedding lookup table layer 802, feature extraction layer 803, embedding connection layer 804 and fully connected network layer 805, which are described in detail below:
[0214] The feature input layer 801 is used to obtain input feature data. The input feature data of the feature input layer 801 includes: a first object feature, a first information feature, a first cross feature, a first click message sequence, and a second click message sequence. The first object feature, the first information feature, and the first cross feature are collectively referred to as sample basic features.
[0215] The embedding lookup table layer 802 is used to determine the embedding vector of each feature based on the embedding table. Among them, the basic shared embedding table 8021 can be used to perform feature mapping on the basic features of the sample to obtain the basic embedding vector. Since the historical message ID numbers in the first click message sequence and the second click message sequence often overlap with the feature values in the basic features of the sample. In order to avoid taking the same embedding vector for feature values with very different actual meanings, two additional embedding tables (i.e., the first identifier embedding table 8022 and the second identifier embedding table 8024) are used for feature mapping for the first click message sequence and the second click message sequence, respectively, to obtain the first identifier embedding vector and the second identifier embedding vector. In an embodiment of the present application, in order to capture shared item information and recommendation object preferences in different scenarios, from the perspective of representation learning, it is assumed that there is a potential shared space, and the same item has a common representation in different scenarios. This potential space aligns different scenarios and is different from the mapping space specific to the single scenario. Therefore, an additional embedding table (i.e., the shared potential dynamic embedding table 8023) is introduced to capture the item features and sequence patterns of cross-scene items to obtain a fused embedding vector. In order to maintain the embedding vectors of message IDs in both scenarios within limited storage space and query efficiency, the shared potential dynamic embedding table 8023 has a dynamic elimination mechanism, which will be described in detail below.
[0216] The feature extraction layer 803 may include a factorization machine 8031, a sequence representation extraction model 8032, a hybrid sequence representation extraction model 8033, and a sequence representation extraction model 8034, wherein:
[0217] The basic embedding vector is passed into the factorization machine 8031 (such as the Factorization Machine model, a neural network model widely used in recommendation systems for processing high-dimensional features and capturing the interactive relationship between features) for high-order representation extraction to obtain a basic feature vector. The sequence representation extraction model 8032 and the sequence representation extraction model 8034 are used to perform feature extraction processing on the first identifier embedding vector and the second identifier embedding vector, respectively, to obtain a first preference vector and a second preference vector. The fused embedding vector is input into the hybrid sequence representation extraction model 8033 to extract a fused feature vector across scenarios. This will be explained in detail below.
[0218] The embedding connection layer 804 is used to splice the basic feature vector, the first preference vector, the second preference vector and the fused feature vector together to obtain a spliced vector, and then input the spliced vector into the fully connected network layer 805 (a multi-layer perceptron fully connected neural network model) to finally output the predicted click rate.
[0219] Finally, the recommendation model uses the recommended object exposure click data as label information, supervises the predicted click rate output by the recommendation model, and calculates the cross entropy loss function to train the recommendation model.
[0220] Third, the specific description of cross-scenario behavior sequence representation modeling:
[0221] The embodiment of the present application hopes to project the cross-scene behavior sequence into a shared latent space. In this space, the same item in the target scene and the source scene has the same embedding vector. Therefore, a shared embedding table is used for search. Since the scale of the embedding table is limited, that is, the number of embedding vectors that can be accommodated (for example, 100 million) is limited. Therefore, the embodiment of the present application proposes that the embedding table can dynamically determine the number of embedding vectors allocated to the target scene and the source scene based on the difference in importance of the first click message sequence and the second click message sequence to the target scene. Specifically, the embodiment of the present application proposes a dynamic allocation mechanism based on attention and elastic queues.
[0222] See also Figure 9 , is a schematic diagram of cross-scenario behavior sequence fusion provided in an embodiment of the present application, which is described in detail below:
[0223] The first step is to initialize the embedding queues: A flexible embedding queue is initialized for each of the first click message sequence 901 and the second click message sequence 902, resulting in a first embedding queue 903 and a second embedding queue 904. The initial size of each queue is set to half the total size (M) of the shared dynamic embedding table 905, i.e., M / 2. In addition, a special shared embedding vector is reserved for initializing item IDs not included in the table.
[0224] The second step is to calculate the attention weight 907: use the current shared dynamic embedding table to find the corresponding embedding vectors for the first click message sequence 901 and the second click message sequence 902. Then, a small neural network (MLP) is introduced as a weight prediction model 906, which inputs the embedding vector corresponding to the first message identifier in the first click message sequence 901 and the embedding vector corresponding to the second message identifier in the second click message sequence 902. The attention weight 907 (denoted as α, whose value range is [-0.5, 0.5]) is output through calculation. The attention weight represents the importance of the first click message sequence 901 relative to the second click message sequence 902.
[0225] The third step is to dynamically adjust the size of the embedding queues: The first embedding queue 903 and the second embedding queue 904 are dynamically adjusted based on the attention weight 907. Specifically, the total size M of the shared dynamic embedding table is multiplied by the attention weight α to obtain the queue change ΔM, i.e., ΔM = α × M. Then, the size of the first embedding queue 903 is adjusted from M / 2 to M / 2 + ΔM, and the size of the second embedding queue 904 is adjusted from M / 2 to M / 2 - ΔM.
[0226] Step 4: Update the embedding queue: For the first embedding queue 903, if ΔM is positive, add a new element to the end of the first embedding queue 903; if ΔM is negative, delete the extra elements from the beginning. The opposite operation is performed for the second embedding queue 904. The new element is the shared embedding vector corresponding to the first new message identifier of the message to be recommended, and the extra elements are the shared embedding vectors corresponding to the message identifiers determined to be deleted at the beginning of the queue.
[0227] Step 5: Use the updated embedding queue for search: During model training, the updated first embedding queue 903 and second embedding queue 904 are used. During forward and backward propagation, calculations are performed using the embedding vectors in the updated embedding queue. (The essence of calculation is search: the updated first embedding queue is used to search for the first shared embedding vector corresponding to each item ID in the first click message sequence, and the updated second embedding queue is used to search for the second shared embedding vector corresponding to each item ID in the second click message sequence.) For item IDs not included in the updated embedding queue, calculations are performed using reserved special embedding vectors.
[0228] In an embodiment of the present application, dynamic allocation of a shared dynamic embedding table is implemented, so that the sizes of the first embedding queue and the second embedding queue in the shared dynamic embedding table can be adaptively adjusted according to the estimated importance of the first click message sequence and the second click message sequence to the messages to be recommended.
[0229] In the sixth step, the extracted fusion embedding vector is matched with the message to be recommended through the attention mechanism, thereby extracting the cross-domain recommendation object preference vector 910 in the target scene and the source scene:
[0230] In an embodiment of the present application, the fused embedding vector is obtained by splicing the first shared embedding vector and the second shared embedding vector together (denoted as [A; B], assuming that the first shared embedding vector and the second shared embedding vector each have 256 dimensions, the fused embedding vector is 512 dimensions); wherein the first shared embedding vector is obtained by feature mapping each first message identifier in the first click message sequence through the first embedding queue, and the second shared embedding vector is obtained by feature mapping each second message identifier in the second click message sequence through the second embedding queue. The difference between the first shared embedding vector and the second shared embedding vector is calculated (subtraction calculation, denoted as AB), and information such as "the differences and similarities between the most recent click target scene message and the most recent click source scene message" is obtained as the vector difference. The vector difference is also spliced into the merged sequence (denoted as [A; B; AB], which is 768 dimensions after splicing). Finally, the information feature vector of the current message to be recommended (denoted as T) is also spliced into the merged sequence (denoted as [A; B; AB; T], which is 769 dimensions after splicing).
[0231] Then, an MLP model is introduced as the attention weight model 909, and the fusion feature vector, vector difference and information feature vector are input. After feature cross processing, the attention weight vector (512 dimensions) is obtained.
[0232] Finally, the attention weight vector is used to perform a weighted summation on the concatenated sequence [A; B] to obtain a cross-domain recommendation object preference vector 910 (a one-dimensional vector), i.e., a fused feature vector. This cross-domain recommendation object preference vector captures the preference information of the recommended object in both scenarios.
[0233] Referring to Table 1, when the embodiment of the present application is applied to the recommendation ranking of instant messaging client subscription account messages, compared with the baseline models of multiple groups, the average number of message readings and reading time per person are significantly improved. The recommendation model has better sorting capabilities, can capture the recommendation object preferences in different scenarios, and improve the training efficiency of the recommendation model and the recommendation accuracy of the recommendation model.
[0234] Table 1. Comparison of subscription account message recommendation hit rates
[0235]
[0236] The following continues to describe the exemplary structure of the model training device 233 provided in the embodiment of the present application as a software module. In some embodiments, such as Figure 2 As shown, the software modules stored in the model training device 233 of the memory 230-1 may include:
[0237] The first acquisition module 2331 is used to obtain the recommendation model to be trained and obtain multiple training samples and label information of each training sample. The training samples include basic sample features, a first click message sequence in a target scenario, and a second click message sequence in a source scenario.
[0238] The feature mapping module 2332 is used to perform feature mapping on each training sample to obtain a training sample embedding vector.
[0239] The feature fusion mapping module 2333 is used to perform feature fusion mapping on the first click message sequence and the second click message sequence through a shared dynamic embedding table to obtain a fusion embedding vector.
[0240] The feature extraction module 2334 is used to perform feature extraction on the training sample embedding vector and the fusion embedding vector respectively, and obtain the training sample feature vector and the fusion feature vector accordingly.
[0241] The training module 2335 is used to train the recommendation model to be trained by using the training sample feature vector, fusion feature vector and label information of each training sample to obtain a trained recommendation model.
[0242] In some embodiments, the feature mapping module 2332 is also used to perform feature mapping on the first object feature, the first information feature, and the first cross feature through a basic shared embedding table to obtain a basic embedding vector; perform feature mapping on each first message identifier in the first click message sequence through a first identifier embedding table to obtain a first identifier embedding vector; perform feature mapping on each second message identifier in the second click message sequence through a second identifier embedding table to obtain a second identifier embedding vector; and use the basic embedding vector, the first identifier embedding vector, and the second identifier embedding vector to construct the training sample embedding vector.
[0243] In some embodiments, the feature fusion mapping module 2333 is also used to obtain a shared dynamic embedding table, which includes multiple shared embedding vectors; divide the multiple shared embedding vectors into a first embedding queue and a second embedding queue; determine the queue change amount based on the first click message sequence, the second click message sequence, the first embedding queue and the second embedding queue; update the first embedding queue and the second embedding queue based on the queue change amount to obtain an updated first embedding queue and an updated second embedding queue; perform feature mapping on each first message identifier in the first click message sequence through the updated first embedding queue to obtain a first shared embedding vector, and perform feature mapping on each second message identifier in the second click message sequence through the updated second embedding queue to obtain a second shared embedding vector; fuse the first shared embedding vector and the second shared embedding vector to obtain a fused embedding vector.
[0244] In some embodiments, the feature fusion mapping module 2333 is also used to perform feature mapping on each first message identifier in the first click message sequence through the first embedding queue to obtain a first initial embedding vector corresponding to each first message identifier; perform feature mapping on each second message identifier in the second click message sequence through the second embedding queue to obtain a second initial embedding vector corresponding to each second message identifier; use the trained weight prediction model to perform prediction processing on each first initial embedding vector and each second initial embedding vector to obtain an attention weight; obtain the total number of embedding vectors in the shared dynamic embedding table, and determine the queue change amount based on the attention weight and the total number of embedding vectors.
[0245] In some embodiments, the feature fusion mapping module 2333 is also used to obtain shared embedding vectors corresponding to multiple first new message identifiers when the queue change amount is greater than 0; update the first embedding queue based on the queue change amount and the shared embedding vectors corresponding to the multiple first new message identifiers to obtain an updated first embedding queue; delete the number of shared embedding vectors corresponding to the queue change amount from the second embedding queue to obtain an updated second embedding queue.
[0246] In some embodiments, the feature fusion mapping module 2333 is also used to, when the queue change amount is less than 0, delete the shared embedding vectors corresponding to the number of queue changes from the first embedding queue to obtain an updated first embedding queue; obtain the shared embedding vectors corresponding to multiple second new message identifiers; and update the second embedding queue based on the queue table change amount and the shared embedding vectors corresponding to the multiple second new message identifiers to obtain an updated second embedding queue.
[0247] In some embodiments, the feature fusion mapping module 2333 is also used to, when the number of first identifiers of the first new message identifiers is less than or equal to the queue change amount, add the shared embedding vectors corresponding to the multiple first new message identifiers to the first embedding queue to obtain an updated first embedding queue; when the number of first identifiers is greater than the queue change amount, select the shared embedding vectors of the number of queue change amount from the shared embedding vectors corresponding to the multiple first new message identifiers, and add the shared embedding vectors of the number of queue change amount to the first embedding queue to obtain an updated first embedding queue.
[0248] In some embodiments, the feature extraction module 2334 is further used to use the first feature extraction module in the recommendation model to perform feature extraction on the basic embedding vector to obtain a basic feature vector; use the second feature extraction module in the recommendation model to perform feature extraction on the first identifier embedding vector to obtain a first preference vector; use the third feature extraction module in the recommendation model to perform feature extraction on the second identifier embedding vector to obtain a second preference vector; determine the basic feature vector, the first preference vector and the second preference vector as training sample feature vectors; use the fourth feature extraction module in the recommendation model to perform feature extraction on the fused embedding vector to obtain a fused feature vector.
[0249] In some embodiments, the feature extraction module 2334 is further used to use the fourth feature extraction module in the recommendation model to determine the vector difference between the first shared embedding vector and the second shared embedding vector; perform splicing processing on the fused feature vector, the vector difference and the information feature vector to obtain a first spliced feature vector; perform feature cross-processing on the first spliced feature vector to obtain an attention weight vector; and use the attention weight vector to perform weighted processing on the fused embedding vector to obtain a fused feature vector.
[0250] In some embodiments, the training module 2335 is further used to, for each training sample, concatenate the training sample feature vector and the fusion feature vector of the training sample to obtain a second concatenated feature vector; use the recommendation model to be trained to perform prediction processing on each second concatenated feature vector to obtain prediction information of each training sample; and perform backpropagation training on the recommendation model to be trained based on the prediction information and label information of each training sample to obtain a trained recommendation model.
[0251] An embodiment of the present application provides a model training device, which performs feature fusion mapping on the first click message sequence and the second click message sequence in the training sample by sharing a dynamic embedding table, thereby capturing the recommendation object preferences in different scenarios, thereby improving the training efficiency of the recommendation model and the recommendation accuracy of the recommendation model.
[0252] The following continues to describe the exemplary structure of the recommendation device 234 implemented as a software module in the server 200-2 provided in the embodiment of the present application. In some embodiments, such as Figure 3 As shown, the recommendation settings 234 stored in the memory 230-2 may include:
[0253] The second acquisition module 2341 is used to obtain a trained recommendation model, where the trained recommendation model is trained using the model training method according to any one of claims 1 to 10.
[0254] The second acquisition module 2341 is further configured to acquire a set of information to be recommended for a target recommendation object.
[0255] The second acquisition module 2341 is also used to obtain the input features of the information to be recommended for each information to be recommended in the information set to be recommended, and the input features include the second information feature of the information to be recommended, the second object feature of the target recommendation object, the second intersection feature of the information to be recommended and the target recommendation object, the first historical click message sequence of the target recommendation object in the target scenario, and the second historical click message sequence of the target recommendation object in the source scenario.
[0256] The prediction module 2342 is used to use the trained recommendation model to perform prediction processing on the input features to obtain the predicted click probability of the information to be recommended.
[0257] The sorting module 2343 is configured to sort the pieces of information to be recommended in descending order of predicted click probability to obtain sorted pieces of information to be recommended.
[0258] The sending module 2344 is configured to send the sorted information to be recommended to the terminal corresponding to the target recommendation object.
[0259] In some embodiments, the prediction module 2342 is also used to use the trained recommendation model to perform feature mapping on the input features to obtain the embedding vector of the information to be recommended; perform feature fusion mapping on the first historical click message sequence and the second historical click message sequence through a shared dynamic embedding table to obtain a historical fusion embedding vector; perform feature extraction on the embedding vector of the information to be recommended and the historical fusion embedding vector respectively to obtain the feature vector of the information to be recommended and the historical fusion feature vector accordingly; perform prediction based on the feature vector of the information to be recommended and the historical fusion feature vector to obtain the predicted click probability of the information to be recommended.
[0260] The present invention provides a recommendation device that uses a trained recommendation model to predict a set of recommended information for a target object, obtains a predicted click probability for each piece of information, sorts each piece of information in descending order of predicted click probability, obtains the sorted pieces of information, and sends them to the terminal corresponding to the target object. This allows messages with the highest click probability for the target object to be recommended first, thereby improving the click-through rate and user experience of the target object.
[0261] The present invention provides a computer program product comprising a computer program or computer-executable instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer-executable instructions from the computer-readable storage medium and executes the computer-executable instructions, causing the electronic device to perform the model training method or recommendation method described in the present invention.
[0262] The embodiment of the present application provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions or computer programs are stored. When the computer-executable instructions or computer programs are executed by a processor, the processor will be caused to execute the model training method or recommendation method provided by the embodiment of the present application, for example, Figure 4A The model training method shown or Figure 5A The recommended method is shown.
[0263] In some embodiments, the computer-readable storage medium may be a memory such as RAM, ROM, flash memory, magnetic surface memory, optical disk, or CD-ROM; or may be various devices including one or any combination of the above memories.
[0264] In some embodiments, computer-executable instructions may be in the form of a program, software, software module, script, or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine, or other unit suitable for use in a computing environment.
[0265] As an example, computer-executable instructions may, but need not, correspond to a file in a file system, may be stored as part of a file that stores other programs or data, such as in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinating files (e.g., files storing one or more modules, subroutines, or code portions).
[0266] By way of example, computer-executable instructions may be deployed to be executed on one electronic device, or on multiple electronic devices located at one site, or on multiple electronic devices distributed across multiple sites and interconnected by a communication network.
[0267] In summary, the present invention provides a method for training a recommendation model. By sharing a dynamic embedding table, the first click message sequence and the second click message sequence in the training sample are subjected to feature fusion mapping, which can capture the recommendation object preferences in different scenarios, thereby improving the training efficiency of the recommendation model and the recommendation accuracy of the recommendation model. At the same time, a recommendation method based on the recommendation model is proposed, which can understand the cross-domain recommendation object preferences of the recommendation object in different scenarios, more accurately clarify the recommendation object preference information, and improve the recommendation efficiency.
[0268] The above description is merely an embodiment of the present application and is not intended to limit the scope of protection of the present application. Any modifications, equivalent replacements, and improvements made within the spirit and scope of the present application are included in the scope of protection of the present application.
Claims
1. A model training method, characterized in that: The method comprises: Obtaining a recommendation model to be trained, and obtaining multiple training samples and label information of each training sample, wherein the training samples include basic sample features, a first click message sequence in a target scenario, and a second click message sequence in a source scenario; For each training sample, feature mapping is performed on the training sample to obtain a training sample embedding vector; Performing feature fusion mapping on the first click message sequence and the second click message sequence through a shared dynamic embedding table to obtain a fused embedding vector; Performing feature extraction on the training sample embedding vector and the fused embedding vector respectively to obtain a training sample feature vector and a fused feature vector respectively; The recommendation model to be trained is trained using the training sample feature vectors, fusion feature vectors and label information of each training sample to obtain a trained recommendation model.
2. The method according to claim 1, wherein The sample basic features include: a first object feature of the recommended object, a first information feature of the information to be recommended, and a first intersection feature of the recommended object and the information to be recommended. The feature mapping of the training sample to obtain the training sample embedding vector includes: Performing feature mapping on the first object feature, the first information feature, and the first cross feature using a basic shared embedding table to obtain a basic embedding vector; Performing feature mapping on each first message identifier in the first click message sequence using a first identifier embedding table to obtain a first identifier embedding vector; Performing feature mapping on each second message identifier in the second click message sequence using a second identifier embedding table to obtain a second identifier embedding vector; The training sample embedding vector is constructed using the basic embedding vector, the first identifier embedding vector, and the second identifier embedding vector.
3. The method according to claim 1, wherein The performing feature fusion mapping on the first click message sequence and the second click message sequence by sharing a dynamic embedding table to obtain a fused embedding vector includes: Obtaining a shared dynamic embedding table, wherein the shared dynamic embedding table includes a plurality of shared embedding vectors; dividing the plurality of shared embedding vectors into a first embedding queue and a second embedding queue; determining a queue change amount based on the first click message sequence, the second click message sequence, the first embedded queue, and the second embedded queue; updating the first embedded queue and the second embedded queue based on the queue change amount to obtain an updated first embedded queue and an updated second embedded queue; Performing feature mapping on each first message identifier in the first click message sequence using the updated first embedding queue to obtain a first shared embedding vector, and performing feature mapping on each second message identifier in the second click message sequence using the updated second embedding queue to obtain a second shared embedding vector; The first shared embedding vector and the second shared embedding vector are fused to obtain a fused embedding vector.
4. The method according to claim 3, wherein The determining the queue change amount based on the first click message sequence, the second click message sequence, the first embedded queue, and the second embedded queue includes: Performing feature mapping on each first message identifier in the first click message sequence through the first embedding queue to obtain a first initial embedding vector corresponding to each first message identifier; Performing feature mapping on each second message identifier in the second click message sequence using the second embedding queue to obtain a second initial embedding vector corresponding to each second message identifier; Using the trained weight prediction model, each first initial embedding vector and each second initial embedding vector are predicted to obtain attention weights; Obtain a total number of embedding vectors in the shared dynamic embedding table, and determine the queue change amount based on the attention weight and the total number of embedding vectors.
5. The method according to claim 4, characterized in that The updating of the first embedded queue and the second embedded queue based on the queue change amount to obtain an updated first embedded queue and an updated second embedded queue includes: When the queue change amount is greater than 0, obtaining shared embedding vectors corresponding to multiple first new message identifiers; updating the first embedding queue based on the queue change amount and the shared embedding vectors corresponding to the plurality of first new message identifiers to obtain an updated first embedding queue; The shared embedding vectors corresponding to the queue change amount are deleted from the second embedding queue to obtain an updated second embedding queue.
6. The method according to claim 4, characterized in that The updating of the first embedded queue and the second embedded queue based on the queue change amount to obtain an updated first embedded queue and an updated second embedded queue includes: When the queue change amount is less than 0, deleting the shared embedding vectors corresponding to the queue change amount from the first embedding queue to obtain an updated first embedding queue; Obtaining shared embedding vectors corresponding to multiple second new message identifiers; The second embedding queue is updated based on the queue table change amount and the shared embedding vectors corresponding to the multiple second new message identifiers to obtain an updated second embedding queue.
7. The method according to claim 5, characterized in that The updating of the first embedded queue based on the queue change amount and the shared embedding vectors corresponding to the multiple first new message identifiers to obtain an updated first embedded queue includes: When the number of first identifiers of the first new message identifiers is less than or equal to the queue change amount, adding the shared embedding vectors corresponding to the multiple first new message identifiers to the first embedding queue to obtain an updated first embedding queue; When the number of the first identifiers is greater than the queue change amount, a shared embedding vector corresponding to the number of queue changes is selected from the shared embedding vectors corresponding to the multiple first new message identifiers, and the shared embedding vector corresponding to the number of queue changes is added to the first embedding queue to obtain an updated first embedding queue.
8. The method according to claim 2, wherein: The feature extraction is performed on the training sample embedding vector and the fusion embedding vector respectively to obtain the training sample feature vector and the fusion feature vector respectively, including: Using the first feature extraction module in the recommendation model to perform feature extraction on the basic embedding vector to obtain a basic feature vector; Using a second feature extraction module in the recommendation model, extract features from the first identifier embedding vector to obtain a first preference vector; Using a third feature extraction module in the recommendation model, extract features from the second identifier embedding vector to obtain a second preference vector; Determining the basic feature vector, the first preference vector, and the second preference vector as training sample feature vectors; The fourth feature extraction module in the recommendation model is used to perform feature extraction on the fused embedding vector to obtain a fused feature vector.
9. The method according to claim 8, characterized in that The fused embedding vector includes a first shared embedding vector and a second shared embedding vector, the basic feature vector includes an information feature vector of the information to be recommended, and the fourth feature extraction module in the recommendation model is used to extract features from the fused embedding vector to obtain a fused feature vector, including: Determining, using a fourth feature extraction module in the recommendation model, a vector difference between the first shared embedding vector and the second shared embedding vector; performing splicing processing on the fused feature vector, the vector difference, and the information feature vector to obtain a first spliced feature vector; Performing feature cross processing on the first concatenated feature vector to obtain an attention weight vector; The fused embedding vector is weighted using the attention weight vector to obtain a fused feature vector.
10. The method according to any one of claims 1 to 9, characterized in that The method of training the recommendation model to be trained by using the training sample feature vectors, fusion feature vectors and label information of each training sample to obtain a trained recommendation model includes: For each training sample, concatenating the training sample feature vector of the training sample and the fusion feature vector to obtain a second concatenated feature vector; Using the recommendation model to be trained to perform prediction processing on each second spliced feature vector to obtain prediction information of each training sample; Based on the prediction information and label information of each training sample, back propagation training is performed on the recommendation model to be trained to obtain a trained recommendation model.
11. A recommendation method, characterized in that: The method comprises: Obtaining a trained recommendation model, wherein the trained recommendation model is obtained by training using the model training method according to any one of claims 1 to 10; Obtain a set of information to be recommended for the target recommendation object; For each piece of information to be recommended in the set of information to be recommended, obtaining input features of the information to be recommended, the input features including a second information feature of the information to be recommended, a second object feature of the target recommended object, a second intersection feature of the information to be recommended and the target recommended object, a first historical click message sequence of the target recommended object in a target scenario, and a second historical click message sequence of the target recommended object in a source scenario; Using the trained recommendation model to perform prediction processing on the input features to obtain a predicted click probability of the information to be recommended; Sorting each of the to-be-recommended information in descending order of predicted click probability to obtain sorted to-be-recommended information; The sorted information to be recommended is sent to the terminal corresponding to the target recommendation object.
12. The method according to claim 11, characterized in that The step of using the trained recommendation model to perform prediction processing on the input features to obtain the predicted click probability of the information to be recommended includes: Using the trained recommendation model, feature mapping is performed on the input features to obtain an embedding vector of the information to be recommended; Perform feature fusion mapping on the first historical click message sequence and the second historical click message sequence through a shared dynamic embedding table to obtain a historical fusion embedding vector; Performing feature extraction on the embedding vector of the information to be recommended and the historical fusion embedding vector respectively, and obtaining a feature vector of the information to be recommended and a historical fusion feature vector accordingly; Prediction is performed based on the feature vector of the information to be recommended and the historical fusion feature vector to obtain a predicted click probability of the information to be recommended.
13. A model training device, characterized in that: The device comprises: A first acquisition module is used to acquire a recommendation model to be trained and obtain multiple training samples and label information of each training sample, wherein the training samples include basic sample features, a first click message sequence in a target scenario, and a second click message sequence in a source scenario; A feature mapping module is used to perform feature mapping on each training sample to obtain a training sample embedding vector; a feature fusion mapping module, configured to perform feature fusion mapping on the first click message sequence and the second click message sequence through a shared dynamic embedding table to obtain a fused embedding vector; A feature extraction module is used to extract features from the training sample embedding vector and the fused embedding vector respectively, and obtain a training sample feature vector and a fused feature vector respectively; The training module is used to train the recommendation model to be trained by using the training sample feature vector, the fusion feature vector and the label information of each training sample to obtain a trained recommendation model.
14. A recommendation device, characterized in that: The device comprises: A second acquisition module is used to acquire a trained recommendation model, where the trained recommendation model is obtained by training using the model training method according to any one of claims 1 to 10; The second acquisition module is further used to obtain a set of information to be recommended for the target recommendation object; The second acquisition module is further configured to acquire, for each piece of information to be recommended in the set of information to be recommended, input features of the information to be recommended, the input features including a second information feature of the information to be recommended, a second object feature of the target recommended object, a second intersection feature of the information to be recommended and the target recommended object, a first historical click message sequence of the target recommended object in a target scenario, and a second historical click message sequence of the target recommended object in a source scenario; A prediction module, configured to use the trained recommendation model to perform prediction processing on the input features to obtain a predicted click probability of the information to be recommended; A sorting module is used to sort each of the to-be-recommended information in descending order of predicted click probability to obtain sorted to-be-recommended information; The sending module is used to send the sorted information to be recommended to the terminal corresponding to the target recommendation object.
15. An electronic device, characterized in that: The electronic device comprises: a memory for storing computer-executable instructions; A processor, configured to implement the model training method according to any one of claims 1 to 10, or the recommendation method according to claim 11 or 12, when executing computer-executable instructions stored in the memory.
16. A computer-readable storage medium storing computer-executable instructions or a computer program, characterized in that: When the computer executable instructions or computer program are executed by a processor, the model training method according to any one of claims 1 to 10 or the recommendation method according to claim 11 or 12 is implemented.
17. A computer program product comprising computer executable instructions or a computer program, characterized in that When the computer executable instructions or computer program are executed by a processor, the model training method according to any one of claims 1 to 10 or the recommendation method according to claim 11 or 12 is implemented.