Sorting model training method, commodity sorting method and commodity recommendation system

By constructing a generative user behavior model and transferring its embedding layer parameters, combined with a complex encoding layer and periodic training, the problems of overfitting and insufficient generalization ability of ranking models are solved, thereby improving recommendation quality and resource utilization efficiency.

CN121998730APending Publication Date: 2026-05-08HANGZHOU ALIBABA INT INTERNET IND CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
HANGZHOU ALIBABA INT INTERNET IND CO LTD
Filing Date
2025-12-05
Publication Date
2026-05-08

AI Technical Summary

Technical Problem

Existing ranking models are prone to overfitting during training, leading to decreased recommendation quality and wasted resources. They also lack a deep understanding of user behavior sequences, resulting in insufficient generalization ability.

Method used

A generative user behavior model is pre-trained, and the parameters of the embedding layer are transferred to the ranking model through cross-model parameter transfer. More complex encoding layer structures, such as multi-head attention mechanisms and multi-layer Transformer blocks, are introduced into the ranking model. The training process of the ranking model is optimized by combining periodic training and cross-time parameter transfer strategies.

Benefits of technology

It effectively alleviates the overfitting problem of ranking models, improves recommendation quality, enhances the deep understanding and generalization ability of user behavior, reduces service resource waste, and improves the timeliness of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121998730A_ABST
    Figure CN121998730A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a sorting model training method, a commodity sorting method and a commodity recommendation system, and the method comprises the steps: constructing a generative user behavior model based on autoregression, and carrying out the training of the generative user behavior model based on a user historical behavior sequence, the generative user behavior model comprises the embedded layer and the coding layer and is used for predicting a next behavior target of the user according to a user behavior sequence; after training of the generative user behavior model is completed, parameters of the embedded layer in the generative user behavior model are migrated to a sorting model; and in the process of training the sorting model, parameters of an embedded layer in the sorting model are fixed, and parameters of a coding layer participate in training. Through the embodiment of the invention, the overfitting problem of the sorting model can be relieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of information processing technology, and in particular to ranking model training, product ranking methods, and product recommendation systems. Background Technology

[0002] Product recommendation is a crucial function in product information service systems. Through product recommendation systems, users can quickly discover products they are interested in, reducing search costs. From the platform's perspective, it allows for the display of products most likely to be clicked or purchased within limited page space, achieving efficient traffic utilization and contributing to improved platform metrics such as GMV (Gross Merchandise Volume). From a technical implementation perspective, product recommendation systems are a fusion of various algorithms and technologies. Their core process can be summarized as a multi-layered funnel model of "recall-ranking-reordering." The recall layer primarily filters out hundreds to thousands of potentially relevant candidate products from a database of millions or even tens of millions of products. The ranking layer accurately scores the hundreds of candidate products generated by the recall layer, predicting click-through rates and conversion rates for each product, and then sorts them according to their scores. The reordering layer fine-tunes the sorted list before finally displaying the recommendation results to the user, meeting diverse needs such as business rules and user experience.

[0003] The ranking layer typically requires complex ranking algorithm models, such as using deep learning models to automatically learn the complex interactions between features: capturing users' immediate interests through their historical behavior sequences, and then combining the features of candidate products (including product category, brand, price, sales volume, rating, listing time, etc.) and contextual features (including time (weekday / weekend, holiday), season, weather, etc.) to score the candidate products. The scoring results represent the probability that users will click on / purchase the candidate products, and then the candidate products can be ranked according to the scoring results.

[0004] In other words, the final product recommendation results displayed to users are closely related to the scoring and ranking results of the ranking model. Obviously, the quality of the ranking model directly affects the quality of the recommendation results. How to further optimize the ranking model and reduce the waste of service resources has always been an important issue of concern to those skilled in the art. Summary of the Invention

[0005] This application provides a ranking model training method, a product ranking method, and a product recommendation system, which can alleviate the overfitting problem caused by the mismatch between the learnable parameter scale and the optimization objective of the ranking model, thereby improving the recommendation quality and reducing the waste of service resources.

[0006] This application provides the following solution: A ranking model training method is provided. The ranking model is used in a product recommendation scenario to calculate and rank candidate products based on their matching degree with user interests. The network structure of the ranking model includes an embedding layer for initially mapping input data into vectors, and an encoding layer for modeling the relationships between different products in a user behavior sequence. The method includes: A generative user behavior model based on autoregression is constructed, and the generative user behavior model is trained based on the user's historical behavior sequence. The generative user behavior model includes the embedding layer and the encoding layer, which are used to predict the user's next behavior target based on the user behavior sequence. After the generative user behavior model is trained, the parameters of the embedding layer in the generative user behavior model are transferred to the ranking model. During the training of the ranking model, the parameters of the embedding layer in the ranking model are kept constant, and the parameters of the encoding layer are used in the training.

[0007] The generative user behavior model and the ranking model both adopt a periodic training method. During each period of training, the complete model parameters obtained from the previous period of training of the generative user behavior model are transferred to the generative user behavior model as the initial weights for the current period. After the generative user behavior model completes training for the current period, the parameters of the embedding layer are transferred to the ranking model, and the parameters of the encoding layer obtained from the previous training period are transferred to the ranking model. Then, the ranking model is trained for the current period.

[0008] The ranking model reuses the network structure of the encoding layer in the generative user behavior model.

[0009] The generative user behavior model includes a self-attention layer in its encoding layer. The self-attention layer prevents the generative user behavior model from knowing the information of the next product and subsequent products in the user behavior sequence during the prediction process by adding a mask to the product information after the target position in the user behavior sequence.

[0010] In the generative user behavior model, the encoding layer adopts a multi-head attention mechanism and / or multiple stacked block structures to realize multi-level interactions between different products in the process of modeling the relationship between different products in the user behavior sequence.

[0011] A product ranking method in a product recommendation process includes: When it is necessary to recommend products to target users, the user behavior sequence of the target users is obtained, and a set of candidate products is determined. The user behavior sequence and the product information in the candidate product set are processed using a ranking model to calculate and rank the matching degree between multiple candidate products and the user interests of the target user; wherein the ranking model is trained using the method described in any of the preceding methods.

[0012] This also includes: In the process of using the ranking model, the user history sequence modeling part and the candidate product modeling part are calculated separately, so that the user behavior sequence part is calculated only once and the calculation result is cached for subsequent calculations.

[0013] This also includes: The length of the user behavior sequence is padded with a fixed value, and operators are constructed using the underlying library. The internal matrix operations of the computation processing unit are optimized by a parallel computing platform and / or a template library for implementing high-performance matrix multiplication and related calculations. Before the calculation, the memory address of the tensor used to cache the calculation results of the user behavior sequence is obtained so that the computation processing unit can write the calculation results to the memory address.

[0014] The constructed operator supports both half-precision floating-point numbers and full-precision floating-point numbers, allowing for the selection of different precisions based on hardware support and / or model requirements.

[0015] A product recommendation system includes a server and a client, wherein, The server is configured to, when it is necessary to recommend products to a target user, acquire the user behavior sequence of the target user, determine a set of candidate products, and then use a ranking model to process the user behavior sequence and the product information in the set of candidate products to calculate and rank the matching degree between multiple candidate products and the user interests of the target user; wherein, the ranking model is trained using the method described in any one of claims 1 to 5. The client is used to display recommended product information on the target page according to the candidate products and their ranking results determined by the server.

[0016] A computer-readable storage medium having a computer program stored thereon that, when executed by a processor, implements the steps of any of the preceding methods.

