Object recommendation method and device, electronic equipment and storage medium

By dividing the object recommendation process into two stages, the problem of redundant copying of user feature data in traditional recommendation systems is solved, the efficiency of object recommendation and GPU utilization are improved, and the unified deployment of training and inference is realized.

CN121542497APending Publication Date: 2026-02-17HANGZHOU NETEASE CLOUD MUSIC TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511374169.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-24
Publication Date
2026-02-17

AI Technical Summary

Technical Problem

In traditional recommendation systems, redundant copying of user feature data leads to a linear increase in GPU memory and computational redundancy with the number of candidate objects, resulting in low GPU utilization, fragmented training and inference modes, and an inability to deploy end-to-end, thus affecting efficiency and performance.

Method used

The object recommendation process is divided into two stages: the first stage generates and caches encoded data based on historical behavior sequences, and the second stage uses the cached encoded data to predict the recommendation probability. The first stage model pre-encodes the historical behavior sequences to generate encoded data and caches it. The second stage uses the encoded data and user feature data to predict the recommendation probability of candidate objects.

Benefits of technology

It avoids computational redundancy in encoded data, improves object recommendation efficiency and GPU utilization, achieves the unification of training and inference, and improves the deployment efficiency and performance of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121542497A_ABST
    Figure CN121542497A_ABST
Patent Text Reader

Abstract

The invention provides an object recommendation method and device, electronic equipment and a storage medium, and the method comprises the steps: obtaining user feature data and a historical behavior sequence if an object recommendation request is received; inputting the historical behavior sequence into a first stage model, pre-coding the historical behavior sequence through the first stage model to obtain coded data, and caching the coded data; and inputting the user feature data, the cached coded data and the candidate object sequence into a second-stage model, predicting recommendation probabilities respectively corresponding to a plurality of to-be-recommended objects in the candidate object sequence based on the user feature data and the coded data through the second-stage model, and recommending the plurality of to-be-recommended objects based on the recommendation probabilities. According to the mode, the object recommendation process is divided into two stages, in the first stage, the coded data is generated and cached based on the historical behavior sequence, and in the second stage, the cached coded data is utilized to predict the recommendation probability of the to-be-recommended article, so that the calculation redundancy of the coded data is avoided, and the object recommendation efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of data processing technology, and in particular to an object recommendation method, apparatus, electronic device, and storage medium. Background Technology

[0002] In recommender systems, traditional ranking models use the SUSI input-output model, which means that each input is the features of a user and an object, and the recommendation probability of the candidate object is calculated through a neural network. However, this calculation method requires the user feature data to be copied repeatedly, which causes the redundancy of GPU memory and computation to increase linearly with the number of candidate objects, and also leads to low GPU utilization. Summary of the Invention

[0003] The purpose of this disclosure is to provide an object recommendation method, apparatus, electronic device, and storage medium to improve object recommendation efficiency.

[0004] In a first aspect, this disclosure provides an object recommendation method, which includes: in response to receiving an object recommendation request, acquiring user feature data and historical behavior sequences; wherein, the historical behavior sequence includes multiple historical behavior data, which includes: objects triggered within a preset historical time period, and object features corresponding to the objects; inputting the historical behavior sequence into a first-stage model, and pre-encoding each historical behavior data in the historical behavior sequence through the first-stage model to obtain encoded data corresponding to the historical behavior sequence, and caching the encoded data; inputting the user feature data, the cached encoded data, and the candidate object sequence into a second-stage model, and predicting the recommendation probability corresponding to each of the multiple objects to be recommended in the candidate object sequence based on the user feature data and the encoded data through the second-stage model, and outputting the recommendation probability corresponding to each of the multiple objects to be recommended in the candidate object sequence; and recommending multiple objects to be recommended based on the recommendation probability corresponding to each of the multiple objects to be recommended in the candidate object sequence.

[0005] Secondly, this disclosure provides an object recommendation device, comprising: a data acquisition module, configured to acquire user feature data and historical behavior sequences in response to receiving an object recommendation request; wherein the historical behavior sequence includes multiple historical behavior data, which include: objects triggered within a preset historical time period, and object features corresponding to the objects; a data encoding module, configured to input the historical behavior sequence into a first-stage model, and pre-encode each historical behavior data in the historical behavior sequence through the first-stage model to obtain encoded data corresponding to the historical behavior sequence, and cache the encoded data; a result prediction module, configured to input the user feature data, the cached encoded data, and the candidate object sequence into a second-stage model, and predict the recommendation probability corresponding to each of the multiple objects to be recommended in the candidate object sequence based on the user feature data and the encoded data through the second-stage model, and output the recommendation probability corresponding to each of the multiple objects to be recommended in the candidate object sequence; and an object recommendation module, configured to recommend multiple objects to be recommended based on the recommendation probability corresponding to each of the multiple objects to be recommended in the candidate object sequence.

[0006] Thirdly, this disclosure provides an electronic device including a processor and a memory, the memory storing machine-executable instructions executable by the processor to implement the above-described object recommendation method.

[0007] Fourthly, this disclosure provides a computer-readable storage medium storing computer-executable instructions that, when invoked and executed by a processor, cause the processor to implement the aforementioned object recommendation method.

[0008] The embodiments disclosed herein bring the following beneficial effects: This disclosure provides an object recommendation method, apparatus, electronic device, and storage medium. First, in response to receiving an object recommendation request, it acquires user feature data and historical behavior sequences. The historical behavior sequences include multiple historical behavior data points, each containing objects triggered within a preset historical time period and their corresponding object features. The historical behavior sequences are then input into a first-stage model, which pre-encodes each historical behavior data point to obtain encoded data corresponding to the historical behavior sequence, and caches this encoded data. Next, the user feature data, the cached encoded data, and a candidate object sequence are input into a second-stage model. Based on the user feature data and the encoded data, the second-stage model predicts the recommendation probabilities of multiple objects to be recommended in the candidate object sequence and outputs these probabilities. Finally, based on these recommendation probabilities, multiple objects to be recommended are recommended. This method divides the object recommendation process into two stages: the first stage generates and caches encoded data based on the historical behavior sequences, and the second stage uses the cached encoded data to predict the recommendation probability of the items to be recommended, thereby avoiding computational redundancy in the encoded data and improving object recommendation efficiency and GPU utilization.

[0009] Other features and advantages of this disclosure will be set forth in the following description, or some features and advantages may be inferred from the description or determined without doubt, or may be learned by practicing the techniques described above.

[0010] To make the above-mentioned objects, features and advantages of this disclosure more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0011] To more clearly illustrate the technical solutions in the specific embodiments of this disclosure or the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this disclosure. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0012] Figure 1 A flowchart of an object recommendation method provided in this embodiment of the disclosure; Figure 2 A comparison diagram of conventional model training and model training of this disclosure provided for embodiments of the present disclosure; Figure 3 An overall architecture diagram provided for an embodiment of this disclosure; Figure 4 This is a schematic diagram of the structure of an object recommendation device provided in an embodiment of the present disclosure; Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Detailed Implementation

