Project recommendation method and related device thereof

By using a multi-head self-attention mechanism to process user historical information, the problem of single-factor operation in neural network models is solved, resulting in more accurate project recommendation results and improved user experience.

CN115292583BActive Publication Date: 2026-01-02HUAWEI TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210705920.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-21
Publication Date
2026-01-02
Estimated Expiration
2042-06-21

AI Technical Summary

Technical Problem

Existing neural network models consider only a limited number of factors in item recommendation, resulting in low accuracy of recommendation results and negatively impacting user experience.

Method used

A multi-head self-attention mechanism is used to process user historical information, considering the mutual influence between behaviors of the same and different categories. Combining behavior ranking and distance, user interest distribution is generated through feature extraction and fusion, thereby improving the accuracy of recommendation results.

Benefits of technology

By processing user behavior through a multi-head self-attention mechanism, more accurate project recommendation results are generated, thus improving the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115292583B_ABST
    Figure CN115292583B_ABST
Patent Text Reader

Abstract

The application discloses a project recommendation method and a related device thereof. The project recommendation result output by the neural network model used by the application can have high accuracy, which is beneficial to optimizing user experience. The method of the application is realized by a target model. The method of the application comprises the following steps: acquiring N first information, wherein the i first information is used for indicating the i first project and the i behavior, the i behavior is the behavior of a user to the i project, N behaviors of the user correspond to M categories, i=1,...,N, N>=M, and M>1; processing the N first information based on a multi-head self-attention mechanism to obtain N second information; and acquiring a project recommendation result based on the N second information, wherein the project recommendation result is used for determining a target project recommended to the user from K second projects, and K>=1.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of artificial intelligence (AI) technology, and particularly relates to a project recommendation method and a related device thereof. BACKGROUND

[0002] With the rapid development of computer technology, in order to meet the online needs of users, developers are increasingly inclined to present content of interest to users on the pages of applications. Based on this, for a certain application, it is often necessary to predict which item or items a user will purchase, that is, to recommend items of interest to the user, so as to present these items on the pages of the application to provide services for the user.

[0003] At present, AI technology can be used to predict items that can be recommended to users. Specifically, historical information of a user can be collected first, which is used to indicate items that the user has interacted with and behaviors of the user with respect to these items. Since there are various categories of behaviors of the user with respect to items, the historical information of the user can be divided according to the categories of behaviors, and each category of information can be processed by a neural network model to obtain a processing result of each category of information. Finally, the processing results of each category of information can be superimposed to obtain a project recommendation result, so as to determine a target item to be recommended to the user.

[0004] In the above process, when the neural network model processes information, it mainly considers the mutual influence between multiple behaviors belonging to the same category, and the considered factors are relatively single, which leads to low accuracy of the project recommendation result finally output by the model, and affects the user experience. SUMMARY

[0005] Embodiments of the present application provide a project recommendation method and a related device thereof, and the project recommendation result output by the neural network model used by the method can have high accuracy, which is beneficial to optimizing the user experience.

[0006] A first aspect of embodiments of the present application provides a project recommendation method, which comprises:

[0007] When a user uses an application, in order to display items of interest to the user on a page of the application, the user can first collect some historical data of the user using the application, and based on the historical data, N first information can be obtained. The i-th first information is used to indicate an i-th first item (i.e., a historical item) and an i-th action that the user has operated when using the application. The i-th action can be understood as an action performed by the user when operating the i-th item. The N actions performed by the user can be divided into M categories, i = 1,..., N, N ≥ M, M > 1. For example, when a user uses a shopping software, in order to predict a product that can be recommended to the user, 5 first information generated by the user when using the software can be obtained. The 1st first information is used to indicate a piece of clothing and a click action of the user on the clothing. The 2nd first information is used to indicate a pair of shoes and a collection action of the user on the shoes. The 3rd first information is used to indicate a hat and a purchase action of the user on the hat. The 4th first information is used to indicate a pair of trousers and a click action of the user on the trousers. The 5th first information is used to indicate another pair of trousers and a purchase action of the user on the trousers. As can be seen, the 5 actions of the user on the 5 products can be divided into 3 categories, which are click action, collection action and purchase action.

[0008] After obtaining the N first information, the N first information can be input into a target model. Therefore, the target model can process the N first information based on a multi-head self-attention mechanism, so as to obtain N second information correspondingly. After obtaining the N second information, the target model can obtain a product recommendation result based on the N second information. The product recommendation result can be used to determine a target product to be recommended to the user from K second items (i.e., candidate items), K ≥ 1.

[0009] As can be seen from the above method, when it is needed to recommend a target item of interest of a user, N first information can be input to the target model, wherein the i-th first information is used to indicate the i-th first item and the i-th behavior, the i-th behavior is the behavior of the user to the i-th item, the N behaviors of the user correspond to M categories, i = 1, …, N, N ≥ M, M > 1. Then, the target model can process the N first information based on the multi-head self-attention mechanism to obtain N second information. Finally, the target model can obtain an item recommendation result based on the N second information, and the item recommendation result is used to determine a target item to be recommended to the user from K second items, K ≥ 1. In the foregoing process, since the N first information is not only used to indicate the N first items, but also used to indicate the N behaviors which can be divided into M categories, in the process that the target model processes the N first information to correspondingly obtain the N second information, not only the mutual influence between the behaviors belonging to the same category and the mutual influence between the first items can be considered, but also the mutual influence between the behaviors belonging to different categories can be considered, the considered factors are more comprehensive, and therefore the item recommendation result output by the target model based on the N second information can have high accuracy, which is beneficial to optimizing the user experience.

[0010] In a possible implementation, the processing of the N first information based on the multi-head attention mechanism to obtain N second information comprises: performing linear processing on the ith first information to obtain the ith Q information, the ith K information and the ith V information; and performing operation on the ith Q information, the N K information, the N V information and N weight information corresponding to the ith action to obtain the ith second information, the jth weight information corresponding to the ith action being determined based on the ith action and the jth action, j = 1, …, N. In the foregoing implementation, after receiving the N first information, for any one of the N first information, that is, the ith first information, the target model can first perform linear processing on the ith first information to obtain the ith Q information, the ith K information and the ith V information. For the remaining first information other than the ith first information, the target model can also perform the operation as performed on the ith first information, so that N Q information, N K information and N V information can be obtained in total. That is, the target model can perform linear processing on the 1st first information to obtain the 1st Q information, the 1st K information and the 1st V information, can perform linear processing on the 2nd first information to obtain the 2nd Q information, the 2nd K information and the 2nd V information, and can perform linear processing on the Nth first information to obtain the Nth Q information, the Nth K information and the Nth V information. For the ith Q information, the target model can perform operation on the ith Q information, the N K information, the N V information and N weight information corresponding to the ith action to obtain the ith second information, the jth weight information corresponding to the ith action being determined based on the ith action and the jth action, j = 1, …, N. For the remaining Q information other than the ith Q information, the target model can also perform the operation as performed on the ith Q information, so that N second information can be obtained. That is, the target model can first perform operation on the 1st Q information, the N K information, the N V information and N weight information corresponding to the 1st action to obtain the 1st second information, can perform operation on the 2nd Q information, the N K information, the N V information and N weight information corresponding to the 2nd action to obtain the 2nd second information, and can perform operation on the Nth Q information, the N K information, the N V information and N weight information corresponding to the Nth action to obtain the Nth second information. Wherein, the 1st weight information corresponding to the 1st action is determined based on the 1st action, the 2nd weight information corresponding to the 1st action is determined based on the 1st action and the 2nd action, …, the Nth weight information of the 1st action is determined based on the 1st action and the Nth action, …, the 1st weight information corresponding to the Nth action is determined based on the Nth action and the 1st action, the 2nd weight information corresponding to the Nth action is determined based on the Nth action and the 2nd action, …, and the Nth weight information of the Nth action is determined based on the Nth action.

[0011] In a possible implementation, the method further includes: obtaining N third information, the i-th third information being used to indicate the i-th action; performing operation on the i-th third information and the N third information to obtain N fourth information corresponding to the i-th action, the j-th fourth information corresponding to the i-th action being used to indicate the distance between the i-th action and the j-th action; and performing operation on the i-th Q information, the N K information, the N V information, and the N weight information corresponding to the i-th action to obtain the i-th second information. In the foregoing implementation, after receiving the N third information, for any one of the N third information, i.e., the i-th third information, the target model can perform operation on the i-th third information and the N third information to obtain N fourth information corresponding to the i-th action, the j-th fourth information corresponding to the i-th action being used to indicate the distance between the i-th action and the j-th action. For the remaining third information other than the i-th third information, the target model can also perform operation as performed on the i-th third information, and thus N fourth information corresponding to the 1st action, N fourth information corresponding to the 2nd action,..., and N fourth information corresponding to the Nth action can be obtained in total. That is, the target model can perform operation on the 1st third information and the 1st third information to obtain the 1st fourth information corresponding to the 1st action (used to indicate the distance between the 1st actions), perform operation on the 1st third information and the 2nd third information to obtain the 2nd fourth information corresponding to the 1st action (used to indicate the distance between the 1st action and the 2nd action),..., perform operation on the 1st third information and the Nth third information to obtain the Nth fourth information corresponding to the 1st action (used to indicate the distance between the 1st action and the Nth action),..., perform operation on the Nth third information and the 1st third information to obtain the 1st fourth information corresponding to the Nth action (used to indicate the distance between the Nth action and the 1st action), perform operation on the Nth third information and the 2nd third information to obtain the 2nd fourth information corresponding to the Nth action (used to indicate the distance between the Nth action and the 2nd action),..., and perform operation on the Nth third information and the Nth third information to obtain the Nth fourth information corresponding to the Nth action (used to indicate the distance between the Nth actions). Then, for the i-th Q information, the target model can perform operation on the i-th Q information, the N K information, the N V information, the N weight information corresponding to the i-th action, and the N fourth information corresponding to the i-th action to obtain the i-th second information. For the remaining Q information other than the i-th Q information, the target model can also perform operation as performed on the i-th Q information, and thus N second information can be obtained.That is, the target model can first perform operations on the first Q information, the N K information, the N V information, the N weight information corresponding to the first behavior, and the N fourth information corresponding to the first behavior to obtain the first second information, the target model can also perform operations on the second Q information, the N K information, the N V information, the N weight information corresponding to the second behavior, and the N fourth information corresponding to the second behavior to obtain the second second information, and so on, the target model can also perform operations on the Nth Q information, the N K information, the N V information, the N weight information corresponding to the Nth behavior, and the N fourth information corresponding to the Nth behavior to obtain the Nth second information. As can be seen, in the process of processing the N first information based on the multi-head self-attention mechanism, the target model also considers the influence of the distance between the rankings of different behaviors, the considered factors are more comprehensive compared to related technologies, and the project recommendation result output by the target model can also accurately match the real intention of the user, thereby further improving the accuracy of the project recommendation result.

[0012] In a possible implementation, the distance between the ith behavior and the jth behavior includes an interval between the ranking of the ith behavior and the ranking of the jth behavior, for example, an interval between the time when the user performs the ith behavior and the time when the user performs the jth behavior, and the like.

[0013] In a possible implementation, the recommendation result based on the N second information acquisition items comprises: performing feature extraction on the N second information to obtain fifth information and sixth information, the fifth information being used to indicate different points among the N behaviors, and the sixth information being used to indicate same points among the N behaviors; fusing the fifth information and the sixth information to obtain seventh information, the seventh information being used to indicate the interest distribution of the user; and calculating matching degrees between the seventh information and K eighth information, the matching degrees being used as the item recommendation result, and the tth eighth information being used to indicate the tth second item, t = 1,..., K. In the foregoing implementation, after the N second information is obtained, the target model can perform feature extraction on the N second information in a certain manner to obtain the fifth information, the fifth information containing the exclusive characteristics of each of the N behaviors, and therefore the fifth information can be used to indicate different points among the N behaviors. Meanwhile, the target model can also perform feature extraction on the N second information in another manner to obtain the sixth information, the sixth information containing the common characteristics of the N behaviors, and therefore the sixth information can be used to indicate same points among the N behaviors. After the fifth information and the sixth information are obtained, the target model can perform weighted summation on the fifth information and the sixth information to obtain the seventh information, the seventh information being the behavior representation of the user, and therefore the seventh information can be used to indicate the interest distribution of the user. After the seventh information is obtained, the target model can also obtain K eighth information, wherein the tth eighth information is used to indicate the tth second item, t = 1,..., K. In the K eighth information, the target model can calculate the matching degrees between the seventh information and the tth eighth information, and for the eighth information other than the tth eighth information, the target model can also perform operations as performed on the tth eighth information, and therefore the matching degrees between the seventh information and the K eighth information can be obtained, and therefore these matching degrees can be used as the item recommendation result finally output by the target model. As can be seen, the target model can perform deeper information mining on the processing result of the multi-head self-attention mechanism, and therefore mine the exclusive information of the multiple behaviors of the user and the common information of the multiple behaviors, to construct the behavior representation of the user. Then, the item that can match the behavior representation of the user can be used as the target item recommended to the user, and therefore the accuracy of item recommendation can be improved.