[0017] An electronic device, comprising: One or more processors; and A memory associated with the one or more processors, the memory being used to store program instructions that, when read and executed by the one or more processors, perform the steps of any of the preceding methods.

[0018] A computer program product includes a computer program / computer executable instructions that, when executed by a processor in an electronic device, implement the steps of any of the preceding methods.

[0019] According to the specific embodiments provided in this application, the following technical effects are disclosed: Through the embodiments of this application, an autoregressive generative user behavior model can be constructed. The network structure of this model can be similar to that of a ranking model, both including an embedding layer for initially mapping input data into vectors, and an encoding layer for modeling the relationships between different items in a user behavior sequence. Before training the ranking model, the generative user behavior model can be trained first using user behavior sequences as training data, enabling it to predict the user's next behavioral target based on the user behavior sequence. After the generative user behavior model is trained, the parameters of the embedding layer can be transferred to the ranking model. Then, during the training of the ranking model, the parameters of the embedding layer can be kept fixed, while the parameters of the encoding layer are used in the training. In this way, since the generative user behavior model has already modeled rich user behavior patterns through a pre-training strategy, the parameters in the embedding layer of the generative user behavior model contain rich user behavior information after the model training converges. Therefore, through this cross-model parameter transfer method, the ranking model gains the ability to acquire user behavior information. Meanwhile, since the number of parameters involved in the embedding layer is usually large, the number of learnable model parameters in the ranking model can be greatly reduced when these parameters do not need to participate in the training. This can effectively alleviate the overfitting problem caused by the mismatch between the size of the learnable parameters and the optimization objective, thereby improving the recommendation quality and reducing the waste of service resources.

[0020] Furthermore, in the preferred implementation, the encoding layer of the ranking model can be upgraded to a more complex modeling approach. Specifically, this can be achieved through multi-head attention mechanisms and / or multiple stacked block structures to realize multi-level interactions between different products, thereby enabling the model to construct extremely rich contextual representations. For example, in specific implementations, the encoding layer can be implemented using models such as the Transformer. In this way, the ranking model can gain a deeper understanding of user behavior sequences, improving its generalization ability. In addition, by introducing models such as the Transformer, not only can behavioral patterns be explored more deeply, but the understanding of user interests and preferences can also be further improved by expanding the parameter scale of the ranking model. This achieves the scaling law phenomenon of the ranking model, that is, the model performance can predictably improve as the parameter scale increases.

[0021] Furthermore, to ensure the timeliness of the recommendation ranking model and meet the needs of changing user interests, the training of both the generative user behavior model and the ranking model can be performed periodically. Additionally, a "cross-time parameter transfer" strategy can be employed to achieve continuous evolution of model parameters over time. For the generative user behavior model, this cross-time parameter transfer can involve a full parameter transfer. That is, the complete model parameters from the previous training cycle (including all components such as the embedding layer and encoding layer) can be used as the initial weights for the current cycle, allowing the generative user behavior model to continuously learn based on existing knowledge, gradually absorbing the latest user behavior patterns and achieving progressive updates to behavioral representations. The ranking model, on the other hand, can employ a partial parameter transfer strategy. This means only the parameters of the encoding layer from the previous training cycle are transferred, while the parameters of the embedding layer are obtained from the generative user behavior model through "cross-model parameter transfer." This dual-parameter transfer-driven generative user behavior modeling and recommendation ranking joint training method can fully capture complex patterns of user behavior and effectively transfer these patterns to the recommendation ranking model. This not only effectively alleviates the overfitting problem faced by conventional ranking models, but also allows for an incremental understanding of user interest transfer.

[0022] Of course, any product implementing this application does not necessarily need to achieve all of the advantages described above at the same time. Attached Figure Description

[0023] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0024] Figure 1 This is a schematic diagram of the system architecture provided in the embodiments of this application; Figure 2 This is a flowchart of the first method provided in the embodiments of this application; Figure 3 This is a schematic diagram of the model structure of the generative user behavior model provided in the embodiments of this application; Figure 4 This is a schematic diagram of the product sorting model provided in the embodiments of this application; Figure 5 This is a schematic diagram of the model training and online service process provided in the embodiments of this application; Figure 6 This is a flowchart of the second method provided in the embodiments of this application; Figure 7 This is a schematic diagram of the electronic device provided in the embodiments of this application. Detailed Implementation

[0025] 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 some embodiments of this application, and not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.

[0026] To facilitate understanding of the technical solutions provided in the embodiments of this application, a brief introduction to traditional sorting models will be given first.