[0013] To make the objectives, technical solutions, and advantages of the embodiments of this disclosure clearer, the technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this disclosure, and not all embodiments. The components of the embodiments of this disclosure described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.

[0014] Therefore, the following detailed description of the embodiments of this disclosure provided in the accompanying drawings is not intended to limit the scope of the claimed disclosure, but merely to illustrate selected embodiments of the disclosure. All other embodiments obtained by those skilled in the art based on the embodiments of this disclosure without inventive effort are within the scope of protection of this disclosure.

[0015] In recommender systems, traditional ranking models employ a SUSI (Single User, Single Item) input-output model, where each input consists of the features of one user and one item, and the neural network calculates results for tasks such as click probabilities. During network training, the first dimension of the input tensor is expanded to the batch size to improve efficiency. In the online service phase, to obtain a single user's ratings for multiple candidate items, a SUMI (Single User, Multiple Items) model is often used for inference, where user features are copied to match the number of candidate items.

[0016] When existing recommender systems migrate to larger models (Transformer architecture), they often use sequences as input to the Transformer architecture. However, as the number of model layers and the length of the sequences increase, training and inference face the following problems: 1. Training efficiency bottleneck: The traditional SUSI sample format causes user features to be repeatedly copied during batch processing. The redundancy of GPU memory and computation increases linearly with the number of candidate items. This means that the transformer architecture, which has the highest computational complexity, needs to extract interest from the same user's sequence multiple times. However, the change in user sequence is not significant at different times, resulting in low GPU utilization and artificially high training FLOPs. 2. Inference Latency Bottleneck: Traditional recommendation models use SUMI to organize user features and candidate item sets during inference. However, this results in significant redundant computations in the transformer architecture. While online recommendation models use KV-Cache to simplify transformer computations, traditional KV-Cache cannot implement a targeted attention mechanism between the candidate item set and the user's historical behavior sequence, making it unusable directly.

[0017] 3. Training-Inference Paradigm Disconnection: During the training phase, samples are split according to SUSI, but during the inference phase, samples need to be organized according to SUMI. The difference in format between the two leads to additional conversion overhead, making end-to-end deployment impossible and potentially affecting the online performance of the model.

[0018] To address the aforementioned issues, this disclosure provides an object recommendation method, apparatus, electronic device, and storage medium, which can be applied to scenarios involving object recommendation or user action prediction.

[0019] To facilitate understanding of the embodiments of this disclosure, a method for recommending objects provided by the embodiments of this disclosure will first be described in detail, such as... Figure 1 As shown, the method includes the following specific steps: Step S102: In response to receiving an object recommendation request, obtain user feature data and historical behavior sequence; wherein, the historical behavior sequence includes multiple historical behavior data, the historical behavior data includes: objects triggered within a preset historical time period, and object features corresponding to those objects.

[0020] In practical implementation, the aforementioned object recommendation request can be a request sent by the user to the target server through the client. For example, the user can send an object recommendation request by triggering a control or button in the interactive interface provided by the client. Alternatively, the object recommendation request can be a request triggered periodically by the target server, that is, triggered once at fixed intervals. When the target server receives an object recommendation request, it will obtain the corresponding user feature data and historical behavior sequences, so as to subsequently predict the user's preferences using this data, thereby accurately recommending objects that the user prefers.

[0021] The aforementioned user characteristic data may include, but is not limited to, statistical information such as user age, gender, city, music genre preference, and language preference. The aforementioned historical behavior sequence includes multiple historical behavior data sets, each containing an object triggered by the user within a preset historical time period and the object's characteristics. This preset historical time period can be a fixed historical period or a period prior to receiving an object recommendation request; for example, it could be 7 days or 30 days prior to receiving the request. The triggered objects refer to objects that the user clicked, favorited, or browsed through the target client within the preset historical time period. The object characteristics may include, but are not limited to, attribute information such as object color, object type, and object publication time.

[0022] Step S104: Input the historical behavior sequence into the first-stage model, and pre-encode each historical behavior data in the historical behavior sequence through the first-stage model to obtain the encoded data corresponding to the historical behavior sequence, and cache the encoded data.

[0023] In practical implementation, the aforementioned first-stage model can be a pre-trained deep learning model, neural network model, or generative model, etc. Specifically, the first-stage model pre-encodes each historical behavior data in the historical behavior sequence. This pre-encoding can be done using preset encoding rules or model parameters. The preset encoding rules can be determined according to R&D needs. For example, the preset encoding rules could be multiplying preset weights by the historical behavior data, or converting the historical behavior data into preset characters, etc.

[0024] The encoded data can be stored in memory or in a pre-defined database so that it can be retrieved directly from the storage location later.

[0025] Step S106: Input user feature data, cached encoded data and candidate object sequence into the second-stage model. The second-stage model predicts the recommendation probability of multiple objects to be recommended in the candidate object sequence based on user feature data and encoded data, and outputs the recommendation probability of multiple objects to be recommended in the candidate object sequence.

[0026] In the specific implementation, the above candidate object sequence contains multiple objects to be recommended. These multiple objects to be recommended can be of all types, or they can be objects that have not been triggered by the user.

[0027] The second-stage model described above can employ neural network models, deep learning models, or generative models, etc. This second-stage model is trained using a training dataset and a pre-defined loss function. Based on user feature data and encoded data, it predicts the recommendation probability for each candidate object in the candidate object sequence and outputs the predicted recommendation probability for each candidate object as the data result.

[0028] Step S108: Recommend multiple objects to be recommended based on their respective recommendation probabilities in the candidate object sequence.

[0029] In practical implementation, objects with a recommendation probability greater than a preset probability value in the candidate object sequence can be stored in the user recommendation list; alternatively, the objects in the candidate object sequence can be sorted in descending order of recommendation probability, and the sorted result can be used as the user recommendation list; or a preset number of objects at the top of the sorted result can be stored in the user recommendation list. Then, the user recommendation list is sent to the client that sent the object recommendation request or the designated device to recommend objects from the user recommendation list to the user.

[0030] The object recommendation method provided in this disclosure divides the object recommendation process into two stages. The first stage generates and caches encoded data based on historical behavior sequences, and the second stage uses the cached encoded data to predict the recommendation probability of the item to be recommended, thereby avoiding computational redundancy of encoded data and improving object recommendation efficiency and GPU utilization.

[0031] The following examples describe a method for generating and caching encoded data.

[0032] Specifically, the first-stage model mentioned above includes at least one layer of network structure. Based on this, the specific process of precoding each historical behavior data in the historical behavior sequence through the first-stage model to obtain the encoded data corresponding to the historical behavior sequence and caching the encoded data includes: precoding each historical behavior data in the historical behavior sequence through each layer of network structure included in the first-stage model to obtain the encoding result corresponding to each layer of network structure; determining the encoding result corresponding to each layer of network structure as the encoded data corresponding to the historical behavior sequence and caching the encoded data.

