Data processing method and device for model training, electronic device and storage medium

By extracting samples of historical behavior data from user behavior data and training them online, the problem of high memory consumption in online recommendation systems was solved, recommendation accuracy was improved, and system pressure was reduced.

CN115345311BActive Publication Date: 2026-05-12BEIJING DAJIA INTERNET INFORMATION TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
BEIJING DAJIA INTERNET INFORMATION TECH CO LTD
Filing Date
2021-05-11
Publication Date
2026-05-12

AI Technical Summary

Technical Problem

In existing technologies, using extremely long behavioral sequences as input during model training and inference leads to high memory consumption and excessive pressure on online recommendation systems.

Method used

By acquiring behavioral data samples from user accounts, including historical and online behavioral data samples, a portion of historical behavioral data samples are extracted from all historical behavioral data samples using sample extraction logic. These samples are then used to train the online recommendation model online, adjusting the model parameters to improve recommendation accuracy while reducing memory consumption.

Benefits of technology

Without changing the model structure and inference input, the accuracy of the recommendation model was improved by increasing the number of historical behavior data samples, and the memory consumption and pressure of the online system were significantly reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115345311B_ABST
    Figure CN115345311B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a model training data processing method and device, electronic equipment and storage medium. The method comprises: obtaining a plurality of behavior data samples of a user account, the plurality of behavior data samples comprising historical behavior data samples and online behavior data samples, the historical behavior data samples comprising all historical behavior data samples of the user account, or part of the historical behavior data samples extracted from all the historical behavior data samples based on sample extraction logic; determining training data and training labels corresponding to each behavior data sample; and performing online training on an online recommendation model using the training data and the training labels, the online recommendation model being a model that has been trained to meet online prediction requirements, and the trained online recommendation model being used to recommend objects to the user account online. By adding historical behavior data to the training samples, the model structure and the input of the inference stage can be changed, and the pressure on the online recommendation system can be greatly reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of Internet technology, and in particular to a data processing method, apparatus, electronic device, computer-readable storage medium, and computer program product for model training. Background Technology

[0002] Recommendation systems can recommend items to clients based on model-predicted click-through rate (CTR) and conversion rate (CVR). Since users' historical behavior information contains information about their interests, training the model to continuously learn from this information helps improve the accuracy of the recommendation system.

[0003] To enable the model to learn more about users' historical behavior, related technologies use extremely long behavior sequences formed from all of a user's historical behavior data as training data to train the model. Correspondingly, the extremely long behavior sequence formed from all historical behavior data is also needed as input during inference. However, using extremely long behavior sequences as input for both training and inference means that online recommendation systems face immense pressure and suffer from significant memory consumption. Summary of the Invention

[0004] This disclosure provides a data processing method, apparatus, electronic device, computer-readable storage medium, and computer program product for model training, to at least solve the problem of high memory consumption in online recommendation systems when using extremely long behavioral sequences as input to the model during both training and inference. The technical solution of this disclosure is as follows:

[0005] According to a first aspect of the present disclosure, a data processing method for model training is provided, comprising:

[0006] Obtain several behavioral data samples of a user account. Each behavioral data sample is generated by the user account performing operations on associated objects. The several behavioral data samples include historical behavioral data samples and online behavioral data samples. The historical behavioral data samples include all historical behavioral data samples of the user account, or a portion of the historical behavioral data samples extracted from all the historical behavioral data samples based on sample extraction logic.

[0007] Determine the training data and training labels corresponding to each behavioral data sample;

[0008] The online recommendation model is trained online using the training data and the training labels. The online recommendation model is a model that has been trained to meet the requirements for online prediction. The trained online recommendation model is used to recommend objects to the user account online.

[0009] In one embodiment, the partial historical behavior data sample extracted from the total historical behavior data sample based on the sample extraction logic is obtained by performing any of the following processes:

[0010] The partial historical behavior data sample is obtained by extracting data based on the importance of the objects corresponding to the historical behavior data sample.

[0011] Alternatively, obtain the target object type of the object corresponding to the online behavior data sample, and extract the historical behavior data sample under the target object type from all historical behavior data samples as the partial historical behavior data sample;

[0012] Alternatively, obtain the first similarity between the historical behavior data sample and the online behavior data sample, and extract based on the first similarity to obtain the partial historical behavior data sample;

[0013] Alternatively, obtain the type diversity index of the object type, and extract the partial historical behavior data sample based on the type diversity index.

[0014] In one embodiment, the number of extracted historical behavior data samples is determined based on the training speed of the online recommendation model.

[0015] In one embodiment, training the online recommendation model using the training data and the training labels includes:

[0016] Obtain the weight corresponding to each of the aforementioned behavioral data samples;

[0017] The training data corresponding to each behavioral data sample is input into the online recommendation model to obtain the prediction result corresponding to each behavioral data sample.

[0018] The loss value is determined based on the prediction result, the training label, and the weights corresponding to each behavioral data sample.

[0019] The model parameters of the online recommendation model are adjusted based on the loss value, and the training data corresponding to the next behavior data sample is input until the training stopping condition is met.

[0020] In one embodiment, when the behavior data sample is a historical behavior data sample, obtaining the weight corresponding to each behavior data sample includes:

[0021] Obtain the time difference between the timestamp and the current time in each of the historical behavior data samples, and determine the weight corresponding to each of the historical behavior data samples based on the time difference, wherein the weight is negatively correlated with the time difference;

[0022] Alternatively, the weight of each historical behavior data sample can be determined based on the importance of the object corresponding to each historical behavior data sample, and the weight is positively correlated with the importance.

[0023] Alternatively, a second similarity score can be obtained between each historical behavior data sample and the online behavior data sample, and a weight corresponding to each historical behavior data sample can be determined based on the second similarity score, wherein the weight is positively correlated with the second similarity score.

[0024] Alternatively, obtain the type diversity index of the object type, and determine the weight corresponding to each of the historical behavior data samples based on the type diversity index;

[0025] Alternatively, the corresponding weights can be obtained by predicting each of the historical behavior data samples using a first deep learning model.

[0026] In one embodiment, all historical behavior data samples are obtained by querying a first mapping table, which is obtained during offline training of the online recommendation model and is updated in real time as the online recommendation model is trained online.

[0027] In one embodiment, determining the training data and training labels corresponding to each behavioral data sample includes:

[0028] If the behavior data sample is an online behavior data sample, then training data corresponding to the online behavior data sample is generated based on the online behavior data sample;

[0029] The original labels are obtained from the online behavior data samples and used as the training labels corresponding to the online behavior data samples.