[0027] As described in the background section, ranking models are primarily used to calculate the matching degree between candidate products and user interests. This matching degree calculation can also be described as predicting the probability of a user clicking / purchasing a specific candidate product. Information about user interests is mainly obtained by modeling user behavior sequences (e.g., the product sequences corresponding to a user's historical clicks / purchases / adding items to the cart). In other words, the process of modeling user behavior sequences is crucial for understanding user interests and preferences.

[0028] Traditional ranking model training methods directly use user behavior sequences as training data to train the ranking model. The supervision signals used in this training process are simple and sparse, which may lead to overfitting of the ranking model during training. That is, the prediction results of the ranking model are only effective for the training set, but perform poorly for the validation set and actual predictions.

[0029] To better understand the concept of "overfitting," we will first briefly introduce the related concept of "Epoch." When the number of learnable model parameters matches the complexity of the supervision signal, multiple Epochs (often called "cycles" or "generations") of training are usually required for the model to converge sufficiently. An Epoch (one cycle / generation) refers to the process by which the model learns the entire training dataset completely once; in other words, an Epoch is completed when the model has "seen" every sample in the training set once. The reason for needing multiple Epochs is twofold. First, the amount of data to be learned is enormous. For example, in deep learning, the training set may contain millions of images or hundreds of millions of texts, and the model cannot learn all the complex patterns in the data at once. Second, model training is a gradual, iterative optimization process. By learning on the same data over multiple Epochs, the model can gradually adjust its internal parameters (weights and biases), making the prediction results increasingly accurate. Therefore, the training process typically consists of multiple Epochs. In each Epoch, the model relearns the entire dataset (but the order is usually shuffled) and continuously improves.

[0030] However, for traditional ranking models, the most common supervision signal is a binary target (simply represented by 0 and 1) indicating whether a user "clicked" an item. This signal typically has low complexity. Meanwhile, ranking models usually have a large number of learnable model parameters, meaning they have strong learning capabilities. Therefore, a mismatch can exist between the number of learnable model parameters and the complexity of the supervision signal (large learnable model parameters, low supervision signal complexity). This mismatch leads to overfitting. Especially when using modern large-scale parametric models as ranking models, an even more serious situation may occur—"One-epoch overfitting," meaning overfitting occurs after only one epoch.

[0031] In addition to the aforementioned "overfitting" problem, another challenge faced by traditional ranking models is that, since the most common supervision signal in traditional ranking models is a binary target used to express whether an item has been clicked, the ranking model may only rely on simple statistical features to fit the distribution of the training dataset. That is, it only needs to map the user behavior sequence to a vector, but it lacks a deeper understanding of the user behavior sequence, resulting in insufficient generalization ability of the ranking model.

[0032] To address the above issues, this application provides corresponding solutions. Specifically, to address the "overfitting" problem, a generative user behavior model can be constructed. This model fully models and understands user behavior patterns by modeling user behavior sequences, thereby uncovering users' potential interests and preferences. Specifically, this generative user behavior model can predict the next item the user is likely to perform a target action (e.g., click, purchase, add to cart) based on the product information ranked at and before the target position in the user behavior sequence. In addition to an embedding layer for initially mapping input data into vectors, the generative user behavior model can also include an encoding layer for modeling the relationships between different products in the user behavior sequence.

[0033] It's important to note that the ranking model's network structure can also include the aforementioned embedding and encoding layers. Their functions are identical to those of the embedding and encoding layers in the generative user behavior model. Furthermore, in some optional scenarios, the ranking model can even reuse the encoding layer from the generative user behavior model. Of course, the inputs, outputs, and training objectives of the generative user behavior model differ from those of the training model.

[0034] Having constructed a generative user behavior model, it can be trained before training the ranking model. This generative user behavior model can be an autoregressive model, also known as a causal autoregressive model. "Causal" here typically refers to "causal attention" or "causal masking," the core idea of ​​which is that in a sequence, an element can only focus on elements preceding it (including itself), not elements following it. This is to maintain the sequentiality and rationality of generation: when predicting the next element during model training, the model should not "peek" into future answers. This simulates the human reading or writing process, proceeding word by word sequentially. "Autoregression" is a generative mode whose core idea is to view sequence generation as a progressive, cyclical process. The model generates only one element (e.g., a word) at a time and uses this newly generated element as part of the input to predict the next element. In practice, "causality" is the means; by forcing the use of a causal mask in the model architecture, it ensures that when predicting the t-th position, the model can only see positions 1 to t, technically preventing "peeking into the future." "Autoregressive" is a pattern. Under causal constraints, a model can only be generated in an autoregressive manner. That is, it needs to infer the future step by step based on the content that has been generated in the past.

[0035] In this embodiment of the application, when training the autoregressive generative user behavior model, the generative user behavior model can be guided by prompts or other means to predict the next product that the user may perform the target behavior (click, purchase, etc.) based on the product information that is ranked at or before the target position in the user behavior sequence. Then, supervised training can be performed with the actual value of the next product in the user behavior sequence as the optimization objective.

[0036] The aforementioned generative user behavior model has modeled rich user behavior patterns through a pre-training strategy. The parameters in the embedding layer of the generative user behavior model, after model training converges, already contain rich user behavior information. Furthermore, since the embedding layer is mainly used for vector mapping and is a low-level component of the deep learning model, it has good compatibility and can be easily transferred to different types of ranking models. Therefore, this application proposes a "cross-model parameter transfer" strategy, that is, after training the generative user behavior model, the parameters in the embedding layer of the generative user behavior model can be transferred to the ranking model. When training the ranking model, the parameters of the embedding layer can be frozen, meaning that the parameters of the embedding layer do not participate in training. Since the number of parameters involved in the embedding layer is usually large, not participating in training with these parameters effectively alleviates the overfitting problem caused by the mismatch between the model parameter size and the optimization objective in the ranking model.

[0037] Furthermore, to address the issue of "insufficient generalization ability of the ranking model due to a lack of deeper understanding of user behavior sequences," this application embodiment can further improve the encoding layer of the ranking model. Specifically, in traditional ranking models, the encoding layer typically uses a simple cross-attention modeling approach to model the relationships between different products. However, in this application embodiment, the encoding layer can be upgraded to a more complex modeling method. For example, the encoding layer of the ranking model can be implemented using a Transformer model. Of course, in specific implementations, the encoding layer can also be implemented using other structures such as RNN (Recurrent Neural Network) and CNN (Convolutional Neural Network). This application embodiment mainly uses Transformer as an example for introduction.

[0038] Since the encoding layer is mainly used to model the relationships between different products, the complexity of the modeling method can be reflected by the "order" of the interactions between different products. In traditional ranking models, only single-order interactions (or first-order interactions, where each token (the basic unit for processing text and other information in the model) can aggregate information based on its similarity to other tokens, representing the most direct first-order interaction based on the current representation, used to establish direct associations between tokens) can be achieved. However, with more complex modeling methods, multi-order interactions between different products can be realized.

[0039] Multi-level interaction refers to the model's ability to capture dependencies of different types / ranges and complexities between elements in an input sequence. This is not just two-level interaction, but can also be a multi-layered fusion of information from local to global and from simple to complex. In practical implementation, from the perspective of the attention mechanism itself, the core of the attention mechanism is to calculate a weighted sum, and this weight matrix itself contains interaction information. A single attention head can achieve first-level interaction, while multiple attention heads can bring multi-level interaction, which is the most intuitive manifestation of multi-level interaction. That is, through the "multi-attention head" mechanism, the model can learn different types of interactions (e.g., local interactions, long-range dependency interactions, syntactic / semantic role interactions, etc.) in different representation subspaces, allowing the model to capture multiple types and ranges of interactions in parallel and simultaneously. From the perspective of network depth, in more complex modeling methods such as the Transformer model, the network structure can be composed of multiple stacked Transformer blocks, where the Transformer block is the basic building block of the Transformer model's network structure. As information is passed through multiple Transformer layers, the "order" and complexity of the interaction continuously increase, enabling the model to construct extremely rich contextual representations, which is difficult to achieve with traditional convolutional neural networks and recurrent neural networks. In practice, the above-mentioned multi-order interaction can be achieved through a "multi-head attention" mechanism or a structure of multiple stacked "Transformer blocks," or a combination of the two methods.

[0040] In practical implementation, since generative user behavior models typically include the aforementioned embedding and encoding layers, and the encoding layer of a generative user behavior model can often be implemented using more complex modeling methods such as the Transformer model, the network structure of the encoding layer in the generative user behavior model can be directly reused in the ranking model. This maintains consistency with the network structure of the generative user behavior model, making it easier to learn users' interests and preferences in the recommendation field from the transferred parameters.

[0041] It should be noted that since the number of parameters in the embedding layer is usually very large and much larger than that in the encoding layer, in this embodiment of the application, even if the modeling complexity of the encoding layer is increased, the number of parameters actually involved in training will be less than that in the embedding layer while keeping the parameters of the embedding layer unchanged during the training of the ranking model. Therefore, even after increasing the modeling complexity of the encoding layer, overfitting can still be avoided.

[0042] Through the aforementioned "parameter transfer across models" and the introduction of more complex modeling methods such as Transformers into the encoding layer of the ranking model, a scaling law phenomenon was also discovered in the ranking model. That is, the model performance can predictably improve as the parameter scale increases. This is because the parameters of the embedding layer of the ranking model can be transferred from the embedding layer of the generative behavior model. These parameters can be kept fixed during training, which gives the network parameter scale of the encoding layer greater freedom. Furthermore, by introducing more complex modeling methods such as Transformers into this encoding layer, the parameter scale of the ranking model can be increased. These parameters are mainly related to modeling the relationships between different products. The larger this part is involved, the richer the information related to the relationships between different products will be. On this basis, more data (e.g., the user behavior sequences of all users across the entire platform over the past year) can be used to train the ranking model, thereby improving the performance of the ranking model.

[0043] The above describes the "parameter transfer across models" and the more complex modeling approach used in the encoding layer of the ranking model. In practical applications, since user behavior sequences are usually constantly changing, in order to capture the dynamic changes in user behavior patterns in a timely manner and ensure that the timeliness of the ranking model in the recommendation field meets the needs of changing user interests, both the generative user behavior model and the ranking model can be trained periodically. For example, a daily cycle can be used, in which case the generative user behavior model and the ranking model can be retrained every day. Of course, since the training results of the previous cycle are usually still highly valuable in the current cycle, this application also provides a "parameter transfer across time" strategy to achieve continuous evolution of model parameters in the time dimension.

[0044] For generative user behavior models and ranking models, the specific parameter transfer strategies employed during cross-time parameter transfer can differ. For example, for generative user behavior models, a full parameter transfer can be performed. That is, the complete model parameters from the previous training cycle (including all components such as the embedding layer and encoding layer (specifically, the Transformer encoder)) can be used as the initial weights for the current cycle. In this way, training can proceed based on these initial weights in the current training cycle. This approach allows the generative user behavior model to continuously learn based on existing knowledge, gradually absorbing the latest user behavior patterns and achieving progressive updates to the behavioral representation.

[0045] For ranking models, since the parameters of the embedding layer need to be transferred from the embedding layer of the generative user behavior model through "cross-model parameter transfer", a partial parameter transfer strategy can be adopted when performing "cross-time parameter transfer". That is, only the parameters of the encoding layer of the ranking model after the end of the previous training cycle (for example, it can be a Transformer structure, including self-attention layer, feedforward network, etc.) are transferred and used as the initial weights of the current cycle.

[0046] In other words, in practical implementation, the generative user behavior model is trained first in each training cycle, followed by the ranking model. Before training the generative user behavior model, its complete model parameters from the previous cycle are transferred over as the initial weights for the current cycle. The generative user behavior model is then trained based on these initial weights. After the generative user behavior model is trained, the parameters of the embedding layer trained in the current cycle are transferred to the embedding layer of the ranking model. Similarly, the parameters of the encoding layer trained in the previous cycle are transferred to the encoding layer of the ranking model. In other words, when initializing the weights of the ranking model in each training cycle, some parameters are obtained through "cross-model parameter transfer," and some are obtained through "cross-time parameter transfer." These two parameter transfer methods provide the ranking model with complete initial weights for the current cycle.

[0047] The above describes the model training method. After training the generative user behavior model and the ranking model in each training cycle, the ranking model can be used for specific online services. That is, when it is necessary to recommend products to a specific user, the newly trained ranking model can calculate and rank the candidate products based on their matching degree with the user's interests. Subsequently, through fine-tuning and other processes, the final recommended products and their ranking to be presented to the user are determined. It should be noted that the generative user behavior model provided in this embodiment is mainly used to assist in training the ranking model. When providing specific online services, only the ranking model needs to be used to score and rank the products, and the participation of the generative user behavior model is no longer required. Since the ranking model in this embodiment improves the model performance by increasing model complexity, it also increases the online inference time. Therefore, some optimization strategies can be adopted during the online inference process, including operator fusion, operator rearrangement, KV caching, etc., which will be introduced later.

[0048] From a system architecture perspective, see Figure 1 This application provides a model training method for ranking models used in product recommendation scenarios of product information service systems. Specifically, during the training of the ranking model, a generative user behavior model is constructed to assist in the training. Specifically, a pre-trained dataset can be used to train the generative user behavior model, and then, through cross-model parameter transfer, the parameters of the embedding layer in the trained generative user behavior model can be transferred to the ranking model. During the training of the ranking model using the training dataset of the recommendation domain, the parameters in the embedding layer can be kept constant, reducing the number of parameters actually involved in training. This makes the number of learnable parameters in the ranking model more closely match the complexity of the supervision signal, avoiding overfitting. Furthermore, by increasing the modeling complexity of the encoding layer in the ranking model (used to model the relationships between different products in the user behavior sequence), a deeper understanding of the user behavior sequence can be achieved, improving the generalization ability of the ranking model. Moreover, the model training process can be performed periodically, and cross-time parameter transfer can be realized. The trained ranking model can be deployed online to provide online inference services for specific product recommendation scenarios, calculating and ranking candidate products based on their matching degree with user interests.

[0049] The specific implementation schemes provided in the embodiments of this application will be described in detail below.

[0050] Example 1 First, this embodiment provides a method for training a product ranking model. The ranking model is used in a product recommendation scenario to calculate and rank candidate products based on their matching degree with user interests. Specifically, the network structure of the ranking model includes an embedding layer for initially mapping input data into vectors, and an encoding layer for modeling the relationships between different products in a user behavior sequence. See [link to documentation]. Figure 2 The method may specifically include: S201: Construct an autoregressive generative user behavior model and train the generative user behavior model based on the user's historical behavior sequence. The generative user behavior model includes the embedding layer and the encoding layer, which are used to predict the user's next behavioral target based on the user behavior sequence.

[0051] The generative user behavior model is a concept proposed in the embodiments of this application. That is to say, such a model does not exist in the prior art, or it is not used when training the ranking model. The generative user behavior model is constructed in the embodiments of this application to avoid the problem of overfitting in the ranking model during training.

[0052] As mentioned earlier, generative user behavior models can employ an autoregressive approach, enabling them to progressively generate future sequences from already generated partial sequences. Specifically, in the context of user behavior sequences, this means the model can predict the next item a user might choose to purchase based on a given position in the user behavior sequence and the preceding product information. In other words, for a generative user behavior model, each data point in its input dataset D represents a user behavior sequence, i.e., user behavior information arranged chronologically.

[0053] in, Let i represent a product, V be the set of all products, and L be the length of the sequence.

[0054] In addition, each product possesses features including its category. These features can be embedded and summed, then input into the foundational structure of the generative user behavior model. For example, ... Figure 3 As shown, it illustrates the structure and input / output information of a generative user behavior model. Among them, As shown in the diagram, each product node can be represented by product characteristics, category characteristics, and timestamp characteristics. For products related to search behavior, search term characteristics can also be added. Furthermore, the input data can also include behavior nodes from user behavior sequences. Specifically, it can express the behavior type information corresponding to each product, that is, the behavior type information of the user performing on the specific products in the sequence. For example, it can include click behavior, search behavior, add to cart behavior, payment behavior, etc.

[0055] To ensure that the generative user behavior model can capture rich behavioral pattern information, the network structure of the specifically constructed generative user behavior model can be similar to that of the ranking model. It can also include an embedding layer for initially mapping input data into vectors, and an encoding layer for modeling the relationships between different items in the user behavior sequence. For example, in a specific implementation, such as... Figure 3 As shown, the encoding layer can be implemented based on the classic Transformer model, etc. This module can include multiple stacked blocks (Transformer blocks), where each block includes a masked self-attention module and a feed-forward network. The reason for using a masked self-attention module is that the generative user behavior model in this embodiment needs to predict the next product that the user might perform a certain target action (click or purchase) based on a specified position in the user behavior sequence and some product information preceding it. For example, it needs to predict the fourth product based on the first three products in a user behavior sequence, and subsequently predict the fifth product based on the first four products, and so on. This requires that product information after a certain current position in the user behavior sequence cannot be perceived by the generative user behavior model. However, since each user behavior sequence is input as a whole, the aforementioned mask-based self-attention module can be used to mask the product information following a specified position in the user behavior sequence, thus preventing the generative user behavior model from perceiving the information after that specified position. The feedforward network is primarily used to perform non-linear transformations on the vector at each position to enhance the model's expressive power.

[0056] in addition, Figure 3 In The output representation of the encoding layer is typically a high-dimensional vector, perhaps hundreds of dimensions. However, the actual prediction needed is whether a user will click or purchase a product; this prediction result is a low-dimensional vector. Therefore, generative user behavior models can also include an MLP (Multilayer Perceptron) layer to map high-dimensional vectors to low-dimensional vectors. Then, the low-dimensional vector is used to construct the loss function (sampled softmax loss). Specifically, the MLP maps the high-dimensional (e.g., 1024-dimensional) output of the Transformer to a low-dimensional (e.g., 32-dimensional) vector, which can be understood as the user interest vector. Then, this 32-dimensional vector is multiplied by the inner product of "N randomly sampled product vectors" and "the next correctly interacted product vector" (each product is 32-dimensional) to obtain N+1 similarity scores. The sampled softmax loss aims to maximize the similarity score between the "user interest vector" and the "next correctly interacted product vector."

[0057] In practical implementation, using a single Modeling LP to simultaneously map product, behavior, and category information may lead to a "seesaw effect," meaning it's impossible to accurately model all three simultaneously. Therefore, a preferred implementation approach is to use separate MLPs for product, behavior, and category modeling. This approach has the advantage of modeling the unique patterns of each piece of information (e.g., user preferences for categories) and avoiding parameter conflicts arising from learning different information. Specifically, the product MLP models user preferences for products themselves, i.e., fine-grained user preferences; the category MLP models user preferences for product categories, i.e., coarse-grained user preferences; and the behavior MLP models unique user behavior patterns, such as some users preferring to buy from add-to-cart items, while others prefer direct purchases, etc.

[0058] The inputs for the Product MLP and Category MLP are the same, but the inputs for the Category MLP are different. This difference is determined by the form of the input sequence. For example, suppose the input sequence is "Product 1, Product 2, Behavior 1, Product 3, Behavior 1". Since the next element after "Product 1" is also a product, only the Product MLP and Category MLP need to be calculated; there is no Behavior MLP. The next element after "Product 2" is "Behavior 1", meaning the predicted information is behavior; therefore, only the Behavior MLP needs to be calculated, and there are no Product or Category MLPs.

[0059] In addition, to improve the training stability, performance, and generalization ability of generative user behavior models, improvement strategies that have been validated in the NLP (Natural Language Processing) domain can be introduced. For example, this could include: 1) Pre-Normalization (a normalization strategy in deep learning that improves model training stability and convergence speed by normalizing the input before it reaches the neural network layers), which ensures stable input distribution for each layer by standardizing the input in advance, thereby accelerating training convergence and improving training stability; 2) RMSNorm (Root Mean Square Layer Normalization, a simplified layer normalization technique that normalizes the input data by calculating the root mean square (RMS) to improve model training stability and convergence speed), which reduces computation by normalizing only the input data, omitting the mean calculation and centering steps; 3) RoPE (Rotary Position Embedding), a position encoding method for Transformer architectures that fuses absolute and relative position information by rotating word embedding vectors, enabling the model to adaptively process sequences of arbitrary length by encoding position information into a rotation matrix; 4) SwiLU (Sigmoid Weighted Linear Array). Unit is an activation function that combines the characteristics of the Sigmoid function and the linear unit. It is mainly used to enhance the nonlinear expressive power of the model. Its core idea is to use the Sigmoid function to weight the input data to achieve a gating mechanism-like effect. As an activation function, it introduces additional degrees of freedom through the gating mechanism, thereby increasing the complexity of the model.