[0014] In a possible implementation, the K second items contain the N first items.

[0015] The second aspect of the embodiment of the present application provides a model training method, which comprises the following steps: inputting N first information into a to-be-trained model to obtain a predicted item recommendation result, the to-be-trained model being configured to: acquire the N first information, the i-th first information being configured to indicate the i-th first item and the i-th behavior, the i-th behavior being a behavior of a user to the i-th item, the N behaviors of the user corresponding to M categories, i=1,...,N, N≥M, M>1; process the N first information based on a multi-head attention mechanism to obtain N second information; acquire the predicted item recommendation result based on the N second information, the predicted item recommendation result being configured to determine a target item to be recommended to the user from K second items, K≥1; acquire a target loss based on the predicted item recommendation result and a real item recommendation result, the target loss being configured to indicate a difference between the predicted item recommendation result and the real item recommendation result; update parameters of the to-be-trained model based on the target loss until a model training condition is met to obtain a target model.

[0016] The target model trained by the above method has the function of recommending items to users. When it is necessary to recommend a target item of interest to a user, the target model can be input with N first information, wherein the i-th first information is configured to indicate the i-th first item and the i-th behavior, the i-th behavior being a behavior of a user to the i-th item, the N behaviors of the user corresponding to M categories, i=1,...,N, N≥M, M>1. Then, the target model can process the N first information based on a multi-head self-attention mechanism to obtain N second information. Finally, the target model can acquire an item recommendation result based on the N second information, the item recommendation result being configured to determine a target item to be recommended to the user from K second items, K≥1. In the foregoing process, since the N first information is configured to indicate not only the N first items but also the N behaviors which can be divided into M categories, when the target model processes the N first information to obtain the N second information, it can not only consider the mutual influence between behaviors belonging to the same category and the mutual influence between the first items, but also consider the mutual influence between behaviors belonging to different categories. The considered factors are more comprehensive, and therefore the item recommendation result output by the target model based on the N second information can have high accuracy, which is conducive to optimizing the user experience.

[0017] In a possible implementation manner, the to-be-trained model is configured to: linearly process the i-th first information to obtain i-th Q information, i-th K information and i-th V information; and operate the i-th Q information, N K information, N V information and N weight information corresponding to the i-th behavior to obtain the i-th second information, the j-th weight information corresponding to the i-th behavior being determined based on the i-th behavior and the j-th behavior, j=1,...,N.

[0018] In a possible implementation, the to-be-trained model is further configured to: obtain N third information, the i-th third information being used to indicate the i-th behavior; and perform operation on the i-th third information and the N third information to obtain N fourth information corresponding to the i-th behavior, the j-th fourth information corresponding to the i-th behavior being used to indicate a distance between the i-th behavior and the j-th behavior; and the to-be-trained model is configured to perform operation on the i-th Q information, the N K information, the N V information, N weight information corresponding to the i-th behavior, and the N fourth information corresponding to the i-th behavior to obtain the i-th second information.

[0019] In a possible implementation, the distance between the i-th behavior and the j-th behavior includes an interval between the ranking of the i-th behavior and the ranking of the j-th behavior.

[0020] In a possible implementation, the to-be-trained model is configured to: perform feature extraction on the N second information to obtain fifth information and sixth information, the fifth information being used to indicate different points among the N behaviors, and the sixth information being used to indicate same points among the N behaviors; perform fusion on the fifth information and the sixth information to obtain seventh information, the seventh information being used to indicate the interest distribution of the user; and calculate a matching degree between the seventh information and K eighth information, the matching degree being used as the item recommendation result, and the t-th eighth information being used to indicate the t-th second item, t = 1,..., K.

[0021] In a possible implementation, the K second items include the N first items.

[0022] A third aspect of the embodiment of the present application provides an item recommendation apparatus, which comprises: a first obtaining module configured to obtain N first information by using a target model, the i-th first information being used to indicate an i-th first item and an i-th behavior, the i-th behavior being a behavior of a user to the i-th item, N behaviors of the user corresponding to M categories, i = 1,..., N, N ≥ M, and M > 1; a processing module configured to process the N first information based on a multi-head self-attention mechanism by using the target model to obtain N second information; and a second obtaining module configured to obtain an item recommendation result by using the target model based on the N second information, the item recommendation result being used to determine a target item to be recommended to the user from K second items, K ≥ 1.

[0023] It can be seen from the above device that when it is necessary to recommend a target item of interest of a user, N first information can be input to the target model, wherein the i-th first information is used to indicate the i-th first item and the i-th behavior, the i-th behavior is the behavior of the user to the i-th item, the N behaviors of the user correspond to M categories, i = 1,..., N, N ≥ M, M > 1. Then, the target model can process the N first information based on the multi-head self-attention mechanism to obtain N second information. Finally, the target model can obtain an item recommendation result based on the N second information, and the item recommendation result is used to determine a target item to be recommended to the user from K second items, K ≥ 1. In the foregoing process, since the N first information is used to indicate not only the N first items but also the N behaviors that can be divided into M categories, in the process in which the target model processes the N first information to correspondingly obtain the N second information, not only the mutual influence between the behaviors belonging to the same category and the mutual influence between the first items can be considered, but also the mutual influence between the behaviors belonging to different categories can be considered. The considered factors are relatively comprehensive, and therefore the item recommendation result output by the target model based on the N second information can have relatively high accuracy, which is beneficial to optimizing the user experience.

[0024] In a possible implementation, the processing module is configured to: perform linear processing on the i-th first information by using the target model to obtain i-th Q information, i-th K information and i-th V information; and perform operation on the i-th Q information, N K information, N V information and N weight information corresponding to the i-th behavior by using the target model to obtain the i-th second information, wherein the j-th weight information corresponding to the i-th behavior is determined based on the i-th behavior and the j-th behavior, j = 1,..., N.

[0025] In a possible implementation, the device further includes: a third obtaining module configured to obtain N third information by using the target model, wherein the i-th third information is used to indicate the i-th behavior; an operation module configured to perform operation on the i-th third information and the N third information by using the target model to obtain N fourth information corresponding to the i-th behavior, wherein the j-th fourth information corresponding to the i-th behavior is used to indicate the distance between the i-th behavior and the j-th behavior; and a processing module configured to perform operation on the i-th Q information, N K information, N V information, N weight information corresponding to the i-th behavior and N fourth information corresponding to the i-th behavior by using the target model to obtain the i-th second information.

[0026] In a possible implementation, the distance between the i-th behavior and the j-th behavior includes an interval between the ranking of the i-th behavior and the ranking of the j-th behavior.

[0027] In a possible implementation, the second obtaining module is configured to: perform feature extraction on the N second information by using the target model to obtain fifth information and sixth information, the fifth information being used to indicate different points among the N behaviors, and the sixth information being used to indicate same points among the N behaviors; perform fusion on the fifth information and the sixth information by using the target model to obtain seventh information, the seventh information being used to indicate the interest distribution of the user; and calculate a matching degree between the seventh information and K eighth information by using the target model, the matching degree being used as the item recommendation result, and the tth eighth information being used to indicate the tth second item, t = 1,..., K.

[0028] In a possible implementation, the K second items include the N first items.

[0029] The fourth aspect of the embodiment of the present application provides a model training apparatus, which comprises: a processing module configured to input N first information into a to-be-trained model to obtain a predicted item recommendation result, the to-be-trained model being configured to: obtain the N first information, the ith first information being used to indicate an ith first item and an ith behavior, the ith behavior being a behavior of a user to the ith item, N behaviors of the user corresponding to M categories, i = 1,..., N, N ≥ M, and M > 1; perform processing on the N first information based on a multi-head attention mechanism to obtain N second information; obtain the predicted item recommendation result based on the N second information, the predicted item recommendation result being used to determine a target item to be recommended to the user from K second items, K ≥ 1; an obtaining module configured to obtain a target loss based on the predicted item recommendation result and an actual item recommendation result, the target loss being used to indicate a difference between the predicted item recommendation result and the actual item recommendation result; and an updating module configured to update parameters of the to-be-trained model based on the target loss until a model training condition is met to obtain a target model.

[0030] The target model trained by the device has the function of recommending items to users. When it is necessary to recommend target items of interest to a user, N first information can be input to the target model, wherein the i-th first information is used to indicate the i-th first item and the i-th behavior, the i-th behavior is the behavior of the user to the i-th item, the N behaviors of the user correspond to M categories, i = 1,..., N, N ≥ M, M > 1. Then, the target model can process the N first information based on the multi-head self-attention mechanism to obtain N second information. Finally, the target model can obtain an item recommendation result based on the N second information, and the item recommendation result is used to determine a target item to be recommended to the user from K second items, K ≥ 1. In the foregoing process, since the N first information is used to indicate not only the N first items but also the N behaviors that can be divided into M categories, when the target model processes the N first information to correspondingly obtain the N second information, not only the mutual influence between the behaviors belonging to the same category and the mutual influence between the first items can be considered, but also the mutual influence between the behaviors belonging to different categories can be considered. The considered factors are more comprehensive, and therefore the item recommendation result output by the target model based on the N second information can have high accuracy, which is beneficial to optimizing user experience.

[0031] In a possible implementation, the to-be-trained model is configured to: perform linear processing on the i-th first information to obtain i-th Q information, i-th K information and i-th V information; and perform operation on the i-th Q information, N K information, N V information and N weight information corresponding to the i-th behavior to obtain the i-th second information, wherein the j-th weight information corresponding to the i-th behavior is determined based on the i-th behavior and the j-th behavior, j = 1,..., N.

[0032] In a possible implementation, the to-be-trained model is further configured to: obtain N third information, wherein the i-th third information is used to indicate the i-th behavior; and perform operation on the i-th third information and N third information to obtain N fourth information corresponding to the i-th behavior, wherein the j-th fourth information corresponding to the i-th behavior is used to indicate the distance between the i-th behavior and the j-th behavior; and the to-be-trained model is configured to perform operation on the i-th Q information, N K information, N V information, N weight information corresponding to the i-th behavior and N fourth information corresponding to the i-th behavior to obtain the i-th second information.

[0033] In a possible implementation, the distance between the i-th behavior and the j-th behavior includes an interval between the ranking of the i-th behavior and the ranking of the j-th behavior.

[0034] In a possible implementation, the model to be trained is configured to: perform feature extraction on the N second information to obtain fifth information and sixth information, the fifth information being used to indicate different points among the N behaviors, and the sixth information being used to indicate same points among the N behaviors; fuse the fifth information and the sixth information to obtain seventh information, the seventh information being used to indicate the interest distribution of the user; and calculate a matching degree between the seventh information and K eighth information, the matching degree being used as the item recommendation result, and the t-th eighth information being used to indicate the t-th second item, t = 1,..., K.

[0035] In a possible implementation, the K second items include the N first items.

[0036] A fifth aspect of the embodiments of the present application provides an item recommendation apparatus, which includes a memory and a processor; the memory stores code, and the processor is configured to execute the code, when the code is executed, the item recommendation apparatus performs the method according to the first aspect or any possible implementation manner of the first aspect.

[0037] A sixth aspect of the embodiments of the present application provides a model training apparatus, which includes a memory and a processor; the memory stores code, and the processor is configured to execute the code, when the code is executed, the model training apparatus performs the method according to the second aspect or any possible implementation manner of the second aspect.