[0030] If the behavior data sample is a historical behavior data sample, then training data corresponding to the historical behavior data sample is generated based on the historical behavior data sample;

[0031] Obtain the time difference between the timestamp in the historical behavior data sample and the current time;

[0032] The original labels in the historical behavior data samples are attenuated based on the time difference to obtain the training labels corresponding to the historical behavior data samples.

[0033] In one embodiment, the step of attenuating the original labels in the historical behavior data samples based on the time difference to obtain the training labels for the historical behavior data samples includes:

[0034] The training labels corresponding to the time difference of the historical behavior data samples are obtained by querying the second mapping table, which includes the correspondence between time difference and training labels;

[0035] Alternatively, the original labels can be attenuated according to the time difference using a preset attenuation function to obtain the training labels for the historical behavior data samples;

[0036] Alternatively, a second deep learning model can be used to predict the historical behavior data samples to obtain the training labels for those samples.

[0037] According to a second aspect of the present disclosure, a data processing apparatus for model training is provided, comprising:

[0038] The acquisition module is configured to acquire several behavioral data samples of a user account. Each behavioral data sample is generated by the user account performing operations on associated objects. The several behavioral data samples include historical behavioral data samples and online behavioral data samples. The historical behavioral data samples include all historical behavioral data samples of the user account, or a portion of historical behavioral data samples extracted from all historical behavioral data samples based on sample extraction logic.

[0039] The training sample generation module is configured to determine the training data and training labels corresponding to each of the said behavioral data samples;

[0040] The model training module is configured to perform online training on an online recommendation model using the training data and the training labels. The online recommendation model is a model that has been trained to meet the online prediction requirements. The trained online recommendation model is used to recommend objects to the user account online.

[0041] In one embodiment, the apparatus further includes a sample extraction module configured to perform extraction based on the importance of the objects corresponding to the historical behavior data samples to obtain the partial historical behavior data samples;

[0042] Alternatively, obtain the target object type of the object corresponding to the online behavior data sample, and extract the historical behavior data sample under the target object type from all historical behavior data samples as the partial historical behavior data sample;

[0043] Alternatively, obtain the first similarity between the historical behavior data sample and the online behavior data sample, and extract based on the first similarity to obtain the partial historical behavior data sample;

[0044] Alternatively, obtain the type diversity index of the object type, and extract the partial historical behavior data sample based on the type diversity index.

[0045] In one embodiment, the number of extracted historical behavior data samples is determined based on the training speed of the online recommendation model.

[0046] In one embodiment, the model training module includes:

[0047] The weight acquisition unit is configured to acquire the weight corresponding to each of the behavioral data samples.

[0048] The prediction unit is configured to input the training data corresponding to each of the behavioral data samples into the online recommendation model to obtain the prediction result corresponding to each of the behavioral data samples.

[0049] The loss value determination unit is configured to determine a loss value based on the prediction result, the training label, and the weights corresponding to each of the said behavioral data samples;

[0050] The parameter adjustment unit is configured to adjust the model parameters of the online recommendation model according to the loss value, and continue to input the training data corresponding to the next behavior data sample until the training stopping condition is met.

[0051] In one embodiment, when the behavior data sample is a historical behavior data sample, the weight acquisition unit is configured to acquire the time difference between the timestamp in each historical behavior data sample and the current time, and determine the weight corresponding to each historical behavior data sample based on the time difference, wherein the weight is negatively correlated with the time difference;

[0052] Alternatively, the weight of each historical behavior data sample can be determined based on the importance of the object corresponding to each historical behavior data sample, and the weight is positively correlated with the importance.

[0053] Alternatively, a second similarity score can be obtained between each historical behavior data sample and the online behavior data sample, and a weight corresponding to each historical behavior data sample can be determined based on the second similarity score, wherein the weight is positively correlated with the second similarity score.

[0054] Alternatively, obtain the type diversity index of the object type, and determine the weight corresponding to each of the historical behavior data samples based on the type diversity index;

[0055] Alternatively, the corresponding weights can be obtained by predicting each of the historical behavior data samples using a first deep learning model.

[0056] In one embodiment, the complete historical behavior data samples are obtained by querying a first mapping table, which is obtained during the offline training of the online recommendation model and is updated in real time as the online recommendation model is trained online.

[0057] In one embodiment, the training sample generation module includes:

[0058] The first training data generation unit is configured to generate training data corresponding to the online behavior data sample if the behavior data sample is an online behavior data sample.

[0059] The first label determination unit is configured to extract the original label from the online behavior data sample and use it as the training label corresponding to the online behavior data sample.

[0060] The second training data generation unit is configured to generate training data corresponding to the historical behavior data sample if the behavior data sample is a historical behavior data sample.

[0061] The acquisition unit is configured to acquire the time difference between the timestamp and the current moment in the historical behavior data sample;

[0062] The second label determination unit is configured to perform attenuation of the original labels in the historical behavior data samples according to the time difference, so as to obtain the training labels corresponding to the historical behavior data samples.

[0063] In one embodiment, the second label determination unit is configured to query a second mapping table to obtain a training label corresponding to the time difference of the historical behavior data sample, the second mapping table including the correspondence between time difference and training label;

[0064] Alternatively, the original labels can be attenuated according to the time difference using a preset attenuation function to obtain the training labels for the historical behavior data samples;

[0065] Alternatively, a second deep learning model can be used to predict the historical behavior data samples to obtain the training labels for those samples.

[0066] According to a third aspect of the present disclosure, an electronic device is provided, comprising:

[0067] processor;

[0068] Memory used to store the processor's executable instructions;

[0069] The processor is configured to execute the instructions to implement the data processing method for model training as described in any embodiment of the first aspect.

[0070] According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided that, when instructions in the computer-readable storage medium are executed by a processor of an electronic device, enables the electronic device to perform a data processing method for model training as described in any embodiment of the first aspect.

[0071] According to a fifth aspect of the present disclosure, a computer program product is provided, including a computer program that, when executed by a processor, implements the data processing method for model training as described in any embodiment of the first aspect.

[0072] The technical solutions provided by the embodiments of this disclosure bring at least the following beneficial effects:

[0073] For online recommendation models that have been trained to meet online prediction requirements, these models have learned historical user behavior information, but this information can be forgotten due to catastrophic forgetting or other reasons. Therefore, by incorporating historical behavior data samples into the online training process, the online recommendation model can relearn user behavior information, improving its recommendation accuracy. Furthermore, by adding historical behavior data samples, compared to related techniques that rely on extremely long behavior sequences for training and inference, it is possible to significantly reduce the pressure on the online system and decrease memory consumption without altering the model structure or the input during the inference phase.

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