[0060] After determining the network structure of the generative user behavior model, it can be trained. The training data used can be user behavior sequences. Since the generative user behavior model is a pre-trained AI (Artificial Intelligence) model, its generation goals can be guided using natural language prompts. Specifically, as mentioned earlier, the model is guided to predict the next item the user might choose to perform a certain action (click or purchase) based on information about items preceding a specified position in the user behavior sequence. Then, supervised training can be performed with the actual value of the next item in the user behavior sequence as the optimization objective. For example, assuming the length of the user behavior sequence is N, the current position i = 1, 2, ..., N. For instance, when the current position i = 1, the generative user behavior model can predict the next product the user will click / purchase based on the first product in the user behavior sequence (the prediction range can be a certain number of products randomly selected from the entire set of products, and the actual next product in the user behavior sequence is also included in the prediction range), and use the second product in the user behavior sequence to supervise the prediction result; when the current position i = 2, the generative user behavior model can predict the next product the user will click / purchase based on the first and second products in the user behavior sequence, and use the third product in the user behavior sequence to supervise the prediction result, and so on.

[0061] Finally, the training objective of the generative user behavior model can be defined as minimizing the negative log-likelihood on the dataset, or it can be maximized, that is, making the prediction results of the generative user behavior model as close as possible to the true value of the next item in the user behavior sequence.