[0038] A seventh aspect of the embodiments of the present application provides circuitry, which includes processing circuitry configured to perform the method according to the first aspect, any possible implementation manner of the first aspect, the second aspect, or any possible implementation manner of the second aspect.

[0039] An eighth aspect of the embodiments of the present application provides a chip system, which includes a processor, configured to invoke a computer program or computer instruction stored in a memory, so that the processor performs the method according to the first aspect, any possible implementation manner of the first aspect, the second aspect, or any possible implementation manner of the second aspect.

[0040] In a possible implementation, the processor is coupled with the memory through an interface.

[0041] In a possible implementation, the chip system further includes the memory, and the memory stores the computer program or the computer instruction.

[0042] The ninth aspect of the embodiments of the present application provides a computer storage medium, which stores a computer program, and the program causes a computer to implement the method in the first aspect, any possible implementation manner of the first aspect, the second aspect, or any possible implementation manner of the second aspect when the program is executed by the computer.

[0043] The tenth aspect of the embodiments of the present application provides a computer program product, which stores instructions, and the instructions cause a computer to implement the method in the first aspect, any possible implementation manner of the first aspect, the second aspect, or any possible implementation manner of the second aspect when the instructions are executed by the computer.

[0044] In the embodiments of the present application, when it is necessary to recommend a target item of interest to a user, N first information can be input to a target model, wherein the i th first information is used to indicate an i th first item and an i th behavior, the i th behavior is a behavior of the user to the i th item, N behaviors of the user correspond to M categories, i = 1, …, N, N ≥ M, and M > 1. Then, the target model can process the N first information based on a multi-head self-attention mechanism to obtain N second information. Finally, the target model can obtain an item recommendation result based on the N second information, and the item recommendation result is used to determine a target item to be recommended to the user from K second items, K ≥ 1. In the foregoing process, since the N first information is used to indicate not only the N first items but also the N behaviors that can be divided into the M categories, in the process in which the target model processes the N first information to correspondingly obtain the N second information, not only the mutual influence between the behaviors belonging to the same category and the mutual influence between the first items can be considered, but also the mutual influence between the behaviors belonging to different categories can be considered. The considered factors are relatively comprehensive, and therefore the item recommendation result output by the target model based on the N second information can have relatively high accuracy, which is beneficial to optimizing user experience. BRIEF DESCRIPTION OF DRAWINGS

[0045] Figure 1 A structural schematic diagram of an artificial intelligence subject framework;

[0046] Figure 2a A structural schematic diagram of an item recommendation system provided by the embodiments of the present application;

[0047] Figure 2b Another structural schematic diagram of an item recommendation system provided by the embodiments of the present application;

[0048] Figure 2c A schematic diagram of related equipment for item recommendation provided by the embodiments of the present application;

[0049] Figure 3A schematic diagram of a system 100 architecture provided by an embodiment of the present application;

[0050] Figure 4 A flowchart of a project recommendation method provided by an embodiment of the present application;

[0051] Figure 5 A structural diagram of a target model provided by an embodiment of the present application;

[0052] Figure 6 A structural diagram of a first module and a second module provided by an embodiment of the present application;

[0053] Figure 7 A flowchart of a model training method provided by an embodiment of the present application;

[0054] Figure 8 A structural diagram of a project recommendation apparatus provided by an embodiment of the present application;

[0055] Figure 9 A structural diagram of a model training apparatus provided by an embodiment of the present application;

[0056] Figure 10 A structural diagram of an execution device provided by an embodiment of the present application;

[0057] Figure 11 A structural diagram of a training device provided by an embodiment of the present application;

[0058] Figure 12 A structural diagram of a chip provided by an embodiment of the present application. DETAILED DESCRIPTION

[0059] The embodiments of the present application provide a project recommendation method and related devices, and the project recommendation result output by the neural network model used by the method can have high accuracy, which is beneficial to optimizing user experience.

[0060] With the rapid development of computer technology, in order to meet the online needs of users, developers are more and more inclined to display the content of interest to users on the page of an application. Based on this, for a certain application, it is often necessary to predict which item or items a user will purchase, that is, to recommend the item of interest to the user, so as to present the item on the page of the application to provide services for the user. For example, for a certain shopping software, it is necessary to predict which part of goods a user tends to purchase when using the shopping software, that is, to recommend the goods of interest to the user, and display the goods on the page of the shopping software for the user to browse and purchase.

[0061] Currently, an item that can be recommended to a user can be predicted by a neural network model of AI technology. Specifically, historical information of the user can be collected first, which is used to indicate items that the user has interacted with and behaviors of the user with respect to the items. Since the behaviors of the user with respect to the items have multiple categories (for example, each of a click behavior, a collection behavior, a search behavior, an adding-to-cart behavior, and a purchase behavior), the historical information of the user can be divided according to the categories of the behaviors, and the historical information of each category is processed by a neural network model to obtain a processing result of the historical information of each category. Finally, the processing results of the historical information of each category can be superimposed to obtain an item recommendation result, so as to determine a target item to be recommended to the user.

[0062] In the above process, when the neural network model processes the historical information, the mutual influence between multiple behaviors belonging to the same category is mainly considered, the factors considered are relatively single, and the accuracy of the item recommendation result finally output by the model is not high, which affects the user experience.

[0063] Further, multiple behaviors of the user often have an order (for example, a time sequence, etc.), and the order between the behaviors often affects the purchase decision of the user. For example, a purchase behavior of the user with respect to an item before a certain period of time still has a great influence on the interest of the user (whether to perform a purchase behavior) in another item at present, and the neural network model cannot pay attention to the influence, so that the item recommendation result output by the neural network model cannot accurately match the real intention of the user, and the accuracy of the item recommendation result is also reduced.

[0064] Further, in the training process of the neural network model, the role of training data used to indicate auxiliary behaviors (for example, a click behavior, a collection behavior, a search behavior, and an adding-to-cart behavior, etc.) is often ignored, and only training data used to indicate a main behavior (for example, a purchase behavior) is used to complete the training of the model, so that the performance of the model obtained by training is poor.

[0065] To solve the above problems, an embodiment of the present application provides an item recommendation method, which can be implemented in combination with artificial intelligence (AI) technology. AI technology is a technology subject that uses a digital computer or a machine controlled by a digital computer to simulate, extend, and expand human intelligence, and AI technology obtains the best results by perceiving the environment, acquiring knowledge, and using the knowledge. In other words, artificial intelligence technology is a branch of computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can react in a similar way to human intelligence. Data processing using artificial intelligence is a common application of artificial intelligence.

[0066] First, the overall workflow of the artificial intelligence system is described, please see Figure 1 , Figure 1 is a structural diagram of the artificial intelligence subject framework, and the following describes the artificial intelligence subject framework from two dimensions of "intelligent information chain" (horizontal axis) and "IT value chain" (vertical axis). Among them, "intelligent information chain" reflects a series of processes from data acquisition to processing. For example, it can be a general process of intelligent information perception, intelligent information representation and formation, intelligent reasoning, intelligent decision-making, intelligent execution and output. In this process, data undergoes a condensation process of "data-information-knowledge-wisdom". "IT value chain" reflects the value brought by artificial intelligence to the information technology industry from the underlying infrastructure of human intelligence, information (provision and processing technology implementation) to the industrial ecological process of the system.

[0067] (1) Infrastructure

[0068] The infrastructure provides computing power support for the artificial intelligence system, realizes communication with the outside world, and realizes support through the underlying platform. Communication with the outside world through sensors; computing power is provided by intelligent chips (CPU, NPU, GPU, ASIC, FPGA, etc. Hardware acceleration chips); the underlying platform includes distributed computing framework and network related platform guarantee and support, which can include cloud storage and computing, interconnection network, etc. For example, sensors and external communication acquire data, which are provided to intelligent chips in the distributed computing system provided by the underlying platform for calculation.

[0069] (2) Data

[0070] The data on the upper layer of the infrastructure is used to represent the data source in the field of artificial intelligence. Data involves graphics, images, speech, text, and also involves Internet of Things data of traditional devices, including business data of existing systems and sensing data such as force, displacement, liquid level, temperature, humidity, etc.

[0071] (3) Data processing

[0072] Data processing usually includes data training, machine learning, deep learning, search, reasoning, decision-making, etc.

[0073] Among them, machine learning and deep learning can symbolize and formalize intelligent information modeling, extraction, preprocessing, training, etc.

[0074] Reasoning refers to the process of simulating human intelligent reasoning methods in computers or intelligent systems, using formalized information to perform machine thinking and solve problems according to reasoning control strategies, and the typical function is search and matching.

[0075] Decision refers to the process of intelligent information making decisions after reasoning, usually providing classification, sorting, prediction and other functions.

[0076] (4) General capabilities

[0077] After the data mentioned above is processed, some general capabilities can be formed based on the results of data processing, such as algorithms or a general system, for example, translation, text analysis, computer vision processing, speech recognition, image recognition, etc.

[0078] (5) Intelligent products and industry applications

[0079] Intelligent products and industry applications refer to the products and applications of artificial intelligence systems in various fields, which are the packaging of the overall solution of artificial intelligence, and the productization and landing application of intelligent information decision. Its application fields mainly include: intelligent terminal, intelligent transportation, intelligent medical treatment, automatic driving, smart city, etc.

[0080] Next, several application scenarios of the present application are introduced.

[0081] Figure 2a A structural diagram of a project recommendation system provided by an embodiment of the present application is provided, which includes a user device and a data processing device. The user device includes a mobile phone, a personal computer or an information processing center, etc. The user device is the initiator of the project recommendation, and is the initiator of the project recommendation request, which is usually initiated by the user through the user device.

[0082] The above-mentioned data processing device can be a cloud server, a network server, an application server and a management server, etc. with data processing function. The data processing device receives the project recommendation request from the intelligent terminal through the interactive interface, and then performs machine learning, deep learning, search, reasoning, decision and other ways of project recommendation processing through the storage data storage and data processing processor. The storage in the data processing device can be a general term, including local storage and database storing historical data, which can be on the data processing device or other network servers.

[0083] In Figure 2aIn the item recommendation system shown, the user equipment can receive an instruction of the user, for example, the user can trigger / select an application on the user equipment, and then initiate a request to the data processing equipment, so that the data processing equipment performs item recommendation processing for the application on the user equipment, thereby obtaining an item recommendation result for the application. For example, the user can trigger one of the applications (for example, a shopping software, a music software, or a software mall, etc.) among the applications installed on the user equipment, and then initiate an item recommendation request for the application to the data processing equipment, so that the data processing equipment performs item recommendation processing for the application, thereby obtaining an item recommendation result for the application, that is, a probability of each item in the application being purchased by the user. Therefore, based on the item recommendation result, a part of items with a larger probability can be determined as target items recommended to the user.

[0084] In Figure 2a , the data processing equipment can perform the item recommendation method of the embodiments of the present application.

[0085] Figure 2b Another structural schematic diagram of the item recommendation system provided by the embodiments of the present application is shown in Figure 2b , the user equipment directly serves as the data processing equipment. After determining a certain application triggered / selected by the user, the user equipment can directly perform item recommendation processing for the application by the user equipment itself. The specific process is similar to Figure 2a , and reference can be made to the above description, which will not be repeated here.

[0086] In Figure 2b , the user equipment can receive an instruction of the user, for example, the user can trigger one of the applications installed on the user equipment, and the user equipment can directly perform item recommendation processing for the application, thereby obtaining an item recommendation result for the application, that is, a probability of each item in the application being purchased by the user. Therefore, based on the item recommendation result, a part of items with a larger probability can be determined as target items recommended to the user.

[0087] In Figure 2b , the user equipment itself can perform the item recommendation method of the embodiments of the present application.

[0088] Figure 2c A schematic diagram of related equipment for item recommendation provided by the embodiments of the present application.

[0089] The user equipment in the above Figure 2a and Figure 2b may be the local device 301 or the local device 302 in Figure 2c , and the data processing equipment in the above Figure 2a may be the local device 301 or the local device 302 in Figure 2cThe data storage system 250 can store the data to be processed of the execution device 210, and the data storage system 250 can be integrated on the execution device 210 or set on a cloud or other network server.