[0075] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure, and are not intended to unduly limit this disclosure.

[0076] Figure 1 This is an application environment diagram illustrating a data processing method for model training according to an exemplary embodiment.

[0077] Figure 2 This is a flowchart illustrating a data processing method for model training according to an exemplary embodiment.

[0078] Figure 3This is a flowchart illustrating a model training step according to an exemplary embodiment.

[0079] Figure 4 This is a flowchart illustrating the determination of training data and training labels according to an exemplary embodiment.

[0080] Figure 5 This is a flowchart illustrating a data processing method for model training according to an exemplary embodiment.

[0081] Figure 6 This is a block diagram illustrating a data processing apparatus for model training according to an exemplary embodiment.

[0082] Figure 7 This is a block diagram illustrating an electronic device according to an exemplary embodiment. Detailed Implementation

[0083] To enable those skilled in the art to better understand the technical solutions of this disclosure, the technical solutions in the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings.

[0084] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.

[0085] The data processing method for model training provided in this disclosure can be applied to, for example... Figure 1In the application environment shown, terminal 110 interacts with server 120 via a network. Terminal 110 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, and portable wearable devices. Server 120 can be implemented using a standalone server or a server cluster consisting of multiple servers. Applications can be installed on terminal 110. These applications can be social networking applications, short video applications, instant messaging applications, etc. Terminal 110 can provide users with various resources through the applications. These resources can be images, music, videos, games, text, web pages, etc. Server 120 can deploy an online recommendation system, which can personalize recommendations to application clients using an online recommendation model. The online recommendation model can be any model capable of predicting the recommendability rate of an object, such as a linear model, neural network model, support vector machine, dual-tower model, etc. The recommendability rate of an object can be represented using click-through rate, conversion rate, etc.

[0086] In its implementation, server 120 acquires several behavioral data samples from user accounts. Each behavioral data sample is generated by the user account's operations on associated objects. These behavioral data samples include historical behavioral data samples and online behavioral data samples. The historical behavioral data samples include all historical behavioral data samples of the user account, or a subset of historical behavioral data samples extracted from all historical behavioral data samples based on sample extraction logic. Server 120 determines the training data and training labels corresponding to each behavioral data sample. The online recommendation model is trained online using the training data and training labels until the training stops. Server 120 updates the model parameters of the online recommendation model in use using the trained model parameters and then uses the trained online recommendation model to recommend objects to terminal 110 online. The update can be a full update or an incremental update.

[0087] Figure 2 This is a flowchart illustrating a data processing method for model training according to an exemplary embodiment, such as... Figure 2 As shown, the data processing method for model training can be used on a server, including the following steps.

[0088] In step S210, several behavioral data samples of the user account are obtained. Each behavioral data sample is generated by the user account's operations on associated objects. The several behavioral data samples include historical behavioral data samples and online behavioral data samples. The historical behavioral data samples include all historical behavioral data samples of the user account, or a portion of the historical behavioral data samples extracted from all historical behavioral data samples based on sample extraction logic.

[0089] Behavioral data samples refer to samples generated when a user account interacts with objects within an application. For example, if a user clicks on video A, a behavioral data sample is generated indicating that the user account clicked on video A. Behavioral data samples may include, but are not limited to, user attribute information, operation behavior information, time information, and object information of the operated object. User attribute information may include user account identifier, name, gender, region, occupation, etc. Operation behavior information can represent the user's actions, such as clicking or not clicking. Time information may include operation timestamps, operation duration, etc. The operated object refers to the object on which the user's action was performed; the object can be a video, article, product, music, etc. Object information can be used to represent the object's attributes, such as object name, object identifier, object type, etc.

[0090] Online behavior data samples can be real-time samples generated by a user account, such as samples generated after the user account logged in this time; or samples generated within a short period of time, such as samples generated within the previous two hours. Online behavior data samples can be collected using message queues. Message queues can use ActiveMQ (Active Message Queue, an open-source message middleware), RabbitMQ (RabbitMessage Queue, an open-source message middleware that implements an advanced message queue protocol), Kafka (a high-throughput distributed publish-subscribe messaging system), etc. When a user account generates online behavior data samples, the server can add the online behavior data samples to the message queue. Online behavior data samples are obtained by consuming messages from the message queue.

[0091] Historical behavioral data samples can refer to behavioral data samples other than online behavioral data samples. Historical behavioral data samples can be stored using methods such as distributed storage systems. Historical behavioral data samples can also be further divided into long-term historical behavioral data samples and short-term historical behavioral data samples. Long-term and short-term historical behavioral data samples can be determined by a time dimension. The time dimension can be, but is not limited to, the time of occurrence of the action, its duration, etc.

[0092] Taking the occurrence time of an action as an example, long-term historical behavior data can be data generated within a first time difference; short-term historical behavior data can be data generated within a second time difference. The first time difference is greater than the second time difference, and the first time difference is earlier than the second time difference. The determination method of the first and second time differences can be pre-configured. For example, the first and second time differences can be configured as fixed time differences, such as the first time difference being 5 months to 2 weeks prior to the current time, and the second time difference being 2 weeks prior to the current time. The first and second time differences can also be changed according to the training requirements of the online recommendation model. For example, the first time difference can be changed to 4 months to 1 month prior to the current time, and the second time difference to 1 month prior to the current time. Furthermore, the first and second time differences can also be obtained through statistical analysis based on the current online recommendation model's training speed, the model's sample requirements, etc., using an algorithm.

[0093] Specifically, behavioral data samples correspond to user account identifiers. During online training of the online recommendation model, the server can obtain online behavioral data samples and historical behavioral data samples of the user account based on the user account identifier. The historical behavioral data samples can be all historical behavioral data samples of the user account. All historical behavioral data samples can refer to all historical behavioral data samples generated by the user account since it started using the application. All historical behavioral data samples can be stored in a distributed storage system. Historical behavioral data samples can also be partial historical behavioral data samples extracted from all historical behavioral data samples based on sample extraction logic.

[0094] In step S220, the training data and training labels corresponding to each behavioral data sample are determined.

[0095] The training data can be a vectorized representation of behavioral data samples. Specifically, the acquired behavioral data samples may be raw data without any processing. The server needs to process each behavioral data sample to obtain its vectorized representation. For example, one or more of the following methods can be used to process each behavioral data sample: MLP (Multilayer Perceptron), one-hot encoding, and Embedding Lookup, to obtain its vectorized representation as training data.