[0062] S202: After the generative user behavior model is trained, the parameters of the embedding layer in the generative user behavior model are transferred to the ranking model.

[0063] After training the generative user behavior model, the parameters of its embedding layer can be transferred to a ranking model. In other words, after training, the generative user behavior model models rich user behavior patterns, and the parameters of its embedding layer, as the model converges, contain abundant user behavior information. Furthermore, the embedding layer is a low-level component of deep learning models, exhibiting good compatibility and facilitating transfer to different types of ranking models. Therefore, the "cross-model parameter transfer" strategy in this embodiment involves transferring the fixed embedding layer parameters of the generative user behavior model to a ranking model in the recommendation domain.

[0064] S203: During the training of the ranking model, the parameters of the embedding layer in the ranking model are kept fixed, and the parameters of the encoding layer are used in the training.

[0065] After transferring the embedding layer parameters of the generative user behavior model to the ranking model in the recommendation field, the ranking model can be trained. Since the parameters of the embedding layer have already completed the cross-model transfer, the parameters of the embedding layer can be kept fixed during the training process of the ranking model, and then the parameters of the encoding layer can be used for training.

[0066] The overall framework diagram of the recommended field ranking model can be seen as follows: Figure 4 As shown, candidate product features and user behavior sequences are input into the sequence modeling module, and user features (such as click-through rates in the past 30 days) are concatenated. After passing through a fully connected network layer, the resulting candidate product score represents the user's preference for the candidate products. The core component of the recommendation field ranking model lies in the subsequent sequence modeling module (i.e., the encoding layer used to model the relationships between different products). To better model the complex user behavior patterns transferred from generative user behavior models, this embodiment can upgrade the encoding layer from a conventional "Cross-attention Layer" to a more complex modeling method, such as a "Transformer" layer.

[0067] The "Cross-attention Layer" used in traditional ranking models is a neural network module based on an attention mechanism, used to achieve directed information fusion between different feature sequences. This layer receives candidate product features as query input and user behavior sequences as key and value inputs. By calculating cross-sequence attention weights, it dynamically extracts contextual information associated with candidate product features from the user behavior sequences and generates a weighted aggregated output representation.

[0068] Upgrading to network structures like Transformer allows for multi-head attention mechanisms and / or multiple stacked block structures, enabling multi-level interactions between different items in the user behavior sequence. These multi-level interactions allow the ranking model to learn richer user behavior pattern information, thus improving model performance. Of course, the Transformer described above is just one specific network structure. In practice, any network structure that can achieve more complex modeling through multi-head attention mechanisms and / or multiple stacked block structures can serve as the encoding layer network structure for the ranking model in this embodiment; no limitation is imposed here.

[0069] When the encoding layer of the ranking model also uses network structures such as Transformer, the ranking model can directly reuse the network structure of the encoding layer in the generative user behavior model. This can maintain the consistency of the network structure with the encoding layer of the generative user behavior model, making it easier to learn the user's interests and preferences in the recommendation field from the transferred parameters.