[0090] Figure 2a and Figure 2b The processor in the data processing system 200 can train / learn / deep learn data through a neural network model or other model (for example, a model based on a support vector machine), and finally train or learn a model through the data, and perform item recommendation processing on the application through the model to obtain a corresponding processing result.

[0091] Figure 3 An example of the system 100 architecture provided by the embodiments of the present application is shown in Figure 3 In the execution device 110, an input / output (I / O) interface 112 is configured to interact with external devices, and a user can input data to the I / O interface 112 through a client device 140. The input data can include various tasks to be scheduled, callable resources, and other parameters in the embodiments of the present application.

[0092] During the pre-processing of the input data by the execution device 110, or during the calculation of the calculation module 111 of the execution device 110, the execution device 110 can call data, codes, etc. in the data storage system 150 for corresponding processing, or store the data, instructions, etc. obtained by the corresponding processing in the data storage system 150.

[0093] Finally, the I / O interface 112 returns the processing result to the client device 140, thereby providing the user.

[0094] It is worth noting that the training device 120 can generate a corresponding target model / rule based on different training data for different targets or different tasks, and the corresponding target model / rule can be used to achieve the above target or complete the above task, thereby providing the user with the required result. The training data can be stored in the database 130 and come from the training samples collected by the data collection device 160.

[0095] In Figure 3In the case shown in FIG. 1, the user can manually give input data, which can be operated through the interface provided by the I / O interface 112. In another case, the client device 140 can automatically send input data to the I / O interface 112, and if the user needs to authorize the client device 140 to automatically send input data, the user can set the corresponding permission in the client device 140. The user can view the results output by the execution device 110 in the client device 140, and the specific presentation form can be a specific way such as display, sound, action, etc. The client device 140 can also act as a data collection end, collect the input data input into the I / O interface 112 and the output results output by the I / O interface 112 as new sample data, and store them into the database 130. Of course, the collection can also be performed without the client device 140, and the I / O interface 112 directly stores the input data input into the I / O interface 112 and the output results output by the I / O interface 112 as new sample data into the database 130.

[0096] It is worth noting that, Figure 3 The system architecture shown in the figure is only a schematic diagram of a system architecture provided by an embodiment of the present application, and the positional relationship between the devices, components, modules, etc. shown in the figure does not constitute any limitation. For example, in Figure 3 In the case shown in FIG. 1, the data storage system 150 is an external memory relative to the execution device 110, and in other cases, the data storage system 150 can also be placed in the execution device 110. As shown in Figure 3 The neural network can be trained by the training device 120.

[0097] The chip provided by an embodiment of the present application includes a neural network processor NPU. The chip can be arranged in the execution device 110 as shown in Figure 3 to complete the computing work of the computing module 111. The chip can also be arranged in the training device 120 as shown in Figure 3 to complete the training work of the training device 120 and output the target model / rule.

[0098] The neural network processor NPU is mounted on a host central processing unit (CPU) (host CPU) as a coprocessor, and tasks are allocated by the host CPU. The core part of the NPU is an operation circuit, and the controller controls the operation circuit to extract data in the memory (weight memory or input memory) and perform operation.

[0099] In some implementations, the arithmetic circuit includes a plurality of processing engines (PEs) inside. In some implementations, the arithmetic circuit is a two-dimensional systolic array. The arithmetic circuit can also be a one-dimensional systolic array or other electronic circuit capable of performing mathematical operations such as multiplication and addition. In some implementations, the arithmetic circuit is a general-purpose matrix processor.

[0100] For example, assume there is an input matrix A, a weight matrix B, and an output matrix C. The arithmetic circuit fetches the corresponding data of matrix B from the weight memory and caches it on each PE of the arithmetic circuit. The arithmetic circuit fetches the data of matrix A from the input memory and performs matrix operation with matrix B, and the partial result or final result of the matrix is saved in an accumulator.

[0101] The vector computation unit can further process the output of the arithmetic circuit, such as vector multiplication, vector addition, exponential operation, logarithmic operation, size comparison, etc. For example, the vector computation unit can be used for network computation of non-convolution / non-FC layers in a neural network, such as pooling, batch normalization, local response normalization, etc.

[0102] In some implementations, the vector computation unit can store the processed output vector to the unified buffer. For example, the vector computation unit can apply a non-linear function to the output of the arithmetic circuit, such as a vector of accumulated values, to generate activation values. In some implementations, the vector computation unit generates normalized values, merged values, or both. In some implementations, the processed output vector can be used as activation input to the arithmetic circuit, such as for use in a subsequent layer in a neural network.

[0103] The unified memory is used to store input data and output data.

[0104] The weight data is transferred from the external memory to the input memory and / or the unified memory, from the external memory to the weight memory, and from the unified memory to the external memory by a direct memory access controller (DMAC).

[0105] A bus interface unit (BIU) is used to interact between the main CPU, the DMAC, and the instruction memory through a bus.

[0106] An instruction fetch buffer connected to the controller, configured to store instructions used by the controller;

[0107] A controller configured to invoke the instructions cached in the instruction fetch buffer to control the operation of the operation accelerator.

[0108] Generally, the unified memory, the input memory, the weight memory and the instruction fetch buffer are on-chip memories, and the external memory is a memory external to the NPU. The external memory can be a double data rate synchronous dynamic random access memory (DDR SDRAM), a high bandwidth memory (HBM) or other readable and writable memories.

[0109] Since the embodiments of the present application involve the application of a large number of neural networks, in order to facilitate understanding, the related terms and concepts related to neural networks involved in the embodiments of the present application will be introduced first.

[0110] (1) Neural network

[0111] The neural network can be composed of neural units, and the neural unit can be an operation unit with xs and intercept 1 as inputs. The output of the operation unit can be:

[0112]

[0113] wherein s = 1, 2, … n, n is a natural number greater than 1, Ws is the weight of xs, b is the bias of the neural unit. f is an activation function of the neural unit, which is used to introduce a nonlinear characteristic into the neural network to convert the input signal in the neural unit into an output signal. The output signal of the activation function can be used as the input of the next convolution layer. The activation function can be a sigmoid function. The neural network is a network formed by connecting many single neural units together, that is, the output of one neural unit can be the input of another neural unit. The input of each neural unit can be connected to the local receptive field of the previous layer to extract the features of the local receptive field, and the local receptive field can be a region composed of several neural units.

[0114] The work of each layer in the neural network can be described by the mathematical expression y = a(Wx + b): from a physical perspective, the work of each layer in the neural network can be understood as completing the transformation of the input space (a set of input vectors) to the output space (i.e., the row space of the matrix to the column space) through five operations on the input space, which include: 1, dimensionality increase / decrease; 2, magnification / reduction; 3, rotation; 4, translation; 5, "bending". Among them, the operations of 1, 2, and 3 are completed by Wx, the operation of 4 is completed by +b, and the operation of 5 is completed by a(). The reason why "space" is used here is that the objects to be classified are not single things, but a class of things, and the space refers to the set of all individuals of this class of things. Among them, W is a weight vector, and each value in the vector represents the weight value of a neuron in the neural network. The vector W determines the spatial transformation of the input space to the output space described above, that is, the weight W of each layer controls how to transform the space. The purpose of training the neural network is to obtain the weight matrix of all layers of the trained neural network (the weight matrix formed by the vectors W of many layers). Therefore, the training process of the neural network is essentially learning the way to control the spatial transformation, more specifically, learning the weight matrix.

[0115] Because the output of the neural network is expected to be as close as possible to the value that is truly intended to be predicted, the weight vector of each layer of the neural network can be updated by comparing the predicted value of the current network with the target value that is truly intended to be predicted, and then adjusting the weight vector according to the difference between the two, for example, if the predicted value of the network is too high, the weight vector is adjusted to make it predict lower, and the adjustment is continuously made until the neural network can predict the target value that is truly intended to be predicted. Therefore, it is necessary to define "how to compare the difference between the predicted value and the target value" in advance, which is the loss function or the objective function, which is an important equation for measuring the difference between the predicted value and the target value. Among them, taking the loss function as an example, the higher the output value (loss) of the loss function, the greater the difference, and then the training of the neural network becomes a process of trying to minimize this loss.

[0116] (2) Backpropagation algorithm

[0117] The neural network can adopt a back propagation (BP) algorithm to correct the size of the parameters in the initial neural network model in the training process, so that the reconstruction error loss of the neural network model becomes smaller and smaller. Specifically, the forward transmission of the input signal until the output generates an error loss, and the initial neural network model parameters are updated by back propagating the error loss information, so as to make the error loss converge. The back propagation algorithm is a back propagation movement dominated by error loss, aiming to obtain the optimal neural network model parameters, such as a weight matrix.

[0118] The method provided in the present application is described below from the training side of the neural network and the application side of the neural network.

[0119] The model training method provided in the embodiments of the present application involves processing of data sequences, and can be specifically applied to data training, machine learning, deep learning and the like. The training data (for example, N first information and N third information in the model training method provided in the embodiments of the present application, and the like) are subjected to intelligent information modeling, extraction, preprocessing, training and the like in a symbolic and formal manner, and finally a trained neural network (for example, a target model in the model training method provided in the embodiments of the present application) is obtained. In addition, the project recommendation method provided in the embodiments of the present application can use the trained neural network, input the input data (for example, N first information and N third information in the project recommendation method provided in the embodiments of the present application, and the like) into the trained neural network, and obtain the output data (for example, a project recommendation result in the project recommendation method provided in the embodiments of the present application, and the like). It should be noted that the model training method and the project recommendation method provided in the embodiments of the present application are based on the same concept to produce an invention, and can also be understood as two parts in a system or two stages of an overall process: for example, a model training stage and a model application stage.

[0120] Figure 4 A flowchart of the project recommendation method provided in the embodiments of the present application is shown in FIG. 1, which includes the following steps. Figure 4

[0121] 401、Obtain N first information, the i-th first information is used to indicate the i-th first item and the i-th behavior, the i-th behavior is the behavior of the user to the i-th item, the N behaviors of the user correspond to M categories, i = 1,..., N, N ≥ M, M > 1.

[0122] ​In this embodiment, when a user uses an application, in order to display items of interest of the user on a page of the application, the user can first collect some historical data of the user using the application before, which can include attribute information (for example, the name of the first item, the price of the first item, the function of the first item, and the category of the first item, etc.) of N first items (also referred to as historical items) that the user has operated on the application before, and related information (for example, the category of the behavior, etc.) of N behaviors performed by the user when operating the N first items. It should be noted that based on the related information of the N behaviors, the N behaviors can be divided into M categories, and one category can include at least one behavior. For example, for a shopping software, if the user has clicked 3 goods, collected 2 goods, and purchased 2 goods on the software, it can be seen that the user has operated 7 goods, and accordingly performed 7 behaviors, which can be divided into 3 categories, wherein the first category includes 3 click behaviors, the second category includes 2 collection behaviors, and the third category includes 2 purchase behaviors. Therefore, when collecting the historical data of the user for the software, the historical data includes the attribute information of the 7 goods and the related information of the 7 behaviors.

[0123] Therefore, the attribute information of the N first items can be respectively mapped on the latent space, and the vector representation of the N first items is correspondingly obtained, wherein the vector representation of the i-th first item is used to indicate the i-th first item. Similarly, the related information of the N behaviors can also be respectively mapped on the latent space, and the vector representation of the N behaviors (i.e., N third information) is correspondingly obtained, wherein the vector representation of the i-th behavior (i.e., the i-th third information) is used to indicate the behavior of the user for the i-th first item. For example, after mapping the attribute information of the N first items, the vector representation of the N first items x = [x1, x2, …, xN] can be obtained, wherein the vector representation x1 of the first first item is used to indicate the first first item, the vector representation x2 of the second first item is used to indicate the second first item, …, and the vector representation xN of the N-th first item is used to indicate the N-th first item. N ] is obtained, wherein the vector representation x1 of the first first item is used to indicate the first first item, the vector representation x2 of the second first item is used to indicate the second first item, …, and the vector representation xN of the N-th first item is used to indicate the N-th first item. N Similarly, after mapping the related information of the N behaviors, the vector representation b = [b1, b2, …, bN] of the N behaviors can be obtained, wherein the vector representation b1 of the first behavior (i.e., the first third information) is used to indicate the behavior of the user for the first first item, the vector representation b2 of the second behavior (i.e., the second third information) is used to indicate the behavior of the user for the second first item, …, and the vector representation bN of the N-th behavior (i.e., the N-th third information) is used to indicate the behavior of the user for the N-th first item. N ] is obtained, wherein the vector representation x1 of the first first item is used to indicate the first first item, the vector representation x2 of the second first item is used to indicate the second first item, …, and the vector representation xN of the N-th first item is used to indicate the N-th first item. N Similarly, after mapping the related information of the N behaviors, the vector representation b = [b1, b2, …, bN] of the N behaviors can be obtained, wherein the vector representation b1 of the first behavior (i.e., the first third information) is used to indicate the behavior of the user for the first first item, the vector representation b2 of the second behavior (i.e., the second third information) is used to indicate the behavior of the user for the second first item, …, and the vector representation bN of the N-th behavior (i.e., the N-th third information) is used to indicate the behavior of the user for the N-th first item.