[0096] Training labels can be determined based on the action behavior information in each action data sample. For example, samples with click behavior can be designated as positive samples, and their training labels can be set to 1; samples without click behavior can be designated as negative samples, and their training labels can be set to 0.

[0097] In step S230, the online recommendation model is trained online using training data and training labels. The online recommendation model is a model that has been trained to meet the requirements for online prediction. The trained online recommendation model is used to recommend objects to user accounts online.

[0098] Specifically, after processing each behavioral data sample to obtain corresponding training data and training labels, the training data of several behavioral data samples can be divided into multiple batches of training data. The training data of each behavioral data sample is then sequentially input into the online recommendation model. The online recommendation model makes predictions to obtain the prediction result for each behavioral data sample. A loss function is used to calculate the loss value for each behavioral data sample's prediction result and corresponding training label. The model parameters of the online recommendation model are adjusted in the direction of decreasing loss value until a training stopping condition is reached. The training stopping condition can be that the loss value reaches its minimum or the number of iterations reaches a preset number, etc. The server uses the trained model parameters to perform a full or incremental update on the online recommendation model in use, resulting in a trained online recommendation model. The trained online recommendation model is then used to recommend objects to user accounts online.

[0099] Furthermore, in the subsequent online recommendation process, the server can still refer to steps S210 and S230 to train the online recommendation model online in real time.

[0100] Furthermore, the process described in the above embodiments is also applicable to the offline training process of recommendation models.

[0101] In the data processing methods described above for model training, for online recommendation models that have been trained to meet online prediction requirements, the models have already learned historical user behavior information, but this information has been forgotten due to catastrophic forgetting or other reasons. Therefore, by incorporating historical behavior data samples into the online training process of the online recommendation model, the model can relearn the user's historical behavior information, improving the recommendation accuracy. Furthermore, by adding historical behavior data samples, without changing the model structure or the input during the inference stage, compared to related techniques that rely on extremely long behavior sequences for training and inference, the pressure on the online system and memory consumption can be significantly reduced.

[0102] In an exemplary embodiment, all historical behavior data samples can be obtained as follows: During the offline streaming training (offline training) of the online recommendation model using historical behavior data samples, the correspondence between account identifiers and historical behavior data samples can be stored synchronously to obtain a first mapping table. The stored historical behavior data samples may include user operation behavior information, time information, object identifiers, etc. The object identifier can be a hash value obtained through hash processing or an unhashable raw value. The server can read the corresponding object features through the object identifier.

[0103] Furthermore, the first mapping table can be stored in the parameter server. The parameter server uses distributed memory as the storage for parameters, enabling the server to quickly retrieve all historical behavior data corresponding to a user account's account identifier from the parameter server's memory during online training.

[0104] Furthermore, the first mapping table can also be stored on other devices, enabling the server to obtain all historical behavioral data samples through methods such as reading HIVE (a data warehouse tool) tables using SQL (Structured Query Language).

[0105] Furthermore, as the online recommendation model is trained online, the server can update the first mapping table with new behavioral data samples in real time, thereby ensuring the accuracy and consistency of the data.

[0106] Furthermore, the amount of data used in offline streaming training can be far greater than that used in online training. For example, offline streaming training might use 30 days of behavioral data, while online training is real-time. Therefore, the inference system may experience significant resource idleness during online training. This embodiment utilizes the system's redundant resources for online training, thus avoiding additional operational pressure on the system.

[0107] In this embodiment, by establishing a mapping table between account identifiers and historical behavior data, the server can quickly retrieve all historical behavior data samples from the mapping table, thereby helping to improve the efficiency of online training of online recommendation models.

[0108] In one exemplary embodiment, a portion of the historical behavior data samples extracted from all historical behavior data samples based on sample extraction logic is obtained by performing any of the following processes:

[0109] (1) Extract some historical behavior data samples by considering the importance of the objects corresponding to the historical behavior data samples.

[0110] Importance can be represented from multiple dimensions. For example, by using the popularity tags of objects, we can extract historical behavioral data samples containing objects that are labeled as popular; by using user interest representation, we can extract historical behavioral data samples containing objects that have been labeled as objects of interest by a certain number of user accounts.

[0111] (2) Obtain the target object type of the object corresponding to the online behavior data sample, and extract the historical behavior data sample under the target object type from all historical behavior data samples as part of the historical behavior data sample.

[0112] Specifically, the target object type of the object corresponding to the online behavior data sample may include at least one. Based on the target object type, the server extracts historical behavior data samples under that target object type from all historical behavior data. For example, if the target object type of the object corresponding to the online behavior data sample is a game video, then the server can extract samples containing game video IDs from all historical behavior data samples as a partial historical behavior data sample. By extracting samples based on object type, the online recommendation model can recommend objects that better match the user's current interests to the user's account, thereby helping to extend the user's dwell time.

[0113] (3) Obtain the first similarity between the historical behavior data sample and the online behavior data sample, and extract based on the first similarity to obtain a partial historical behavior data sample.

[0114] The first similarity can be represented using cosine similarity, Hamming distance, Mahalanobis distance, etc. Specifically, object features can be found based on object IDs in historical behavior data samples. The first similarity between the object features of online behavior data samples and the object features of historical behavior data samples is calculated, and the historical behavior data sample with the highest first similarity is extracted as a partial historical behavior data sample. By extracting samples based on similarity, the online recommendation model can recommend objects that better match the user's current interests to the user's account, thereby helping to extend the user's dwell time.

[0115] (4) Obtain the type diversity index of the object type, and extract some historical behavior data samples based on the type diversity index.

[0116] The object types can be, but are not limited to, live videos, game videos, images, etc. The object type diversity metric can be used to represent the various object types to be extracted, as well as the proportions and quantities corresponding to each object type. Specifically, several recommendable object types are predefined. After the server acquires all historical behavior data, it extracts a subset of historical behavior data samples that meet the requirements based on the proportions and quantities corresponding to each object type. For example, the object types in the diversity metric include game videos and music videos, each with a 50% proportion. Therefore, the server can extract half a preset number of historical behavior data samples containing game video IDs and half a preset number of historical behavior data samples containing music video IDs from all historical behavior data samples. By extracting samples based on object types, the trained online recommendation model can recommend objects of multiple object types to user accounts, thereby achieving diversified object recommendations.

[0117] In one exemplary embodiment, the number of extracted historical behavior data samples can be a preset number. This preset number can be adjusted based on the training speed of the online recommendation model; for example, the faster the model trains, the smaller the preset number, ensuring that the training speed of the online recommendation model can meet the training requirements of the online behavior data. Specifically, a mapping table between the preset number and the training speed can be pre-established, allowing for a quick lookup of the table to determine the required number of samples. Alternatively, the required number can be predicted based on the current training speed using methods such as deep learning models.