[0070] In practical implementation, the parameter transfer strategy needs to transfer complex behavioral patterns learned from the generative user behavior model to the recommendation field ranking model. On the other hand, it also needs to ensure the timeliness of the recommendation field ranking model to meet the needs of changing user interests. To this end, this application also proposes a dual-parameter transfer-driven joint training method for generative user behavior modeling and recommendation ranking, specifically "cross-model parameter transfer" and "cross-time parameter transfer." Specifically, cross-time parameter transfer means that both the generative user behavior model and the ranking model can be trained periodically, for example, daily. During training in each period, cross-time parameter transfer can be performed on both the generative user behavior model and the ranking model. Specifically, as... Figure 5 As shown, the complete model parameters obtained from training the generative user behavior model in the previous period (e.g., day T) can be transferred to the generative user behavior model as the initial weights for the current period (day T+1). After initialization, the parameters in both the embedding and encoding layers are trainable during the training of the generative user behavior model. After the generative user behavior model completes training for the current period, the parameters of the embedding layer are first transferred to the ranking model through cross-model parameter transfer. Additionally, cross-time parameter transfer is performed; that is, the parameters of the encoding layer obtained from training the ranking model in the previous period are transferred to the ranking model before training the ranking model for the current period. In other words, cross-time parameter transfer can be performed on the generative user behavior model in each training period, while for the ranking model, cross-model parameter transfer can be performed on the embedding layer, and cross-time parameter transfer can be performed on the encoding layer. During the training of the ranking model for the current period, the parameters of the embedding layer are frozen, and only the parameters of the encoding layer are trainable.

[0071] After training the ranking model, it can be used for specific online inference services. For example, when a user accesses the client program of a product information service system, they send a request to the server. After obtaining information such as the user ID, the server can retrieve the user's behavior sequence from systems such as the user feature service center and recall a batch of candidate products from the product database. Then, the ranking model can be used to calculate and rank the candidate products according to the user's interests, so as to recommend a set of products that the user is interested in.

[0072] In this application embodiment, the recommendation field ranking model improves model performance by increasing model complexity (mainly by upgrading the encoding layer to a more complex modeling method), which may increase the online inference time. To address this, this application embodiment can also optimize the specific online inference process using some optimization strategies.

[0073] For example, one optimization strategy could be to calculate the user history sequence modeling part and the candidate product modeling part separately, so that the user behavior sequence part is calculated only once and the calculation result is cached. That is, to implement the KV Cache (key-value caching) logic within a single request: the key and value vectors calculated in the current step can be cached for use in the next step. This avoids recalculating the K and V of all previous tokens in each step, reducing the computational complexity from O(n²) to O(n), which is key to accelerating inference. In this embodiment, since the user behavior sequence is used as the key and value, the KV Cache corresponds to caching the user behavior sequence information. In other words, since the user behavior sequence part is completely identical within the batch (batch-processed dataset) in a single request, it only needs to be calculated once, saving a lot of redundant computation.

[0074] Another optimization strategy is operator optimization. Specifically, based on the existing MLIR (Multi-Level Intermediate Representation, a compiler infrastructure designed to solve traditional compiler optimization and heterogeneous hardware adaptation problems through hierarchical intermediate representation) capabilities, a large number of fragmented computational operations (ops) are compiled online into a small number of large, integrated fusion ops, making computation more intensive. This is operator fusion, reducing scheduling overhead in computation. An op is a basic, indivisible unit of work for building a complex computational task (such as running the sorting model in this embodiment). Common op computations include mathematical operations, tensor operations, normalization operations, etc. The aforementioned fusion process is also known as operator fusion. "A large number of fragmented computational ops" refers to a computational task being decomposed into many small, independent operation steps. For example, in the computation graph, a MatMul op (matrix multiplication), an Add op (vector addition), and a ReLU op (activation function) might be decomposed, etc. Each op needs to be started and executed separately, and may write intermediate results back to memory. This approach is inefficient. Each small operation incurs startup overhead, and frequent reads and writes of intermediate results into memory significantly increase memory bandwidth pressure, often becoming a computational bottleneck. "Merging into a few large, unified operations" refers to combining multiple consecutive small operations into a single, large, composite operation. For example, merging the three operations MatMul + Add + ReLU in the example above into a single composite FusedMatMulAddReLU operation. The advantages are twofold: firstly, it reduces kernel startup overhead: from three startups to one; secondly, it reduces memory reads and writes: intermediate results (such as the outputs of MatMul and Add) no longer need to be written back to main memory, but are directly passed to the next operation from the cache or registers, reducing memory bandwidth pressure. Additionally, it makes computation more intensive: computation becomes more continuous and efficient, making fuller use of computational units instead of wasting time waiting for data to be moved from memory.

[0075] Furthermore, during this stage, it is necessary to capture recurring computational patterns online for compilation. Since user behavior sequences have a wide range of possible lengths, the number of computational patterns is also high. Frequent online compilation triggers can cause latency spikes in requests. This problem can be mitigated by padding the sequence length to a few fixed values, but this results in redundant computation. Additionally, due to the introduction of KVCache and some modifications to the model structure, existing operators cannot be directly reused. Therefore, embodiments of this application can also construct new operators (e.g., Transformer operators). Specifically, considering the need for each layer to retain the ability to output KVCache as quickly as possible (minimizing the latency between computation completion and KVCache readiness, ensuring that KVCache is immediately available when the next token is generated), a single-layer Transformer was chosen to be implemented (either from scratch or using an underlying library to implement a Transformer layer). Internal matrix operations are optimized using techniques such as CUDA (Compute Unified Device Architecture) and CUTLASS (CUDA Template Abstractions for Linear Algebra Subroutines). The output Tensor pointers (tensors are the most basic data structure in deep learning and can also be regarded as a container for representing data in computers) are used as the memory space (buffer) for kv computation, directly storing the cache tensor to be output, reducing memory copying.

[0076] CUDA is a general-purpose parallel computing platform. Directly using CUDA allows developers fine-grained control over kernel functions, such as the use of custom warps and the allocation of shared memory. CUTLASS is a CUDA C++ template library for implementing high-performance GEMM (General Matrix to Matrix Multiplication) and related computations. It encapsulates various optimized GEMM algorithms, allowing developers to achieve near-hardware-limit performance without having to write complex matrix operations from scratch. Using these technologies, in the single-layer Transformer designed in this embodiment, core operations such as the fully connected layer (Linear) and attention score calculation (MatMul) can be implemented using CUTLASS template instantiation to achieve operator parallelism, thereby ensuring optimal performance for these intensive computations.

[0077] The statement "using the output Tensor pointer as a buffer for kv computation and directly storing it in the output CacheTensor" is a memory optimization designed to eliminate unnecessary data copying. The traditional, less efficient computation method typically involves: Step 1. Calculating K and V for the current step; Step 2. Writing the result to a temporarily allocated memory space (Buffer); Step 3. Copying the data from this temporary Buffer to the final Tensor storing the KVCache. Steps 2 and 3 incur additional memory usage and copying overhead.

[0078] The efficient approach provided in this application is to directly obtain the memory address (pointer) of the Tensor that will ultimately be stored in the KVCache before computation, allowing the CUDA / CUTLASS kernel to directly write the computation result to this final address. This method eliminates the temporary buffer and one data copy, reducing memory usage and, more importantly, lowering latency and improving throughput.

