Multi-task learning model, training method, electronic device and computer storage medium
By dividing the multi-task learning model into time-sensitive segments and optimizing the joint loss function, the problems of insufficient real-time, short-term and long-term user intent layering and cross-domain semantic association in existing technologies are solved. This achieves more efficient scenario-based demand response and model interpretability, and improves the model's generalization ability in complex scenarios.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHENGDU HAPPY NOTE TECH CO LTD
- Filing Date
- 2026-01-29
- Publication Date
- 2026-06-19
AI Technical Summary
Existing multi-task learning techniques have shortcomings in capturing user intent hierarchically in real time, short-term and long-term, cross-domain semantic association and model interpretability, resulting in inaccurate response to scenario-based needs, poor cross-scenario guidance effect and insufficient feature robustness in cold start scenarios.
By dividing the data into real-time, short-term, and long-term layers according to their timeliness, and inputting them into the corresponding networks for training, feature vectors and cluster centers are generated. The network is then optimized through a joint loss function to achieve semantic alignment and feature fusion at different time scales.
It improves the generalization ability and robustness of multi-task learning models in complex scenarios, enabling them to accurately respond to scenario-specific needs, enhance cross-domain feature space alignment and model interpretability, and improve feature robustness, especially in cold-start scenarios.
Smart Images