[0124] Based on this, the vector representation of the i-th first item can be concatenated with the vector representation of the i-th action to obtain the i-th first piece of information. This i-th first piece of information is used to indicate the i-th first item and the user's action on it. A similar concatenation operation can be performed on the vector representations of the remaining first items and actions, thus obtaining N pieces of first information. Continuing with the example above, the vector representation x1 of the first first item can be concatenated with the vector representation b1 of the first action to obtain the first piece of first information h1; the vector representation of the second first item can be concatenated with the vector representation of the second action to obtain the second piece of first information h2, and so on, until the vector representation of the Nth first item is concatenated with the vector representation of the Nth action to obtain the Nth piece of first information h1. N In this way, we obtain N pieces of initial information H = [h1, h2, ..., h N ].

[0125] After obtaining N pieces of initial information, these N pieces of initial information can be input into the target model (a pre-trained neural network model) to process the N pieces of initial information and obtain the project recommendation results.

[0126] 402. The target model processes N pieces of first information based on a multi-head self-attention mechanism to obtain N pieces of second information.

[0127] The target model obtains N pieces of first information, which can be processed based on a multi-head self-attention mechanism to obtain N pieces of second information.

[0128] It is worth noting that, such as Figure 5 As shown ( Figure 5 (This is a schematic diagram of the structure of a target model provided in an embodiment of this application). The target model may include a first module, a second module, and a third module. The first input terminal of the first module serves as the first input terminal of the entire target model and is used to receive N first pieces of information. The second input terminal of the first module serves as the second input terminal of the target model and is used to receive N pieces of third information. The input terminal of the second module serves as the third input terminal of the target model and is used to receive N pieces of third information. The first input terminal of the third module serves as the fourth input terminal of the target model and is used to receive N pieces of third information. The third input terminal of the first module is connected to the output terminal of the second module, the output terminal of the first module is connected to the second input terminal of the third module, and the output terminal of the third module serves as the output terminal of the target model.

[0129] Specifically, the first module of the target model can process N pieces of first information based on a multi-head self-attention mechanism to obtain N pieces of second information in the following way:

[0130] (1) After receiving the N first information, for any one of the N first information, i.e., the i-th first information, the first module can first perform linear processing on the i-th first information, thereby obtaining the i-th Q information, the i-th K information and the i-th V information. For the remaining first information other than the i-th first information, the first module can also perform operations as performed on the i-th first information, so that a total of N Q information, N K information and N V information can be obtained. That is, the first module can perform linear processing on the 1st first information to obtain the 1st Q information, the 1st K information and the 1st V information, can also perform linear processing on the 2nd first information to obtain the 2nd Q information, the 2nd K information and the 2nd V information, and can also perform linear processing on the Nth first information to obtain the Nth Q information, the Nth K information and the Nth V information.

[0131] (2) For the i-th Q information, the first module can perform operations on the i-th Q information, N K information, N V information and N weight information corresponding to the i-th behavior to obtain the i-th second information, the j-th weight information corresponding to the i-th behavior being determined based on the i-th behavior and the j-th behavior, j = 1,..., N. For the remaining Q information other than the i-th Q information, the first module can also perform operations as performed on the i-th Q information, so that N second information can be obtained. That is, the first module can first perform operations on the 1st Q information, N K information, N V information and N weight information corresponding to the 1st behavior to obtain the 1st second information, the first module can also perform operations on the 2nd Q information, N K information, N V information and N weight information corresponding to the 2nd behavior to obtain the 2nd second information, and the first module can also perform operations on the Nth Q information, N K information, N V information and N weight information corresponding to the Nth behavior to obtain the Nth second information. Among them, the 1st weight information corresponding to the 1st behavior is determined based on the 1st behavior, the 2nd weight information corresponding to the 1st behavior is determined based on the 1st behavior and the 2nd behavior,..., the Nth weight information of the 1st behavior is determined based on the 1st behavior and the Nth behavior,..., the 1st weight information corresponding to the Nth behavior is determined based on the Nth behavior and the 1st behavior, the 2nd weight information corresponding to the Nth behavior is determined based on the Nth behavior and the 2nd behavior, and the Nth weight information of the Nth behavior is determined based on the Nth behavior.

[0132] Further, the second module of the target model can also cooperate with the first module of the target model to jointly obtain N second information:

[0133] (1) After receiving the N third information, for any one of the N third information, i.e., the i-th third information, the second module can operate the i-th third information and the N third information to obtain N fourth information corresponding to the i-th behavior, and the j-th fourth information corresponding to the i-th behavior is used to indicate the distance between the i-th behavior and the j-th behavior. For the remaining third information other than the i-th third information, the second module can also perform the operation as performed on the i-th third information, so that a total of N fourth information corresponding to the 1st behavior, N fourth information corresponding to the 2nd behavior,..., and N fourth information corresponding to the Nth behavior can be obtained. That is, the second module can operate the 1st third information and the 1st third information to obtain the 1st fourth information corresponding to the 1st behavior (used to indicate the distance between the 1st behavior), and can also operate the 1st third information and the 2nd third information to obtain the 2nd fourth information corresponding to the 1st behavior (used to indicate the distance between the 1st behavior and the 2nd behavior),..., and can also operate the 1st third information and the Nth third information to obtain the Nth fourth information corresponding to the 1st behavior (used to indicate the distance between the 1st behavior and the Nth behavior),..., and can also operate the Nth third information and the 1st third information to obtain the 1st fourth information corresponding to the Nth behavior (used to indicate the distance between the Nth behavior and the 1st behavior), and can also operate the Nth third information and the 2nd third information to obtain the 2nd fourth information corresponding to the Nth behavior (used to indicate the distance between the Nth behavior and the 2nd behavior),..., and can also operate the Nth third information and the Nth third information to obtain the Nth fourth information corresponding to the Nth behavior (used to indicate the distance between the Nth behavior).

[0134] (2) After receiving the N fourth information corresponding to the first behavior, the N fourth information corresponding to the second behavior, and the N fourth information corresponding to the Nth behavior from the second module, the first module can perform operations on the i-th Q information, the N K information, the N V information, the N weight information corresponding to the i-th behavior, and the N fourth information corresponding to the i-th behavior to obtain the i-th second information. The first module can also perform operations on the remaining Q information except the i-th Q information as the operation performed on the i-th Q information, and thus N second information can be obtained. That is, the first module can first perform operations on the first Q information, the N K information, the N V information, the N weight information corresponding to the first behavior, and the N fourth information corresponding to the first behavior to obtain the first second information, the first module can also perform operations on the second Q information, the N K information, the N V information, the N weight information corresponding to the second behavior, and the N fourth information corresponding to the second behavior to obtain the second second information, and the first module can also perform operations on the Nth Q information, the N K information, the N V information, the N weight information corresponding to the Nth behavior, and the N fourth information corresponding to the Nth behavior to obtain the Nth second information.

[0135] Further, the distance between the i-th behavior and the j-th behavior includes the interval between the order of the i-th behavior and the order of the j-th behavior, for example, the interval between the time when the user performs the i-th behavior and the time when the user performs the j-th behavior, and the like.

[0136] Still as the above example, as shown in Figure 6 Figure 6 a structural schematic diagram of the first module and the second module provided by the embodiments of the present application, Figure 6 is drawn on the basis of Figure 5 , the first module of the target model can include N groups of self-attention modules and a multilayer perceptro (MLP) module, the N groups of self-attention modules are connected with the MLP module, each group of self-attention modules can include N self-attention modules, and among the N groups of self-attention modules, the first group of self-attention modules is used to process the first first information h1 to obtain the first twelfth information g1, the second group of self-attention modules is used to process the second first information h2 to obtain the second twelfth information g2, and the Nth group of self-attention modules is used to process the Nth first information hN to obtain the Nth twelfth information gN. N . The MLP module can process the first twelfth information g1, the second twelfth information g2, and the Nth twelfth information gN respectively to obtain the first second information h`1, the second second information h`2, and the Nth second information h`N respectively. N N . The MLP module can process the first twelfth information g1, the second twelfth information g2, and the Nth twelfth information gN respectively to obtain the first second information h`1, the second second information h`2, and the Nth second information h`N respectively.​​N .

[0137] The following section will introduce the workflow of the N self-attention modules and the MLP module. Since the workflows of the N self-attention modules are similar, for ease of explanation, the following section will focus on any one of the N self-attention modules, specifically the i-th self-attention module.

[0138] For the j-th self-attention module in the i-th group of self-attention modules, its input is the i-th first information h. i And the j-th information h j This self-attention module can first process the i-th piece of first information h. i Perform linear processing to obtain the i-th Q-information q. i The i-th K information k i And the i-th V information v i And for the j-th information h j Perform linear processing to obtain the j-th Q-information q. j The j-th K information k j And the j-th V information v j .

[0139] Next, this module can process the i-th Q information q i The j-th K information k j and the j-th first weight matrix corresponding to the i-th row. Multiplying the results, we obtain the j-th ninth piece of information F[i,j] corresponding to the i-th row, as shown in the following formula:

[0140]

[0141] At the same time, this module can also receive the j-th fourth information P1[i,j] corresponding to the i-th action from the second module. The j-th fourth information P1[i,j] corresponding to the i-th action can be obtained by the second module from the i-th third information b. i And the j-th third information b j The calculation process is shown in the following formula:

[0142]

[0143] In the above formula, (ji) can be based on the i-th third information b. i And the j-th third information b j Determine the interval between the sorting of the i-th behavior and the sorting of the j-th behavior.

[0144] Then, the module can fuse (for example, add, etc.) the jth ninth information F[i, j] corresponding to the ith behavior and the jth fourth information P1[i, j] corresponding to the ith behavior, and then normalize (for example, softmax processing, etc.) to obtain the jth tenth information A[i, j] corresponding to the ith behavior.

[0145] Subsequently, the module can multiply the jth tenth information A[i, j] corresponding to the ith behavior, the jth second weight matrix corresponding to the ith behavior, and the jth V information v j to obtain the jth eleventh information R[i, j] corresponding to the ith behavior, which is as shown in the following formula:

[0146]

[0147] It should be noted that the jth first weight matrix corresponding to the ith behavior and the jth second weight matrix corresponding to the ith behavior are the jth weight information corresponding to the ith behavior.

[0148] Similarly, the remaining self-attention modules in the ith group of self-attention modules can also perform operations as the jth self-attention module does, so that the ith group of self-attention modules can obtain N eleventh information R[i] = [R[i, 1], R[i, 2],..., R[i, N]] corresponding to the ith behavior, and perform weighted summation on R[i, 1], R[i, 2],..., R[i, N] to obtain the ith twelfth information g i .

[0149] Similarly, the remaining groups of self-attention modules other than the ith group of self-attention modules can also perform operations as the ith group of self-attention modules does, so that the N groups of self-attention modules can obtain N twelfth information G = [g1, g2,..., g N in total, that is, the first twelfth information g1, the second twelfth information g2,..., and the Nth twelfth information g N .

[0150] Finally, after receiving the N twelfth information G = [g1, g2,..., g N ], the MLP module can process the N twelfth information G = [g1, g2,..., g n ] in combination with the N third information b = [b1, b2,..., b N ] to obtain N second information H` = [h`1, h`2,..., h` NThat is, processing the first third information b1 and the first twelfth information g1 (e.g., feature extraction and nonlinear processing) to obtain the first second information h`1; processing the second third information b2 and the second twelfth information g2 to obtain the second second information h`2,..., and processing the Nth third information b... N And the Nth twelfth information g N Processing is performed (e.g., feature extraction and nonlinear processing, etc.) to obtain the Nth second piece of information h`. N .

[0151] 403. Based on N pieces of secondary information using the target model, obtain project recommendation results. The project recommendation results are used to determine the target project to recommend to the user from K secondary projects, where K≥1.

[0152] After obtaining N pieces of secondary information, the target model can use these N pieces of secondary information to obtain project recommendation results. These project recommendation results can be used to determine the target project to recommend to the user from K secondary projects (which can also be understood as candidate projects), where K ≥ 1. Generally, these K secondary projects contain N primary projects.

[0153] Specifically, the third module of the target model can obtain project recommendation results in the following ways:

[0154] (1) After receiving N pieces of second information from the first module, the first expert network of the third module can extract features from the N pieces of second information to obtain fifth information. The fifth information contains the unique features of each of the N behaviors, so the fifth information can be used to indicate the differences between the N behaviors. At the same time, the second expert network of the third module can extract features from the N pieces of second information to obtain sixth information. The sixth information contains the common features of the N behaviors, so the sixth information can be used to indicate the similarities between the N behaviors.

[0155] (2) After obtaining the fifth and sixth information, the third module can perform a weighted summation of the fifth and sixth information (the weights used can be determined by the third module based on N third information) to obtain the seventh information. The seventh information is the user's behavioral representation, so the seventh information can be used to indicate the user's interest distribution.

[0156] (3) After obtaining the seventh information, the third module can further obtain K eighth information, wherein the tth eighth information is used to indicate the tth second item, t = 1,..., K. Among the K eighth information, the third module can calculate the matching degree between the seventh information and the tth eighth information, and for the eighth information other than the tth eighth information, the third module can also perform the operation as performed on the tth eighth information, so as to obtain the matching degree between the seventh information and the K eighth information, so these matching degrees can be used as the final output item recommendation result of the target model.

[0157] In this way, based on the item recommendation result, a part of the second items with higher matching degree can be determined as the target item recommended to the user.

[0158] In addition, the target model provided by the embodiments of the present application can also be compared with the neural network model provided by the related art to compare the performance of these models on different data sets, and the comparison result is shown in Table 1:

[0159] Table 1

[0160]

[0161]

[0162] Based on Table 1, it can be known that in terms of recommendation accuracy, the target model provided by the embodiments of the present application can achieve the best experimental result in two indicators, proving the effectiveness of the item recommendation method provided by the embodiments of the present application.

[0163] In the embodiments of the present application, when it is necessary to recommend a target item of interest to a user, N first information can be input to the target model, wherein the i th first information is used to indicate an i th first item and an i th behavior, the i th behavior is a behavior of the user to the i th item, N behaviors of the user correspond to M categories, i = 1, …, N, N ≥ M, M > 1. Then, the target model can process the N first information based on the multi-head self-attention mechanism to obtain N second information. Finally, the target model can obtain an item recommendation result based on the N second information, and the item recommendation result is used to determine a target item recommended to the user from K second items, K ≥ 1. In the foregoing process, since the N first information is used to indicate not only the N first items but also the N behaviors which can be divided into M categories, in the process of processing the N first information by the target model to correspondingly obtain the N second information, not only the mutual influence between the behaviors belonging to the same category and the mutual influence between the first items can be considered, but also the mutual influence between the behaviors belonging to different categories can be considered. The considered factors are more comprehensive, and therefore the item recommendation result output by the target model based on the N second information can have high accuracy, which is beneficial to optimizing the user experience.

[0164] Further, in the process of processing the N first information based on the multi-head self-attention mechanism, the target model also considers the influence of the interval between the rankings of different behaviors (for example, the interval between the times when the user performs different behaviors), and the considered factors are more comprehensive than related technologies. The item recommendation result output by the target model can also accurately match the real intention of the user, thereby further improving the accuracy of the item recommendation result.

[0165] The above is a detailed description of the item recommendation method provided by the embodiments of the present application. The model training method provided by the embodiments of the present application will be introduced below. Figure 7 A flowchart of a model training method provided by the embodiments of the present application is shown in FIG. 7, which includes the following steps. Figure 7

[0166] 701, input N first information to a to-be-trained model to obtain a predicted item recommendation result, the to-be-trained model is used to: obtain N first information, the i th first information is used to indicate an i th first item and an i th behavior, the i th behavior is a behavior of the user to the i th item, N behaviors of the user correspond to M categories, i = 1, …, N, N ≥ M, M > 1; process the N first information based on a multi-head attention mechanism to obtain N second information; based on the N second information, obtain a predicted item recommendation result, the predicted item recommendation result is used to determine a target item recommended to the user from K second items, K ≥ 1. ​

[0167] In this embodiment, when the to-be-trained model (i.e., the neural network model to be trained) needs to be trained, a batch of training data can be obtained first, the batch of training data containing N first information, wherein the i-th first information is used to indicate the i-th first item (i.e., the historical item) and the i-th behavior, the i-th behavior being the behavior of the user to the i-th item, the N behaviors of the user corresponding to M categories, i = 1,..., N, N ≥ M, M > 1. It is worth noting that the real item recommendation result corresponding to the N first information is known, so based on the real item recommendation result, the real item recommended to the user can be determined among the K second items (i.e., the candidate items).

[0168] Then, after obtaining the N first information, the N first information can be input to the to-be-trained model, and then after receiving the N first information, the to-be-trained model can process the N first information based on the multi-head attention mechanism to obtain N second information. Then, the to-be-trained model can obtain the predicted item recommendation result based on the N second information, and the predicted item recommendation result is used to determine the target item (predicted item) recommended to the user among the K second items.

[0169] In a possible implementation, the to-be-trained model is configured to: perform linear processing on the i-th first information to obtain i-th Q information, i-th K information and i-th V information; and perform operation on the i-th Q information, N K information, N V information and N weight information corresponding to the i-th behavior to obtain the i-th second information, wherein the j-th weight information corresponding to the i-th behavior is determined based on the i-th behavior and the j-th behavior, j = 1,..., N.

[0170] In a possible implementation, the to-be-trained model is further configured to: obtain N third information, the i-th third information being used to indicate the i-th behavior; and perform operation on the i-th third information and N third information to obtain N fourth information corresponding to the i-th behavior, the j-th fourth information corresponding to the i-th behavior being used to indicate the distance between the i-th behavior and the j-th behavior; and the to-be-trained model is configured to perform operation on the i-th Q information, N K information, N V information, N weight information corresponding to the i-th behavior and N fourth information corresponding to the i-th behavior to obtain the i-th second information.

[0171] In a possible implementation, the distance between the i-th behavior and the j-th behavior includes the interval between the ranking of the i-th behavior and the ranking of the j-th behavior.

[0172] In a possible implementation, the model to be trained is configured to: perform feature extraction on the N second information to obtain fifth information and sixth information, the fifth information being used to indicate different points among the N behaviors, and the sixth information being used to indicate same points among the N behaviors; fuse the fifth information and the sixth information to obtain seventh information, the seventh information being used to indicate the interest distribution of the user; and calculate a matching degree between the seventh information and K eighth information, the matching degree being used as the item recommendation result, and the t-th eighth information being used to indicate the t-th second item, t = 1,..., K.

[0173] In a possible implementation, the K second items include the N first items.

[0174] It should be noted that the step 701 can be understood with reference to the related description of the steps 401 to 403 in the embodiment shown in Figure 4 FIG. 4, which will not be repeated here.

[0175] 702. Based on the predicted item recommendation result and the real item recommendation result, obtain a target loss, the target loss being used to indicate a difference between the predicted item recommendation result and the real item recommendation result.

[0176] After obtaining the predicted item recommendation result output by the model to be trained, since the real item recommendation result is known, the predicted item recommendation result and the real item recommendation result can be calculated by using a preset target loss function, so as to obtain a target loss, the target loss being used to indicate a difference between the predicted item recommendation result and the real item recommendation result.

[0177] 703. Based on the target loss, update the parameters of the model to be trained until a model training condition is met, to obtain a target model.

[0178] After obtaining the target loss, the parameters of the model to be trained can be updated based on the target loss, and the model to be trained after the update is used to continue training by using the next batch of training data, until a model training condition (for example, the target loss reaches convergence, etc.) is met, so as to obtain the target model in the embodiment shown in Figure 4 FIG. 4.

[0179] The target model trained by the embodiments of the present application has the function of recommending items to users. When it is necessary to recommend target items of interest to a user, N first information can be input to the target model, wherein the i-th first information is used to indicate the i-th first item and the i-th behavior, the i-th behavior being the behavior of the user to the i-th item, the N behaviors of the user corresponding to M categories, i = 1, …, N, N ≥ M, M > 1. Then, the target model can process the N first information based on the multi-head self-attention mechanism to obtain N second information. Finally, the target model can obtain an item recommendation result based on the N second information, the item recommendation result being used to determine a target item to be recommended to the user from K second items, K ≥ 1. In the foregoing process, since the N first information is used to indicate not only the N first items but also the N behaviors which can be divided into M categories, in the process of processing the N first information by the target model to correspondingly obtain the N second information, not only the mutual influence between the behaviors belonging to the same category and the mutual influence between the first items can be considered, but also the mutual influence between the behaviors belonging to different categories can be considered. The considered factors are more comprehensive, and therefore the item recommendation result output by the target model based on the N second information can have high accuracy, which is conducive to optimizing the user experience.

[0180] Further, in the process of processing the N first information based on the multi-head self-attention mechanism, the target model also considers the influence of the interval between the rankings of different behaviors (for example, the interval between the times at which the user performs different behaviors), and the considered factors are more comprehensive than related technologies. The item recommendation result output by the target model can accurately match the real intention of the user, thereby further improving the accuracy of the item recommendation result.

[0181] Still further, in the training process of the target model, the training data used, i.e., the N first information, is used to indicate the N behaviors which can be divided into M categories. The N behaviors can include not only click behavior, collection behavior, search behavior, and add-to-cart behavior, but also purchase behavior. It can be seen that the embodiments of the present application not only consider the role of training data indicating main behaviors in model training, but also consider the role of auxiliary behaviors in model training. Therefore, the target model trained can have good performance.

[0182] The above is a detailed description of the model training method provided by the embodiments of the present application. In the following, the item recommendation device and the model training device provided by the embodiments of the present application will be introduced. Figure 8 A structural schematic diagram of the item recommendation device provided by the embodiments of the present application is shown in FIG. 1, which includes: Figure 8

[0183] ​The first obtaining module 801 is configured to obtain N first information through the target model, the i-th first information being used to indicate the i-th first item and the i-th behavior, the i-th behavior being the behavior of the user to the i-th item, the N behaviors of the user corresponding to M categories, i=1,...,N, N≥M, and M>1.

[0184] The processing module 802 is configured to process the N first information based on the multi-head self-attention mechanism through the target model to obtain N second information.

[0185] The second obtaining module 803 is configured to obtain an item recommendation result based on the N second information through the target model, the item recommendation result being used to determine a target item to be recommended to the user from K second items, K≥1.

[0186] In the embodiments of the present application, when it is necessary to recommend a target item of interest to the user, the N first information can be input to the target model, wherein the i-th first information is used to indicate the i-th first item and the i-th behavior, the i-th behavior being the behavior of the user to the i-th item, the N behaviors of the user corresponding to M categories, i=1,...,N, N≥M, and M>1. Then, the N first information can be processed based on the multi-head self-attention mechanism through the target model to obtain N second information. Finally, the item recommendation result can be obtained based on the N second information through the target model, the item recommendation result being used to determine a target item to be recommended to the user from K second items, K≥1. In the foregoing process, since the N first information is used to indicate not only the N first items but also the N behaviors that can be divided into M categories, in the process of processing the N first information through the target model to obtain the N second information, not only the mutual influence between the behaviors belonging to the same category and the mutual influence between the first items can be considered, but also the mutual influence between the behaviors belonging to different categories can be considered. The considered factors are more comprehensive, and therefore the item recommendation result output by the target model based on the N second information can have high accuracy, which is conducive to optimizing the user experience.

[0187] In a possible implementation, the processing module 802 is configured to perform linear processing on the i-th first information through the target model to obtain the i-th Q information, the i-th K information, and the i-th V information; and perform operation on the i-th Q information, the N K information, the N V information, and N weight information corresponding to the i-th behavior through the target model to obtain the i-th second information, the j-th weight information corresponding to the i-th behavior being determined based on the i-th behavior and the j-th behavior, j=1,...,N.

[0188] In a possible implementation, the apparatus further includes: a third obtaining module, configured to obtain N third information by the target model, the i th third information being used to indicate the i th behavior; an operation module, configured to operate the i th third information and the N third information by the target model to obtain N fourth information corresponding to the i th behavior, the j th fourth information corresponding to the i th behavior being used to indicate a distance between the i th behavior and the j th behavior; and a processing module 802, configured to operate the i th Q information, the N K information, the N V information, N weight information corresponding to the i th behavior, and the N fourth information corresponding to the i th behavior by the target model to obtain the i th second information.

[0189] In a possible implementation, the distance between the i th behavior and the j th behavior includes an interval between the ranking of the i th behavior and the ranking of the j th behavior.

[0190] In a possible implementation, the second obtaining module 803 is configured to: perform feature extraction on the N second information by the target model to obtain fifth information and sixth information, the fifth information being used to indicate different points among the N behaviors, and the sixth information being used to indicate same points among the N behaviors; fuse the fifth information and the sixth information by the target model to obtain seventh information, the seventh information being used to indicate the interest distribution of the user; and calculate a matching degree between the seventh information and K eighth information by the target model, the matching degree being used as the item recommendation result, and the t th eighth information being used to indicate the t th second item, t = 1,..., K.

[0191] In a possible implementation, the K second items include the N first items.

[0192] Figure 9 A structural schematic diagram of a model training apparatus provided by an embodiment of the present application is shown in FIG. 1. The apparatus includes: Figure 9

[0193] A processing module 901 is configured to input the N first information into a to-be-trained model to obtain a predicted item recommendation result. The to-be-trained model is configured to: obtain the N first information, the i th first information being used to indicate the i th first item and the i th behavior, the i th behavior being a behavior of the user to the i th item, the N behaviors of the user corresponding to M categories, i = 1,..., N, N ≥ M, and M > 1; process the N first information based on a multi-head attention mechanism to obtain N second information; and obtain the predicted item recommendation result based on the N second information, the predicted item recommendation result being used to determine a target item to be recommended to the user from K second items, K ≥ 1.

[0194] ​The acquisition module 902 is configured to acquire a target loss based on the predicted item recommendation result and the real item recommendation result, the target loss being used to indicate a difference between the predicted item recommendation result and the real item recommendation result.

[0195] The updating module 903 is configured to update parameters of the to-be-trained model based on the target loss until a model training condition is met, to obtain a target model.

[0196] The target model obtained by the embodiments of the present application has the function of recommending items for users. When it is necessary to recommend a target item of interest of a user, N first information can be input to the target model first, wherein the i-th first information is used to indicate an i-th first item and an i-th behavior, the i-th behavior being a behavior of the user to the i-th item, N behaviors of the user correspond to M categories, i = 1,..., N, N ≥ M, and M > 1. Then, the target model can process the N first information based on a multi-head self-attention mechanism to obtain N second information. Finally, the target model can obtain an item recommendation result based on the N second information, the item recommendation result being used to determine a target item to be recommended to the user from K second items, K ≥ 1. In the foregoing process, since the N first information is used to indicate not only the N first items but also the N behaviors that can be divided into M categories, in the process in which the target model processes the N first information to correspondingly obtain the N second information, not only the mutual influence between behaviors belonging to the same category and the mutual influence between the first items can be considered, but also the mutual influence between behaviors belonging to different categories can be considered. The considered factors are relatively comprehensive, and therefore the item recommendation result output by the target model based on the N second information can have relatively high accuracy, which is conducive to optimizing user experience.

[0197] In a possible implementation, the to-be-trained model is configured to perform linear processing on the i-th first information to obtain i-th Q information, i-th K information and i-th V information; and perform operation on the i-th Q information, N K information, N V information and N weight information corresponding to the i-th behavior to obtain the i-th second information, the j-th weight information corresponding to the i-th behavior being determined based on the i-th behavior and the j-th behavior, j = 1,..., N.

[0198] In one possible implementation, the model to be trained is further configured to: acquire N third pieces of information, the i-th third piece of information being used to indicate the i-th action; perform calculations on the i-th third piece of information and the N third pieces of information to obtain N fourth pieces of information corresponding to the i-th action, the j-th fourth piece of information corresponding to the i-th action being used to indicate the distance between the i-th action and the j-th action; and the model to be trained is configured to perform calculations on the i-th Q-information, the N K-information, the N V-information, the N weight information corresponding to the i-th action, and the N fourth pieces of information corresponding to the i-th action to obtain the i-th second piece of information.

[0199] In one possible implementation, the distance between the i-th behavior and the j-th behavior includes the interval between the ranking of the i-th behavior and the ranking of the j-th behavior. In another possible implementation, the model to be trained is used to: extract features from N pieces of second information to obtain fifth and sixth information, where the fifth information indicates the differences between the N behaviors and the sixth information indicates the similarities between the N behaviors; fuse the fifth and sixth information to obtain seventh information, which indicates the user's interest distribution; calculate the matching degree between the seventh information and K pieces of eighth information, with the matching degree serving as the item recommendation result, where the t-th piece of eighth information indicates the t-th second item, t = 1, ..., K.

[0200] In one possible implementation, K second items contain N first items.

[0201] It should be noted that the information interaction and execution process between the modules / units of the above-mentioned device are based on the same concept as the method embodiment of this application, and the resulting technical effects are the same as those of the method embodiment of this application. For details, please refer to the description in the method embodiment shown above in the embodiment of this application, and it will not be repeated here.

[0202] This application also relates to an execution device. Figure 10 This is a schematic diagram of the execution device provided in an embodiment of this application. Figure 10 As shown, the execution device 1000 can specifically manifest as a mobile phone, tablet, laptop, smart wearable device, server, etc., and is not limited here. Among them, the execution device 1000 may deploy... Figure 8 The project recommendation device described in the corresponding embodiment is used to implement Figure 4 The corresponding embodiment describes the recommended functionality. Specifically, the execution device 1000 includes: a receiver 1001, a transmitter 1002, a processor 1003, and a memory 1004 (wherein the execution device 1000 may have one or more processors 1003). Figure 10The processor 1003 can include an application processor 10031 and a communication processor 10032, for example. In some embodiments of the present application, the receiver 1001, the transmitter 1002, the processor 1003 and the memory 1004 can be connected through a bus or other means.

[0203] The memory 1004 can include read-only memory and random access memory, and provide the processor 1003 with instructions and data. A portion of the memory 1004 can also include non-volatile random access memory (NVRAM). The memory 1004 stores processor and operating instructions, executable modules or data structures, or a subset thereof, or an expanded set thereof, wherein the operating instructions can include various operating instructions for implementing various operations.

[0204] The processor 1003 controls the operation of the execution device. In a specific application, various components of the execution device are coupled together through a bus system, which can include a data bus in addition to a power bus, a control bus, and a state signal bus, etc. However, for the sake of clarity, all the buses are referred to as a bus system in the figure.

[0205] The method disclosed in the embodiments of the present application can be applied to the processor 1003 or implemented by the processor 1003. The processor 1003 can be an integrated circuit chip having a signal processing capability. In the implementation process, the steps of the method can be completed by the integrated logic electric circuit or the instruction of the software form in the processor 1003. The processor 1003 can be a general processor, a digital signal processor (DSP), a microprocessor or a microcontroller. The processor 1003 can further include an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. The processor 1003 can implement or execute the methods, steps and logic block diagrams disclosed in the embodiments of the present application. The general processor can be a microprocessor or the processor can also be any conventional processor or the like. The steps of the method disclosed in combination with the embodiments of the present application can be directly embodied as a hardware code processor to execute, or be executed by a combination of hardware and software modules in the code processor. The software module can be located in a random access memory, a flash memory, a read only memory, a programmable read only memory or an electrically erasable programmable memory, a register, or other mature storage medium in the art. The storage medium is located in the storage 1004, and the processor 1003 reads the information in the storage 1004 to complete the steps of the method in combination with the hardware.

[0206] The receiver 1001 can be used to receive input digital or character information, and generate signal input related to the relevant settings and function control of the execution device. The transmitter 1002 can be used to output digital or character information through the first interface; the transmitter 1002 can also be used to send instructions to the disk group through the first interface to modify the data in the disk group; the transmitter 1002 can also include a display device such as a display screen.

[0207] In an embodiment of the present application, in one case, the processor 1003 is configured to obtain the item recommendation result by Figure 4 The target model in the corresponding embodiment processes the information associated with the user, thereby obtaining the item recommendation result.

[0208] The embodiments of the present application also relate to a training device, Figure 11 A structural schematic diagram of the training device provided in the embodiments of the present application is shown in FIG. 1. As shown in FIG. 1, the training device includes a processor 1003, a storage 1004, a receiver 1001 and a transmitter 1002. Figure 11As shown, the training device 1100 is implemented by one or more servers, which can include one or more central processing units (CPUs) 1114 (e.g., one or more processors) and memory 1132, one or more storage media 1130 (e.g., one or more mass storage devices) storing applications 1142 or data 1144, which can vary in configuration and performance. The memory 1132 and the storage media 1130 can be volatile (e.g., random access memory, cache memory, etc.) or non-volatile (e.g., read only memory, flash memory, optical media, magnetic media, etc.). The programs stored in the storage media 1130 can include one or more modules (not shown), each of which can include a series of instructions for operating on the training device. Further, the central processing unit 1114 can be configured to communicate with the storage media 1130 to execute the series of instructions in the storage media 1130 on the training device 1100.

[0209] The training device 1100 can also include one or more power supplies 1126, one or more wired or wireless network interfaces 1150, one or more input / output interfaces 1158; or, one or more operating systems 1141, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.

[0210] In particular, the training device can perform Figure 7 the model training method in the corresponding embodiments.

[0211] The embodiments of the present application also relate to a computer readable storage medium storing a program for signal processing, which, when executed on a computer, causes the computer to perform the steps performed by the aforementioned execution device, or causes the computer to perform the steps performed by the aforementioned training device.

[0212] The embodiments of the present application also relate to a computer program product storing instructions, which, when executed by a computer, causes the computer to perform the steps performed by the aforementioned execution device, or causes the computer to perform the steps performed by the aforementioned training device.

[0213] The execution device, the training device or the terminal device provided by the embodiments of the present application can be a chip, which includes a processing unit, for example, a processor, and a communication unit, for example, an input / output interface, a pin or a circuit, etc. The processing unit can execute computer execution instructions stored in a storage unit, so that the chip in the execution device executes the data processing method described in the above embodiments, or so that the chip in the training device executes the data processing method described in the above embodiments. Optionally, the storage unit is a storage unit in the chip, such as a register, a cache, etc., and the storage unit can also be a storage unit outside the chip in the wireless access device, such as a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM), etc.

[0214] Specifically, refer to Figure 12 , Figure 12 A structural diagram of the chip provided by the embodiments of the present application is shown in FIG. 12. The chip can be a neural network processor NPU 1200, which is mounted on a host CPU (Host CPU) as a coprocessor and is assigned tasks by the Host CPU. The core part of the NPU is an operation circuit 1203, which extracts matrix data in a memory and performs multiplication operation under the control of a controller 1204.

[0215] In some implementations, the operation circuit 1203 internally includes a plurality of processing units (PEs). In some implementations, the operation circuit 1203 is a two-dimensional systolic array. The operation circuit 1203 can also be a one-dimensional systolic array or other electronic circuits capable of performing mathematical operations such as multiplication and addition. In some implementations, the operation circuit 1203 is a general-purpose matrix processor.

[0216] For example, it is assumed that there are an input matrix A, a weight matrix B and an output matrix C. The operation circuit takes corresponding data of the matrix B from the weight memory 1202 and buffers it on each PE in the operation circuit. The operation circuit takes the matrix A data from the input memory 1201 and performs matrix operation with the matrix B, and the partial result or final result of the obtained matrix is saved in an accumulator 1208.

[0217] The unified memory 1206 is used to store input data and output data. The weight data is transferred to the weight memory 1202 through a Direct Memory Access Controller (DMAC) 1205. The input data is also transferred to the unified memory 1206 through the DMAC.

[0218] The BIU is a Bus Interface Unit 1213 for the interaction between the AXI bus and the DMAC and the Instruction Fetch Buffer (IFB) 1209.

[0219] The BIU is a Bus Interface Unit 1213 for the interaction between the AXI bus and the DMAC and the Instruction Fetch Buffer (IFB) 1209.

[0220] The DMAC is mainly used to transfer the input data in the external memory DDR to the unified memory 1206 or to transfer the weight data to the weight memory 1202 or to transfer the input data to the input memory 1201.

[0221] The vector computation unit 1207 includes a plurality of operation processing units, which further process the output of the operation circuit 1203 as needed, such as vector multiplication, vector addition, exponential operation, logarithmic operation, size comparison, etc. It is mainly used for non-convolutional / full connection layer network computation in neural networks, such as Batch Normalization, pixel-level summation, upsampling of the predicted label plane, etc.

[0222] In some implementations, the vector computation unit 1207 can store the processed output vector to the unified memory 1206. For example, the vector computation unit 1207 can apply a linear function; or, a non-linear function to the output of the operation circuit 1203, such as linear interpolation to the predicted label plane extracted from the convolutional layer, and further, a vector of accumulated values to generate activation values. In some implementations, the vector computation unit 1207 generates normalized values, pixel-level summation values, or both. In some implementations, the processed output vector can be used as activation input to the operation circuit 1203, such as for use in subsequent layers in the neural network.

[0223] The controller 1204 is connected to an instruction fetch buffer 1209 for storing instructions used by the controller 1204;

[0224] The unified memory 1206, the input memory 1201, the weight memory 1202, and the instruction memory 1209 are on-chip memories. The external memory is private to the NPU hardware architecture.

[0225] Any processor mentioned in the above can be a general central processing unit, a microprocessor, an ASIC, or one or more integrated circuits for controlling execution of the above programs.

[0226] It should be noted that the apparatus embodiments described above are merely illustrative, and the units described as separate components can or can not be physically separated, and the components shown as units can or can not be physical units, i.e., they can be located in one place or distributed on multiple network units. Some or all of the modules can be selected to achieve the purpose of the embodiment according to actual needs. In addition, the connection relationship between the modules in the apparatus embodiment provided in the present application indicates that there is a communication connection between them, which can be implemented as one or more communication buses or signal lines.

[0227] Through the description of the above embodiments, those skilled in the art can clearly understand that the present application can be implemented by means of software and the necessary general hardware, and of course, it can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. Generally, functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure for implementing the same function can also be various, such as analog circuits, digital circuits, or special circuits. However, for the present application, software program implementation is a better embodiment. Based on this understanding, the technical solutions of the present application can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer's floppy disk, U disk, mobile hard disk, ROM, RAM, magnetic disk or optical disk, etc., including a plurality of instructions for making a computer device (which can be a personal computer, a training device, or a network device, etc.) execute the methods described in various embodiments of the present application.

[0228] In the above embodiments, all or part can be implemented by software, hardware, firmware, or any combination thereof. When implemented by software, it can be implemented in the form of a computer program product in whole or in part.

[0229] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions described in the embodiments of the present application are generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions can be transmitted from one website, computer, training device or data center to another website, computer, training device or data center through wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be stored by the computer or a data storage device such as a training device, a data center, etc. integrated with one or more available media sets. The available media can be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape), an optical medium (for example, a DVD), or a semiconductor medium (for example, a solid state disk (SSD)), etc.

Claims

1. A project recommendation method, Its characteristic lies in that the method is implemented through a target model, and the method includes: Obtain N pieces of first information, where the i-th piece of first information is used to indicate the i-th first item and the i-th action. The i-th action is the user's behavior toward the i-th item. The user's N actions correspond to M categories, i = 1, ..., N, N ≥ M, M > 1. The N pieces of first information are processed based on a multi-head self-attention mechanism to obtain N pieces of second information; Based on the N pieces of second information, a project recommendation result is obtained. The project recommendation result is used to determine the target project to be recommended to the user from K second projects, where K≥1; The process of processing the N first pieces of information based on the multi-head self-attention mechanism to obtain N second pieces of information includes: The i-th first information is linearly processed to obtain the i-th Q information, the i-th K information, and the i-th V information; Obtain N pieces of third information, where the i-th piece of third information is used to indicate the i-th action; The i-th third information and the N third information are processed to obtain the N fourth information corresponding to the i-th behavior. The j-th fourth information corresponding to the i-th behavior is used to indicate the distance between the i-th behavior and the j-th behavior. The i-th Q information, N K information, N V information, N weight information corresponding to the i-th behavior, and N fourth information corresponding to the i-th behavior are calculated to obtain the i-th second information. The j-th weight information corresponding to the i-th behavior is determined based on the i-th behavior and the j-th behavior, where j = 1, ..., N.

2. The method according to claim 1, characterized in that, The distance between the i-th action and the j-th action includes the interval between the order of the i-th action and the order of the j-th action.

3. The method according to claim 1 or 2, characterized in that, The process of obtaining project recommendation results based on the N pieces of second information includes: Feature extraction is performed on the N pieces of second information to obtain fifth information and sixth information. The fifth information is used to indicate the differences between the N behaviors, and the sixth information is used to indicate the similarities between the N behaviors. The fifth and sixth pieces of information are fused to obtain the seventh pieces of information, which are used to indicate the user's interest distribution. Calculate the matching degree between the seventh piece of information and K pieces of eighth information. The matching degree is used as the item recommendation result. The t-th piece of eighth information is used to indicate the t-th second item, t = 1, ..., K.

4. The method according to claim 3, characterized in that, The K second items contain N first items.

5. A model training method, Its characteristic is that the method includes: N pieces of first information are input into the model to be trained to obtain predicted item recommendation results. The model to be trained is used to: acquire N pieces of first information, where the i-th piece of first information indicates the i-th first item and the i-th action, and the i-th action is the user's behavior toward the i-th item. The user's N actions correspond to M categories, i = 1, ..., N, N ≥ M, M > 1; process the N pieces of first information based on a multi-head attention mechanism to obtain N pieces of second information; and obtain predicted item recommendation results based on the N pieces of second information. The predicted item recommendation results are used to determine the target item to be recommended to the user from K second items, where K ≥ 1. Based on the predicted project recommendation results and the actual project recommendation results, a target loss is obtained, which is used to indicate the difference between the predicted project recommendation results and the actual project recommendation results. Based on the target loss, the parameters of the model to be trained are updated until the model training conditions are met, and the target model is obtained. The model to be trained is used for: The i-th first information is linearly processed to obtain the i-th Q information, the i-th K information, and the i-th V information; The model to be trained is also used for: Obtain N pieces of third information, where the i-th piece of third information is used to indicate the i-th action; The i-th third information and the N third information are processed to obtain the N fourth information corresponding to the i-th behavior. The j-th fourth information corresponding to the i-th behavior is used to indicate the distance between the i-th behavior and the j-th behavior. The model to be trained is further used to perform calculations on the i-th Q information, N K information, N V information, N weight information corresponding to the i-th behavior, and N fourth information corresponding to the i-th behavior to obtain the i-th second information. The j-th weight information corresponding to the i-th behavior is determined based on the i-th behavior and the j-th behavior, where j = 1, ..., N.

6. The method according to claim 5, characterized in that, The distance between the i-th action and the j-th action includes the interval between the order of the i-th action and the order of the j-th action.

7. The method according to claim 5 or 6, characterized in that, The model to be trained is used for: Feature extraction is performed on the N pieces of second information to obtain fifth information and sixth information. The fifth information is used to indicate the differences between the N behaviors, and the sixth information is used to indicate the similarities between the N behaviors. The fifth and sixth pieces of information are fused to obtain the seventh pieces of information, which are used to indicate the user's interest distribution. Calculate the matching degree between the seventh piece of information and K pieces of eighth information. The matching degree is used as the item recommendation result. The t-th piece of eighth information is used to indicate the t-th second item, t = 1, ..., K.

8. The method according to claim 7, characterized in that, The K second items contain N first items.

9. A project recommendation device, Its characteristic is that the device includes: The first acquisition module is used to acquire N pieces of first information through the target model. The i-th piece of first information is used to indicate the i-th first item and the i-th behavior. The i-th behavior is the user's behavior towards the i-th item. The user's N behaviors correspond to M categories, i = 1, ..., N, N ≥ M, M > 1. The processing module is used to process the N first pieces of information through the target model based on a multi-head self-attention mechanism to obtain N second pieces of information; The second acquisition module is used to acquire project recommendation results based on the N second pieces of information through the target model. The project recommendation results are used to determine the target project to be recommended to the user from K second projects, where K≥1. The processing module is used for: The i-th first information is linearly processed to obtain the i-th Q information, the i-th K information, and the i-th V information; The device further includes: The third acquisition module is used to acquire N pieces of third information, where the i-th piece of third information is used to indicate the i-th action; The calculation module is used to perform calculations on the i-th third information and the N third information to obtain N fourth information corresponding to the i-th behavior, wherein the j-th fourth information corresponding to the i-th behavior is used to indicate the distance between the i-th behavior and the j-th behavior; The processing module is further configured to perform calculations on the i-th Q information, N K information, N V information, N weight information corresponding to the i-th behavior, and N fourth information corresponding to the i-th behavior to obtain the i-th second information. The j-th weight information corresponding to the i-th behavior is determined based on the i-th behavior and the j-th behavior, where j = 1, ..., N.

10. A model training device, Its characteristic is that the device includes: The processing module is used to input N pieces of first information into the model to be trained to obtain predicted item recommendation results. The model to be trained is used to: acquire N pieces of first information, where the i-th piece of first information indicates the i-th first item and the i-th action, and the i-th action is the user's action on the i-th item. The user's N actions correspond to M categories, i = 1, ..., N, N ≥ M, M > 1; process the N pieces of first information based on a multi-head attention mechanism to obtain N pieces of second information; and obtain predicted item recommendation results based on the N pieces of second information. The predicted item recommendation results are used to determine the target item recommended to the user from K second items, where K ≥ 1. The acquisition module is used to acquire a target loss based on the predicted project recommendation results and the actual project recommendation results, wherein the target loss is used to indicate the difference between the predicted project recommendation results and the actual project recommendation results. The update module is used to update the parameters of the model to be trained based on the target loss until the model training conditions are met, thereby obtaining the target model. The model to be trained is used for: The i-th first information is linearly processed to obtain the i-th Q information, the i-th K information, and the i-th V information; The model to be trained is also used for: Obtain N pieces of third information, where the i-th piece of third information is used to indicate the i-th action; The i-th third information and the N third information are processed to obtain the N fourth information corresponding to the i-th behavior. The j-th fourth information corresponding to the i-th behavior is used to indicate the distance between the i-th behavior and the j-th behavior. The model to be trained is used to perform calculations on the i-th Q information, N K information, N V information, N weight information corresponding to the i-th behavior, and N fourth information corresponding to the i-th behavior to obtain the i-th second information. The j-th weight information corresponding to the i-th behavior is determined based on the i-th behavior and the j-th behavior, where j = 1, ..., N.

11. A project recommendation device, characterized in that, The device includes a memory and a processor; the memory stores code, and the processor is configured to execute the code, wherein when the code is executed, the project recommendation device performs the method as described in any one of claims 1 to 8.

12. A computer storage medium, characterized in that, The computer storage medium stores one or more instructions that, when executed by one or more computers, cause the one or more computers to perform the method of any one of claims 1 to 8.

13. A computer program product, characterized in that, The computer program product stores instructions that, when executed by a computer, cause the computer to perform the method described in any one of claims 1 to 8.

Citation Information

Patent Citations

  • Click rate prediction method based on heterogeneous behaviors in session

    CN114529077A