[0118] In this embodiment, samples that meet the requirements are extracted from all historical behavior data samples based on sample extraction logic. This not only enables the recommendation model to learn from historical behavior data, but also speeds up the training of the model.

[0119] In one exemplary embodiment, such as Figure 3 As shown, step S230, training the online recommendation model using training data and training labels, can be achieved through the following steps:

[0120] In step S310, the weight corresponding to each behavioral data sample is obtained.

[0121] The weights are used to reflect the importance of the training data to the model training. During the online training of the online recommendation model, corresponding weights can be assigned to each behavioral data sample, allowing the online recommendation model to learn from historical behavioral data without affecting its learning of online behavioral data.

[0122] In some possible embodiments, when the behavioral data sample is an online behavioral data sample, the weight of the online behavioral data sample can be set to 1 by default. When the behavioral data sample is a historical behavioral data sample, the weight corresponding to each historical behavioral data sample can be obtained through any of the following methods:

[0123] (1) The weights can be determined based on the time difference between the timestamp of each historical behavior data sample and the current time. The weights are negatively correlated with the time difference; that is, the longer the time difference, the smaller the weight. For details, please refer to the implementation method of training labels for historical behavior data samples mentioned above, which will not be elaborated here. By determining the weight of each historical behavior data sample from the time dimension, the online recommendation model can learn more knowledge from historical behavior data samples that are closer to the current time, thereby enabling the online recommendation model to recommend objects that are more in line with the user's current interests to the user account.

[0124] (2) Determine the weight of each historical behavior data sample based on the importance of the object corresponding to each historical behavior data sample. The weight is positively correlated with the importance.

[0125] The definition of importance can refer to the above embodiment and will not be elaborated here. Importance levels can be predefined, and corresponding weights can be assigned to each importance level; the higher the importance level, the greater the weight. Specifically, the importance level of each historical behavior data sample is determined according to the importance of the object corresponding to that sample. Then, the weight corresponding to the importance level is obtained as the weight of each historical behavior data sample. For example, the "popular" level is higher than the "marked as interesting" level, and the "marked as interesting" level is higher than the "not marked as interested" level. The weight of "popular" is 0.9, the weight of "marked as interested" is 0.7, and the weight of "not marked as interested" is 0.5. If the importance level of a historical behavior data sample is "popular," then the weight of that historical behavior data sample is 0.9.

[0126] (3) Obtain the second similarity between each historical behavior data sample and the online behavior data sample, and determine the weight corresponding to each historical behavior data sample based on the second similarity. The weight is positively correlated with the second similarity.

[0127] The second similarity can be represented using cosine similarity, Hamming distance, Mahalanobis distance, etc. Specifically, object features can be found based on object IDs in historical behavior data samples. The second similarity between the object features of online behavior data samples and the object features of historical behavior data samples is calculated. The server can assign higher weights to historical behavior data samples with higher second similarity. For example, a pre-established correspondence between second similarity and weight can be established: a second similarity of 0.9–1 corresponds to a weight of 0.9; a second similarity of 0.8–0.9 corresponds to a weight of 0.8; and so on. If the similarity of a historical behavior data sample is 0.95, then the weight can be 0.9.

[0128] (3) Obtain the type diversity index of the object type, and determine the weight of each historical behavior data sample based on the type diversity index.

[0129] The type diversity index can be used to represent the various object types to be extracted and the weights corresponding to each object type. Specifically, after the server obtains historical behavior data samples, the weight of each historical behavior data sample can be determined based on the object type to which it belongs. For example, the weight of game videos can be set to 0.9, music videos to 0.5, and live stream videos to 0.3. When a historical behavior data sample corresponds to a game video, its weight is determined to be 0.9.

[0130] (4) The corresponding weights are obtained by predicting each historical behavior data sample through the first deep learning model.

[0131] The first deep learning model can be any model capable of predicting weights, such as a linear model, a neural network model, or a support vector machine. It can be an offline or online model and can be trained together with an online recommendation system model to learn the relationship between historical behavior data samples and weights. The training process can utilize the cross-entropy loss function to backpropagate gradients. After acquiring historical behavior data samples, relevant features and time differences from these samples can be used as input data to predict weights through the first deep learning model.

[0132] In step S320, the training data corresponding to each behavior data sample is input into the online recommendation model to obtain the prediction result corresponding to each behavior data sample.

[0133] In step S330, the loss value is determined based on the prediction result, training label, and weight corresponding to each behavioral data sample.

[0134] In step S340, the model parameters of the online recommendation model are adjusted according to the loss value, and the training data corresponding to the next behavior data sample is input until the training stopping condition is met.

[0135] Specifically, after processing each behavioral data sample to obtain corresponding training data, training labels, and weights, the training data of several behavioral data samples can be randomly divided into multiple batches of training data. Each training data is then sequentially input into the online recommendation model to obtain the corresponding prediction result. A loss function with weighted coefficients is used to calculate the loss value based on the prediction result, training label, and weight of each behavioral data sample. The model parameters are adjusted in the direction of decreasing loss value until the training stopping condition is met, resulting in a trained online recommendation model.

[0136] In this embodiment, by setting corresponding weights for each behavioral data sample, the online recommendation model can learn from historical behavioral data without affecting its learning of online behavioral data, which helps to improve the model's prediction accuracy and recommendation performance.

[0137] In one exemplary embodiment, such as Figure 4 As shown, step S220, determining the training data and training labels corresponding to each behavioral data sample, can be achieved through the following steps:

[0138] In step S410, if the behavior data sample is an online behavior data sample, then training data corresponding to the online behavior data sample is generated based on the online behavior data sample.

[0139] Specifically, for each online behavior data sample, the server processes it to obtain a vectorized representation of each sample. For example, it can use one or more of the following methods in combination: MLP, one-hot encoding, EmbeddingLookup, etc., to process each sample and obtain its vectorized representation, which serves as the training data for each sample.

[0140] In step S420, the original labels are obtained from the online behavior data samples and used as the training labels corresponding to the online behavior data samples.

[0141] The original labels can be determined based on the action information in each online behavior data sample. For example, the original label for each online behavior data sample containing click behavior can be set to 1; the original label for the sample containing no click behavior can be set to 0. The original labels from the online behavior data can then be used as training labels.

[0142] In step S430, if the behavior data sample is a historical behavior data sample, then training data corresponding to the historical behavior data sample is generated based on the historical behavior data sample.