[0033] In practical implementation, only the historical behavior sequence is input into the first-stage model, and the corresponding encoded data is output. Specifically, the first-stage model includes one or more network structures. When the first-stage model includes multiple network structures, the encoding result of each network structure needs to be calculated. The first network structure encodes the historical behavior sequence, and the encoded data of other network structures are influenced by the output of the previous layer. Specifically, the encoded data corresponding to the historical behavior sequence includes the encoding result of each network structure. After obtaining the encoded data, it is cached in a preset storage location for direct use by the second-stage model.

[0034] In an optional embodiment, the specific process of precoding each historical behavior data in the historical behavior sequence through each layer of the network structure included in the first-stage model to obtain the encoding result corresponding to each layer of the network structure can be achieved through the following steps 10-13: Step 10: Starting from the first layer of the first-stage model, pre-encode each historical behavior data in the historical behavior sequence through the current layer network structure to obtain the encoding result and output sequence corresponding to the current layer network structure; wherein, the output sequence is used as input to the next layer network structure of the current layer network structure.

[0035] In practical implementation, each layer of the network structure in the first-stage model needs to be used as the current mesh structure. The first layer of the network structure pre-encodes the historical behavior data in the original historical behavior sequence to obtain the encoding result corresponding to the first layer of the network structure. The network structures other than the first layer of the network structure pre-encode the new historical behavior sequence to obtain encoded data. The new historical behavior data here is also the output sequence of the previous layer of the network structure.

[0036] In an optional embodiment, the specific process of precoding each historical behavior data in the historical behavior sequence using the current layer network structure to obtain the encoding result and output sequence corresponding to the current layer network structure may include: obtaining the first network weight, second network weight, and third network weight corresponding to the current layer network structure; multiplying each historical behavior data in the historical behavior sequence with the first network weight to obtain key data; multiplying each historical behavior data in the historical behavior sequence with the second network weight to obtain value data; determining the key data and value data as the encoding result corresponding to the current layer network structure; multiplying each historical behavior data in the historical behavior sequence with the third network weight to obtain the target product; and determining the output sequence corresponding to the current layer network structure based on the key data, value data, and target product.

[0037] In practical implementation, the first, second, and third network weights corresponding to each network layer are independently initialized and trainable neural network weights. Specifically, the product of the historical behavior sequence and the first network weight corresponding to the current network layer can be used to determine the key data corresponding to the current network layer, and the product of the historical behavior sequence and the second network weight corresponding to the current network layer can be used to determine the value data corresponding to the current network layer.

[0038] To calculate the encoding results of network structures other than the first layer in the first-stage model, the historical behavior sequence needs to be multiplied by the third weight to obtain the target product. Then, the attention score is obtained by calculating the dot product of the target product and the key data. The attention score is scaled and normalized by the Softmax function to obtain the target weight. Finally, the elements in the value data are weighted and summed using the target weight to obtain the output sequence of the current layer network structure.

[0039] Step 11: Determine whether the current layer network structure is the last layer network structure of the first stage model. If not, proceed to step 12; if so, proceed to step 13.

[0040] Step 12: Take the output sequence of the current layer network structure as the new historical behavior sequence, take the next layer network structure of the current layer network structure as the new current layer network structure, and continue to execute step 10.

[0041] If the current layer network structure is not the last layer network structure in the first stage model, it is necessary to continue to calculate the encoding result corresponding to the next layer network structure. Therefore, the output sequence of the current layer network structure needs to be used as the new historical behavior sequence, that is, the output sequence of the current layer network structure is used as the input sequence of the next layer network structure, and the next layer network structure is used as the new current layer network structure. Then, step 10 is executed, that is, each historical behavior data in the new historical behavior sequence is pre-encoded through the new current layer network structure to obtain the encoding result and output sequence corresponding to the new current layer network structure. Then, it is necessary to continue to determine whether the new current layer network structure is the last layer network structure in the first stage model.

[0042] Step 13: Output the encoding results corresponding to each layer of the network structure.

[0043] In the specific implementation, when the encoding result corresponding to the last layer of the network structure in the first stage model is calculated, it is necessary to output the encoding result corresponding to each layer of the network structure in the first stage model, and determine the encoding result corresponding to all network structures as the encoding data corresponding to the historical behavior sequence, and then cache the encoding data corresponding to the historical behavior sequence in memory.

[0044] In an optional embodiment, for each historical behavior data in the historical behavior sequence, the key data, value data, and target product corresponding to each historical behavior data are calculated using the following formula. The key data corresponding to each historical behavior data is integrated to obtain the key data corresponding to the current layer network structure, and the value data corresponding to each historical behavior data is integrated to obtain the value data corresponding to the current layer network structure.

[0045]

[0046]

[0047] in, , and They represent the first l The weights of the third network, the first network, and the second network corresponding to the layered network structure; Indicates the first l The t-th historical behavior data in the historical behavior sequence corresponding to the -1 layer network structure; Indicates the first l The t-th element in the target product corresponding to the layer network structure. Indicates the first l The t-th element in the key data corresponding to the layer network structure. Indicates the first l The t-th element in the value data corresponding to the layer network structure. Where, if the t-th element... l If the -1 layer network structure is the first layer network structure, then the... l The historical behavior sequence corresponding to the -1 layer network structure is also the original historical behavior sequence obtained. If the -1 layer network structure is the original historical behavior sequence obtained... l If a -1 layer network structure is a network structure with more than one layer, then the -1 layer network structure is a network structure with more than one layer. l The historical behavior sequence corresponding to the -1 layer network structure is the... l -1 layer network structure column corresponding to the output sequence.

[0048] Furthermore, the first can be calculated using the following formula. l The target weights corresponding to the layered network structure:

[0049] Wherein, the target weights are a matrix. Indicates the first l The t-th element in the target weights corresponding to the layer network structure; The dimension of the target weight is represented, which is also the dimension of the target product or the dimension of the key data; m represents the dimension of the historical behavior sequence.

[0050] Then, the first is determined by the following formula. l The output sequence corresponding to the layer network structure:

[0051] in, Indicates the first l The t-th historical behavior data in the historical behavior sequence corresponding to the +1 layer network structure, that is, the t-th historical behavior data. l The t-th element in the output sequence corresponding to the layer network structure.

[0052] During this process, the key and value data of each layer of the network structure are cached for later use:

[0053] Among them, KV Cache (l) Indicates the first l The encoding results corresponding to the layer network structure.

[0054] The encoded data corresponding to the historical behavior sequences generated in the above method can be cached so that the cached encoded data can be used to perform batch scoring on the recommended objects in the future, reducing redundant calculations.

[0055] The following examples illustrate how recommendation probabilities are generated.

[0056] Specifically, the process described above, which uses the second-stage model to predict the recommendation probabilities of multiple objects to be recommended in the candidate object sequence based on user feature data and encoded data, and outputs the recommendation probabilities of multiple objects to be recommended in the candidate object sequence, may include: using the second-stage model to perform self-attention calculation on the candidate object sequence based on the encoded data to obtain a state vector, and based on the state vector and user feature data, obtaining and outputting the recommendation probabilities of multiple objects to be recommended in the candidate object sequence.

