Model streaming training method, device, equipment and medium
Through the streaming training method in the distributed model training system, the problems of high component coupling and poor timeliness in large-scale distributed training are solved, real-time and training efficiency of the model are improved, ensuring data consistency and fast feedback.
Patent Information
- Application Number
- CN202310632866.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-31
- Publication Date
- 2025-08-12
- Estimated Expiration
- 2043-05-31
Smart Images

Figure CN116629383B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a streaming training method, apparatus, device, and medium for a model. Background Art
[0002] With the widespread application of deep learning in various industries and fields, training large-scale neural network models requires a lot of computing resources and time.
[0003] Traditional offline training methods require preprocessing large amounts of data and loading it all into memory for training. However, due to memory limitations, this approach often cannot handle very large datasets. Furthermore, traditional model training often lacks real-time training and updates, nor can it quickly capture user behavior and provide feedback, resulting in a lag in model effectiveness.
[0004] To address these issues, the industry has proposed a number of online learning and training technologies. However, these methods still simply apply the traditional model development process, constructing data into streaming batch inputs only. They are unable to conduct large-scale distributed training and are very inflexible. In addition, the various training components are highly coupled. At the same time, the problem of feature data consistency still exists, and the improvement in model effectiveness is also limited. Summary of the Invention
[0005] The embodiments of the present application provide a streaming training method, apparatus, computer equipment and storage medium for a model, aiming to solve the problems of inability to support large-scale distributed training, high coupling between training components and poor model timeliness during model training.
[0006] In a first aspect, an embodiment of the present application provides a streaming training method for a model, which is applied to a distributed model training system based on user behavior. The distributed model training system includes a first data reporting server, a second data reporting server, a feature server, a frequency control server, a sample stream Kafka queue, a training client, and a training server, which includes:
[0007] The first data reporting server consumes the real-time generated behavior data from the target Kafka queue for reporting behavior data to obtain a first real-time feature;
[0008] The second data reporting server consumes the real-time behavioral data from the target Kafka queue, constructs statistical features using the consumed data to obtain a second real-time feature, and stores the second real-time feature in the feature server for the feature server to process the second real-time feature;
[0009] The first data reporting server calls the feature server and obtains feature data from the feature server, concatenates the obtained feature data with the first real-time feature to obtain sample data, and saves the sample data to the sample stream Kafka queue; wherein the feature data includes offline features and features obtained after processing based on the second real-time feature;
[0010] The training client consumes data from the sample stream Kafka queue, obtains pre-configured sample attributes and obtains the user's behavior records in the frequency control server, constructs a sample data packet based on the consumed data, the sample attributes and the behavior records, and sends the sample data packet to the training server;
[0011] The training server obtains model training parameters from a preset model configuration, and performs training based on the model training parameters, the sample data packet and the preset model graph file of the training server to obtain a target model.
[0012] In a second aspect, an embodiment of the present application provides a streaming training device for a model, which runs on a distributed model training system. The distributed model training system includes a first data reporting server, a second data reporting server, a feature server, a frequency control server, a sample stream Kafka queue, a training client, and a training server, which includes:
[0013] The first data reporting server is configured to consume the real-time generated behavior data from a target Kafka queue for reporting behavior data to obtain a first real-time feature;
[0014] The second data reporting server is configured to consume the real-time behavioral data from the target Kafka queue, construct statistical features using the consumed data to obtain a second real-time feature, and store the second real-time feature in the feature server for the feature server to process the second real-time feature;
[0015] The first data reporting server is further configured to call the feature server, obtain feature data from the feature server, combine the obtained feature data with the first real-time feature to obtain sample data, and save the sample data to the sample stream Kafka queue; wherein the feature data includes offline features and features obtained after processing based on the second real-time feature;
[0016] The training client is used to consume data from the sample stream Kafka queue, obtain pre-configured sample attributes and obtain the user's behavior records in the frequency control server, construct a sample data packet based on the consumed data, the sample attributes and the behavior records, and send the sample data packet to the training server;
[0017] The training server is used to obtain model training parameters from a preset model configuration, and perform training based on the model training parameters, the sample data packet and the preset model graph file of the training server to obtain a target model.
[0018] In a third aspect, an embodiment of the present application further provides a computer device, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, it implements the streaming training method of the model described in the first aspect above.
[0019] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor executes the streaming training method of the model described in the first aspect above.
[0020] The embodiments of the present application provide a streaming training method, apparatus, equipment and medium for a model. On the one hand, the distributed model training system includes a first data reporting server, a second data reporting server, a feature server, a frequency control server, a sample stream Kafka queue, a training client, and a training server. The servers are distributedly deployed during the training process, which solves the problem of high coupling between training components. On the other hand, the data reporting server consumes real-time behavioral data from the Kafka queue and transmits data based on the sample stream Kafka queue. The real-time performance of the model is improved through streaming training. Combined with the distributed architecture, it not only supports the training of massive data, but also effectively guarantees the training efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the description of the embodiments. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0022] Figure 1 Schematic diagram of an application scenario of the streaming training method for the model provided in an embodiment of the present application;
[0023] Figure 2 A flow chart of a streaming training method for a model provided in an embodiment of the present application;
[0024] Figure 3 A schematic block diagram of a streaming training device for a model provided in an embodiment of the present application;
[0025] Figure 4A schematic block diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0026] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0027] It will be understood that when used in this specification and the appended claims, the terms “comprises” and “comprising” indicate the presence of described features, integers, steps, operations, elements and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof.
[0028] It should also be understood that the terms used in this specification are for the purpose of describing specific embodiments only and are not intended to limit the present application. As used in this specification and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms unless the context clearly indicates otherwise.
[0029] It should be further understood that the term "and / or" used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
[0030] See also Figure 1 and Figure 2 , Figure 1 Schematic diagram of an application scenario of the streaming training method for the model provided in an embodiment of the present application; Figure 2 A flow chart of the streaming training method for the model provided in an embodiment of the present application. The streaming training method for the model is applied in a distributed model training system based on user behavior and interacts with the user end for data. The method is executed by application software installed in the distributed model training system.
[0031] like Figure 2 As shown, the method is applied to a distributed model training system based on user behavior, wherein the distributed model training system includes a first data reporting server, a second data reporting server, a feature server, a frequency control server, a sample stream Kafka queue, a training client, and a training server, and includes steps S101 to S105.
[0032] S101. The first data reporting server consumes real-time behavior data from a target Kafka queue for reporting behavior data to obtain a first real-time feature.
[0033] In this embodiment, the technical solution is described with the distributed model training system as the execution subject. The user terminal used by the user (such as a smart phone, tablet computer and other intelligent terminals) can interact with the distributed model training system for data. Specifically, the distributed model training system provides a streaming training platform for a model, and the user can log in to the streaming training platform of the model using the user terminal. The user interaction interface of the streaming training platform of the model is displayed on the terminal interface of the user terminal, and there is at least one data upload interface in the user interaction interface (which may include a picture upload interface, a voice upload interface, a text upload interface, etc.). The user can upload data through the upload interface for use when the distributed model training system trains the model.
[0034] In this embodiment, the target Kafka queue is used to uniformly store user behavior data, such as exposure, click and other behavior data.
[0035] Specifically, the first data reporting server can perform preliminary tracking filtering in the target Kafka queue to retain the behavior data of the specified scenario.
[0036] The designated scenarios may include, but are not limited to: product recommendation scenarios, information recommendation scenarios, video recommendation scenarios, etc.
[0037] S102. The second data reporting server consumes the real-time behavioral data from the target Kafka queue, constructs statistical features using the consumed data to obtain a second real-time feature, and stores the second real-time feature in the feature server for the feature server to process the second real-time feature.
[0038] Specifically, the second data reporting server consumes the real-time behavior data from the target Kafka queue in a similar manner to the first data reporting server consuming the real-time behavior data from the target Kafka queue for reporting behavior data as described above, which will not be repeated here.
[0039] In this embodiment, the method of constructing a statistical feature using the consumption data to obtain the second real-time feature includes:
[0040] The second data reporting server obtains at least one statistical category and statistical logic of each statistical category;
[0041] The second data reporting server performs statistical processing on the consumption data according to the statistical logic of each statistical category to obtain at least one statistical feature;
[0042] The second data reporting server combines the at least one statistical feature to obtain the second real-time feature.
[0043] The statistical categories may include, but are not limited to, one or a combination of the following: food, sports, entertainment, etc.
[0044] The statistical logic of each statistical category may include, but is not limited to, one or more of the following combinations: the number of clicks, the number of logins (activity), negative feedback behaviors (such as recommended videos being quickly swiped), etc. under each statistical category.
[0045] By performing statistical processing on the consumption data, the user's interest preferences can be determined based on the obtained statistical features, and then a user profile can be constructed to improve the accuracy of the model.
[0046] S103. The first data reporting server calls the feature server and obtains feature data from the feature server, concatenates the obtained feature data with the first real-time feature to obtain sample data, and saves the sample data to the sample stream Kafka queue; wherein the feature data includes offline features and features obtained after processing based on the second real-time feature.
[0047] In this embodiment, the feature server provides feature storage and feature output services for training and estimation.
[0048] Among them, feature storage comes from two sources: one is offline features, which can be synchronized to the feature server through offline feature push tools; the other is real-time features, which are calculated in real time by the first data reporting server and the second data reporting server and synchronized to the feature server.
[0049] In this embodiment, before acquiring feature data from the feature server, the method further includes:
[0050] The feature server obtains historical behavior data as the offline feature at preset time intervals.
[0051] The preset time interval can be customized, such as one month, one day, etc.
[0052] Traditional feature updates are low and usually updated at a fixed frequency, resulting in delayed feedback on user behavior. Furthermore, features updated at a fixed frequency cannot achieve the expected results due to the lag, and are not suitable for scenarios with high real-time requirements for the model.
[0053] Since the feature server in this embodiment stores both real-time features and offline features, unlike the traditional model development mode that adopts offline training and online calling, this embodiment can not only collect offline data for training regularly, but also supports streaming training of real-time data, and can learn user behavior data in seconds, so as to provide timely feedback on user behavior more quickly, helping to increase core indicators such as CTR (Click-Through-Rate) of business scenarios such as recommendation search to more than 30%. At the same time, it also solves the problem of inconsistency between the features used during training and the features used during calling, avoiding deviations in model effects.
[0054] S104. The training client consumes data from the sample stream Kafka queue, obtains pre-configured sample attributes and obtains the user's behavior records in the frequency control server, constructs a sample data packet based on the consumed data, the sample attributes and the behavior records, and sends the sample data packet to the training server.
[0055] In this embodiment, the distributed model training system provides a stable training service based on a distributed architecture. The distributed model training system includes services such as the first data reporting server, the second data reporting server, the feature server, the frequency control server, the sample stream Kafka queue, the training client, and the training server, which can be transmitted and transferred through real-time interfaces and Kafka queues, reducing the coupling between services and enabling flexible cross-platform migration and deployment. This not only improves development efficiency, but also improves model launch efficiency, enabling faster estimation of service deployment. In the original method, the model took 3 weeks from development to implementation, but this embodiment only takes 2 weeks to complete, improving the efficiency of algorithm implementation by 50%, and ensuring the consistency of online and offline data, solving the performance bottleneck problem caused by insufficient training resources on a single machine.
[0056] In this embodiment, the sample attributes may include, but are not limited to, one or a combination of the following attributes: sample positive-negative ratio, control sample batch size (i.e., the maximum sample size used during training), etc. For example, the sample positive-negative ratio may be 1:1, or 1:10, etc.
[0057] In this embodiment, before obtaining the user's behavior record in the frequency control server, the method further includes:
[0058] The frequency control server caches each exposure sample for a preset time period;
[0059] Within the preset time period, when a click behavior on the material corresponding to any exposure sample is detected, the frequency control server discards the any exposure sample and retains the click behavior as the behavior record.
[0060] Among them, positive samples refer to samples that have received user feedback (that is, after being exposed to the user, the user clicks on the material corresponding to the exposure behavior), and negative samples refer to samples that have not received user feedback (that is, after being exposed to the user, the user does not click on the material corresponding to the exposure behavior).
[0061] The preset duration can be customized, such as 180 seconds.
[0062] For example, after a short video is exposed to a user, the frequency control server caches the short video ID. Within 180 seconds, if a user clicks on the short video, the sample can be determined as a positive sample, that is, the exposure behavior has received positive feedback from the user. However, since both positive and negative feedback must first exist in the presence of exposure behavior, in order to avoid recording positive feedback data that has received user clicks as negative samples (i.e., the exposure behavior has not received user feedback), the exposure samples that have received user feedback are directly discarded, and only the click records are retained as positive samples to ensure the accuracy of the click sample and exposure sample logic.
[0063] Furthermore, a sample data packet is constructed based on the consumed data, the sample attributes and the behavior records, that is, a Batch sample data packet is uniformly packaged to generate a batch sample data packet, and the sample data packet is sent to the training server through an interface for model training.
[0064] S105. The training server obtains model training parameters from the preset model configuration, and performs training based on the model training parameters, the sample data packet and the preset model graph file of the training server to obtain a target model.
[0065] Among them, the training server includes a preset model graph file and a preset model configuration.
[0066] The preset model configuration is used to store configured model training parameters.
[0067] The model training parameters refer to some parameter items that need to be configured during training.
[0068] Among them, the preset model graph file can be a pre-written network graph, which can be used to generate a DeepFM (Deep Factorization Machine) model network structure based on Tensorflow.
[0069] In this embodiment, after receiving a Batch sample data packet transmitted by the training client, the training server enters the preset model graph file for training, and a model parameter cache can be created locally during training.
[0070] Specifically, the distributed model training system further includes a parameter server; after obtaining the target model, the method further includes:
[0071] The parameter server stores model parameters of the target model.
[0072] The model parameters refer to the model after training, which is actually a bunch of data.
[0073] In the above embodiment, after the training is completed, the model parameters will be synchronized to the parameter server in a timely manner and called by downstream services later.
[0074] In this embodiment, the distributed model training system further includes an estimation server; after obtaining the target model, the method further includes:
[0075] In response to a call request for the target model from a model requester, the estimation server calls the feature server to obtain features, and calls the parameter server to obtain the model parameters;
[0076] The estimation server performs prediction based on the acquired features, the model parameters and the target model to obtain a prediction result;
[0077] The estimation server feeds back the prediction result to the model requester.
[0078] For example, the estimation server calls the feature server and obtains features such as age and gender. When calling the model for interest recommendation, the same features can be used to predict the interest of people of the same age group and gender in videos or products, so as to recommend videos or products in a targeted manner.
[0079] In the above embodiment, since the features used during training and the features used during calling are consistent, deviations in model effects can be avoided.
[0080] In this embodiment, the distributed model training system further includes a training monitoring server, and the method further includes:
[0081] The training monitoring server obtains at least one indicator;
[0082] The training monitoring server collects the indicator value of each indicator generated during the training process;
[0083] The training monitoring server uses the indicator value of each indicator to establish a time-indicator value curve graph corresponding to each indicator, and when an inflection point appears in the curve graph of an indicator, the inflection point is determined as an abnormal point; or the training monitoring server obtains historical data within a configured time range, and calculates the average value of each indicator based on the historical data, calculates the deviation of the indicator value of each indicator from the corresponding average value, and when it is detected that the deviation corresponding to an indicator value is greater than or equal to a preset threshold, determines the abnormal point according to the detected indicator value;
[0084] The training monitoring server reports the abnormal point.
[0085] For example, the at least one indicator may include, but is not limited to, a combination of one or more of the following indicators: AUC (Area Under Curve), ACC (Accuracy), Loss, AvgPredict, and Avg Label.
[0086] For example, Grafana can be used to build the training monitoring server.
[0087] The abnormal point may be output once every specified time period (eg, 30 seconds), which is not limited in this application.
[0088] Through the above embodiments, the training process can be monitored in real time, training anomalies can be discovered in a timely manner, and abnormal points can be automatically located.
[0089] It can be seen from the above technical solutions that, on the one hand, the distributed model training system includes a first data reporting server, a second data reporting server, a feature server, a frequency control server, a sample stream Kafka queue, a training client, and a training server. The servers are distributed during the training process, which solves the problem of high coupling between training components. On the other hand, the data reporting server consumes real-time behavioral data from the Kafka queue and transmits data based on the sample stream Kafka queue. The real-time performance of the model is improved through streaming training. Combined with the distributed architecture, it not only supports the training of massive data, but also effectively guarantees the training efficiency.
[0090] The present application also provides a model flow training device, which is used to perform any embodiment of the aforementioned model flow training method. Figure 3 , Figure 3 It is a schematic block diagram of the streaming training device 100 of the model provided in an embodiment of the present application.
[0091] Among them, Figure 3As shown, the model streaming training device 100 runs in a distributed model training system, including a first data reporting server 101, a second data reporting server 102, a feature server 103, a frequency control server 104, a sample stream Kafka queue 105, a training client 106, and a training server 107.
[0092] The first data reporting server 101 is used to consume real-time behavior data from a target Kafka queue for reporting behavior data to obtain a first real-time feature.
[0093] In this embodiment, the technical solution is described with the distributed model training system as the execution subject. The user terminal used by the user (such as a smart phone, tablet computer and other intelligent terminals) can interact with the distributed model training system for data. Specifically, the distributed model training system provides a streaming training platform for a model, and the user can log in to the streaming training platform of the model using the user terminal. The user interaction interface of the streaming training platform of the model is displayed on the terminal interface of the user terminal, and there is at least one data upload interface in the user interaction interface (which may include a picture upload interface, a voice upload interface, a text upload interface, etc.). The user can upload data through the upload interface for use when the distributed model training system trains the model.
[0094] In this embodiment, the target Kafka queue is used to uniformly store user behavior data, such as exposure, click and other behavior data.
[0095] Specifically, the first data reporting server can perform preliminary tracking filtering in the target Kafka queue to retain the behavior data of the specified scenario.
[0096] The designated scenarios may include, but are not limited to: product recommendation scenarios, information recommendation scenarios, video recommendation scenarios, etc.
[0097] The second data reporting server 102 is used to consume the real-time behavioral data from the target Kafka queue, and use the consumed data to construct statistical features to obtain a second real-time feature, and store the second real-time feature in the feature server 103 for the feature server 103 to process the second real-time feature.
[0098] Specifically, the second data reporting server 102 consumes the real-time behavior data from the target Kafka queue in a similar manner to the first data reporting server 101 consuming the real-time behavior data from the target Kafka queue for reporting behavior data as described above, which will not be repeated here.
[0099] In this embodiment, the method of constructing a statistical feature using the consumption data to obtain the second real-time feature includes:
[0100] The second data reporting server 102 obtains at least one statistical category and the statistical logic of each statistical category;
[0101] The second data reporting server 102 performs statistical processing on the consumption data according to the statistical logic of each statistical category to obtain at least one statistical feature;
[0102] The second data reporting server 102 combines the at least one statistical feature to obtain the second real-time feature.
[0103] The statistical categories may include, but are not limited to, one or a combination of the following: food, sports, entertainment, etc.
[0104] The statistical logic of each statistical category may include, but is not limited to, one or more of the following combinations: the number of clicks, the number of logins (activity), negative feedback behaviors (such as recommended videos being quickly swiped), etc. under each statistical category.
[0105] By performing statistical processing on the consumption data, the user's interest preferences can be determined based on the obtained statistical features, and then a user profile can be constructed to improve the accuracy of the model.
[0106] The first data reporting server 101 is also used to call the feature server 103, and obtain feature data from the feature server 103, splice the obtained feature data with the first real-time feature to obtain sample data, and save the sample data to the sample stream Kafka queue 105; wherein, the feature data includes offline features and features obtained after processing based on the second real-time feature.
[0107] In this embodiment, the feature server 103 provides feature storage and feature output services for training and estimation.
[0108] Among them, feature storage comes from two sources: one is offline features, which can be synchronized to the feature server 103 through an offline feature push tool; the other is real-time features, which are calculated in real time by the first data reporting server 101 and the second data reporting server 102 and synchronized to the feature server 103.
[0109] In this embodiment, before acquiring feature data from the feature server 103 , the feature server 103 acquires historical behavior data as offline features at preset time intervals.
[0110] The preset time interval can be customized, such as one month, one day, etc.
[0111] Traditional feature updates are low and usually updated at a fixed frequency, resulting in delayed feedback on user behavior. Furthermore, features updated at a fixed frequency cannot achieve the expected results due to the lag, and are not suitable for scenarios with high real-time requirements for the model.
[0112] Since the feature server 103 stores both real-time features and offline features, unlike traditional model development that uses offline training and online calling, this embodiment can not only regularly collect offline data for training, but also supports streaming training of real-time data, and can learn user behavior data in seconds, thereby providing more timely feedback on user behavior, helping to increase core indicators such as CTR (Click-Through-Rate) of business scenarios such as recommendation search to more than 30%. At the same time, it also solves the problem of inconsistency between the features used during training and the features used during calling, avoiding deviations in model effects.
[0113] The training client 106 consumes data from the sample stream Kafka queue 105, obtains pre-configured sample attributes and obtains the user's behavior records in the frequency control server 104, constructs a sample data packet based on the consumed data, the sample attributes and the behavior records, and sends the sample data packet to the training server 107.
[0114] In this embodiment, the distributed model training system provides a stable training service based on a distributed architecture. The distributed model training system includes services such as the first data reporting server 101, the second data reporting server 102, the feature server 103, the frequency control server 104, the sample stream Kafka queue 105, the training client 106, and the training server 107. These services can be transmitted and transferred through real-time interfaces and Kafka queues, reducing the coupling between services and enabling flexible cross-platform migration and deployment. This not only improves development efficiency, but also improves model launch efficiency, enabling faster estimation of service deployment. In the original method, the model took 3 weeks from development to implementation, while this embodiment only takes 2 weeks to complete. The efficiency of algorithm implementation has increased by 50%, and the consistency of online and offline data can be ensured, solving the performance bottleneck problem caused by insufficient single-machine training resources.
[0115] In this embodiment, the sample attributes may include, but are not limited to, one or a combination of the following attributes: sample positive-negative ratio, control sample batch size (i.e., the maximum sample size used during training), etc. For example, the sample positive-negative ratio may be 1:1, or 1:10, etc.
[0116] In this embodiment, before obtaining the user's behavior record in the frequency control server, the frequency control server 104 caches each exposure sample for a preset time period;
[0117] Within the preset time period, when a click behavior on the material corresponding to any exposure sample is detected, the frequency control server 104 discards the any exposure sample and retains the click behavior as the behavior record.
[0118] Among them, positive samples refer to samples that have received user feedback (that is, after being exposed to the user, the user clicks on the material corresponding to the exposure behavior), and negative samples refer to samples that have not received user feedback (that is, after being exposed to the user, the user does not click on the material corresponding to the exposure behavior).
[0119] The preset duration can be customized, such as 180 seconds.
[0120] For example, after a short video is exposed to a user, the frequency control server 104 caches the short video ID. Within 180 seconds, if a user clicks on the short video, the sample can be determined as a positive sample, that is, the exposure behavior has received positive feedback from the user. However, since both positive and negative feedback must be preceded by the exposure behavior, in order to avoid recording positive feedback data that has received user clicks as negative samples (i.e., the exposure behavior has not received user feedback), the exposure samples that have received user feedback are directly discarded, and only the click records are retained as positive samples to ensure the accuracy of the click sample and exposure sample logic.
[0121] Furthermore, a sample data packet is constructed based on the consumed data, the sample attributes and the behavior records, that is, a Batch sample data packet is uniformly packaged and generated, and the sample data packet is sent to the training server 107 through an interface for model training.
[0122] The training server 107 is used to obtain model training parameters from a preset model configuration, and perform training based on the model training parameters, the sample data packet and the preset model graph file of the training server 107 to obtain a target model.
[0123] The training server 107 includes a preset model graph file and a preset model configuration.
[0124] The preset model configuration is used to store configured model training parameters.
[0125] The model training parameters refer to some parameter items that need to be configured during training.
[0126] Among them, the preset model graph file can be a pre-written network graph, which can be used to generate a DeepFM (Deep Factorization Machine) model network structure based on Tensorflow.
[0127] In this embodiment, after receiving a Batch sample data packet transmitted by the training client 106, the training server 107 enters the preset model graph file for training, and a model parameter cache can be created locally during training.
[0128] Specifically, the distributed model training system also includes a parameter server; after obtaining the target model, the parameter server stores the model parameters of the target model.
[0129] The model parameters refer to the model after training, which is actually a bunch of data.
[0130] In the above embodiment, after the training is completed, the model parameters will be synchronized to the parameter server in a timely manner and called by downstream services later.
[0131] In this embodiment, the distributed model training system further includes an estimation server; after obtaining the target model, in response to a call request for the target model from the model requester, the estimation server calls the feature server 103 to obtain features, and calls the parameter server to obtain the model parameters;
[0132] The estimation server performs prediction based on the acquired features, the model parameters and the target model to obtain a prediction result;
[0133] The estimation server feeds back the prediction result to the model requester.
[0134] For example, the estimation server calls the feature server 103 and obtains features such as age and gender. When calling the model for interest recommendation, the same features can be used to predict the interest of people of the same age group and gender in videos or products, so as to recommend videos or products in a targeted manner.
[0135] In the above embodiment, since the features used during training and the features used during calling are consistent, deviations in model effects can be avoided.
[0136] In this embodiment, the distributed model training system further includes a training monitoring server, and the training monitoring server obtains at least one indicator;
[0137] The training monitoring server collects the indicator value of each indicator generated during the training process;
[0138] The training monitoring server uses the indicator value of each indicator to establish a time-indicator value curve graph corresponding to each indicator, and when an inflection point appears in the curve graph of an indicator, the inflection point is determined as an abnormal point; or the training monitoring server obtains historical data within a configured time range, and calculates the average value of each indicator based on the historical data, calculates the deviation of the indicator value of each indicator from the corresponding average value, and when it is detected that the deviation corresponding to an indicator value is greater than or equal to a preset threshold, determines the abnormal point according to the detected indicator value;
[0139] The training monitoring server reports the abnormal point.
[0140] For example, the at least one indicator may include, but is not limited to, a combination of one or more of the following indicators: AUC (Area Under Curve), ACC (Accuracy), Loss, AvgPredict, and Avg Label.
[0141] For example, Grafana can be used to build the training monitoring server.
[0142] The abnormal point may be output once every specified time period (eg, 30 seconds), which is not limited in this application.
[0143] Through the above embodiments, the training process can be monitored in real time, training anomalies can be discovered in a timely manner, and abnormal points can be automatically located.
[0144] It can be seen from the above technical solutions that, on the one hand, the distributed model training system includes a first data reporting server, a second data reporting server, a feature server, a frequency control server, a sample stream Kafka queue, a training client, and a training server. The servers are distributed during the training process, which solves the problem of high coupling between training components. On the other hand, the data reporting server consumes real-time behavioral data from the Kafka queue and transmits data based on the sample stream Kafka queue. The real-time performance of the model is improved through streaming training. Combined with the distributed architecture, it not only supports the training of massive data, but also effectively guarantees the training efficiency.
[0145] The streaming training device of the above model can be implemented in the form of a computer program, which can be used in Figure 4 Runs on the computer device shown.
[0146] See also Figure 4 , Figure 44 is a schematic block diagram of a computer device provided in an embodiment of the present application. The computer device 400 is a server or a server cluster. The server can be a standalone server or 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.
[0147] See Figure 4 The computer device 400 includes a processor 402 , a memory, and a network interface 405 connected via a device bus 401 , wherein the memory may include a storage medium 403 and an internal memory 404 .
[0148] The storage medium 403 may store an operating system 4031 and a computer program 4032. When the computer program 4032 is executed, the processor 402 may execute a streaming training method for the model.
[0149] The processor 402 is used to provide computing and control capabilities to support the operation of the entire computer device 400.
[0150] The internal memory 404 provides an environment for the operation of the computer program 4032 in the storage medium 403. When the computer program 4032 is executed by the processor 402, the processor 402 can execute the streaming training method of the model.
[0151] The network interface 405 is used for network communication, such as providing data information transmission. Those skilled in the art will understand that Figure 4 The structure shown in the figure is merely a block diagram of a portion of the structure related to the solution of the present application, and does not constitute a limitation on the computer device 400 to which the solution of the present application is applied. The specific computer device 400 may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0152] The processor 402 is used to run the computer program 4032 stored in the memory to implement the streaming training method of the model disclosed in the embodiment of the present application.
[0153] Those skilled in the art will understand that Figure 4 The embodiment of the computer device shown in the figure does not constitute a limitation on the specific composition of the computer device. In other embodiments, the computer device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently. For example, in some embodiments, the computer device may only include a memory and a processor. In such an embodiment, the structure and function of the memory and processor are the same as those in the figure. Figure 4The embodiments shown are consistent and will not be described again here.
[0154] It should be understood that in the embodiment of the present application, the processor 402 may be a central processing unit (CPU), and the processor 402 may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0155] In another embodiment of the present application, a computer-readable storage medium is provided. The computer-readable storage medium may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium. The computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the streaming training method of the model disclosed in the embodiment of the present application is implemented.
[0156] It should be noted that the data involved in this case were all obtained legally.
[0157] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described equipment, devices and units can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, computer software or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0158] In the several embodiments provided in this application, it should be understood that the disclosed devices, apparatuses and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, or units with the same function may be combined into one unit. For example, multiple units or components may be combined or integrated into another device, or some features may be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interfaces, devices or units, or may be an electrical, mechanical or other form of connection.
[0159] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiments of the present application.
[0160] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0161] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a background server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a magnetic disk or an optical disk.
[0162] The above description is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present application, and such modifications or substitutions should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.
Claims
1. A streaming model training method is applied to a distributed model training system based on user behavior, wherein the distributed model training system includes a first data reporting server, a second data reporting server, a feature server, a frequency control server, a sample stream Kafka queue, a training client, and a training server, characterized in that: include: The first data reporting server consumes the real-time generated behavior data from the target Kafka queue for reporting behavior data to obtain a first real-time feature; The second data reporting server consumes the real-time behavioral data from the target Kafka queue, constructs statistical features using the consumed data to obtain a second real-time feature, and stores the second real-time feature in the feature server for the feature server to process the second real-time feature; The first data reporting server calls the feature server and obtains feature data from the feature server, concatenates the obtained feature data with the first real-time feature to obtain sample data, and saves the sample data to the sample stream Kafka queue; wherein the feature data includes offline features and features obtained after processing based on the second real-time feature; The training client consumes data from the sample stream Kafka queue, obtains pre-configured sample attributes and obtains the user's behavior records in the frequency control server, constructs a sample data packet based on the consumed data, the sample attributes and the behavior records, and sends the sample data packet to the training server; The training server obtains model training parameters from a preset model configuration, and performs training based on the model training parameters, the sample data packet and the preset model graph file of the training server to obtain a target model.
2. The streaming training method of the model according to claim 1, characterized in that The step of constructing a statistical feature using the consumption data to obtain the second real-time feature includes: The second data reporting server obtains at least one statistical category and statistical logic of each statistical category; The second data reporting server performs statistical processing on the consumption data according to the statistical logic of each statistical category to obtain at least one statistical feature; The second data reporting server combines the at least one statistical feature to obtain the second real-time feature.
3. The streaming training method of the model according to claim 1, characterized in that Before acquiring the feature data from the feature server, the method further includes: The feature server obtains historical behavior data as the offline feature at preset time intervals.
4. The streaming training method of the model according to claim 1, characterized in that Before obtaining the user's behavior record in the frequency control server, the method further includes: The frequency control server caches each exposure sample for a preset time period; Within the preset time period, when a click behavior on the material corresponding to any exposure sample is detected, the frequency control server discards the any exposure sample and retains the click behavior as the behavior record.
5. The streaming training method of the model according to claim 1, characterized in that The distributed model training system also includes a parameter server; After obtaining the target model, the method further includes: The parameter server stores model parameters of the target model.
6. The streaming training method of the model according to claim 5, characterized in that The distributed model training system also includes an estimation server; After obtaining the target model, the method further includes: In response to a call request for the target model from a model requester, the estimation server calls the feature server to obtain features, and calls the parameter server to obtain the model parameters; The estimation server performs prediction based on the acquired features, the model parameters and the target model to obtain a prediction result; The estimation server feeds back the prediction result to the model requester.
7. The streaming training method of the model according to claim 1, characterized in that The distributed model training system further includes a training monitoring server, and the method further includes: The training monitoring server obtains at least one indicator; The training monitoring server collects the indicator value of each indicator generated during the training process; The training monitoring server uses the indicator value of each indicator to establish a time-indicator value curve graph corresponding to each indicator, and when an inflection point appears in the curve graph of an indicator, the inflection point is determined as an abnormal point; or the training monitoring server obtains historical data within a configured time range, and calculates the average value of each indicator based on the historical data, calculates the deviation of the indicator value of each indicator from the corresponding average value, and when it is detected that the deviation corresponding to an indicator value is greater than or equal to a preset threshold, determines the abnormal point according to the detected indicator value; The training monitoring server reports the abnormal point.
8. A streaming training device for a model, running in a distributed model training system, wherein the distributed model training system includes a first data reporting server, a second data reporting server, a feature server, a frequency control server, a sample stream Kafka queue, a training client, and a training server, characterized in that: include: The first data reporting server is configured to consume the real-time generated behavior data from a target Kafka queue for reporting behavior data to obtain a first real-time feature; The second data reporting server is configured to consume the real-time behavioral data from the target Kafka queue, construct statistical features using the consumed data to obtain a second real-time feature, and store the second real-time feature in the feature server for the feature server to process the second real-time feature; The first data reporting server is further configured to call the feature server, obtain feature data from the feature server, combine the obtained feature data with the first real-time feature to obtain sample data, and save the sample data to the sample stream Kafka queue; wherein the feature data includes offline features and features obtained after processing based on the second real-time feature; The training client is used to consume data from the sample stream Kafka queue, obtain pre-configured sample attributes and obtain the user's behavior records in the frequency control server, construct a sample data packet based on the consumed data, the sample attributes and the behavior records, and send the sample data packet to the training server; The training server is used to obtain model training parameters from a preset model configuration, and perform training based on the model training parameters, the sample data packet and the preset model graph file of the training server to obtain a target model.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the streaming training method of the model according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which, when executed by a processor, causes the processor to perform the streaming training method of the model according to any one of claims 1 to 7.
Citation Information
Patent Citations
Online model training method and device
CN111126621A
Model training method and device
CN112612768A