[0143] Specifically, for each historical behavior data sample, the server processes it to obtain a vectorized representation of each sample. For example, it can use one or more of the following methods in combination: MLP, one-hot encoding, EmbeddingLookup, etc., to process each historical behavior data sample and obtain its vectorized representation, which serves as the training data for each sample.

[0144] In step S440, the time difference between the timestamp in the historical behavior data sample and the current time is obtained.

[0145] In step S450, the original labels in the historical behavior data samples are attenuated according to the time difference to obtain the training labels corresponding to the historical behavior data samples.

[0146] Specifically, for historical behavior data samples, considering that users' interests may evolve over time—for example, a short video that a user clicked a year ago might not be recommended to them now—the original labels can be attenuated based on the time difference between the timestamp in the historical behavior data sample and the current moment. The attenuated original labels are then used as the training labels for each historical behavior data sample.

[0147] In this embodiment, the training labels of the behavioral data samples are obtained based on the generation time of the behavioral data samples. This allows the model parameters of the online recommendation model to be adjusted in a direction that better matches the user's current interests during the training process, thereby improving the prediction accuracy of the model and improving the recommendation effect.

[0148] In an exemplary embodiment, in step S450, the original labels in the historical behavior data samples are attenuated according to the time difference to obtain the training labels of the historical behavior data samples. This can be implemented in any of the following ways:

[0149] (1) Query the training labels corresponding to the time difference of the historical behavior data samples from the second mapping table.

[0150] Specifically, the second mapping table includes the correspondence between time differences and training labels. The server can query the training label corresponding to the time difference of the historical behavior data sample from the preset second mapping table. For example, the second mapping table defines that for a time difference of 15 days to 1 month, the original label of the positive sample decays to 0.9; for a time difference of 1 month to 2 months, the original label of the positive sample decays to 0.85; for a time difference of 2 months to 3 months, the original label of the positive sample decays to 0.8, and so on, until the original label decays to 0. If the time difference of the historical behavior data sample is 20 days, the training label can be 0.9. By determining the training label corresponding to each historical behavior data sample in the form of a mapping table, the logic for determining the training label can be simplified, which helps to improve the model training speed.

[0151] (2) The original labels are attenuated according to the time difference by a preset attenuation function to obtain the training labels of historical behavior data samples.

[0152] Specifically, the decay function can be any of the following: linear, exponential, or Gaussian functions, and can be determined through multiple experimental analyses. After obtaining the time difference for each historical behavior data sample, the training label corresponding to the time difference can be calculated based on the decay function. Using the decay function to obtain the training label for each historical behavior data sample helps ensure the accuracy of the training labels.

[0153] (3) The training labels of the historical behavior data samples are obtained by making predictions based on the historical behavior data samples through the second deep learning model.

[0154] The second deep learning model can be any model capable of predicting training labels, such as a linear model, a neural network model, or a support vector machine. This second-degree learning model can be offline or online and can be trained together with the recommendation system model to learn the relationship between time difference and decay rate. The training process can utilize the cross-entropy loss function to backpropagate gradients. After acquiring historical behavior data samples, the relevant features, time differences, and original labels of each historical behavior data sample can be used as input data to predict training labels through the second deep learning model. Obtaining training labels for each historical behavior data sample based on the deep learning model, combined with the prior knowledge learned by the deep learning model, allows for more accurate predictions of training labels, thereby improving model performance.

[0155] Figure 5 This is a flowchart illustrating a data processing method for model training according to an exemplary embodiment, such as... Figure 5 As shown, the data processing method for model training can be used on a server, including the following steps.

[0156] In step S502, several behavioral data samples of the user account are obtained. These behavioral data samples include historical behavioral data samples and online behavioral data samples. The specific methods for obtaining the historical and online behavioral data samples can be referred to the above embodiments and will not be elaborated here.

[0157] In step S504, for each online behavior data sample, training data and training labels corresponding to each online behavior data sample can be generated with reference to the above embodiment.

[0158] In step S506, for each historical behavior data sample, training data and training labels corresponding to each historical behavior data sample can be generated with reference to the above embodiment.

[0159] In step S508, for each historical behavior data sample, the weight of each historical behavior data sample can be obtained by referring to the above embodiment.

[0160] In step S510, the training data corresponding to each behavior data sample is input into the online recommendation model to obtain the prediction result corresponding to each behavior data sample.

[0161] In step S512, the loss value corresponding to each behavior data sample is calculated based on the weight, prediction result and training label of each behavior data sample by using a loss function carrying weight coefficients.

[0162] In step S514, the model parameters of the online recommendation model are adjusted in the direction of decreasing loss value until the training stopping condition is met.

[0163] It should be understood that although the steps in the flowchart above are shown sequentially as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowchart above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages in other steps.

[0164] Figure 6 This is a block diagram of a data processing apparatus 600 for model training according to an exemplary embodiment. (Refer to...) Figure 6 The device includes an acquisition module 602, a training sample generation module 604, and a model training module 606.

[0165] The acquisition module 602 is configured to acquire several behavioral data samples of a user account. Each behavioral data sample is generated by the user account's operations on associated objects. The several behavioral data samples include historical behavioral data samples and online behavioral data samples. The historical behavioral data samples include all historical behavioral data samples of the user account, or a portion of historical behavioral data samples extracted from all historical behavioral data samples based on sample extraction logic. The training sample generation module 604 is configured to determine the training data and training labels corresponding to each behavioral data sample. The model training module 606 is configured to perform online training on an online recommendation model using the training data and training labels. The online recommendation model is a model that has been trained to meet online prediction requirements. The trained online recommendation model is used to recommend objects to the user account online.

[0166] In one embodiment, the apparatus further includes a sample extraction module configured to perform extraction based on the importance of the objects corresponding to the historical behavior data samples to obtain partial historical behavior data samples;

[0167] Alternatively, obtain the target object type of the object corresponding to the online behavior data sample, and extract the historical behavior data sample under the target object type from all historical behavior data samples as a partial historical behavior data sample.

[0168] Alternatively, obtain the first similarity between historical behavior data samples and online behavior data samples, and extract based on the first similarity to obtain partial historical behavior data samples;

[0169] Alternatively, obtain the type diversity index of the object type, and extract some historical behavior data samples based on the type diversity index.

[0170] In one exemplary embodiment, the number of extracted historical behavior data samples is determined based on the training speed of the online recommendation model.