[0057] In the specific implementation, after the user feature data, encoded data and candidate object sequence are input into the second-stage model, the second-stage model calculates the self-attention of the encoded data to obtain the state vector of the candidate object sequence. Then, the state vector is concatenated with the user feature data to obtain the concatenated data. This concatenated data is processed by an MLP structure with an output dimension of 1 to obtain the recommendation probability corresponding to each recommended object in the candidate object sequence.

[0058] In an optional embodiment, the specific process of performing self-attention calculation on the candidate object sequence based on the encoded data using the second-stage model to obtain a state vector, and obtaining and outputting the recommendation probabilities corresponding to multiple objects to be recommended in the candidate object sequence based on the state vector and user feature data, may include: segmenting the candidate object sequence into multiple sub-sequences using the second-stage model; concatenating the encoded data with the current sub-sequence for each of the multiple sub-sequences to obtain concatenated data; performing self-attention calculation on the concatenated data to obtain the state vector corresponding to the current sub-sequence; obtaining the recommendation probabilities corresponding to multiple objects to be recommended in the current sub-sequence based on the state vector of the current sub-sequence and user feature data; concatenating the recommendation probabilities corresponding to the multiple sub-sequences to obtain and outputting the recommendation probabilities corresponding to the multiple objects to be recommended in the candidate object sequence.

[0059] In practical implementation, for faster computation, the candidate object sequence can be divided into multiple slices according to a pre-defined slice size. Each slice is also a subsequence, and the number of elements in a subsequence matches the slice size. For example, the candidate object sequence is... According to the pre-set fragment size The data is split into c+1 partitions, each containing b elements.

[0060]

[0061]

[0062]