Figure CN121599045B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of multi-task learning technology, and more specifically, to a multi-task learning model and training method, electronic device, and computer storage medium. Background Technology
[0002] Currently, existing technologies, such as Multi-Task Learning (MTL) and cross-domain recommendation, have made some progress in achieving multi-objective optimization and cross-scenario information transfer, but several key limitations remain. Representative solutions like MMOE use shared expert networks and task-specific gating mechanisms for joint multi-task learning, but fail to explicitly distinguish the spatiotemporal hierarchy of user intent, leading to a conflation of real-time behavior and long-term interests. Cross-domain joint modeling methods (such as "search" plus "recommendation") achieve joint task training through shared embeddings or simple feature concatenation, but lack deep semantic alignment between explicit search intent and implicit recommendation interests, resulting in a fragmented cross-domain feature space and difficulty in effectively transmitting strong intent signals from search to recommendation scenarios. Furthermore, while feature clustering-assisted methods (such as K-means and GMM) attempt to cluster user behavior to extract interest patterns, they are mostly limited to offline feature engineering and fail to integrate with end-to-end dynamic model training, thus limiting their adaptive capabilities.
[0003] These technical solutions all face the following objective shortcomings:
[0004] First, the intent modeling is coarse-grained, failing to capture real-time, short-term, and long-term user intent in a layered manner, affecting the accurate response to scenario-based needs (such as instant purchases). Second, there is insufficient cross-domain semantic association, with semantic gaps between search and recommendation, weakening the cross-scenario guidance effect. Third, the model has poor interpretability, relying on a black-box structure and lacking explicit explanation mechanisms based on clustering or intent prototypes, which restricts the credibility of business optimization. Finally, in cold start scenarios (user cold start, item cold start, and system cold start), existing methods do not fully incorporate strategies such as unsupervised clustering to enhance the feature robustness of sparse data (such as new users, new products / articles / videos, and new platforms), limiting the model's generalization ability. Summary of the Invention
[0005] In view of this, the purpose of this application is to provide a multi-task learning model and training method, electronic device, and computer storage medium to improve the above-mentioned problems existing in the prior art.
[0006] In a first aspect, embodiments of this application provide a method for training a multi-task learning model. The method includes: dividing data according to timeliness to obtain processed data; wherein the processed data includes real-time layer data, short-term layer data, and long-term layer data; inputting the processed real-time layer data into a real-time network for training to obtain real-time feature vectors and corresponding real-time cluster centers; inputting the processed short-term layer data into a short-term network for training to obtain short-term feature vectors and corresponding short-term cluster centers; inputting the processed long-term layer data into a long-term network for training to obtain long-term feature vectors and corresponding long-term cluster centers; wherein the real-time feature vectors, the short-term feature vectors, and the long-term feature vectors are used for task prediction, and the real-time cluster centers, the short-term cluster centers, and the long-term cluster centers are used to assist in optimizing the multi-task learning model; and optimizing the real-time network, the short-term network, and the long-term network using a loss function.
[0007] In the above implementation process, the original data is first divided into real-time layer data, short-term layer data, and long-term layer data according to their timeliness. Then, the real-time layer data is input into the real-time network for training to obtain real-time feature vectors and corresponding real-time cluster centers. The short-term layer data is input into the short-term network for training to obtain short-term feature vectors and corresponding short-term cluster centers. The long-term layer data is input into the long-term network for training to obtain long-term feature vectors and corresponding long-term cluster centers. Among them, the real-time feature vectors, short-term feature vectors, and long-term feature vectors are directly used for the final task prediction of the multi-task learning model, while the real-time cluster centers, short-term cluster centers, and long-term cluster centers do not directly participate in the final prediction output. Instead, they are used to calculate the auxiliary clustering loss and cross-domain distribution difference loss to guide the training process of the real-time network, short-term network, and long-term network and achieve the alignment of semantic spaces at different time scales. Finally, the overall parameters of the real-time network, short-term network, and long-term network are optimized through a joint loss function that includes the main task loss, auxiliary clustering loss, and cross-domain distribution difference loss, thereby improving the generalization ability and prediction accuracy of the multi-task learning model for time-varying data.
[0008] Optionally, the step of inputting the real-time layer data into a real-time network for training to obtain a real-time feature vector and a corresponding real-time clustering center includes: performing time-series modeling on the real-time layer data to obtain real-time time-series features; performing online clustering on the real-time time-series features to generate a real-time intent prototype vector as the real-time clustering center; calculating the similarity between the real-time time-series features and the real-time clustering center; performing weighted aggregation on the real-time time-series features; and outputting the real-time feature vector.
[0009] In the above implementation process, firstly, temporal modeling is performed on the real-time layer data to extract real-time temporal features. Then, online clustering is performed on these real-time temporal features to generate real-time intent prototype vectors that can represent the distribution of potential intents at the current moment, and these vectors are used as real-time cluster centers. Next, the similarity between each real-time temporal feature and the real-time cluster center is calculated, and the real-time temporal features are weighted and aggregated based on the similarity scores to highlight the information most relevant to the current intent and suppress noise. Finally, the weighted and aggregated real-time feature vector is output. This real-time feature vector retains the original temporal dynamics and enhances intent discriminability, and can be directly used for subsequent task prediction. The real-time cluster centers obtained simultaneously will participate in the calculation of auxiliary clustering loss and cross-domain distribution difference loss to further guide the joint optimization of the real-time network, short-term network, and long-term network.
[0010] Optionally, the step of inputting the short-term layer data into a short-term network for training to obtain short-term feature vectors and corresponding short-term cluster centers includes: performing temporal modeling on the short-term layer data to obtain short-term temporal features; performing online clustering on the short-term temporal features to generate short-term intent prototype vectors as the short-term cluster centers; calculating the similarity between the short-term temporal features and the short-term cluster centers; performing weighted aggregation on the short-term temporal features; and outputting the short-term feature vectors.
[0011] In the above implementation process, firstly, temporal modeling is performed on the short-term layer data to extract short-term temporal features. Then, online clustering is performed on these short-term temporal features to generate short-term intent prototype vectors that can represent the distribution of potential intents within a short-term time window, and these vectors are used as short-term cluster centers. Next, the similarity between each short-term temporal feature and the short-term cluster center is calculated, and the short-term temporal features are weighted and aggregated based on the similarity scores to highlight the information most relevant to the short-term intent and suppress noise. Finally, the weighted and aggregated short-term feature vector is output. This short-term feature vector retains the short-term temporal dynamics and enhances intent discriminability, and can be directly used for subsequent task prediction. The short-term cluster centers obtained simultaneously will participate in the calculation of auxiliary clustering loss and cross-domain distribution difference loss to further guide the joint optimization of the real-time network, short-term network, and long-term network.
[0012] Optionally, the step of inputting the long-term layer data into a long-term network for training to obtain a long-term feature vector and the corresponding long-term cluster center includes: extracting statistical features from the long-term layer data to obtain long-term statistical features; performing preference clustering on the long-term statistical features to generate a long-term profile prototype vector as the long-term cluster center; and outputting the long-term feature vector based on the correlation between the long-term statistical features and the long-term cluster center.
[0013] In the above implementation process, firstly, temporal modeling is performed on the long-term layer data to extract long-term temporal features. Then, online clustering is performed on these long-term temporal features to generate long-term intent prototype vectors that characterize the distribution of potential intents within a long-term time window, which serve as long-term cluster centers. Next, the similarity between each long-term temporal feature and the long-term cluster centers is calculated, and the long-term temporal features are weighted and aggregated based on the similarity scores to highlight the information most relevant to long-term intents and suppress noise. Finally, the weighted and aggregated long-term feature vector is output, effectively extracting representative long-term statistical features from the long-term layer data. Furthermore, preference clustering is used to generate long-term profile prototype vectors as long-term cluster centers. This long-term feature vector retains long-term temporal dynamics and enhances intent discriminativeness, allowing it to be directly used for subsequent task prediction. The synchronously obtained long-term cluster centers will participate in the calculation of auxiliary clustering loss and cross-domain distribution difference loss to further guide the joint optimization of the real-time network, short-term network, and long-term network.
[0014] Optionally, the loss function includes a main task loss function; optimizing the real-time network, the short-term network, and the long-term network using the loss function includes optimizing the core accuracy of the model in real-time, short-term, and / or long-term scenarios using the main task loss function; wherein the main task loss function is constructed based on a weighted sum of the real-time cluster centers, the short-term cluster centers, and the long-term cluster centers.
[0015] In the above implementation process, by adjusting the weights for different cluster centers, the relative importance of real-time, short-term, and long-term information in the model's final decision can be flexibly controlled. For example, when real-time cluster centers are given higher weights, the model focuses more on learning the latest data features and patterns; while when the weights of long-term cluster centers are increased, the model tends to rely more on stable and generalized knowledge accumulated historically. This weighted fusion mechanism allows the model to adaptively balance its attention to information at different time scales according to specific task requirements, thereby enhancing the model's adaptability and robustness in different scenarios while ensuring core accuracy.
[0016] Optionally, the loss function further includes an auxiliary task loss function; the optimization of the real-time network, the short-term network, and the long-term network through the loss function further includes constraining the quality and classification accuracy of the real-time cluster centers, the short-term cluster centers, and the long-term cluster centers through the auxiliary task loss function; wherein the auxiliary task loss function is constructed based on the distance between the output feature vector of each network and the corresponding cluster center.
[0017] In the above implementation process, firstly, the real-time feature vector, short-term feature vector, and long-term feature vector are concatenated or weighted and fused and then fed into the corresponding main task prediction to obtain the task prediction results for real-time, short-term, and / or long-term scenarios. Subsequently, based on the labeled tags or self-supervised signals, the real-time main task loss, short-term main task loss, and / or long-term main task loss are calculated respectively. Next, based on the importance of the sample distribution reflected by the real-time cluster centers, short-term cluster centers, and long-term cluster centers, the three types of main task losses are weighted and summed based on the cluster center weight coefficients to construct a unified main task loss function. Finally, by backpropagating the main task loss function, all trainable parameters of the real-time network, short-term network, and long-term network are optimized end-to-end, thereby improving the core accuracy of the model in real-time, short-term, and / or long-term scenarios while ensuring the specificity of each time scale.
[0018] Optionally, the loss function further includes a cross-domain alignment loss function; the optimization of the real-time network, the short-term network, and the long-term network using the loss function further includes: using the cross-domain alignment loss function to narrow the distribution distance between the real-time cluster centers, the short-term cluster centers, and the long-term cluster centers in the semantic space; wherein the cross-domain alignment loss function is constructed based on the distribution differences between the real-time cluster centers, the short-term cluster centers, and the long-term cluster centers.
[0019] In the above implementation process, firstly, the real-time cluster centers, short-term cluster centers, and long-term cluster centers are regarded as prototype anchor points in their respective time domains. The degree of offset between the real-time domain, short-term domain, and long-term domain in the semantic space is quantified by calculating the distribution differences between them (such as Wasserstein distance, KL divergence, or maximum mean difference MMD). Then, with the goal of minimizing this distribution difference, a cross-domain alignment loss function is constructed to make the real-time cluster centers, short-term cluster centers, and long-term cluster centers approach each other and align with each other in the shared semantic space. Next, the cross-domain alignment loss function is weighted and combined with the main task loss function and the auxiliary clustering loss function to form a unified joint loss function. Finally, by backpropagating this joint loss function, all trainable parameters of the real-time network, short-term network, and long-term network are optimized end-to-end. This significantly reduces the semantic gap between the real-time domain, short-term domain, and long-term domain while ensuring the discriminative power of features at each time scale, thereby improving the generalization ability and consistency performance of the multi-task learning model in cross-time scenarios.
[0020] Optionally, optimizing the real-time network, the short-term network, and the long-term network using loss functions further includes: increasing the weight of the main task loss function in the early stage of model training; balancing the weights of the main task loss function, the auxiliary task loss function, and the cross-domain alignment loss function in the middle stage of model training; and emphasizing the weight of the cross-domain alignment loss function in the late stage of model training.
[0021] In the above implementation process, a three-stage dynamic weighting strategy is adopted to schedule the overall loss function: In the early stage of model training, the weight of the main task loss function is set to the highest, so that the real-time network, short-term network and long-term network prioritize fitting the core labels of the real-time scene, short-term scene and / or long-term scene, thereby quickly obtaining a multi-task learning model with basic accuracy; in the middle stage of model training, the weight of the main task loss function is gradually reduced, while the weight of the auxiliary task loss function and the cross-domain alignment loss function are increased simultaneously, so that the real-time cluster centers, short-term cluster centers and long-term cluster centers begin to form structured semantic clusters under the constraints of auxiliary clustering and cross-domain distribution differences, and achieve the initial alignment of feature spaces at different time scales; at the end of model training, the weight of the main task loss function and the auxiliary task loss function is further reduced, while the weight of the cross-domain alignment loss function is significantly increased, forcing the real-time cluster centers, short-term cluster centers and long-term cluster centers to highly overlap in the common semantic space, completing fine cross-time semantic alignment, and finally outputting a multi-task learning model that achieves the best in both core accuracy and cross-domain consistency.
[0022] Secondly, embodiments of this application provide a multi-task learning model, the model comprising: a data classification module, a real-time network, a short-term network, a long-term network, and a loss function optimization module; the data classification module is used to classify data according to timeliness to obtain processed data; wherein, the processed data includes real-time layer data, short-term layer data, and long-term layer data; the real-time network is used to process the real-time layer data and output real-time feature vectors and corresponding real-time cluster centers; the short-term network is used to process the short-term layer data and output short-term feature vectors and corresponding short-term cluster centers; the long-term network is used to process the long-term layer data and output long-term feature vectors and corresponding long-term cluster centers; wherein, the real-time feature vectors, the short-term feature vectors, and the long-term feature vectors are directly output, and the real-time cluster centers, the short-term cluster centers, and the long-term cluster centers are used to assist in the optimization of the multi-task learning model; the loss function optimization module is used to optimize the real-time network, the short-term network, and the long-term network through a loss function; wherein, the loss function includes at least a main task loss function, an auxiliary task loss function, and a cross-domain alignment loss function.
[0023] In the above implementation process, the data classification module first divides the original input data into real-time layer data, short-term layer data, and long-term layer data according to their timeliness, thus decoupling the time granularity. Then, the real-time network performs temporal modeling, online clustering, and weighted aggregation on the real-time layer data, outputting a real-time feature vector that can be directly used for the final task prediction, and simultaneously generating real-time cluster centers for auxiliary optimization. The short-term network performs the same temporal modeling, online clustering, and weighted aggregation on the short-term layer data, outputting a short-term feature vector that can be directly used for the final task prediction, and simultaneously generating short-term cluster centers for auxiliary optimization. The long-term network performs statistical feature extraction, preference clustering, and correlation weighting on the long-term layer data, outputting a feature vector that can be directly used for... The final task predicts long-term feature vectors and simultaneously generates long-term cluster centers for auxiliary optimization. Finally, the loss function optimization module merges the main task loss function, auxiliary task loss function, and cross-domain alignment loss function according to preset or dynamically adjusted weights. Through backpropagation, it simultaneously optimizes all parameters of the real-time network, short-term network, and long-term network end-to-end, so that the real-time feature vector, short-term feature vector, and long-term feature vector maintain discriminative power at their respective time scales. At the same time, the real-time cluster centers, short-term cluster centers, and long-term cluster centers achieve semantic alignment in the common semantic space, thus obtaining a multi-task learning model with both high-precision multi-task prediction capability and cross-time-period generalization consistency.
[0024] Optionally, the model further includes: a scene adaptive fusion module; the scene adaptive fusion module is used to generate an output vector by weighted fusion of the real-time feature vector, the short-term feature vector and the long-term feature vector according to the current usage scenario type and context information.
[0025] In the above implementation process, the scene adaptive fusion module first encodes the current usage scenario type (such as peak / off-peak, weekday / holiday, new user / old user) and context information (such as timestamp, device type, geographical location) to obtain a scene context vector. Then, based on this scene context vector, it calculates the dynamic weight coefficients of the real-time feature vector, short-term feature vector, and long-term feature vector, so that features at different time scales can be adaptively enhanced or suppressed according to the needs of the scenario. Next, the real-time feature vector, short-term feature vector, and long-term feature vector are weighted and summed using the calculated dynamic weight coefficients to generate an output vector that highly matches the current scenario. Finally, this output vector is sent to the downstream task prediction head to achieve accurate prediction based on scene awareness. This enables the multi-task learning model to automatically adjust the feature fusion strategy in real-time sudden scenarios, short-term fluctuating scenarios, and long-term stable scenarios, further improving the overall accuracy and robustness.
[0026] Thirdly, embodiments of this application also provide an electronic device, which includes a memory and a processor. The memory stores program instructions, and when the processor reads and runs the program instructions, it executes the steps in any of the above implementation methods.
[0027] Fourthly, embodiments of this application also provide a computer-readable storage medium storing computer program instructions, which, when read and executed by a processor, perform the steps in any of the above implementations. Attached Figure Description
[0028] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0029] Figure 1 This is a first flowchart of a multi-task learning model training method provided in an embodiment of this application;
[0030] Figure 2 This is a second flowchart of a multi-task learning model training method provided in an embodiment of this application;
[0031] Figure 3 This is a third flowchart of the multi-task learning model training method provided in the embodiments of this application;
[0032] Figure 4 This is a fourth flowchart of the multi-task learning model training method provided in the embodiments of this application;
[0033] Figure 5 The fifth flowchart of the multi-task learning model training method provided in the embodiments of this application;
[0034] Figure 6 The sixth flowchart of the multi-task learning model training method provided in the embodiments of this application;
[0035] Figure 7 This is a schematic diagram of a multi-task learning model provided in an embodiment of this application;
[0036] Figure 8 This is a block diagram of an electronic device provided in an embodiment of this application.
[0037] Icons: 010 - Data classification module; 021 - Real-time network; 022 - Short-term network; 023 - Long-term network; 030 - Loss function optimization module; 040 - Scene adaptive fusion module; 100 - Electronic device; 111 - Memory; 112 - Memory controller; 113 - Processor; 114 - Peripheral interface; 115 - Input / output unit; 116 - Display unit. Detailed Implementation
[0038] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of the embodiments of this application.
[0039] Currently, while representative solutions have explored multi-task learning and cross-domain recommendation, they still face several fundamental challenges. At the interest modeling level, since most models (such as MMOE) are designed to share representations to alleviate data sparsity, their network structures do not incorporate temporal priors to distinguish the timeliness of intent. This leads to real-time scenario demands (such as "instant purchase") and long-term stable interests (such as "brand preference") being confused during feature interaction, making it difficult to accurately capture the dynamic changes in users' decision-making states. Furthermore, regarding cross-domain information fusion, although some works have attempted to jointly train search and recommendation, these methods typically rely on shallow feature sharing or concatenation, lacking explicit alignment of the semantic gap between the strong intent signals contained in the search query and the implicit interests in the recommendation scenario. As a result, search behavior is difficult to effectively transform into guiding signals for the recommendation system, limiting cross-domain information gain. Furthermore, model interpretability also constitutes a major bottleneck: because the solutions generally rely on end-to-end black-box modeling, they neither embed interpretable structures such as unsupervised clustering into the dynamic training process nor extract business-meaningful intent prototypes, resulting in a lack of clear attribution basis for model outputs, ultimately affecting the credibility of operational strategy optimization. Finally, when facing data-sparse scenarios such as cold starts, because the above methods do not coordinate the optimization of unsupervised representation learning such as clustering with model training, it is difficult to leverage common group knowledge to enhance individual representations, thus limiting the model's generalization robustness under low-resource conditions.
[0040] The following explanations are provided for the core terms used in this plan:
[0041] Multi-task learning is a paradigm in machine learning whose core idea is to learn multiple related tasks simultaneously, rather than training a separate model for each task as in traditional single-task learning. Multi-task learning models improve the performance of each task and the model's generalization ability by allowing these tasks to share parts of the model (such as feature representations or model parameters) during training and leveraging the correlation between tasks to mutually promote each other.
[0042] User behavior data refers to a series of raw data that can be recorded and tracked when users interact with digital products (such as websites, mobile applications, mini-programs, smart devices, etc.). It objectively describes "who," "when," "where," "how," and "what content" the user performed "what action."
[0043] Cluster centers are the results of clustering algorithms (such as the classic K-Means algorithm) and represent the core or average position of a cluster. Each cluster center is also a feature vector with the same dimensions as the feature vectors of the original data.
[0044] In the first aspect, embodiments of this application provide a multi-task learning model training method, which is applied to a server. The server can be an electronic device with logical computing functions, such as a personal computer (PC), tablet computer, smartphone, or personal digital assistant (PDA). Through hierarchical spatiotemporal feature modeling and dynamic clustering guidance, the interpretable alignment of search and recommendation intentions is achieved, enabling the recommendation system to directly absorb and utilize explicit demand signals in the search.
[0045] The application scenario of this application may be as follows: On a large video content platform, the system needs to recommend videos that users may be interested in. User behavior is rich and diverse, including: real-time behavior, such as watching a video or frequently searching for a keyword in the current session; short-term behavior, such as watching a particular category of videos (e.g., "programming tutorials") intensively over the past few days; and long-term interests, such as stable preferences over a long period (e.g., a continued fondness for "science fiction movies"). Traditional recommendation models struggle to effectively coordinate users' interests across different time scales, especially when user intent changes rapidly. Specifically, a potential problem is that a user who has long enjoyed "science fiction movies" might recently be watching a large number of "programming tutorials" to prepare for exams. Traditional models either overemphasize long-term interests (continuing to recommend a large number of science fiction films, ignoring recent changes) or are excessively swayed by short-term behavior (only recommending tutorials, suppressing the user's essential interests). Alternatively, users may have different intents at different times and on different devices. For example, during a weekday lunch break, users might prefer short and light content while browsing short videos on their phones; on a weekend evening, they might want to watch a full movie on TV. Traditional models lack the ability to dynamically perceive such contextual situations and cannot adaptively adjust recommendation strategies. Alternatively, for new users or users with sparse behavior, traditional models struggle to make accurate recommendations due to a lack of long-term historical data, and are prone to falling into "popularity bias," recommending popular but not necessarily relevant content.
[0046] This application's embodiments may also be applied in scenarios such as: on a large comprehensive e-commerce platform, the system needs to recommend products to users and display personalized homepage information feeds. User behavior includes: real-time behavior, such as searching for "phone cases," adding a product to the shopping cart, or repeatedly browsing a product on the current page; short-term behavior, such as frequently browsing camping gear and comparing different brands of air fryers in the past week; and long-term interests, such as historical purchase records showing that the user is a "high-end digital product enthusiast" and an "outdoor sports enthusiast." Traditional recommendation models struggle to effectively coordinate users' interests across different time scales, especially when user intent changes rapidly. Specifically, a potential problem is that a user may be a long-term "digital enthusiast" but is currently preparing for camping, generating a strong short-term demand for "outdoor gear." Traditional models may continue to recommend a large number of digital products due to excessive weighting of long-term interests, neglecting the user's most pressing shopping goal, leading to inaccurate recommendations and missed sales opportunities. Alternatively, a user might express a very clear, immediate intent through a search (such as searching for "engagement gift"), but when they finish searching and browse the homepage recommendations, the recommendation system fails to effectively utilize this strong intent signal, still displaying conventional products based on their long-term interests, failing to achieve a smooth transition from "active search" to "passive discovery." Or, for newly listed or niche products on the platform (such as a new brand of camping lamp), due to a lack of user interaction data, traditional models struggle to accurately recommend them to potentially interested users (such as the user mentioned above with short-term camping interests).
[0047] Please combine Figure 1 , Figure 1 The first flowchart of the multi-task learning model training method provided in the embodiments of this application is shown.
[0048] The multi-task learning model training method provided in this application includes: dividing data according to timeliness to obtain processed data; wherein the processed data includes processed real-time layer data, processed short-term layer data, and processed long-term layer data; inputting the processed real-time layer data into a real-time network for training to obtain real-time feature vectors and corresponding real-time cluster centers; inputting the processed short-term layer data into a short-term network for training to obtain short-term feature vectors and corresponding short-term cluster centers; inputting the processed long-term layer data into a long-term network for training to obtain long-term feature vectors and corresponding long-term cluster centers; wherein the real-time feature vectors, short-term feature vectors, and long-term feature vectors are used for task prediction, and the real-time cluster centers, short-term cluster centers, and long-term cluster centers are used to assist in the optimization of the multi-task learning model; and optimizing the real-time network, short-term network, and long-term network through a loss function.
[0049] In the above implementation process, user behavior data is divided into three levels based on timeliness: real-time, short-term, and long-term. These levels are then input into corresponding dedicated networks for training, thereby constructing a feature representation with a temporal hierarchical structure. Each network layer not only outputs feature vectors for the final task prediction but also simultaneously generates corresponding cluster centers, thus achieving a multi-granular characterization of user intent. These cluster centers, as interpretable intent prototypes, can dynamically participate in the model optimization process, enhancing the modeling ability for interest drift and scene changes. Finally, a unified loss function is used to collaboratively optimize the three-layer network, ensuring that user interest representations at different time scales are both complementary and distinct, effectively improving the model's expressive power and robustness in complex scenarios.
[0050] In one embodiment of this application, during the data preprocessing stage, the original user behavior data is hierarchically divided according to the timeliness of the behavior in order to capture user intent patterns at different time scales.
[0051] In this embodiment, user behavior data within 0-5 minutes is classified as real-time data. Specifically, it originates from the integration of dynamic user behavior over the past 5 minutes, including real-time search terms, instant clickstream, GPS location, and device status. This layer of data is primarily associated with search scenarios and is used to characterize the user's instantaneous, contextualized intent. For example, a user searching for "Starbucks" in a shopping mall in real-time is considered a clear signal of immediate consumer demand.
[0052] In this embodiment, user behavior data from the past 1-7 days is categorized into a short-term layer. Specifically, this layer is derived from constructing a sequence of user behavior over the past 7 days, encompassing timestamped browsing history, search history, purchase behavior, and distribution of active time periods. This layer aims to identify users' periodic interests and recent preference patterns. For example, users browsing fitness equipment at fixed times each week can reflect their regular exercise consumption tendencies.
[0053] In this embodiment, user behavior data from the past 30 days or more is categorized into a long-term layer. This long-term layer data is specifically derived from extracting statistical features from the user's historical full-volume behavior, including category preference distribution, brand purchase frequency, price sensitivity, and basic profile tags. This layer is used to represent the user's long-term stable interest attributes; for example, a prominent proportion of spending on outdoor equipment indicates that the user is an outdoor sports enthusiast. The short-term and long-term layers together serve interest modeling in recommendation scenarios.
[0054] In other words, through the above-mentioned layering method, the system can achieve a multi-dimensional structured representation of user intent, from real-time to long-term and from explicit to implicit.
[0055] Please combine Figure 2 , Figure 2The second flowchart is provided for the multi-task learning model training method in the embodiments of this application.
[0056] Optionally, real-time layer data is input into a real-time network for training to obtain real-time feature vectors and corresponding real-time cluster centers, including: performing time-series modeling on the processed real-time layer data to obtain real-time time-series features; performing online clustering on the real-time time-series features to generate real-time intent prototype vectors as real-time cluster centers; calculating the similarity between real-time time-series features and real-time cluster centers; performing weighted aggregation on the real-time time-series features; and outputting real-time feature vectors.
[0057] In the above implementation process, the processing of real-time layer data integrates temporal modeling and dynamic clustering mechanisms. Specifically, firstly, temporal modeling is performed on the real-time user behavior sequences to capture their patterns changing over time, generating real-time temporal features. Subsequently, representative real-time intent prototype vectors are extracted from these temporal features using an online clustering method, serving as real-time cluster centers. Further, the system calculates the similarity between each real-time temporal feature and each real-time cluster center, and adaptively weights and aggregates the temporal features based on similarity weights, ultimately outputting a real-time feature vector that simultaneously reflects real-time behavior patterns and intent attribution. This process not only enhances the representational power of real-time features but also provides interpretability for feature generation through intent prototypes.
[0058] In one embodiment of this application, the real-time network takes real-time layer data acquired from the front end as input, specifically including BERT-encoded search terms, user clickstream sequences, and gridded GPS coordinates. First, an LSTM network is used to model the behavioral sequences in the input real-time layer data to capture their dynamic temporal dependencies, outputting real-time behavioral codes. ,and As real-time time series features, that is, based on the extracted real-time time series features of dimension d. As a real-time temporal feature, an improved K-means algorithm incorporating Dynamic Time Warping (DTW) metrics is used for online clustering. The number of clusters K is not fixed but dynamically optimized based on the silhouette coefficient, aiming to automatically identify consistent intent clusters from behavioral sequences. For example, a series of searches initiated consecutively by a user, such as "sports shoes," "running shoes," and "Nike sports shoes," can be grouped into the same "sports equipment purchase" intent cluster. This step outputs a real-time intent prototype vector. ,and That is, based on the extracted real-time time-series features of dimension d. An attention mechanism is introduced to compute real-time temporal features. With real-time intent prototype vector The similarity weights between the data points are used to selectively enhance the original behavioral features, thereby highlighting the key intents most relevant to the current scenario as real-time cluster centers. Ultimately, the real-time network not only outputs enhanced real-time intent vectors but also simultaneously provides interpretable contextual intent prototypes (such as "afternoon coffee need" or "gym equipment purchase"), providing clear semantic basis for subsequent decisions.
[0059] Taking the K-Means algorithm as an example, the cluster centers are formed as follows: K points are randomly initialized as initial cluster centers. Each data point (feature vector) is assigned to its nearest cluster center, forming K clusters. The average value of all data points in each cluster is recalculated, and this average value is used as the new cluster center. The above steps are repeated until the cluster centers no longer change significantly.
[0060] Please combine Figure 3 , Figure 3 The third flowchart of the multi-task learning model training method provided in the embodiments of this application is shown.
[0061] Optionally, the short-term layer data is input into the short-term network for training to obtain short-term feature vectors and corresponding short-term cluster centers, including: performing time-series modeling on the processed short-term layer data to obtain short-term time-series features; performing online clustering on the short-term time-series features to generate short-term intent prototype vectors as short-term cluster centers; calculating the similarity between the short-term time-series features and the short-term cluster centers; performing weighted aggregation on the short-term time-series features; and outputting short-term feature vectors.
[0062] In the above implementation process, the processing of short-term layer data aims to extract periodic and trend-based user interest patterns from recent behavior. Specifically, firstly, time-series modeling is performed on short-term behavior sequences to capture their dynamic evolution patterns within a week, generating short-term time-series features. Subsequently, representative short-term interest prototype vectors are summarized from these features using online clustering methods, serving as short-term cluster centers. Further, the system calculates the similarity between each short-term time-series feature and the interest prototype, and uses this similarity as a weight to perform weighted fusion of the original features, ultimately outputting short-term feature vectors that reflect both the commonalities of recent behavior and highlight individual differences. This process enhances the interpretability of short-term interests through prototype clustering and provides a stable recent context for the next stage of long-term interest modeling.
[0063] In one embodiment of this application, the input for processing short-term layer data is a sequence of user behavior (ItemID) with timestamps from the past 7 days. First, a Transformer encoder is used to perform temporal modeling on the behavior sequence to capture complex dependencies and cyclical patterns between items, outputting short-term behavior codes. ,and As short-term time series features, that is, based on the extracted short-term time series features of dimension d. An improved K-means algorithm incorporating Dynamic Time Warping (DTW) metric is used for online clustering. The sequences are segmented and clustered according to time windows to generate interest prototype vectors representing common short-term interest patterns. ,and That is, based on the extracted short-term time-series features of dimension d. To further improve clustering performance, a contrastive learning framework (SimCLR) is introduced. This framework enhances the consistency and discriminative power within interest prototypes by maximizing the vector similarity of samples within the same cluster. Ultimately, the short-term network outputs identifiable periodic interest patterns (e.g., "weekly gym gear browsing"), specifically including refined short-term vectors. and its corresponding interest prototype vector This provides a short-term representation of user interests with clear behavioral cycles for the recommendation system.
[0064] In this clustering algorithm, DTW distance is used instead of traditional Euclidean distance as the similarity metric. DTW can effectively calculate the similarity between sequences of different lengths and speeds by finding the optimal nonlinear alignment path between two behavioral sequences. This is based on the extracted short-term temporal features of dimension d. Representative sequences are selected from the current batch of data stream as initial cluster centers. For each behavioral sequence, its DTW distance to all current cluster centers is calculated, and it is assigned to the nearest cluster. The cluster centers are updated by calculating the DTW centroid of all sequences within a cluster, minimizing the sum of the DTW distances to all sequences within the cluster. The number of clusters K is not a preset fixed value, but is dynamically evaluated and determined during the clustering process using metrics such as the silhouette coefficient to adapt to the diversity and changes in real-time behavioral intentions.
[0065] Please combine Figure 4 , Figure 4 The fourth flowchart of the multi-task learning model training method provided in the embodiments of this application is shown.
[0066] Optionally, long-term layer data is input into a long-term network for training to obtain long-term feature vectors and corresponding long-term cluster centers, including: extracting statistical features from the long-term layer data to obtain long-term statistical features; performing preference clustering on the long-term statistical features to generate long-term profile prototype vectors as long-term cluster centers; and outputting long-term feature vectors based on the correlation between long-term statistical features and long-term cluster centers.
[0067] In the above implementation process, the processing of long-term layer data focuses on extracting stable user interests and profile prototypes from historical statistical information. Specifically, firstly, statistical features are extracted from the long-term layer data to generate long-term statistical features reflecting overall user preferences. Subsequently, representative long-term profile prototype vectors are summarized from these statistical features using preference clustering methods, serving as long-term cluster centers. Further, the system analyzes the correlation between long-term statistical features and each profile prototype, and based on this, performs semantic enhancement and summarization of the features, ultimately outputting long-term feature vectors that both represent users' enduring interests and have clear profile attribution. This process transforms sparse statistical features into interpretable profile labels through prototype clustering, improving the model's ability to model users' long-term stable preferences.
[0068] In one embodiment of this application, the input for processing long-term layer data is the user's historical statistical characteristics, including category distribution (e.g., "outdoor equipment accounts for 30%)", annual total consumption, and brand preference (one-hot encoding). First, a Gaussian Mixture Model (GMM) is used to perform soft clustering on the input features, outputting the probability distribution of the user belonging to each profile category. (k is the preset number of portrait categories). Subsequently, long-term statistical features are input into a joint model consisting of a deep neural network (DNN) and a factorization machine (FM). FM effectively captures high-order interactions between features, outputting a long-term portrait encoding vector with clear semantics. (Based on extracted long-term time-series features of dimension d), such as interpretable "price-sensitive" or "quality-first" user profiles. The module's final output includes refined long-term profile vectors. and its corresponding portrait prototype cluster center .
[0069] Among them, the DNN model can automatically learn complex, implicit, high-order interactions between features. These interactions can be very subtle and difficult to design manually, such as the combination pattern of "high-income young men who use iPhones on weekend nights." It maps raw features to a higher-level, more abstract semantic space. The FM model is specifically designed to efficiently compute pairwise interactions (second-order interactions) between features. It estimates the importance of two feature combinations by learning the latent vector of each feature and using the inner product of these latent vectors.
[0070] Please combine Figure 5 , Figure 5 The fifth flowchart of the multi-task learning model training method provided in the embodiments of this application is shown.
[0071] Optionally, the loss function includes: a main task loss function; the loss function is used to optimize the real-time network, short-term network, and long-term network, including: optimizing the core accuracy of the model in real-time, short-term, and / or long-term scenarios using the main task loss function; wherein the main task loss function is constructed based on the weighted sum of real-time cluster centers, short-term cluster centers, and long-term cluster centers.
[0072] In the above implementation process, the model undergoes end-to-end optimization through a comprehensive loss function, with the main task loss at its core. The main task loss function is designed to simultaneously improve the model's prediction accuracy in real-time, short-term, and long-term scenarios. Its construction method does not directly use the original features, but rather performs a weighted fusion of cluster centers generated by the three layers of the real-time, short-term, and long-term networks to form a more representative and robust supervision signal. Through this mechanism, the loss function not only guides the model to optimize the performance of the main task, but also implicitly drives each layer of the network to learn more discriminative and interpretable intent prototypes, thereby achieving collaborative modeling and accurate prediction of users' multi-granular interests.
[0073] In one embodiment of this application, the design of the loss function focuses on multi-task prediction optimization, with the main task loss... The loss is weighted and composed of three sub-tasks: search click-through rate (CTR) prediction, recommendation CTR prediction, and cross-domain conversion rate (CTCVR) prediction.
[0074]
[0075] in, Search CTR loss The corresponding weights Recommended CTR loss The corresponding weights For cross-domain conversion rate The corresponding weights and loss terms are defined as follows:
[0076] In this embodiment, the search CTR loss Binary cross-entropy is used to measure the accuracy of click prediction in search scenarios. For each search result i, the true label is obtained. (1 = clicked, 0 = not clicked), the model predicts the probability that the result has been clicked. The loss for a single sample is calculated using binary cross-entropy, and the search CTR loss is obtained by averaging over N samples.
[0077]
[0078] In this embodiment, CTR loss is recommended. The calculation method is the same as that for search CTR loss. For M recommendation scenario samples in a batch, for each search result i, the true label is obtained. (1 = clicked, 0 = not clicked), the model predicts the probability that the result has been clicked. It can be used to optimize click prediction tasks in recommendation scenarios:
[0079]
[0080] In this embodiment, the Cross-Domain Conversion Rate (CTCVR) loss is used to model the cross-domain behavior conversion from search to recommendation. This loss is based on the click-through rate (CTR). ) and conversion rate ( The joint probability of ) is constructed, and its expression is:
[0081]
[0082] Among them: click pass rate The conversion rate is predicted by CTR. This is predicted by the CVR model. The tag indicates whether a cross-domain conversion occurred, representing whether the user made a purchase based on the recommendations after searching.
[0083] The fused feature vector is obtained by fusing the weights of real-time, short-term, and long-term features. The output vector is obtained after being mapped and activated by a multilayer perceptron.
[0084] Optionally, the loss function further includes: an auxiliary task loss function; the optimization of the real-time network, short-term network, and long-term network through the loss function also includes: constraining the quality and classification accuracy of the real-time cluster centers, short-term cluster centers, and long-term cluster centers through the auxiliary task loss function; wherein the auxiliary task loss function is constructed based on the distance between the output feature vector of each network and the corresponding cluster center.
[0085] In the above implementation process, in addition to the main task loss function, the model also introduces an auxiliary task loss function to improve the learning quality of the intent prototype. This auxiliary loss aims to constrain the cluster centers generated by the real-time, short-term, and long-term three-layer networks, ensuring that they have good representativeness and clear class distinction.
[0086] Specifically, the auxiliary loss is constructed based on the distance between the feature vectors output by each network layer and their corresponding cluster centers. By optimizing the goal of minimizing intra-class distance and maximizing inter-class distance, it indirectly improves the classification accuracy of cluster centers and the compactness of the feature space. This mechanism can enhance the model's ability to discriminate hierarchical user intent and provide a more robust prototype representation for multi-scale interest modeling.
[0087] In one embodiment of this application, the auxiliary task loss function It consists of two weighted components: cluster compactness loss and intention classification loss.
[0088]
[0089] in, For cluster compactness loss and Assign weights to them to ensure that similar samples are clustered together; For the purpose of classifying loss and Optimize the accuracy of intent label prediction by assigning corresponding weights.
[0090] Cluster compactness loss aims to constrain the clustering of similar samples in the feature space. By minimizing the distance between the features of each sample within a cluster and its corresponding cluster center, it improves intra-cluster compactness and inter-cluster discriminability. Its expression is:
[0091]
[0092] in, For the k-th cluster center, The sample feature vector ensures that similar samples are clustered and dissimilar samples are separated.
[0093] Intended classification loss This loss is used to optimize the accuracy of intent category prediction based on clustering results, and the cross-entropy loss supervises the model's ability to discriminate the intent category of a sample. Its calculation formula is:
[0094]
[0095] in, The true label for sample i belonging to category c. Let C be the probability predicted by the model, and C be the total number of categories.
[0096] It is easy to see that this auxiliary loss enhances the model's ability to characterize the user's multi-level interest structure by jointly optimizing the quality of feature clustering and the accuracy of intent recognition.
[0097] Optionally, the loss function further includes a cross-domain alignment loss function; optimizing the real-time network, short-term network, and long-term network through the loss function also includes: narrowing the distribution distance of real-time cluster centers, short-term cluster centers, and long-term cluster centers in the semantic space through the cross-domain alignment loss function; wherein the cross-domain alignment loss function is constructed based on the distribution differences of real-time cluster centers, short-term cluster centers, and long-term cluster centers.
[0098] In the above implementation process, to further promote the semantic consistency of multi-level intent representation, the model additionally introduces a cross-domain alignment loss function. This loss function aims to reduce the distribution differences of the three-layer cluster centers in the semantic space (real-time, short-term, and long-term), thereby achieving unified representation learning of user cross-domain behavior. Specifically, this loss is constructed based on the distribution distance of the cluster centers at each layer. By constraining the relative positions of intent prototypes in the feature space at different time scales, it enhances the semantic association between the explicit intent in the search scenario and the implicit interest in the recommendation scenario, thereby improving the model's generalization and transfer capabilities in cross-domain scenarios.
[0099] In one embodiment of this application, explicit intent clustering centers are extracted based on real-time clustering centers. Interest cluster centers are extracted based on short-term and long-term cluster centers. .
[0100] Define an alignment loss function to constrain the semantic consistency of cluster centers between the search domain and the recommendation domain:
[0101]
[0102] Wherein: KL refers to KL divergence, also called relative entropy, which is an asymmetric measure used to measure the difference between two probability distributions. For the distribution of the i-th cluster center in the search domain, This represents the distribution of the j-th cluster center in the short term within the recommendation domain. For example, it minimizes the vector distance between the cluster centers of the search query "hiking shoes" and the cluster centers of the recommended item "hiking backpack".
[0103] Please combine Figure 6 , Figure 6 The sixth flowchart of the multi-task learning model training method provided in the embodiments of this application is shown.
[0104] Optionally, optimizing the real-time network, short-term network, and long-term network through the loss function also includes: increasing the weight of the main task loss function in the early stage of model training; balancing the weights of the main task loss function, auxiliary task loss function, and cross-domain alignment loss function in the middle stage of model training; and emphasizing the weight of the cross-domain alignment loss function in the late stage of model training.
[0105] In the above implementation process, the model adopts a dynamically weighted training strategy, adjusting the weight configuration of the loss function at different training stages to guide the model to learn systematically. In the early stages of training, the weight of the main task loss function is increased, allowing the model to prioritize learning the predictive capabilities of core business objectives such as click-through rate (CTR) and conversion rate (CVR), quickly converging to a relatively optimal initial solution. In the middle stages of training, the weights of the main task loss function, auxiliary task loss function, and cross-domain alignment loss function are balanced. While ensuring the accuracy of the main task, constraints on clustering quality, intent classification, and cross-domain semantic alignment are gradually introduced to promote the effective extraction of multi-level user interests. In the final stages of training, the weight of the cross-domain alignment loss function is emphasized, focusing on narrowing the distribution of real-time, short-term, and long-term intent prototypes in the semantic space, enhancing the model's generalization ability and the consistency of interest representation in cross-domain scenarios. This phased optimization strategy effectively coordinates the learning pace of different loss objectives, improving the overall performance and robustness of the model.
[0106] In one embodiment of this application, the expression for the total loss function is:
[0107]
[0108] A dynamic weight adjustment strategy could be to prioritize the loss of the main task during the initial training phase, for example, by allocating weights as follows: ; During the middle stage of training, balance the three types of losses (distribute the weights evenly). In the later stage of training, focus on alignment effects (increase...). Weights).
[0109] Secondly, embodiments of this application provide a multi-task learning model. Figure 7 This is a schematic diagram of a multi-task learning model provided in an embodiment of this application.
[0110] The multi-task learning model includes: a data classification module 010, a real-time network 021, a short-term network 022, a long-term network 023, and a loss function optimization module 030. The data classification module 010 is used to classify data according to its timeliness, obtaining processed data. The processed data includes real-time layer data, short-term layer data, and long-term layer data. The real-time network 021 processes the real-time layer data, outputting real-time feature vectors and corresponding real-time cluster centers. The short-term network 022 processes the short-term layer data, outputting short-term feature vectors and corresponding short-term cluster centers. The long-term network 023 processes the long-term layer data, outputting long-term feature vectors and corresponding long-term cluster centers. The real-time feature vectors, short-term feature vectors, and long-term feature vectors are directly output, while the real-time cluster centers, short-term cluster centers, and long-term cluster centers are used to assist in optimizing the multi-task learning model. The loss function optimization module 030 optimizes the real-time network 021, short-term network 022, and long-term network 023 using a loss function. The loss function includes at least a main task loss function, an auxiliary task loss function, and a cross-domain alignment loss function.
[0111] In the above implementation process, the data classification module 010 is responsible for dividing the raw user behavior data according to its timeliness, outputting three types of data: real-time layer, short-term layer, and long-term layer. The real-time network 021 processes the real-time layer data, outputting real-time feature vectors representing immediate intent and their corresponding real-time cluster centers; the short-term network 022 and the long-term network 023 process the data for their respective time periods, outputting short-term feature vectors and short-term cluster centers, and long-term feature vectors and long-term cluster centers. The three types of feature vectors are directly used for downstream task prediction, while the three types of cluster centers serve as interpretable intent prototypes, participating in the model's auxiliary optimization process. The loss function optimization module 030 constructs a multi-objective loss function by integrating the main task loss, auxiliary task loss, and cross-domain alignment loss, and collaboratively trains the real-time, short-term, and long-term networks 023, thereby achieving unified modeling and optimization of user intent features across multiple time scales. This realizes hierarchical modeling of user intent and cross-domain semantic alignment. The model uses the data classification module 010 as its front end, dividing raw behavioral data into three levels—real-time, short-term, and long-term—based on timeliness. These levels are then input into corresponding dedicated networks for feature extraction and intent prototype mining. The real-time, short-term, and long-term networks 023 not only output feature vectors for task prediction but also simultaneously generate corresponding cluster centers as interpretable intent representations. The loss function optimization module 030 constructs a multi-objective optimization framework by fusing the main task prediction loss, auxiliary clustering loss, and cross-domain alignment loss. This enhances the model's ability to identify users' multi-scale interests and its cross-scenario generalization performance while ensuring core business metrics are met. The entire model has a clear structure, with well-defined modules that collectively support the end-to-end learning process from data partitioning to joint optimization.
[0112] Optionally, the model also includes: a scene adaptive fusion module 040; the scene adaptive fusion module 040 is used to generate an output vector by weighted fusion of real-time feature vector, short-term feature vector and long-term feature vector according to the current usage scenario type and context information.
[0113] In the above implementation process, the model further integrates a scene adaptive fusion module 040. This module, as the core decision-making unit, is responsible for dynamically weighting and fusing the feature vectors output by the real-time, short-term, and long-term networks 023 based on the current scene type (such as search, recommendation, or cross-domain scenarios) and contextual information (including time, user status, device environment, etc.). By introducing a learnable gating mechanism, this module can adaptively adjust the contribution weights of features at each level, ultimately generating an output vector that highly matches the current scene, thereby effectively improving the model's perception and response capabilities in different business scenarios.
[0114] In this embodiment, to integrate user representations at different time scales, the system introduces a dynamic gating fusion module. This module adaptively calculates the fusion weights for real-time, short-term, and long-term features based on a context vector containing information such as the current time period, recent user activity, scenario type (search / recommendation), and device network status.
[0115]
[0116] in, for The weights of the real-time network output features. for Weights of short-term network output features These are the weights for the long-term network output features; the gating weights are not fixed, but are dynamically generated by the gating network G (context).
[0117]
[0118] in and These are learnable parameters, optimized during training using gradient descent. The system pre-sets initial weights for different scenarios (e.g., the search scenario emphasizes real-time intent). =0.5, =0.3, =0.2; Recommended scenarios focus on long-term interests: =0.2, =0.4, =0.4), and the gating network makes fine adjustments based on the real-time context to achieve scene-adaptive feature fusion.
[0119] The multi-task learning model trained using the multi-task learning model training method provided in this application embodiment, for the two application scenarios mentioned at the beginning, physically and semantically separates user behavior data through a data classification module and real-time, short-term, and long-term networks. The model no longer confuses interests from different times, but treats them as multiple coexisting and weighted intent prototypes. The recommendation results are no longer static, but can be dynamically adjusted according to the scene context, achieving intelligent scene-aware recommendation and improving user experience and engagement.
[0120] Regarding video application scenarios, using the example at the beginning as background explanation, the long-term network specifically handles the user's "science fiction movie" preference, forming a stable user profile. The short-term network focuses on capturing the user's recent interest in "programming tutorials," treating it as a separate interest cluster. The real-time network senses whether the user is currently searching for a specific programming question. Correspondingly, when the system detects that it is a weekday lunch break or a mobile device (reflected by contextual information), the scene adaptive fusion module automatically increases the weights (α and β) of the output features of the real-time and short-term networks, prioritizing recommendations of light and concise tutorials or short entertainment videos. When it detects that it is a weekend evening or a television device, this module increases the weights of the output features of the long-term network (…). It also incorporates short-term interests to recommend high-quality science fiction movies or in-depth documentaries. Even for new users, as long as their limited actions (such as clicking on one or two videos) can be mapped to an existing cluster center (e.g., the "beginner programming interest cluster") through a real-time or short-term network, the model can make recommendations based on the overall preferences of that cluster.
[0121] For shopping applications, the long-term network steadily learns the user profiles of "digital enthusiasts" and "outdoor enthusiasts." The short-term network keenly captures recent "browsing camping gear" sequences, forming a strong short-term interest cluster. The real-time network is activated when a user starts searching for "tents." When a user searches for "engagement gifts," the real-time cluster centers generated by the real-time network (representing the "gift selection" intent) are strongly activated. The cross-domain alignment loss function has already forced optimization of the semantic distance between the real-time (search) intent prototype and the short-term / long-term (recommendation) interest prototypes during the training phase. Therefore, the "gift selection" intent directly influences the feature representation of the recommendation network. When a user navigates to the homepage, the scene-adaptive fusion module assigns higher weights to real-time features based on the context of "the user just performed a search," thus highlighting suitable gifts (such as high-end perfumes, jewelry, and watches) in the recommendation feed, achieving a seamless transition from search to recommendation. A new "lightweight camping lamp" is listed, but user interaction data is lacking. The system can map the product's features (category, attributes, title, etc.) to a feature space and calculate its similarity to various short-term interest cluster centers. If the system finds that the product is very close to the cluster center of the "camping equipment interest cluster," it can recommend the camping lamp to the target user based on the reason that "the user's short-term interest belongs to this cluster," even if the target user has not seen the new product.
[0122] Optionally, please refer to Figure 8 , Figure 8 This is a block diagram illustrating an electronic device according to an embodiment of this application. The electronic device 100 may include a memory 111, a memory controller 112, a processor 113, a peripheral interface 114, an input / output unit 115, and a display unit 116. Those skilled in the art will understand that... Figure 8 The structure shown is for illustrative purposes only and does not limit the structure of the electronic device 100. For example, the electronic device 100 may also include components that are more... Figure 8 The more or fewer components shown, or having the same Figure 8 The different configurations shown.
[0123] The aforementioned memory 111, memory controller 112, processor 113, peripheral interface 114, input / output unit 115, and display unit 116 are electrically connected directly or indirectly to each other to achieve data transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses or signal lines. The aforementioned processor 113 is used to execute executable modules stored in the memory.
[0124] The memory 111 can be, but is not limited to, Random Access Memory (RAM), Read Only Memory (ROM), Programmable Read-Only Memory (PROM), Erasable Programmable Read-Only Memory (EPROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), etc. The memory 111 stores programs, and the processor 113 executes these programs upon receiving execution instructions. The methods executed by the electronic device 100 as defined in any embodiment of this application can be applied to the processor 113, or implemented by the processor 113.
[0125] The aforementioned processor 113 may be an integrated circuit chip with signal processing capabilities. The processor 113 may be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it may also be a digital signal processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor may be a microprocessor or any conventional processor.
[0126] The peripheral interface 114 described above couples various input / output devices to the processor 113 and the memory 111. In some embodiments, the peripheral interface 114, the processor 113, and the memory controller 112 can be implemented on a single chip. In other instances, they can be implemented on separate chips.
[0127] The input / output unit 115 described above is used to provide user input data. The input / output unit 115 may be, but is not limited to, a mouse and keyboard, etc.
[0128] The aforementioned display unit 116 provides an interactive interface (e.g., a user interface) between the electronic device 100 and the user, or displays image data for the user's reference. In this embodiment, the display unit can be a liquid crystal display (LCD) or a touch display. If it is a touch display, it can be a capacitive touchscreen or a resistive touchscreen that supports single-point and multi-point touch operations. Supporting single-point and multi-point touch operations means that the touch display can sense touch operations generated simultaneously from one or more locations on the touch display and pass the sensed touch operations to the processor for calculation and processing.
[0129] This application also provides a computer-readable storage medium storing computer program instructions, which are read and executed by a processor to perform steps in a multi-task learning model training method.
[0130] By constructing a three-layer feature clustering module encompassing real-time, short-term, and long-term features, the model finely decouples diverse user intents across different time scales, effectively filling the gaps in sparse features for cold-start users and significantly improving their CTR and overall cross-domain conversion rate. Introducing a constraint term based on KL divergence explicitly aligns intent clustering centers in search and recommendation scenarios, enhancing semantic consistency between the two scenarios and directly manifesting as increased intent space overlap. Employing a joint optimization objective of clustering and classification losses allows the model to not only improve end-to-end metrics but also directly output highly readable user intent tags such as "instant purchase - coffee machine," greatly enhancing the interpretability of the results and providing direct support for operational strategy formulation. The modular, layered design avoids redundant computations in end-to-end hybrid models, optimizing computational efficiency and effectively reducing model training time.
[0131] In summary, this application provides a multi-task learning model and training method, an electronic device, and a computer storage medium, relating to the field of multi-task learning technology. The method includes: dividing data according to timeliness to obtain processed data; wherein the processed data includes real-time layer data, short-term layer data, and long-term layer data; inputting the processed real-time layer data into a real-time network for training to obtain real-time feature vectors and corresponding real-time cluster centers; inputting the processed short-term layer data into a short-term network for training to obtain short-term feature vectors and corresponding short-term cluster centers; inputting the processed long-term layer data into a long-term network for training to obtain long-term feature vectors and corresponding long-term cluster centers; and optimizing the real-time network, short-term network, and long-term network using a loss function. This improves the generalization ability and prediction accuracy of the multi-task learning model for data with varying timeliness.
[0132] In the several embodiments provided in this application, it should be understood that the disclosed device can also be implemented in other ways. The device embodiments described above are merely illustrative; for example, the block diagrams in the accompanying drawings illustrate the possible architecture, functions, and operations of the device according to various embodiments of this application. In this regard, each block in the block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagram, and combinations of block diagrams, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0133] In addition, the functional modules in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0134] If the aforementioned functions are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0135] The above description is merely an embodiment of this application and is not intended to limit the scope of protection of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application. It should be noted that similar reference numerals and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.
[0136] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application.
[0137] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes said element.
Claims
1. A method for training a multi-task learning model, characterized in that, The method includes: The data is divided according to its timeliness to obtain processed data; wherein, the processed data includes processed real-time layer data, processed short-term layer data, and processed long-term layer data; wherein, the real-time layer data includes user dynamic behavior data within the last 5 minutes, the short-term layer data includes user behavior sequence data within the last 1-7 days, and the long-term layer data includes user historical statistical feature data for more than 30 days. The processed real-time layer data is input into a real-time network for training to obtain real-time feature vectors and corresponding real-time cluster centers; the processed short-term layer data is input into a short-term network for training to obtain short-term feature vectors and corresponding short-term cluster centers; the processed long-term layer data is input into a long-term network for training to obtain long-term feature vectors and corresponding long-term cluster centers. The real-time feature vector, the short-term feature vector, and the long-term feature vector are used to predict the click-through rate of search results in a search scenario or to predict the click-through rate of recommended content in a recommendation scenario. The real-time clustering center, the short-term clustering center, and the long-term clustering center are used to assist in the optimization of the multi-task learning model. The real-time network, the short-term network, and the long-term network are optimized using loss functions; wherein the loss functions include at least a main task loss function, an auxiliary task loss function, and a cross-domain alignment loss function.
2. The multi-task learning model training method according to claim 1, characterized in that, The step of inputting the processed real-time layer data into a real-time network for training to obtain real-time feature vectors and corresponding real-time clustering centers includes: Time series modeling is performed on the processed real-time layer data to obtain real-time time series features; The real-time time-series features are clustered online to generate real-time intent prototype vectors as the real-time cluster centers. Calculate the similarity between the real-time time-series features and the real-time cluster centers, perform weighted aggregation on the real-time time-series features, and output the real-time feature vector.
3. The multi-task learning model training method according to claim 1, characterized in that, The step of inputting the processed short-term layer data into a short-term network for training to obtain short-term feature vectors and corresponding short-term cluster centers includes: Temporal modeling is performed on the processed short-term layer data to obtain short-term temporal features; The short-term temporal features are clustered online to generate short-term intent prototype vectors as the short-term cluster centers. Calculate the similarity between the short-term time-series features and the short-term cluster centers, perform weighted aggregation on the short-term time-series features, and output the short-term feature vector.
4. The multi-task learning model training method according to claim 1, characterized in that, The step of inputting the processed long-term layer data into a long-term network for training to obtain long-term feature vectors and corresponding long-term cluster centers includes: Statistical features are extracted from the processed long-term layer data to obtain long-term statistical features; The long-term statistical features are subjected to preference clustering to generate long-term profile prototype vectors as the long-term cluster centers. Based on the correlation between the long-term statistical features and the long-term cluster centers, the long-term feature vector is output.
5. The multi-task learning model training method according to claim 1, characterized in that, The optimization of the real-time network, the short-term network, and the long-term network using a loss function includes: The core accuracy of the model is optimized in real-time, short-term and / or long-term scenarios through the main task loss function. The main task loss function is constructed based on the weighted sum of the real-time cluster centers, the short-term cluster centers, and the long-term cluster centers.
6. The multi-task learning model training method according to claim 5, characterized in that, The optimization of the real-time network, the short-term network, and the long-term network using a loss function further includes: The auxiliary task loss function constrains the quality and classification accuracy of the real-time cluster centers, the short-term cluster centers, and the long-term cluster centers. The auxiliary task loss function is constructed based on the distance between the output feature vectors of each network and the corresponding cluster centers.
7. The multi-task learning model training method according to claim 5, characterized in that, The optimization of the real-time network, the short-term network, and the long-term network using a loss function further includes: The cross-domain alignment loss function is used to narrow the distribution distance between the real-time cluster centers, the short-term cluster centers, and the long-term cluster centers in the semantic space. The cross-domain alignment loss function is constructed based on the distribution differences of the real-time cluster centers, the short-term cluster centers, and the long-term cluster centers.
8. A multi-task learning device, characterized in that, The multi-task learning device includes: a data classification module, a real-time network, a short-term network, a long-term network, and a loss function optimization module; The data classification module is used to divide the data according to its timeliness to obtain processed data; wherein, the processed data includes processed real-time layer data, processed short-term layer data, and processed long-term layer data; wherein, the real-time layer data includes user dynamic behavior data within the last 5 minutes, the short-term layer data includes user behavior sequence data within the last 1-7 days, and the long-term layer data includes user historical statistical feature data for more than 30 days. The real-time network is used to process the processed real-time layer data and output real-time feature vectors and corresponding real-time clustering centers. The short-term network is used to process the processed short-term layer data and output short-term feature vectors and corresponding short-term cluster centers. The long-term network is used to process the processed long-term layer data and output long-term feature vectors and corresponding long-term cluster centers. The real-time feature vector, the short-term feature vector, and the long-term feature vector are directly output. The real-time feature vector, the short-term feature vector, and the long-term feature vector are used to predict the click-through rate of search results in search scenarios or to predict the click-through rate of recommended content in recommendation scenarios. The real-time clustering center, the short-term clustering center, and the long-term clustering center are used to assist in the optimization of the multi-task learning model in search scenarios and / or recommendation scenarios. The loss function optimization module is used to optimize the real-time network, the short-term network, and the long-term network using loss functions; wherein, the loss function includes at least a main task loss function, an auxiliary task loss function, and a cross-domain alignment loss function.
9. An electronic device, characterized in that, The electronic device includes a memory and a processor. The memory stores program instructions, and when the processor executes the program instructions, it performs the steps of the method according to any one of claims 1-7.
10. A computer storage medium, characterized in that, The computer storage medium stores computer program instructions, which, when executed by a processor, perform the steps of the method according to any one of claims 1-7.
Citation Information
Patent Citations
Comparative learning-based CTR prediction model training method and apparatus, and electronic device
CN116562359A
Text reinforcement learning method and device, electronic equipment and computer storage medium
CN121145979A