[0171] In one exemplary embodiment, the model training module 606 includes: a weight acquisition unit configured to acquire the weights corresponding to each behavior data sample; a prediction unit configured to input the training data corresponding to each behavior data sample into the online recommendation model to obtain the prediction result corresponding to each behavior data sample; a loss value determination unit configured to determine the loss value based on the prediction result, training label, and weights corresponding to each behavior data sample; and a parameter adjustment unit configured to adjust the model parameters of the online recommendation model based on the loss value, and continue to input the training data corresponding to the next behavior data sample until the training stopping condition is met.

[0172] In an exemplary embodiment, when the behavior data sample is a historical behavior data sample, the weight acquisition unit is configured to: acquire the time difference between the timestamp in each historical behavior data sample and the current time, and determine the weight corresponding to each historical behavior data sample based on the time difference, wherein the weight is negatively correlated with the time difference; or, determine the weight corresponding to each historical behavior data sample based on the importance of the object corresponding to each historical behavior data sample, wherein the weight is positively correlated with the importance; or, acquire the second similarity between each historical behavior data sample and the online behavior data sample, and determine the weight corresponding to each historical behavior data sample based on the second similarity, wherein the weight is positively correlated with the second similarity; or, acquire the type diversity index of the object type, and determine the weight corresponding to each historical behavior data sample based on the type diversity index; or, obtain the corresponding weight by predicting based on each historical behavior data sample using a first deep learning model.

[0173] In one exemplary embodiment, all historical behavior data samples are obtained by querying a first mapping table, which is obtained during the offline training of the online recommendation model and is updated in real time as the online recommendation model is trained online.

[0174] In one exemplary embodiment, the training sample generation module 604 includes: a first training data generation unit configured to generate training data corresponding to an online behavior data sample if the behavior data sample is an online behavior data sample; a first label determination unit configured to obtain original labels from the online behavior data sample as training labels corresponding to the online behavior data sample; a second training data generation unit configured to generate training data corresponding to a historical behavior data sample if the behavior data sample is a historical behavior data sample; an acquisition unit configured to acquire the time difference between the timestamp in the historical behavior data sample and the current time; and a second label determination unit configured to attenuate the original labels in the historical behavior data sample according to the time difference to obtain the training labels corresponding to the historical behavior data sample.

[0175] In one exemplary embodiment, the second label determination unit is configured to: query a second mapping table to obtain a training label corresponding to the time difference of the historical behavior data sample; or, attenuate the original label according to the time difference using a preset attenuation function to obtain the training label of the historical behavior data sample; or, predict the historical behavior data sample using a second deep learning model to obtain the training label of the historical behavior data sample.

[0176] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.

[0177] Figure 7 This is a block diagram illustrating an electronic device S00 for model training according to an exemplary embodiment. For example, the electronic device S00 can be a server. (Refer to...) Figure 7 The electronic device S00 includes a processing component S20, which further includes one or more processors, and memory resources represented by a memory S22 for storing instructions, such as application programs, that can be executed by the processing component S20. The application programs stored in the memory S22 may include one or more modules, each corresponding to a set of instructions. Furthermore, the processing component S20 is configured to execute instructions to perform the data processing method described above for model training.

[0178] The electronic device S00 may also include a power supply component S24 configured to perform power management of the electronic device S00, a wired or wireless network interface S26 configured to connect the electronic device S00 to a network, and an input / output (I / O) interface S28. The electronic device S00 can operate on an operating system stored in memory S22, such as Windows Server, Mac OS X, Unix, Linux, FreeBSD, or similar.

[0179] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory S22 including instructions, which can be executed by a processor of an electronic device S00 to perform the above-described method. The storage medium can be a computer-readable storage medium, for example, a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.

[0180] In an exemplary embodiment, a computer program product is also provided, including a computer program that, when executed by a processor, implements the data processing method for model training as described in any of the above embodiments.

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

[0182] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.

Claims

1. A data processing method for model training, characterized in that, include: Several behavioral data samples of a user account are obtained. Each behavioral data sample is generated by the user account's operations on associated objects. The several behavioral data samples include historical behavioral data samples and online behavioral data samples. The historical behavioral data samples include all historical behavioral data samples of the user account, or a portion of historical behavioral data samples extracted from all historical behavioral data samples based on sample extraction logic. The behavioral data samples contain user attribute information, operation behavior information, time information, and object information of the operated objects. Determine the training data and training labels corresponding to each behavioral data sample; The online recommendation model is trained online using the training data and the training labels. The online recommendation model is a model that has been trained to meet the requirements for online prediction. The trained online recommendation model is used to recommend objects to the user account online. The step of determining the training data and training labels corresponding to each behavior data sample includes: if the behavior data sample is an online behavior data sample, generating training data corresponding to the online behavior data sample based on the online behavior data sample; obtaining the original label from the online behavior data sample as the training label corresponding to the online behavior data sample; if the behavior data sample is a historical behavior data sample, generating training data corresponding to the historical behavior data sample based on the historical behavior data sample; obtaining the time difference between the timestamp in the historical behavior data sample and the current time; and attenuating the original label according to the time difference using a preset attenuation function to obtain the training label corresponding to the historical behavior data sample; wherein the attenuation function is any one of a linear function, an exponential function, or a Gaussian function.

2. The data processing method for model training according to claim 1, characterized in that, The partial historical behavior data sample extracted from all historical behavior data samples based on sample extraction logic is obtained by performing any of the following processes: The partial historical behavior data sample is obtained by extracting data based on the importance of the objects corresponding to the historical behavior data sample. Alternatively, obtain the target object type of the object corresponding to the online behavior data sample, and extract the historical behavior data sample under the target object type from all historical behavior data samples as the partial historical behavior data sample; Alternatively, obtain the first similarity between the historical behavior data sample and the online behavior data sample, and extract based on the first similarity to obtain the partial historical behavior data sample; Alternatively, obtain the type diversity index of the object type, and extract the partial historical behavior data sample based on the type diversity index.

3. The data processing method for model training according to claim 2, characterized in that, The number of extracted historical behavior data samples is determined based on the training speed of the online recommendation model.

4. The data processing method for model training according to any one of claims 1 to 3, characterized in that, The step of training the online recommendation model using the training data and the training labels includes: Obtain the weight corresponding to each of the aforementioned behavioral data samples; The training data corresponding to each behavioral data sample is input into the online recommendation model to obtain the prediction result corresponding to each behavioral data sample. The loss value is determined based on the prediction result, the training label, and the weights corresponding to each behavioral data sample. The model parameters of the online recommendation model are adjusted based on the loss value, and the training data corresponding to the next behavior data sample is input until the training stopping condition is met.