[0063] Among them, if Cannot be Divisible ( ( ), you need to fill the parts that are not divisible with 0, such as:

[0064] For each subsequence, the subsequence needs to be concatenated with the encoded data to form a SUMI form. Target attention operation based on the encoded data is then performed to obtain a score list for each object to be recommended within the subsequence. Concatenating the score lists of all subsequences yields the score result for the candidate object sequence. The user recommendation list is obtained by sorting the scores corresponding to each object to be recommended in the score results (here, the score is equivalent to the recommendation probability mentioned above).

[0065] The following examples illustrate how to train a recommendation model.

[0066] Specifically, the first-stage model and the second-stage model mentioned above are trained through the following steps 20-21: Step 20: Obtain the training dataset; wherein the training dataset includes multiple training samples, including: user feature data, historical behavior sequences within a first preset historical time period, object sequences corresponding to objects that appeared within a second preset historical time period, and label sequences corresponding to the object sequences; wherein the label sequence is used to indicate the object label corresponding to each object in the object sequence, and the object label is used to indicate whether the object was triggered.

[0067] The first preset historical time period and the second preset historical time period are different time periods. Usually, the first preset historical time period is earlier than the second preset historical time period.

[0068] Step 21: Based on the training dataset and the preset loss function, train the first-stage model and the second-stage model to obtain the trained first-stage model and the trained second-stage model.

[0069] The specific function corresponding to the above-mentioned preset loss function can be determined according to the research and development needs. For example, the loss function can be a cumulative loss function or an information entropy loss function.

[0070] In practical applications, the specific implementation process of step 21 above includes: obtaining target training samples from the training dataset; inputting the historical behavior sequences in the target training samples into the first-stage model and outputting the encoded data corresponding to the historical behavior sequences in the target training samples; inputting the encoded data corresponding to the historical behavior in the target training samples, the user feature data and object sequences in the target training samples into the second-stage model and obtaining the output result; determining the model loss value based on the output result, the label sequence in the target training samples and the preset loss function; adjusting the model parameters of the first-stage model and the second-stage model based on the model loss value, and continuing to execute the step of obtaining target training samples from the training dataset until the model loss value meets the preset conditions, thereby obtaining the first-stage model and the second-stage model that have been trained.

[0071] In practice, the target training samples obtained from the training dataset are different each time. The model loss value mentioned above is determined based on the difference between the output calculated by the preset loss function and the label sequence in the target training samples. Generally, the greater the difference, the greater the model loss value.

[0072] In practical applications, for the traditional SUSI organization of samples, there is a large overlap in the historical behavior sequences of multiple samples of the same user. Based on the characteristics of transformer, the original row-level samples are uniformly aggregated into user-level tensors. That is, all the objects to be recommended and their labels of the same user are compressed into a fixed-length object sequence and the corresponding label sequence, and only one copy of the user feature data is retained.

[0073] Suppose that the user [during the second preset historical time period] , [For multiple objects] All of them have been exposed, and the corresponding object tags are as follows: At this point, the user feature data f_context remains essentially unchanged, and the user... The historical sequence of events corresponding to previous historical times is as follows ,exist The historical sequence of events corresponding to previous historical times is as follows , and have ∈ Based on this, it is determined that all historical behavior sequences of the user within the historical time period prior to t_max contain [the following information / content]. In most cases It won't be more than It contains too many objects, therefore use As [ , The user's historical behavior sequence within a time period does not result in much information loss.

[0074] Because historical behavior sequences were used You can [ , All objects within a given time period and their corresponding object labels are compressed into two lists: Object Sequence I = { } and label sequence L={ This disclosure considers using an n-layer transformer model (equivalent to the first-stage model mentioned above) to first process the historical behavior sequence. To perform self-attention computation, the self-attention process during training needs to be divided into two stages: the pre-encoding stage and the scoring stage.

[0075] In the precoding stage, the historical behavior sequences are precoded to generate corresponding encoded data, and this encoded data is cached. This process can be referenced from the precoding process in the above-described model execution stage embodiment, and will not be repeated here.

[0076] After obtaining the KV Cache, which contains the encoded data corresponding to the user's historical behavior sequence, the KV Cache can be directly used to cache the object sequence I={ Each object in the sequence I computes a self-attention output. Specifically, assume the object sequence I = { After reusing the KV-Cache for self-attention calculation, the state vector O={ }∈R (b ×d) Where d is the dimension of the state vector, the state vector is concatenated with the user feature data and then passed through an MLP structure with an output dimension of 1 to obtain the list of predicted scores S={ for the object sequence. } (that is, the output of the second-stage model), where for any score in the predicted score list (equivalent to the recommendation probability mentioned above). All of them are: =MLP(concat(f_context, Then, the preset loss function is summed to obtain the model loss value:

[0077] Where Loss represents the model loss value. Indicates the preset score list number i The score corresponding to each element Indicates the first label in the label sequence i The BCELoss expression for the object tag corresponding to each element is:

[0078] like Figure 2 The diagram shown is a comparison between a traditional model training method and the model training method of this disclosure, as provided in an embodiment of the present disclosure. Figure 2 The image above is a schematic diagram of traditional model training. Figure 2 The image below is a schematic diagram of the model training disclosed herein. Figure 2 In this diagram, user1 represents a user, user1 basic features represent user feature data, historical sequence features represent historical behavior sequences, and basic features represent object sequences. The training method disclosed herein can reuse historical behavior sequences, thereby compressing user historical behavior sequences by a factor of b, and also accelerating model training by a factor of b.

[0079] like Figure 3 The diagram shown is an overall architecture diagram provided by an embodiment of this disclosure. Figure 3The process is divided into a training phase and an inference settlement phase. First, in the training phase, user consumption results are recorded to obtain historical behavior sequences. These sequences are then organized into SUSI sample format using a dynamic compression algorithm to obtain the training dataset. The first and second stage models are trained using this dataset and then deployed in the inference phase. During inference based on the first and second stage models, the inference phase is further divided into two stages: Stage 1 is the historical behavior sequence pre-encoding stage, where only the historical behavior sequence is input into the first stage model upon receiving an object recommendation request, resulting in the output of the corresponding KV Cache (equivalent to the encoded data mentioned above); Stage 2 is the reuse stage: the candidate object sequence (equivalent to...) is pre-encoded into the first stage model. Figure 3 The candidate object pool and user feature data are arranged in SUMI form and input into the KV Cache and the candidate object sequence into the second-stage model so that the second-stage model can directly output the scoring results of each object to be recommended in the candidate object sequence. Then the scoring results are sorted to obtain the recommendation results (equivalent to the user recommendation list mentioned above), and then the recommendation results are returned to the user.

[0080] The method for dynamically compressing training data disclosed herein constructs a training data format adapted to the SUMI model by aggregating user-related object features and labels, while introducing a dependency list to ensure causality. Furthermore, the encoder-level data caching and block parallelism techniques in this approach fuse Transformer blocks to achieve parallel computation, reducing redundant computations through two-stage forward propagation and improving training and inference efficiency. In addition, the unified framework design for training and inference ensures consistency between training data processing and online inference modes, reducing performance losses caused by deployment differences.

[0081] Corresponding to the above method embodiments, this disclosure provides an object recommendation device, such as... Figure 4 As shown, the device includes: The data acquisition module 40 is used to acquire user feature data and historical behavior sequences in response to receiving an object recommendation request; wherein, the historical behavior sequence includes multiple historical behavior data, which includes: objects triggered within a preset historical time period, and the object features corresponding to the objects.

[0082] The data encoding module 41 is used to input the historical behavior sequence into the first-stage model, and to pre-encode each historical behavior data in the historical behavior sequence through the first-stage model to obtain the encoded data corresponding to the historical behavior sequence, and to cache the encoded data.

[0083] The result prediction module 42 is used to input user feature data, cached encoded data and candidate object sequence into the second-stage model. The second-stage model predicts the recommendation probability of multiple objects to be recommended in the candidate object sequence based on user feature data and encoded data, and outputs the recommendation probability of multiple objects to be recommended in the candidate object sequence.

[0084] The object recommendation module 43 is used to recommend multiple objects based on the recommendation probabilities corresponding to multiple objects in the candidate object sequence.

[0085] The aforementioned object recommendation device divides the object recommendation process into two stages. The first stage generates and caches encoded data based on historical behavior sequences, and the second stage uses the cached encoded data to predict the recommendation probability of the item to be recommended. This avoids computational redundancy of the encoded data and improves the efficiency of object recommendation and GPU utilization.

[0086] Furthermore, the first-stage model mentioned above includes at least one layer of network structure; based on this, the data encoding module 41 is used to: pre-encode each historical behavior data in the historical behavior sequence through each layer of network structure included in the first-stage model, to obtain the encoding result corresponding to each layer of network structure; determine the encoding result corresponding to each layer of network structure as the encoded data corresponding to the historical behavior sequence, and cache the encoded data.

[0087] Furthermore, the aforementioned data encoding module 41 is also used to: starting from the first layer network structure of the first-stage model, pre-encode each historical behavior data in the historical behavior sequence through the current layer network structure to obtain the encoding result and output sequence corresponding to the current layer network structure; wherein, the output sequence is used as input to the next layer network structure of the current layer network structure; determine whether the current layer network structure is the last layer network structure of the first-stage model, if not, take the output sequence of the current layer network structure as the new historical behavior sequence, take the next layer network structure of the current layer network structure as the new current layer network structure, and continue to execute the step of pre-encoding each historical behavior data in the historical behavior sequence through the current layer network structure to obtain the encoding result and output sequence corresponding to the current layer network structure; if so, output the encoding result corresponding to each layer network structure.

[0088] Furthermore, the aforementioned data encoding module 41 is also used to: obtain the first network weight, the second network weight, and the third network weight corresponding to the current layer network structure; multiply each historical behavior data in the historical behavior sequence with the first network weight to obtain key data; multiply each historical behavior data in the historical behavior sequence with the second network weight to obtain value data; determine the key data and value data as the encoding result corresponding to the current layer network structure; multiply each historical behavior data in the historical behavior sequence with the third network weight to obtain the target product; and determine the output sequence corresponding to the current layer network structure based on the key data, value data, and target product.

[0089] Furthermore, the aforementioned result prediction module 42 is used to: perform self-attention calculation on the candidate object sequence based on the encoded data through the second-stage model to obtain a state vector, and obtain and output the recommendation probability corresponding to multiple objects to be recommended in the candidate object sequence based on the state vector and user feature data.

[0090] Furthermore, the aforementioned result prediction module 42 is also used to: segment the candidate object sequence using the second-stage model to obtain multiple sub-sequences; for each sub-sequence, concatenate the encoded data with the current sub-sequence to obtain concatenated data; perform self-attention calculation on the concatenated data to obtain the state vector corresponding to the current sub-sequence; and obtain the recommendation probability corresponding to each of the multiple objects to be recommended in the current sub-sequence based on the current sub-sequence state vector and user feature data; and concatenate the recommendation probabilities corresponding to each of the multiple sub-sequences to obtain and output the recommendation probabilities corresponding to each of the multiple objects to be recommended in the candidate object sequence.

[0091] Furthermore, the aforementioned device also includes a model training module, used for: acquiring a training dataset; wherein the training dataset includes multiple training samples, the training samples including: user feature data, historical behavior sequences within a first preset historical time period, object sequences corresponding to objects that appeared within a second preset historical time period, and label sequences corresponding to the object sequences; wherein the label sequences are used to indicate the object labels corresponding to each object in the object sequences, and the object labels are used to indicate whether the object has been triggered; and training a first-stage model and a second-stage model based on the training dataset and a preset loss function to obtain the trained first-stage model and the trained second-stage model.

[0092] Furthermore, the aforementioned model training module is also used for: obtaining target training samples from the training dataset; inputting historical behavior sequences from the target training samples into the first-stage model and outputting the encoded data corresponding to the historical behavior sequences from the target training samples; inputting the encoded data corresponding to the historical behavior sequences from the target training samples, along with the user feature data and object sequences from the target training samples, into the second-stage model to obtain the output result; determining the model loss value based on the output result, the label sequence from the target training samples, and the preset loss function; adjusting the model parameters of the first-stage model and the second-stage model based on the model loss value, and continuing to execute the step of obtaining target training samples from the training dataset until the model loss value meets the preset conditions, thereby obtaining the trained first-stage model and the trained second-stage model.

[0093] The object recommendation device provided in this disclosure has the same implementation principle and technical effect as the aforementioned method embodiment. For the sake of brevity, any parts not mentioned in the device embodiment can be referred to the corresponding content in the aforementioned method embodiment.

[0094] This disclosure also provides an electronic device, such as... Figure 5 As shown, the electronic device includes a processor and a memory, the memory storing machine-executable instructions that can be executed by the processor to implement the above-described object recommendation method.

[0095] Specifically, the above object recommendation method includes: in response to receiving an object recommendation request, acquiring user feature data and historical behavior sequences; wherein, the historical behavior sequence includes multiple historical behavior data, which includes: objects triggered within a preset historical time period, and object features corresponding to the objects; inputting the historical behavior sequence into a first-stage model, and pre-encoding each historical behavior data in the historical behavior sequence through the first-stage model to obtain encoded data corresponding to the historical behavior sequence, and caching the encoded data; inputting the user feature data, the cached encoded data, and the candidate object sequence into a second-stage model, and predicting the recommendation probability corresponding to each of the multiple objects to be recommended in the candidate object sequence based on the user feature data and the encoded data through the second-stage model, and outputting the recommendation probability corresponding to each of the multiple objects to be recommended in the candidate object sequence; and recommending multiple objects to be recommended based on the recommendation probability corresponding to each of the multiple objects to be recommended in the candidate object sequence.

[0096] The object recommendation method described above divides the object recommendation process into two stages. The first stage generates and caches encoded data based on historical behavior sequences. The second stage uses the cached encoded data to predict the recommendation probability of the item to be recommended, thereby avoiding computational redundancy of encoded data and improving the efficiency of object recommendation and GPU utilization.

[0097] In an optional embodiment, the first-stage model includes at least one layer of network structure. Based on this, the step of precoding each historical behavior data in the historical behavior sequence using the first-stage model to obtain the encoded data corresponding to the historical behavior sequence and caching the encoded data includes: precoding each historical behavior data in the historical behavior sequence using each layer of network structure included in the first-stage model to obtain the encoding result corresponding to each layer of network structure; determining the encoding result corresponding to each layer of network structure as the encoded data corresponding to the historical behavior sequence and caching the encoded data.

[0098] In an optional embodiment, the step of precoding each historical behavior data in the historical behavior sequence using each layer of the network structure included in the first-stage model to obtain the encoding result corresponding to each layer of the network structure includes: starting from the first layer of the network structure of the first-stage model, precoding each historical behavior data in the historical behavior sequence using the current layer of the network structure to obtain the encoding result and output sequence corresponding to the current layer of the network structure; wherein, the output sequence is used as input to the next layer of the network structure of the current layer of the network structure; determining whether the current layer of the network structure is the last layer of the network structure of the first-stage model; if not, taking the output sequence of the current layer of the network structure as the new historical behavior sequence, taking the next layer of the network structure of the current layer of the network structure as the new current layer of the network structure, and continuing to execute the step of precoding each historical behavior data in the historical behavior sequence using the current layer of the network structure to obtain the encoding result and output sequence corresponding to the current layer of the network structure; if yes, outputting the encoding result corresponding to each layer of the network structure.

[0099] In an optional embodiment, the steps described above for precoding each historical behavior data in the historical behavior sequence using the current layer network structure to obtain the encoding result and output sequence corresponding to the current layer network structure include: obtaining the first network weight, second network weight, and third network weight corresponding to the current layer network structure; multiplying each historical behavior data in the historical behavior sequence with the first network weight to obtain key data; multiplying each historical behavior data in the historical behavior sequence with the second network weight to obtain value data; determining the key data and value data as the encoding result corresponding to the current layer network structure; multiplying each historical behavior data in the historical behavior sequence with the third network weight to obtain the target product; and determining the output sequence corresponding to the current layer network structure based on the key data, value data, and target product.

[0100] In an optional embodiment, the steps described above, which predict the recommendation probabilities of multiple objects to be recommended in the candidate object sequence based on user feature data and encoded data using the second-stage model, and output the recommendation probabilities of multiple objects to be recommended in the candidate object sequence, include: using the second-stage model to perform self-attention calculation on the candidate object sequence based on the encoded data to obtain a state vector, and based on the state vector and user feature data, obtaining and outputting the recommendation probabilities of multiple objects to be recommended in the candidate object sequence.

[0101] In an optional embodiment, the steps described above, which involve performing self-attention calculation on the candidate object sequence based on the encoded data using the second-stage model to obtain a state vector, and obtaining and outputting the recommendation probabilities corresponding to multiple objects to be recommended in the candidate object sequence based on the state vector and user feature data, include: segmenting the candidate object sequence using the second-stage model to obtain multiple sub-sequences; concatenating the encoded data with the current sub-sequence for each of the multiple sub-sequences to obtain concatenated data; performing self-attention calculation on the concatenated data to obtain the state vector corresponding to the current sub-sequence; obtaining the recommendation probabilities corresponding to multiple objects to be recommended in the current sub-sequence based on the state vector of the current sub-sequence and user feature data; and concatenating the recommendation probabilities corresponding to the multiple sub-sequences to obtain and outputting the recommendation probabilities corresponding to the multiple objects to be recommended in the candidate object sequence.

[0102] In an optional embodiment, the first-stage model and the second-stage model described above are trained in the following manner: A training dataset is obtained; wherein the training dataset includes multiple training samples, which include: user feature data, historical behavior sequences within a first preset historical time period, object sequences corresponding to objects that appeared within a second preset historical time period, and label sequences corresponding to the object sequences; wherein the label sequence is used to indicate the object label corresponding to each object in the object sequence, and the object label is used to indicate whether the object was triggered; based on the training dataset and a preset loss function, the first-stage model and the second-stage model are trained to obtain the trained first-stage model and the trained second-stage model.

[0103] In an optional embodiment, the steps of training a first-stage model and a second-stage model based on a training dataset and a preset loss function to obtain a trained first-stage model and a trained second-stage model include: obtaining target training samples from the training dataset; inputting historical behavior sequences from the target training samples into the first-stage model and outputting encoded data corresponding to the historical behavior sequences from the target training samples; inputting the encoded data corresponding to the historical behavior sequences from the target training samples, along with user feature data and object sequences from the target training samples, into the second-stage model to obtain an output result; determining the model loss value based on the output result, the label sequence from the target training samples, and the preset loss function; adjusting the model parameters of the first-stage model and the second-stage model based on the model loss value, and continuing to execute the step of obtaining target training samples from the training dataset until the model loss value meets the preset conditions, thereby obtaining a trained first-stage model and a trained second-stage model.

[0104] Furthermore, Figure 5 The electronic device shown also includes a bus 102 and a communication interface 103, with the processor 101, the communication interface 103 and the memory 100 connected via the bus 102.

[0105] The memory 100 may include high-speed random access memory (RAM) and may also include non-volatile memory, such as at least one disk storage device. Communication between this system network element and at least one other network element is achieved through at least one communication interface 103 (which can be wired or wireless), such as the Internet, wide area network, local area network, metropolitan area network, etc. The bus 102 may be an ISA bus, PCI bus, or EISA bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 5 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.

[0106] Processor 101 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of processor 101 or by instructions in software form. The processor 101 can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it can 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 disclosure. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this disclosure can be directly manifested as execution by a hardware decoding processor, or execution by a combination of hardware and software modules in the decoding processor. The software module can reside in a readily available storage medium in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory 100, and processor 101 reads information from memory 100 and, in conjunction with its hardware, completes the steps of the method described in the foregoing embodiments.

[0107] This disclosure also provides a computer-readable storage medium storing computer-executable instructions. When these computer-executable instructions are invoked and executed by a processor, they cause the processor to implement the above-described object recommendation method. For specific implementation details, please refer to the method embodiments, which will not be repeated here.

[0108] Specifically, the above object recommendation method includes: in response to receiving an object recommendation request, acquiring user feature data and historical behavior sequences; wherein, the historical behavior sequence includes multiple historical behavior data, which includes: objects triggered within a preset historical time period, and object features corresponding to the objects; inputting the historical behavior sequence into a first-stage model, and pre-encoding each historical behavior data in the historical behavior sequence through the first-stage model to obtain encoded data corresponding to the historical behavior sequence, and caching the encoded data; inputting the user feature data, the cached encoded data, and the candidate object sequence into a second-stage model, and predicting the recommendation probability corresponding to each of the multiple objects to be recommended in the candidate object sequence based on the user feature data and the encoded data through the second-stage model, and outputting the recommendation probability corresponding to each of the multiple objects to be recommended in the candidate object sequence; and recommending multiple objects to be recommended based on the recommendation probability corresponding to each of the multiple objects to be recommended in the candidate object sequence.

[0109] The object recommendation method described above divides the object recommendation process into two stages. The first stage generates and caches encoded data based on historical behavior sequences. The second stage uses the cached encoded data to predict the recommendation probability of the item to be recommended, thereby avoiding computational redundancy of encoded data and improving the efficiency of object recommendation and GPU utilization.

[0110] In an optional embodiment, the first-stage model includes at least one layer of network structure. Based on this, the step of precoding each historical behavior data in the historical behavior sequence using the first-stage model to obtain the encoded data corresponding to the historical behavior sequence and caching the encoded data includes: precoding each historical behavior data in the historical behavior sequence using each layer of network structure included in the first-stage model to obtain the encoding result corresponding to each layer of network structure; determining the encoding result corresponding to each layer of network structure as the encoded data corresponding to the historical behavior sequence and caching the encoded data.

[0111] In an optional embodiment, the step of precoding each historical behavior data in the historical behavior sequence using each layer of the network structure included in the first-stage model to obtain the encoding result corresponding to each layer of the network structure includes: starting from the first layer of the network structure of the first-stage model, precoding each historical behavior data in the historical behavior sequence using the current layer of the network structure to obtain the encoding result and output sequence corresponding to the current layer of the network structure; wherein, the output sequence is used as input to the next layer of the network structure of the current layer of the network structure; determining whether the current layer of the network structure is the last layer of the network structure of the first-stage model; if not, taking the output sequence of the current layer of the network structure as the new historical behavior sequence, taking the next layer of the network structure of the current layer of the network structure as the new current layer of the network structure, and continuing to execute the step of precoding each historical behavior data in the historical behavior sequence using the current layer of the network structure to obtain the encoding result and output sequence corresponding to the current layer of the network structure; if yes, outputting the encoding result corresponding to each layer of the network structure.

[0112] In an optional embodiment, the steps described above for precoding each historical behavior data in the historical behavior sequence using the current layer network structure to obtain the encoding result and output sequence corresponding to the current layer network structure include: obtaining the first network weight, second network weight, and third network weight corresponding to the current layer network structure; multiplying each historical behavior data in the historical behavior sequence with the first network weight to obtain key data; multiplying each historical behavior data in the historical behavior sequence with the second network weight to obtain value data; determining the key data and value data as the encoding result corresponding to the current layer network structure; multiplying each historical behavior data in the historical behavior sequence with the third network weight to obtain the target product; and determining the output sequence corresponding to the current layer network structure based on the key data, value data, and target product.

[0113] In an optional embodiment, the steps described above, which predict the recommendation probabilities of multiple objects to be recommended in the candidate object sequence based on user feature data and encoded data using the second-stage model, and output the recommendation probabilities of multiple objects to be recommended in the candidate object sequence, include: using the second-stage model to perform self-attention calculation on the candidate object sequence based on the encoded data to obtain a state vector, and based on the state vector and user feature data, obtaining and outputting the recommendation probabilities of multiple objects to be recommended in the candidate object sequence.

[0114] In an optional embodiment, the steps described above, which involve performing self-attention calculation on the candidate object sequence based on the encoded data using the second-stage model to obtain a state vector, and obtaining and outputting the recommendation probabilities corresponding to multiple objects to be recommended in the candidate object sequence based on the state vector and user feature data, include: segmenting the candidate object sequence using the second-stage model to obtain multiple sub-sequences; concatenating the encoded data with the current sub-sequence for each of the multiple sub-sequences to obtain concatenated data; performing self-attention calculation on the concatenated data to obtain the state vector corresponding to the current sub-sequence; obtaining the recommendation probabilities corresponding to multiple objects to be recommended in the current sub-sequence based on the state vector of the current sub-sequence and user feature data; and concatenating the recommendation probabilities corresponding to the multiple sub-sequences to obtain and outputting the recommendation probabilities corresponding to the multiple objects to be recommended in the candidate object sequence.

[0115] In an optional embodiment, the first-stage model and the second-stage model described above are trained in the following manner: A training dataset is obtained; wherein the training dataset includes multiple training samples, which include: user feature data, historical behavior sequences within a first preset historical time period, object sequences corresponding to objects that appeared within a second preset historical time period, and label sequences corresponding to the object sequences; wherein the label sequence is used to indicate the object label corresponding to each object in the object sequence, and the object label is used to indicate whether the object was triggered; based on the training dataset and a preset loss function, the first-stage model and the second-stage model are trained to obtain the trained first-stage model and the trained second-stage model.

[0116] In an optional embodiment, the steps of training a first-stage model and a second-stage model based on a training dataset and a preset loss function to obtain a trained first-stage model and a trained second-stage model include: obtaining target training samples from the training dataset; inputting historical behavior sequences from the target training samples into the first-stage model and outputting encoded data corresponding to the historical behavior sequences from the target training samples; inputting the encoded data corresponding to the historical behavior sequences from the target training samples, along with user feature data and object sequences from the target training samples, into the second-stage model to obtain an output result; determining the model loss value based on the output result, the label sequence from the target training samples, and the preset loss function; adjusting the model parameters of the first-stage model and the second-stage model based on the model loss value, and continuing to execute the step of obtaining target training samples from the training dataset until the model loss value meets the preset conditions, thereby obtaining a trained first-stage model and a trained second-stage model.

[0117] If the aforementioned functions are implemented as software functional units 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 disclosure, 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, a terminal device, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this disclosure. 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.

[0118] In the description of this disclosure, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, and are only for the convenience of describing this disclosure and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of this disclosure. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.

[0119] Finally, it should be noted that the above-described embodiments are merely specific implementations of this disclosure, used to illustrate the technical solutions of this disclosure, and not to limit it. The protection scope of this disclosure is not limited thereto. Although this disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features, within the scope of the technology disclosed in this disclosure. Such modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this disclosure, and should all be covered within the protection scope of this disclosure. Therefore, the protection scope of this disclosure should be determined by the protection scope of the claims.

Claims

1. An object recommendation method, characterized in that, The method includes: In response to receiving an object recommendation request, user feature data and historical behavior sequence are obtained; wherein, the historical behavior sequence includes multiple historical behavior data, and the historical behavior data includes: objects triggered within a preset historical time period, and object features corresponding to the objects; The historical behavior sequence is input into the first-stage model, and each historical behavior data in the historical behavior sequence is pre-encoded by the first-stage model to obtain the encoded data corresponding to the historical behavior sequence, and the encoded data is cached. The user feature data, the cached encoded data, and the candidate object sequence are input into the second-stage model. The second-stage model predicts the recommendation probability of each of the multiple objects to be recommended in the candidate object sequence based on the user feature data and the encoded data, and outputs the recommendation probability of each of the multiple objects to be recommended in the candidate object sequence. Based on the recommendation probabilities corresponding to multiple objects to be recommended in the candidate object sequence, recommendations are made to the multiple objects to be recommended.

2. The method according to claim 1, characterized in that, The first-stage model includes at least one layer of network structure; The step of pre-encoding each historical behavior data in the historical behavior sequence using the first-stage model to obtain encoded data corresponding to the historical behavior sequence, and caching the encoded data, includes: By using each layer of network structure included in the first stage model, each historical behavior data in the historical behavior sequence is pre-encoded to obtain the encoding result corresponding to each layer of network structure. The encoding results corresponding to each layer of the network structure are determined as the encoded data corresponding to the historical behavior sequence, and the encoded data is cached.

3. The method according to claim 2, characterized in that, The step of precoding each historical behavior data in the historical behavior sequence through each layer of the network structure included in the first stage model to obtain the encoding result corresponding to each layer of the network structure includes: Starting from the first layer of the network structure of the first stage model, each historical behavior data in the historical behavior sequence is pre-encoded through the current layer network structure to obtain the encoding result and output sequence corresponding to the current layer network structure; wherein, the output sequence is used as input to the next layer network structure of the current layer network structure; Determine whether the current layer network structure is the last layer network structure of the first stage model. If not, take the output sequence of the current layer network structure as the new historical behavior sequence, take the next layer network structure of the current layer network structure as the new current layer network structure, and continue to execute the step of pre-encoding each historical behavior data in the historical behavior sequence through the current layer network structure to obtain the encoding result and output sequence corresponding to the current layer network structure. If so, output the encoding results corresponding to each layer of the network structure.

4. The method according to claim 3, characterized in that, The step of precoding each historical behavior data in the historical behavior sequence using the current layer network structure to obtain the encoding result and output sequence corresponding to the current layer network structure includes: Obtain the first network weight, second network weight, and third network weight corresponding to the current layer network structure; Each historical behavior data in the historical behavior sequence is multiplied by the first network weight to obtain key data; each historical behavior data in the historical behavior sequence is multiplied by the second network weight to obtain value data; the key data and the value data are determined as the encoding result corresponding to the current layer network structure; The target product is obtained by multiplying each historical behavior data in the historical behavior sequence with the weight of the third network; based on the key data, the value data and the target product, the output sequence corresponding to the current layer network structure is determined.

5. The method according to claim 1, characterized in that, The step of predicting the recommendation probability of multiple objects to be recommended in the candidate object sequence based on the user feature data and the encoded data using the second-stage model, and outputting the recommendation probability of multiple objects to be recommended in the candidate object sequence, includes: The second-stage model performs self-attention calculation on the candidate object sequence based on the encoded data to obtain a state vector. Based on the state vector and the user feature data, it obtains and outputs the recommendation probabilities corresponding to multiple objects to be recommended in the candidate object sequence.

6. The method according to claim 5, characterized in that, The step of performing self-attention calculation on the candidate object sequence based on the encoded data through the second-stage model to obtain a state vector, and obtaining and outputting the recommendation probability corresponding to multiple objects to be recommended in the candidate object sequence based on the state vector and the user feature data, includes: The candidate object sequence is segmented using the second-stage model to obtain multiple sub-sequences; For each of the plurality of subsequences, the encoded data is concatenated with the current subsequence to obtain concatenated data. Self-attention calculation is performed on the concatenated data to obtain the state vector corresponding to the current subsequence. Based on the state vector of the current subsequence and the user feature data, the recommendation probabilities corresponding to the plurality of objects to be recommended in the current subsequence are obtained respectively. By concatenating the recommendation probabilities corresponding to the multiple subsequences, the recommendation probabilities corresponding to the multiple objects to be recommended in the candidate object sequence are obtained and output.

7. The method according to claim 1, characterized in that, The first-stage model and the second-stage model are trained in the following manner: Obtain a training dataset; wherein the training dataset includes multiple training samples, the training samples include: user feature data, historical behavior sequences within a first preset historical time period, object sequences corresponding to objects that appeared within a second preset historical time period, and label sequences corresponding to the object sequences; wherein the label sequences are used to indicate the object labels corresponding to each object in the object sequences, and the object labels are used to indicate whether the object has been triggered; Based on the training dataset and the preset loss function, the first-stage model and the second-stage model are trained to obtain the trained first-stage model and the trained second-stage model.

8. An object recommendation device, characterized in that, The device includes: The data acquisition module is used to acquire user feature data and historical behavior sequences in response to receiving an object recommendation request; wherein, the historical behavior sequence includes multiple historical behavior data, and the historical behavior data includes: objects triggered within a preset historical time period, and object features corresponding to the objects; The data encoding module is used to input the historical behavior sequence into the first-stage model, and pre-encode each historical behavior data in the historical behavior sequence through the first-stage model to obtain the encoded data corresponding to the historical behavior sequence, and cache the encoded data. The result prediction module is used to input the user feature data, the cached encoded data and the candidate object sequence into the second-stage model, and predict the recommendation probability of each of the multiple objects to be recommended in the candidate object sequence based on the user feature data and the encoded data, and output the recommendation probability of each of the multiple objects to be recommended in the candidate object sequence. The object recommendation module is used to recommend multiple objects to be recommended based on the recommendation probabilities corresponding to the multiple objects to be recommended in the candidate object sequence.

9. An electronic device, characterized in that, The electronic device includes a processor and a memory, the memory storing machine-executable instructions that can be executed by the processor, the processor executing the machine-executable instructions to implement the object recommendation method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions that, when invoked and executed by a processor, cause the processor to implement the object recommendation method described in any one of 1 to 7.