[0079] In addition to the optimization methods mentioned above, different optimization needs can be met by supporting fp16 and bf16. fp16 is a half-precision floating-point number, occupying 2 bytes, which significantly reduces memory usage and bandwidth pressure, allowing GPU (Graphics Processing Unit) Tensor Cores to run at maximum throughput. Tensor Cores are processing units that accelerate matrix multiplication; they are hardware units specifically designed to accelerate matrix and tensor operations in fields such as artificial intelligence, deep learning, and high-performance computing. However, this method has a small representation range and is prone to overflow or precision issues. bf16 is a brain-like floating-point number, also occupying 2 bytes. It sacrifices some of the precision of fp16 in exchange for a representation range similar to fp32 (single precision). This makes it more stable in training and inference while effectively utilizing the capabilities of Tensor Cores. In the embodiments of this application, by enabling the entire single-layer implementation to support both precisions simultaneously, the optimal precision can be selected based on hardware support (e.g., newer GPUs have better support for bf16), or the precision can be selected based on the needs of different models (some models are sensitive to fp16, while bf16 can better maintain the effect), and a flexible choice can also be provided between performance and precision.

[0080] By employing the optimization methods described above, the ranking model can achieve better recommendation results during online inference while avoiding increased online inference time. It should be noted that the above optimizations can be used simultaneously, or only one or more of them can be used, depending on the specific needs; no restrictions are imposed here.

[0081] In summary, through the embodiments of this application, an autoregressive generative user behavior model can be constructed. The network structure of this model can be similar to that of a ranking model, both including an embedding layer for initially mapping input data into vectors and an encoding layer for modeling the relationships between different items in a user behavior sequence. Before training the ranking model, the generative user behavior model can be trained first using user behavior sequences as training data. After the generative user behavior model is trained, the parameters of the embedding layer in the generative user behavior model can be transferred to the ranking model. Then, during the training of the ranking model, the parameters of the embedding layer in the ranking model can be kept fixed, while the parameters of the encoding layer are used in the training. In this way, since the generative user behavior model has already modeled rich user behavior patterns through a pre-training strategy, the parameters in the embedding layer of the generative user behavior model already contain rich user behavior information after the model training converges. Therefore, through this cross-model parameter transfer method, the ranking model gains the ability to acquire user behavior information. Meanwhile, since the number of parameters involved in the embedding layer is usually large, the number of learnable model parameters in the ranking model can be greatly reduced when these parameters do not need to participate in the training. This can effectively alleviate the overfitting problem caused by the mismatch between the size of the learnable parameters and the optimization objective, thereby improving the recommendation quality and reducing the waste of service resources.

[0082] Furthermore, in the preferred implementation, the encoding layer of the ranking model can be upgraded to a more complex modeling approach. Specifically, this can be achieved through multi-head attention mechanisms and / or multiple stacked block structures to realize multi-level interactions between different products, thereby enabling the model to construct extremely rich contextual representations. For example, in specific implementations, the encoding layer can be implemented using models such as the Transformer. In this way, the ranking model can gain a deeper understanding of user behavior sequences, improving its generalization ability. In addition, by introducing models such as the Transformer, not only can behavioral patterns be explored more deeply, but the understanding of user interests and preferences can also be further improved by expanding the parameter scale of the ranking model. This achieves the scaling law phenomenon of the ranking model, that is, the model performance can predictably improve as the parameter scale increases.

[0083] Furthermore, to ensure the timeliness of the recommendation ranking model and meet the needs of changing user interests, the training of both the generative user behavior model and the ranking model can be performed periodically. Additionally, a "cross-time parameter transfer" strategy can be employed to achieve continuous evolution of model parameters over time. For the generative user behavior model, this cross-time parameter transfer can involve a full parameter transfer. That is, the complete model parameters from the previous training cycle (including all components such as the embedding layer and encoding layer) can be used as the initial weights for the current cycle, allowing the generative user behavior model to continuously learn based on existing knowledge, gradually absorbing the latest user behavior patterns and achieving progressive updates to behavioral representations. The ranking model, on the other hand, can employ a partial parameter transfer strategy. This means only the parameters of the encoding layer from the previous training cycle are transferred, while the parameters of the embedding layer are obtained from the generative user behavior model through "cross-model parameter transfer." This dual-parameter transfer-driven generative user behavior modeling and recommendation ranking joint training method can fully capture complex patterns of user behavior and effectively transfer these patterns to the recommendation ranking model. This not only effectively alleviates the overfitting problem faced by conventional ranking models, but also allows for an incremental understanding of user interest transfer.

[0084] Example 2 This second embodiment provides a product sorting method for the online reasoning process in the product recommendation process. See [link to relevant documentation]. Figure 6 The method may include: S601: When it is necessary to recommend products to target users, obtain the user behavior sequence of the target users and determine the candidate product set; S602: The user behavior sequence and the product information in the candidate product set are processed using a ranking model to calculate and rank the matching degree between multiple candidate products and the user interests of the target user; wherein, the ranking model is obtained by training using the method described in the aforementioned embodiment one.

[0085] As described in Example 1, in order to reduce the online inference time of the ranking model, some optimization strategies can be provided during the online inference process. For example, one optimization strategy can be KV Cache, that is, in the process of processing using the ranking model, the user history sequence modeling part and the candidate product modeling part are calculated separately, so that the user behavior sequence part is calculated only once and the calculation result is cached for subsequent calculations.

[0086] Additionally, the length of the user behavior sequence can be padded with a fixed value, and operators can be constructed using the underlying library. Internal matrix operations are optimized through a parallel computing platform and / or a template library for implementing high-performance matrix multiplication and related calculations. Before computation, the memory address (pointer) of the tensor used to store cached information is obtained, and the internal matrix operation kernel directly writes the computation result to this memory address to reduce memory usage and latency.

[0087] Furthermore, the first number of computational operations (ops) can be merged into a second number of composite computational operations, which is less than the first number, in order to reduce the scheduling overhead in the computation.

[0088] Example 3 This third embodiment provides a product recommendation system, which may include a server and a client, wherein... The server is used to obtain the user behavior sequence of the target user when it is necessary to recommend products to the target user, and after determining the candidate product set, use a ranking model to process the user behavior sequence and the product information in the candidate product set to calculate and rank the matching degree between multiple candidate products and the user interests of the target user; wherein, the ranking model is trained using the method described in the aforementioned embodiment one; The client is used to display recommended product information on the target page according to the candidate products and their ranking results determined by the server.

[0089] For details not described in Embodiments 2 and 3 above, please refer to Embodiment 1 and other parts of this specification. They will not be repeated here.