5. The data processing method for model training according to claim 4, characterized in that, When the behavior data sample is a historical behavior data sample, obtaining the weight corresponding to each behavior data sample includes: Obtain the time difference between the timestamp and the current time in each of the historical behavior data samples, and determine the weight corresponding to each of the historical behavior data samples based on the time difference, wherein the weight is negatively correlated with the time difference; Alternatively, the weight of each historical behavior data sample can be determined based on the importance of the object corresponding to each historical behavior data sample, and the weight is positively correlated with the importance. Alternatively, a second similarity score can be obtained between each historical behavior data sample and the online behavior data sample, and a weight corresponding to each historical behavior data sample can be determined based on the second similarity score, wherein the weight is positively correlated with the second similarity score. Alternatively, obtain the type diversity index of the object type, and determine the weight corresponding to each of the historical behavior data samples based on the type diversity index; Alternatively, the corresponding weights can be obtained by predicting each of the historical behavior data samples using a first deep learning model.

6. The data processing method for model training according to claim 1, characterized in that, All historical behavior data samples are obtained by querying the first mapping table, which is obtained during offline training of the online recommendation model and is updated in real time as the online recommendation model is trained online.

7. The data processing method for model training according to claim 1, characterized in that, The step of attenuating the original labels in the historical behavior data samples based on the time difference to obtain the training labels for the historical behavior data samples includes: The training labels corresponding to the time difference of the historical behavior data samples are obtained by querying the second mapping table, which includes the correspondence between time difference and training labels; Alternatively, the original labels can be attenuated according to the time difference using a preset attenuation function to obtain the training labels for the historical behavior data samples; Alternatively, a second deep learning model can be used to predict the historical behavior data samples to obtain the training labels for those samples.

8. A data processing device for model training, characterized in that, include: The acquisition module is configured to acquire several behavioral data samples of a user account. Each behavioral data sample is generated by the user account's operations on associated objects. The several behavioral data samples include historical behavioral data samples and online behavioral data samples. The historical behavioral data samples include all historical behavioral data samples of the user account, or a portion of historical behavioral data samples extracted from all historical behavioral data samples based on sample extraction logic. The behavioral data samples contain user attribute information, operation behavior information, time information, and object information of the operated objects. The training sample generation module is configured to determine the training data and training labels corresponding to each of the said behavioral data samples; The model training module is configured to perform online training on an online recommendation model using the training data and the training labels. The online recommendation model is a model that has been trained to meet the online prediction requirements. The trained online recommendation model is used to recommend objects to the user account online. The training sample generation module includes: a first training data generation unit configured to generate training data corresponding to the online behavior data sample if the behavior data sample is an online behavior data sample; a first label determination unit configured to obtain original labels from the online behavior data sample as training labels corresponding to the online behavior data sample; a second training data generation unit configured to generate training data corresponding to the historical behavior data sample if the behavior data sample is a historical behavior data sample; an acquisition unit configured to acquire the time difference between the timestamp in the historical behavior data sample and the current time; and a second label determination unit configured to attenuate the original labels according to the time difference using a preset attenuation function to obtain the training labels corresponding to the historical behavior data sample; the attenuation function is any one of a linear function, an exponential function, and a Gaussian function.

9. The data processing apparatus for model training according to claim 8, characterized in that, The device further includes a sample extraction module, configured to perform extraction based on the importance of the objects corresponding to the historical behavior data samples, to obtain the partial historical behavior data samples; Alternatively, obtain the target object type of the object corresponding to the online behavior data sample, and extract the historical behavior data sample under the target object type from all historical behavior data samples as the partial historical behavior data sample; Alternatively, obtain the first similarity between the historical behavior data sample and the online behavior data sample, and extract based on the first similarity to obtain the partial historical behavior data sample; Alternatively, obtain the type diversity index of the object type, and extract the partial historical behavior data sample based on the type diversity index.

10. The data processing apparatus for model training according to claim 9, characterized in that, The number of extracted historical behavior data samples is determined based on the training speed of the online recommendation model.

11. The data processing apparatus for model training according to any one of claims 8 to 10, characterized in that, The model training module includes: The weight acquisition unit is configured to acquire the weight corresponding to each of the behavioral data samples. The prediction unit is configured to input the training data corresponding to each of the behavioral data samples into the online recommendation model to obtain the prediction result corresponding to each of the behavioral data samples. The loss value determination unit is configured to determine a loss value based on the prediction result, the training label, and the weights corresponding to each of the said behavioral data samples; The parameter adjustment unit is configured to adjust the model parameters of the online recommendation model according to the loss value, and continue to input the training data corresponding to the next behavior data sample until the training stopping condition is met.

12. The data processing apparatus for model training according to claim 11, characterized in that, When the behavior data sample is a historical behavior data sample, the weight acquisition unit is configured to acquire the time difference between the timestamp in each historical behavior data sample and the current time, and determine the weight corresponding to each historical behavior data sample based on the time difference, wherein the weight is negatively correlated with the time difference; Alternatively, the weight of each historical behavior data sample can be determined based on the importance of the object corresponding to each historical behavior data sample, and the weight is positively correlated with the importance. Alternatively, a second similarity score can be obtained between each historical behavior data sample and the online behavior data sample, and a weight corresponding to each historical behavior data sample can be determined based on the second similarity score, wherein the weight is positively correlated with the second similarity score. Alternatively, obtain the type diversity index of the object type, and determine the weight corresponding to each of the historical behavior data samples based on the type diversity index; Alternatively, the corresponding weights can be obtained by predicting each of the historical behavior data samples using a first deep learning model.

13. The data processing apparatus for model training according to claim 8, characterized in that, All historical behavior data samples are obtained by querying the first mapping table, which is obtained during the offline training of the online recommendation model and is updated in real time as the online recommendation model is trained online.

14. The data processing apparatus for model training according to claim 8, characterized in that, The second label determination unit is configured to query a second mapping table to obtain the training label corresponding to the time difference of the historical behavior data sample. The second mapping table includes the correspondence between the time difference and the training label. Alternatively, the original labels can be attenuated according to the time difference using a preset attenuation function to obtain the training labels for the historical behavior data samples; Alternatively, a second deep learning model can be used to predict the historical behavior data samples to obtain the training labels for those samples.

15. An electronic device, characterized in that, include: processor; Memory used to store the processor's executable instructions; The processor is configured to execute the instructions to implement the data processing method for model training as described in any one of claims 1 to 7.

16. A computer-readable storage medium, characterized in that, When the instructions in the computer-readable storage medium are executed by the processor of the electronic device, the electronic device is able to perform the data processing method for model training as described in any one of claims 1 to 7.

17. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the data processing method for model training as described in any one of claims 1 to 7.