[0090] It should be noted that the embodiments of this application may involve the use of user data. In practical applications, user-specific personal data may be used in the scheme described herein within the scope permitted by applicable laws and regulations, provided that it complies with the applicable laws and regulations of the country (e.g., with the user's explicit consent, with the user being properly notified, etc.).

[0091] Corresponding to Embodiment 2, this application also provides a product sorting device in the product recommendation process, which may include: The user behavior sequence acquisition unit is used to acquire the user behavior sequence of the target user and determine the candidate product set when it is necessary to recommend products to the target user. The ranking unit is used to process the user behavior sequence and the product information in the candidate product set using a ranking model, so as to calculate and rank the matching degree between multiple candidate products and the user interests of the target user; wherein the ranking model is trained using the method described in the aforementioned embodiment one.

[0092] In a specific implementation, the device may further include: The caching unit is used to separate the user history sequence modeling part from the candidate product modeling part during the processing using the ranking model, so that the user behavior sequence part is calculated only once and the calculation result is cached for subsequent calculations.

[0093] Additionally, it may include: The operator construction unit is used to fill the length of the user behavior sequence with a fixed value and construct operators using the underlying library. The internal matrix operation of the computation processing unit is optimized by a parallel computing platform and / or a template library for implementing high-performance matrix multiplication and related calculations. Before the calculation, the memory address of the tensor used to cache the calculation results of the user behavior sequence is obtained so that the computation processing unit can write the calculation results to the memory address.

[0094] The constructed operator supports both half-precision floating-point numbers and full-precision floating-point numbers, allowing for the selection of different precisions based on hardware support and / or model requirements.

[0095] In addition, embodiments of this application also provide a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the method described in any of the foregoing method embodiments.

[0096] And an electronic device, comprising: One or more processors; and A memory associated with the one or more processors, the memory being used to store program instructions that, when read and executed by the one or more processors, perform the steps of the method described in any of the foregoing method embodiments.

[0097] A computer program product includes a computer program / computer executable instructions that, when executed by a processor in an electronic device, implement the steps of the method described in the foregoing method embodiments.

[0098] in, Figure 7An exemplary architecture of an electronic device is shown, which may include a processor 710, a video display adapter 711, a disk drive 712, an input / output interface 713, a network interface 714, and a memory 720. The processor 710, video display adapter 711, disk drive 712, input / output interface 713, network interface 714, and memory 720 can communicate with each other via a communication bus 730.

[0099] The processor 710 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to achieve the technical solution provided in this application.

[0100] The memory 720 can be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 720 can store the operating system 721 for controlling the operation of the electronic device 700, and the basic input / output system (BIOS) for controlling the low-level operations of the electronic device 700. Additionally, it can store a web browser 723, a data storage management system 724, and a product sorting processing system 725, etc. The aforementioned product sorting processing system 725 can be the application program that specifically implements the aforementioned steps in this embodiment. In summary, when implementing the technical solution provided in this application through software or firmware, the relevant program code is stored in the memory 720 and executed by the processor 710.

[0101] Input / output interface 713 is used to connect input / output modules to realize information input and output. Input / output modules can be configured as components in the device (not shown in the figure) or externally connected to the device to provide corresponding functions. Input devices may include keyboards, mice, touch screens, microphones, various sensors, etc., and output devices may include displays, speakers, vibrators, indicator lights, etc.

[0102] Network interface 714 is used to connect a communication module (not shown in the figure) to enable communication between this device and other devices. The communication module can communicate via wired means (such as USB, Ethernet cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).

[0103] Bus 730 includes a pathway for transmitting information between various components of the device, such as processor 710, video display adapter 711, disk drive 712, input / output interface 713, network interface 714, and memory 720.

[0104] It should be noted that although the above-described device only shows the processor 710, video display adapter 711, disk drive 712, input / output interface 713, network interface 714, memory 720, bus 730, etc., in specific implementations, the device may also include other components necessary for normal operation. Furthermore, those skilled in the art will understand that the above-described device may only include the components necessary for implementing the solution of this application, and does not necessarily include all the components shown in the figures.

[0105] As can be seen from the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware platforms. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in various embodiments or some parts of the embodiments of this application.

[0106] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, for system or system embodiments, since they are basically similar to method embodiments, the description is relatively simple, and relevant parts can be referred to the descriptions in the method embodiments. The systems and system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without creative effort.

[0107] The foregoing has provided a detailed description of the ranking model training, product ranking method, and product recommendation system provided in this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the embodiments above are merely for the purpose of helping to understand the method and core ideas of this application. Furthermore, those skilled in the art will recognize that, based on the ideas of this application, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A method for training a ranking model, characterized in that, The ranking model is used in a product recommendation scenario to calculate and rank candidate products based on their matching degree with user interests. The network structure of the ranking model includes an embedding layer for initially mapping input data into vectors, and an encoding layer for modeling the relationships between different products in a user behavior sequence. The method includes: A generative user behavior model based on autoregression is constructed, and the generative user behavior model is trained based on the user's historical behavior sequence. The generative user behavior model includes the embedding layer and the encoding layer, which are used to predict the user's next behavior target based on the user behavior sequence. After the generative user behavior model is trained, the parameters of the embedding layer in the generative user behavior model are transferred to the ranking model. During the training of the ranking model, the parameters of the embedding layer in the ranking model are kept constant, and the parameters of the encoding layer are used in the training.

2. The method according to claim 1, characterized in that, Both the generative user behavior model and the ranking model adopt a periodic training method. During each period of training, the complete model parameters obtained from the previous period of training of the generative user behavior model are transferred to the generative user behavior model as the initial weights for the current period. After the generative user behavior model completes training for the current period, the parameters of the embedding layer are transferred to the ranking model, and the parameters of the encoding layer obtained from the previous training period are transferred to the ranking model. Then, the ranking model is trained for the current period.

3. The method according to claim 1, characterized in that, The ranking model reuses the network structure of the encoding layer in the generative user behavior model.

4. The method according to claim 1 or 3, characterized in that, The generative user behavior model includes a self-attention layer in its encoding layer. The self-attention layer prevents the generative user behavior model from knowing the information of the next product and subsequent products in the user behavior sequence during the prediction process by adding a mask to the product information after the target position in the user behavior sequence.

5. The method according to claim 1 or 3, characterized in that, The generative user behavior model employs a multi-head attention mechanism and / or multiple stacked block structures in its encoding layer to enable multi-level interactions between different products during the modeling of relationships between different products in the user behavior sequence.

6. A product ranking method in a product recommendation process, characterized in that, include: When it is necessary to recommend products to target users, the user behavior sequence of the target users is obtained, and a set of candidate products is determined. The user behavior sequence and the product information in the candidate product set are processed using a ranking model to calculate and rank the matching degree between multiple candidate products and the user interests of the target user; wherein the ranking model is trained using the method described in any one of claims 1 to 5.

7. The method according to claim 6, characterized in that, Also includes: In the process of using the ranking model, the user history sequence modeling part and the candidate product modeling part are calculated separately, so that the user behavior sequence part is calculated only once and the calculation result is cached for subsequent calculations.

8. The method according to claim 7, characterized in that, Also includes: The length of the user behavior sequence is padded with a fixed value, and operators are constructed using the underlying library. The internal matrix operations of the computation processing unit are optimized by a parallel computing platform and / or a template library for implementing high-performance matrix multiplication and related calculations. Before the calculation, the memory address of the tensor used to cache the calculation results of the user behavior sequence is obtained so that the computation processing unit can write the calculation results to the memory address.

9. The method according to claim 8, characterized in that, The constructed operator supports both half-precision floating-point numbers and full-precision floating-point numbers, allowing for the selection of different precisions based on hardware support and / or model requirements.

10. A product recommendation system, characterized in that, This includes both the server and the client, among which, The server is configured to, when it is necessary to recommend products to a target user, acquire the user behavior sequence of the target user, determine a set of candidate products, and then use a ranking model to process the user behavior sequence and the product information in the set of candidate products to calculate and rank the matching degree between multiple candidate products and the user interests of the target user; wherein, the ranking model is trained using the method described in any one of claims 1 to 5. The client is used to display recommended product information on the target page according to the candidate products and their ranking results determined by the server.

11. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the program implements the steps of the method described in any one of claims 1 to 9.

12. An electronic device, characterized in that, include: One or more processors; as well as A memory associated with the one or more processors, the memory being used to store program instructions that, when read and executed by the one or more processors, perform the steps of the method according to any one of claims 1 to 9.

13. A computer program product comprising a computer program / computer executable instructions, characterized in that, When the computer program / computer executable instructions are executed by a processor in an electronic device, they implement the steps of the method according to any one of claims 1 to 9.