Model training method, recommendation method, electronic equipment and storage medium

By constructing an expanded sample and comprehensive loss value training model, the problem of insufficient training data was solved, the accuracy of recommending new products was improved, and the learning ability of the model was enhanced.

CN120705708APending Publication Date: 2025-09-26广州商研网络科技有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510828405.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-19
Publication Date
2025-09-26

AI Technical Summary

Technical Problem

Due to the lack of user interaction data for newly listed products in the training data, the model training effect is poor and it is impossible to accurately predict user preferences for products.

Method used

By obtaining user behavior data, using preset prompt words to build expanded samples, combining with pre-trained language models to select target products, and constructing triple data based on behavior data and product information, the first and second loss values ​​of the product recommendation model are determined, and the model is trained using the comprehensive loss value.

Benefits of technology

It improves the training effect of the product recommendation model, enhances the learning ability of newly listed products, and improves the accuracy of recommendations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120705708A_ABST
    Figure CN120705708A_ABST
Patent Text Reader

Abstract

The invention relates to artificial intelligence, and provides a model training method, a recommendation method, electronic equipment and a storage medium. The model training method comprises the steps of obtaining behavior data of a user for a preset commodity; according to a preset prompt word and behavior data, constructing an expansion sample; determining a first loss value of the commodity recommendation model based on the behavior data; determining a second loss value of the commodity recommendation model based on the expanded sample; and training a commodity recommendation model according to the first loss value and the second loss value. According to the method, the training effect of the commodity recommendation model can be improved, and the recommendation accuracy can be improved during subsequent recommendation based on the commodity recommendation model.
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 technology, and specifically to a model training method, a recommendation method, an electronic device, and a storage medium. Background Art

[0002] In the field of e-commerce, users can use a client to browse products in an online store. The product recommendation page of the client can display multiple products in the store, and the order of each product on the page can be determined based on the predicted user preference for the product.

[0003] In related technologies, models are typically trained and then used to predict user preferences for products. However, due to the lack of user interaction data for newly listed products in the training data, the model training effect is poor, resulting in an inability to accurately predict user preferences for products. Summary of the Invention

[0004] The present application provides a model training method, a recommendation method, an electronic device, and a storage medium to solve the technical problem of poor model training effect and low accuracy of model-based recommendations.

[0005] A first aspect of an embodiment of the present application provides a model training method, comprising: obtaining user behavior data on preset products; constructing an expanded sample based on preset prompt words and the behavior data; determining a first loss value of a product recommendation model based on the behavior data; determining a second loss value of the product recommendation model based on the expanded sample; and training the product recommendation model based on the first loss value and the second loss value.

[0006] According to an embodiment of the present application, constructing an extended sample based on the preset prompt words and the behavioral data includes: selecting a target product from the multiple products to be recommended based on the behavioral data, product information of the multiple products to be recommended and the prompt words; and constructing the extended sample based on the target product.

[0007] According to an embodiment of the present application, selecting a target product from the multiple products to be recommended based on the behavioral data, the product information of the multiple products to be recommended, and the prompt words includes: using a pre-trained language model based on the behavioral data, the product information of the multiple products to be recommended, and the prompt words, predicting a first predicted probability that the user will generate a preset behavior for each product to be recommended; and determining the product to be recommended corresponding to the largest first predicted probability as the target product.

[0008] According to an embodiment of the present application, constructing the expanded sample based on the target product includes: constructing triplet data based on the user identifier of the user, the product identifier of the target product, and the product identifier of any remaining product among the multiple products to be recommended except the target product, to obtain the expanded sample.

[0009] According to an embodiment of the present application, the behavioral data includes the behavioral label of the user towards the preset product, and determining the first loss value of the product recommendation model based on the behavioral data includes: based on the characteristic information of the user, using the product recommendation model to predict the second predicted probability that the user will generate a preset behavior towards the preset product; based on the second predicted probability and the behavioral label of the preset product, calculating the first loss value.

[0010] According to an embodiment of the present application, the expanded sample includes the product identification of each product in a product combination determined based on multiple products to be recommended, and determining the second loss value of the product recommendation model based on the expanded sample includes: based on the user's characteristic information, using the product recommendation model to predict the user's third predicted probability for each product in the product combination; based on the third predicted probability of each product in the product combination, calculating the second loss value.

[0011] According to an embodiment of the present application, training the product recommendation model based on the first loss value and the second loss value includes: determining the regularized loss value of the product recommendation model based on the model parameters of the product recommendation model; determining the total loss value of the product recommendation model based on the first loss value, the second loss value and the regularized loss value; and training the product recommendation model based on the total loss value.

[0012] A second aspect of an embodiment of the present application provides a recommendation method, comprising: predicting recommendation scores of multiple objects using a product recommendation model based on user information of a target user; determining objects to be recommended to the target user based on the recommendation score of each object; wherein the product recommendation model is obtained by the model training method described in the first aspect.

[0013] A third aspect of an embodiment of the present application provides a model training device, comprising: an acquisition unit for acquiring user behavior data on preset products; a construction unit for constructing an expanded sample based on preset prompt words and the behavior data; a determination unit for determining a first loss value of a product recommendation model based on the behavior data; the determination unit is also for determining a second loss value of the product recommendation model based on the expanded sample; and a training unit for training the product recommendation model based on the first loss value and the second loss value.

[0014] A fourth aspect of an embodiment of the present application provides a recommendation system, comprising: a prediction module for predicting recommendation scores of multiple objects based on user information of a target user using a product recommendation model; a determination module for determining the objects to be recommended to the target user based on the recommendation score of each object; wherein the product recommendation model is obtained by the model training method described in the first aspect.

[0015] A fifth aspect of an embodiment of the present application provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method provided in the first or second aspect above when executing the computer program.

[0016] A sixth aspect of an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps in the method provided in the first or second aspect are implemented.

[0017] A seventh aspect of the embodiments of the present application provides a computer program product, which includes a computer program. When the computer program is executed by a processor, it implements the steps in the method provided in the first or second aspect above.

[0018] In multiple embodiments of the present application, by constructing an expanded sample using preset prompt words and the behavioral data, the training data of the product recommendation model can be increased, which can solve the problem of insufficient learning of newly listed products during the model training process, thereby improving the training effect of the product recommendation model. In addition, by combining the first loss value and the second loss value, the loss situation of the product recommendation model can be analyzed in multiple dimensions, thereby further improving the training effect of the product recommendation model. When making recommendations based on the product recommendation model in the future, the recommendation accuracy can be improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments of the present application. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0020] Figure 1 This is a schematic diagram of an application scenario of a model training method and a recommendation method provided in an embodiment of the present application; Figure 2 This is a flow chart of a model training method provided in an embodiment of the present application; Figure 3is a flow chart of a method for constructing an expanded sample provided in an embodiment of the present application; Figure 4 This is a flowchart of a recommended method provided in an embodiment of the present application; Figure 5 This is a functional module diagram of a model training device provided in an embodiment of the present application; Figure 6 This is a functional module diagram of a recommendation system provided by an embodiment of the present application; Figure 7 It is a structural diagram of an electronic device for implementing a model training method and a recommendation method provided in an embodiment of the present application. DETAILED DESCRIPTION

[0021] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0022] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or design schemes. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a concrete way.

[0023] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which this application belongs. The terms used in the specification of this application are for the purpose of describing specific embodiments only and are not intended to limit this application. It should be understood that, unless otherwise specified in this application, " / " means or. For example, A / B can mean A or B. "And / or" in this application is merely a way to describe the association relationship of associated objects, indicating that three relationships can exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. "At least one" means one or more. "Multiple" means two or more than two. For example, at least one of a, b or c can mean: a, b, c, a and b, a and c, b and c, a, b and c.

[0024] In the standalone site scenario, users can use the client to browse the products in the online store. The product recommendation page of the client can display multiple products in the store, and the order of each product on the page can be determined based on the predicted user preference for the product.

[0025] Related technologies typically use trained models to predict user product preferences. However, due to the lack of user interaction data for newly listed products in the training data and the model's neglect of relative preferences between items during training, the model training results in poor results, making it impossible to accurately predict user product preferences.

[0026] To solve the above problems, the present invention provides a model training method for improving the training effect of the product recommendation model. In addition, the present invention also provides a recommendation method that can improve the accuracy of recommendations.

[0027] See also Figure 1 , Figure 1 Schematic diagram of an application scenario of a model training method and a recommendation method provided in an embodiment of the present application. The scenario may include various electronic devices 100 and a server 200.

[0028] The electronic device 100 can be a mobile phone, a tablet computer, a desktop computer, a laptop computer, a handheld computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a cellular phone, a personal digital assistant (PDA), an augmented reality (AR) device, a virtual reality (VR) device, an artificial intelligence (AI) device, a wearable device, an in-vehicle device, a smart home device and / or a smart city device. The embodiments of the present application do not impose any special restrictions on the specific type of the electronic device 100.

[0029] Server 200 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, i.e., Content Delivery Network (CDN), as well as big data and artificial intelligence platforms, but is not limited to these.

[0030] It should be noted that the method in the embodiment of the present application can be performed independently by the electronic device 100 or the server 200, or can be performed jointly by the server 200 and the electronic device 100. When performed independently by the electronic device 100 or the server 200, the model training and recommendation process can be implemented independently by the electronic device 100 or the server 200. For example, the trained product recommendation model can be obtained by fine-tuning the product recommendation model on the electronic device 100. Accordingly, after training, the electronic device 100 can use the trained product recommendation model to predict the recommendation scores of multiple objects. The above process can also be performed independently by the server 200. When performed jointly by the server 200 and the electronic device 100, the server 200 can train the product recommendation model and then deploy the trained product recommendation model to the electronic device 100, and the electronic device 100 implements the recommendation process. Alternatively, part of the model training or recommendation process can be implemented by the electronic device 100, and part of the process can be implemented by the server 200, and the two can cooperate to implement the model training or recommendation process. In actual application, specific configuration can be made according to the situation and is not specifically limited here.

[0031] It should be noted that when the model training method and recommendation method provided in the embodiment of the present application are executed separately by the server 200 or the electronic device 100, the above-mentioned application scenario may also only include any single device in the server 200 or the electronic device 100, or the server 200 and the electronic device 100 may also be considered to be the same device. In actual application, when the model training method and recommendation method provided in the embodiment of the present application are jointly executed by the server 200 and the electronic device 100, the server 200 and the electronic device 100 may also be the same device, that is, the server 200 and the electronic device 100 may be different functional modules of the same device, or virtual devices virtualized from the same physical device.

[0032] In one possible implementation, a user may provide user information of a target user through the electronic device 100, and the server 200 may use the recommendation method of an embodiment of the present application to predict the recommendation scores of multiple objects, and determine the objects to be recommended to the target user based on the recommendation scores of each object, and return the objects to be recommended to the electronic device 100 for presentation.

[0033] In the embodiment of the present application, the electronic device 100 and the server 200 can be directly or indirectly connected to each other through one or more networks. The network can be a wired network or a wireless network. For example, the wireless network can be a mobile cellular network or a Wireless Fidelity (Wi-Fi) network. Of course, it can also be other possible networks, and the embodiment of the present application does not limit this. It should be noted that Figure 1 The examples shown are just for illustration. In fact, the number of terminal devices and servers is not limited and is not specifically limited in the embodiments of this application.

[0034] The model training method and recommendation method provided in the embodiments of the present application will be described below with reference to the accompanying drawings in combination with the application scenarios described above. It should be noted that the above application scenarios are only shown to facilitate understanding of the spirit and principles of the embodiments of the present application, and the embodiments of the present application are not limited in this respect.

[0035] like Figure 2 FIG. 1 is a flow chart of a model training method provided by an embodiment of the present application. The model training method is applied to electronic devices, for example, Figure 1 The electronic device 100. According to different requirements, the order of the steps in the flowchart can be changed, and some steps can be omitted.

[0036] S201, obtaining user behavior data on preset products.

[0037] In at least one embodiment of the present application, behavioral data may include historical behavioral data generated by users for preset products. The behavioral data may include positive sample data and negative sample data. The positive sample data may represent the user's behavioral data for preferred products. For example, the positive sample data may include behavioral data of the type of click, browse, favorite, purchase, follow, like, etc. The positive sample data may also include the number of clicks, click-through rate, browsing time, etc. of the user for the preset products. The negative sample data may represent the user's behavioral data for non-preferred products. For example, the negative sample data may include behavioral data of the type of not clicked, not browsed, not favorited, not purchased, not followed, not liked, etc.

[0038] S202: Construct an expanded sample based on the preset prompt words and behavior data.

[0039] In at least one embodiment of the present application, prompt words can be set based on the product information of multiple products to be recommended. The multiple products to be recommended may include but are not limited to: newly listed products, cold-start products that have no accumulated sales records. The preset prompt words (Prompt) may include a combination of one or more information: positive sample data, instructions for the pre-trained language model to select the user's preferred products from multiple products to be recommended, and product information of multiple products to be recommended. For example, the preset prompt words can be set as: "User's historical purchase record U, please estimate which product the user is more likely to click on between product A and product B. The product information of product A is Ia, and the product information of product B is Ib. Answer product A or product B." The embodiment of the present application can also adjust the prompt words according to actual needs.

[0040] In at least one embodiment of the present application, the electronic device can construct an extended sample based on the preset prompt words and behavior data. The construction process of the extended sample can refer to the following Figure 3 The process shown is: S301 , selecting a target product from a plurality of products to be recommended based on the behavior data, product information of the plurality of products to be recommended, and prompt words.

[0041] In some embodiments, the product information of the recommended product may include data related to the attribute information of the recommended product. For example, the product information may include any one or more of the product category, product label, and description information of the recommended product. The description information may be used to describe the recommended product and may include text description information and / or image description information. For example, the product information Ia of the recommended product A is: Women's Organic Cotton Cool Stand-Up Collar Short-Sleeved Dress, and the product information Ib of the recommended product B is: Women's Organic Cotton Crepe Shorts. The product information may also include data related to the statistical characteristics of the recommended product, such as the number of times the recommended product has been exposed, the number of times the recommended product has been clicked, etc.

[0042] In some embodiments, the electronic device selects a target product from multiple products to be recommended based on behavioral data, product information of multiple products to be recommended, and prompt words, including: based on the behavioral data, product information of multiple products to be recommended, and prompt words, using a pre-trained language model to predict the first predicted probability that the user will generate a preset behavior for each product to be recommended; determining the product to be recommended corresponding to the largest first predicted probability as the target product, and the target product can represent the product preferred by the user among the multiple products to be recommended.

[0043] In an embodiment of the present application, the electronic device determines the user's historical purchase records from the behavioral data. For example, the user's historical purchase records U may include: women's organic cotton-blend satin long-sleeved tops, women's organic cotton side-seam-free chiffon woven three-quarter sleeve pajamas.

[0044] In an embodiment of the present application, the pre-trained language model may be a deep learning model trained using a large amount of data. For example, the pre-trained language model may be a large language model (LLM). The pre-trained language model may be pre-trained on large-scale unlabeled text data. The pre-trained language model may also be a general model that is not designed and optimized for a specific task. It may not be designed and optimized for a specific task. The pre-trained model may also include, but is not limited to, a GPT (Generative Pre-trained Transformer) model and its variant models. The specific model may be flexibly selected according to actual needs, or may be constructed by itself as needed.

[0045] In an embodiment of the present application, the electronic device may input a user's purchase history, product information of multiple recommended products, and prompt words into a pre-trained language model. The pre-trained language model is then used to predict a first predicted probability that the user will perform a preset action for each recommended product. The preset actions may include, but are not limited to, actions indicating user preference, such as clicking and purchasing.

[0046] For example, the user's purchase history U, the product information Ia of the recommended product A, and the product information Ib of the recommended product B can be input into the pre-trained language model to obtain the first predicted probabilities of the recommended product A and the first predicted probabilities of the recommended product B. Assuming that the prompt instructs the pre-trained language model to select the user's most preferred product from multiple recommended products, and the first predicted probability of the recommended product A is greater than the first predicted probability of the recommended product B, the pre-trained language model can output the product identifier of the recommended product A.

[0047] This embodiment uses a pre-trained language model to predict the first predicted probability that the user will generate a preset behavior for each product to be recommended, so that the target product preferred by the user can be selected from multiple products to be recommended.

[0048] S302: Construct an expanded sample based on the target product.

[0049] In some embodiments, the electronic device constructs triplet data based on the user's user identifier, the target product identifier, and the product identifiers of any other products in the plurality of recommended products other than the target product to obtain an expanded sample. For example, assuming the user's user identifier is u, the product identifier of the target product is A, and the product identifier of any other product is B, the triplet data obtained is (u, A, B). For another example, assuming the user's user identifier is u, the product identifier of the target product is B, and the product identifier of any other product is A, the triplet data obtained is (u, B, A).

[0050] This embodiment can utilize the general knowledge capabilities of the pre-trained language model, user behavior data, and product information of multiple products to be recommended to construct expanded samples related to cold-start products or newly listed products, thereby compensating for the lack of interactive data on newly listed products in the training data.

[0051] S203: Determine a first loss value of the product recommendation model based on the behavior data.

[0052] In at least one embodiment of the present application, the behavior data may further include a behavior label of the user for the preset product, and the behavior label may indicate a category corresponding to the user's interaction behavior with the preset product. The behavior label may be represented by a preset value, and the preset value may be custom set. The embodiment of the present application does not limit the setting of the preset value. For example, if the interaction behavior between the user and the preset product is a positive feedback behavior, the behavior label corresponding to the preset product may be set to 1. If there is no interaction between the user and the preset product or the interaction behavior between the user and the preset product is a negative feedback behavior, the behavior label corresponding to the preset product may be set to 0. The embodiment of the present application does not limit the setting method of the behavior label. Among them, positive feedback behavior indicates the behavior of the user expressing preference or interest in the preset product. For example, positive feedback behavior may include the user's click, favorite, like or purchase of the preset product. Negative feedback behavior indicates the user's dislike or lack of interest in the preset product. For example, negative feedback behavior may include the user's negative review of the preset product.

[0053] In at least one embodiment of the present application, when determining a first loss value for a product recommendation model, the electronic device uses the product recommendation model to predict, based on the user's characteristic information, a second predicted probability that the user will perform a predetermined behavior with respect to a predetermined product. The electronic device calculates the first loss value based on the second predicted probability and the behavior tag of the predetermined product.

[0054] In the embodiment of the present application, the user's characteristic information may include the user's attribute information, for example, the user's characteristic information may include but is not limited to: the user's gender, age, occupation, hobbies, and geographic location. The user's characteristic information may also include the user's behavioral data.

[0055] In an embodiment of the present application, the product recommendation model is a Deep Factorization Machine (DeepFM) model, a Recurrent Neural Network (RNN), a ChatGLM, or other neural network model. The product recommendation model can be used to predict the probability of a user performing a preset action on a preset product. The second predicted probability indicates the probability of a user performing a preset action on the preset product. The preset action can be a specific action such as clicking, adding to favorites, or purchasing, and can also be a positive or negative feedback action.

[0056] In an embodiment of the present application, the electronic device may use a product recommendation model to encode feature information and product information of a preset product to obtain a coding vector, and obtain a second predicted probability based on the coding vector. Specifically, the product recommendation model may include an attention layer and a normalization layer. The electronic device uses the attention layer to extract features from the coding vector to obtain semantic features, and uses the normalization layer to normalize the semantic features to obtain the second predicted probability that the user will generate a preset behavior for the preset product.

[0057] In this embodiment of the present application, the electronic device calculates a first loss value based on the second predicted probability and the behavior tag of the preset product. The first loss value can be used to measure the degree of difference between the second predicted probability and the behavior tag. The formula for the first loss value can be expressed as: .in, can represent the first loss value, It can represent the number of samples determined based on behavioral data. It can be determined based on the product of the total number of users and the total number of preset products. Can represent behavioral data, Can represent user For preset products Generate a second predicted probability of the preset behavior, Can represent user For preset products behavior label.

[0058] For example, behavioral data may include user For preset products To preset product Data, users For preset products To preset product data, assuming the user For preset products The behavior label is 0, user For preset products The behavior label is 1, the user For preset products The behavior label is 1. User For preset products The behavior label of the user is 0. For preset products The second predicted probability is 0.85, user For preset products The second predicted probability is 0.75, and the user For preset products The second predicted probability is 0.95, user For preset products The second predicted probability is 0.15. After calculation, the first loss value can be obtained as: .

[0059] S204: Determine a second loss value of the product recommendation model based on the expanded sample.

[0060] In at least one embodiment of the present application, the expanded sample may include the product identifier and user identifier of each product in a product combination determined based on multiple products to be recommended. For example, assuming that multiple products to be recommended may include product A, product B, and product C, product combination 1 may include product A and product B, product combination 2 may include product A and product C, and product combination 3 may include product B and product C. The expanded sample may include (u, B, A), (u, C, A), and (u, C, B).

[0061] In at least one embodiment of the present application, when determining the second loss value of the product recommendation model, the electronic device uses the product recommendation model to predict the user's third predicted probability for each product in the product combination based on the user's characteristic information. The electronic device calculates the second loss value based on the third predicted probability for each product in the product combination.

[0062] In an embodiment of the present application, the third predicted probability may represent the probability that the user will perform a preset action on each item in the product combination. The electronic device may utilize the product recommendation model to analyze the feature information and the product information of each item in the product combination to obtain the third predicted probability. The method for determining the third predicted probability is similar to the method for determining the second predicted probability, and this application will not repeat this description.

[0063] In this embodiment of the present application, the electronic device calculates a second loss value based on the third predicted probability of each product in the product combination. The second loss value can be used to measure the degree of difference in the relevant preference relationship between the products. The formula for the second loss value can be expressed as: .in, Can represent the second loss value, Can represent user For preset products Producing a third predicted probability of a predetermined behavior, Can represent user For preset products Producing a third predicted probability of a predetermined behavior, can represent normalization functions, for example, Can be a sigmoid function.

[0064] The embodiment of the present application designs a corresponding second loss value for cold-start products, which can enhance the learning ability of the product recommendation model for cold-start products.

[0065] S205: Training a product recommendation model based on the first loss value and the second loss value.

[0066] In at least one embodiment of the present application, during the process of training a product recommendation model, the electronic device determines a regularized loss value of the product recommendation model based on the model parameters of the product recommendation model. The electronic device determines a total loss value of the product recommendation model based on the first loss value, the second loss value, and the regularized loss value. The electronic device trains the product recommendation model based on the total loss value.

[0067] In an embodiment of the present application, to prevent overfitting of the product recommendation model during training, the electronic device may determine the regularization loss value of the product recommendation model based on the model parameters of the product recommendation model. The model parameters of the product recommendation model may include, but are not limited to, weight vectors in the product recommendation model, for example, matrices in the fully connected layer of the product recommendation model. The formula for the regularization loss value can be expressed as: ,in, can represent the regularization parameter used to control the regularization strength, Can be set and adjusted according to actual needs, can represent model parameters, It can represent the norm of the model parameters.

[0068] In an embodiment of the present application, the electronic device may determine the total loss value of the product recommendation model based on the first loss value, the second loss value, and the regularization loss value. The formula for the total loss value may be expressed as: .in, It can represent the total loss value, can represent weight parameters, Used to balance the relationship between the first loss value and the second loss value, It can be set and adjusted according to actual needs.

[0069] In other embodiments, the electronic device may also determine the total loss value of the product recommendation model based on the first loss value and the second loss value.

[0070] The embodiment of the present application can accurately quantify the total loss value of the product recommendation model by comprehensively considering the first loss value and the second loss value.

[0071] In an embodiment of the present application, the electronic device adjusts the parameters of the product recommendation model based on the total loss value until a preset condition is met. The preset condition may include the total loss value meeting a threshold range; the preset condition may also include the trend of change in the total loss value being stable, for example, if the change in the total loss value is less than a preset threshold, the trend of change in the total loss value is determined to be stable; the preset condition may also include the number of times the parameters of the product recommendation model are adjusted meeting a maximum number of iterations.

[0072] In the model training method of this embodiment, by constructing an expanded sample using preset prompt words and behavioral data, the product recommendation model's training data can be increased, which can address the problem of insufficient learning of newly listed products during model training, thereby improving the training effect of the product recommendation model. In addition, by combining the first loss value and the second loss value, the loss of the product recommendation model can be analyzed in multiple dimensions, further improving the training effect of the product recommendation model. This can improve the accuracy of subsequent recommendations based on the product recommendation model.

[0073] like Figure 4 FIG. 1 is a flow chart of a recommendation method provided by an embodiment of the present application. The recommendation method is applied to electronic devices, for example, Figure 1 The electronic device 100. According to different requirements, the order of the steps in the flowchart can be changed, and some steps can be omitted.

[0074] S401 : Based on the user information of the target user, a product recommendation model is used to predict recommendation scores of multiple objects.

[0075] In at least one embodiment of the present application, user information may include, but is not limited to, user attribute data and input information. For example, user attribute data may include user identification, user location, and user interests and hobbies. Input information may include descriptive information about recommended needs, such as sports-related text ads. Multiple objects may include products in an independent website store.

[0076] In at least one embodiment of the present application, the electronic device uses a product recommendation model to predict the recommendation scores of multiple objects based on the user information of the target user. The multiple objects can be the products on the shelves of the independent station store, and the recommendation scores can represent the scores output by the product recommendation model for the multiple objects. The training method of the product recommendation model can refer to the above Figure 2 The relevant description in , this application will not repeat it.

[0077] S402: Determine the objects to be recommended to the target user based on the recommendation score of each object.

[0078] In at least one embodiment of the present application, the electronic device may select objects with recommendation scores greater than a preset score as objects to be recommended. The electronic device may also select M objects with the highest recommendation scores as objects to be recommended based on the recommendation scores of each object, where M is a positive integer greater than or equal to 1. The electronic device sends the recommended objects to the terminal device of the target user based on the recommendation scores of the recommended objects.

[0079] In at least one embodiment of the present application, the electronic device may sort the objects to be recommended in descending order of recommendation scores, and send the sorted objects to be recommended to the terminal device of the target user.

[0080] In the recommendation method of this embodiment, user information is analyzed through the product recommendation model, which can accurately quantify the recommendation scores of multiple objects for the target user. Then, through the recommendation scores, the recommended objects to be recommended to the target user can be reasonably determined, thereby improving the recommendation accuracy.

[0081] like Figure 5 The figure shows a functional module diagram of a model training device provided by an embodiment of the present application. The model training device 51 includes an acquisition unit 510, a construction unit 511, a determination unit 512 and a training unit 513. The module / unit referred to in this application refers to a unit that can be processed by a processor (e.g. Figure 7 The processor 1101 shown in FIG. 1 is obtained and is capable of performing a series of computer-readable instruction segments that are stored in a memory (eg, Figure 7 1102).

[0082] In one embodiment, an acquisition unit 510 is used to obtain user behavior data on preset products; a construction unit 511 is used to construct an expanded sample based on preset prompt words and behavior data; a determination unit 512 is used to determine a first loss value of a product recommendation model based on the behavior data; the determination unit 512 is also used to determine a second loss value of the product recommendation model based on the expanded sample; and a training unit 513 is used to train the product recommendation model based on the first loss value and the second loss value.

[0083] In one embodiment, the construction unit 511 is specifically configured to: select a target product from a plurality of products to be recommended based on the behavior data, product information of the plurality of products to be recommended, and prompt words; and construct an expanded sample based on the target product.

[0084] In one embodiment, the construction unit 511 is further specifically used to: predict the first predicted probability that the user will generate a preset behavior for each product to be recommended based on behavioral data, product information and prompt words of multiple products to be recommended, and use a pre-trained language model; and determine the product to be recommended corresponding to the largest first predicted probability as the target product.

[0085] In one embodiment, the construction unit 511 is further configured to construct triplet data based on the user identifier of the user, the product identifier of the target product, and the product identifier of any other product among the multiple products to be recommended except the target product, to obtain an expanded sample.

[0086] In one embodiment, the behavioral data includes the user's behavioral label for the preset product, and the determination unit 512 is specifically used to: based on the user's characteristic information, use the product recommendation model to predict the second predicted probability that the user will generate a preset behavior for the preset product; based on the second predicted probability and the behavior label of the preset product, calculate the first loss value.

[0087] In one embodiment, the expanded sample includes the product identifier of each product in the product combination determined based on multiple products to be recommended, and the determination unit 512 is specifically used to: predict the user's third predicted probability of each product in the product combination based on the user's characteristic information using the product recommendation model; calculate the second loss value based on the third predicted probability of each product in the product combination.

[0088] In one embodiment, the training unit 513 is specifically used to: determine the regularization loss value of the product recommendation model based on the model parameters of the product recommendation model; determine the total loss value of the product recommendation model based on the first loss value, the second loss value and the regularization loss value; and train the product recommendation model based on the total loss value.

[0089] In multiple embodiments of the present application, by constructing an expanded sample using preset prompt words and behavioral data, the training data of the product recommendation model can be increased, which can solve the problem of insufficient learning of newly listed products during the model training process, thereby improving the training effect of the product recommendation model. In addition, by combining the first loss value and the second loss value, the loss of the product recommendation model can be analyzed in multiple dimensions, thereby further improving the training effect of the product recommendation model. When making recommendations based on the product recommendation model in the future, the recommendation accuracy can be improved.

[0090] like Figure 6 , which is a functional module diagram of a recommendation system provided by an embodiment of the present application. The recommendation system 61 includes a prediction module 610 and a determination module 611. The module / unit referred to in this application refers to a module that can be processed by a processor (e.g. Figure 7 The processor 1101 shown in FIG. 1 is obtained and is capable of performing a series of computer-readable instruction segments that are stored in a memory (eg, Figure 7 1102).

[0091] In some embodiments, the prediction module 610 is used to predict the recommendation scores of multiple objects based on the user information of the target user using the product recommendation model; the determination module 611 is used to determine the recommended objects to be recommended to the target user based on the recommendation score of each object.

[0092] In multiple embodiments of the present application, by analyzing user information through a product recommendation model, the recommendation scores of multiple objects for a target user can be accurately quantified, and then the objects to be recommended to the target user can be reasonably determined through the recommendation scores, thereby improving the accuracy of the recommendation.

[0093] Figure 7 : is a schematic diagram of the structure of an electronic device for implementing a model training method and a recommendation method provided in an embodiment of the present application. Optionally, Figure 7 The electronic device 100 is used to perform Figure 2 、 Figure 3 、 Figure 4 The method shown.

[0094] The electronic device 100 includes at least one processor 1101 , a memory 1102 , and at least one network interface 1103 .

[0095] The processor 1101 is, for example, a general-purpose central processing unit (CPU), a network processor (NP), a graphics processing unit (GPU), a neural-network processing unit (NPU), a data processing unit (DPU), a microprocessor, or one or more integrated circuits for implementing the solution of the present application. For example, the processor 1101 includes an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The PLD is, for example, a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.

[0096] The memory 1102 may be, for example, a read-only memory (ROM) or other type of static storage device capable of storing static information and instructions, a random access memory (RAM) or other type of dynamic storage device capable of storing information and instructions, an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, an optical disc storage (including a compact disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but is not limited thereto. Optionally, the memory 1102 exists independently and is connected to the processor 1101 via the internal connection 1104. Alternatively, the memory 1102 and the processor 1101 may be integrated together.

[0097] The network interface 1103 uses any transceiver-like device for communicating with other devices or communication networks. For example, the network interface 1103 includes at least one of a wired network interface and a wireless network interface. For example, the wired network interface is an Ethernet interface. For example, the Ethernet interface is an optical interface, an electrical interface, or a combination thereof. For example, the wireless network interface is a wireless local area network (WLAN) interface, a cellular network interface, or a combination thereof.

[0098] In some embodiments, the processor 1101 includes one or more CPUs, such as Figure 7 CPU0 and CPU1 are shown in the figure.

[0099] In some embodiments, the electronic device 100 optionally includes multiple processors, such as Figure 7 1 and 1105. Each of these processors is, for example, a single-CPU or a multi-CPU. A processor herein optionally refers to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions).

[0100] In some embodiments, electronic device 100 further includes internal connections 1104. Processor 1101, memory 1102, and at least one network interface 1103 are connected via internal connections 1104. Internal connections 1104 include pathways for transmitting information between these components. Internal connections 1104 may optionally be a single board or bus. Internal connections 1104 may optionally be divided into an address bus, a data bus, a control bus, and the like.

[0101] In some embodiments, the electronic device 100 further includes an input / output interface 1106 , which is connected to the internal connection 1104 .

[0102] Optionally, the processor 1101 implements the method in the above embodiment by reading the program code 910 stored in the memory 1102, or the processor 1101 implements the method in the above embodiment by internally stored program code. In the case where the processor 1101 implements the method in the above embodiment by reading the program code 910 stored in the memory 1102, the memory 1102 stores the program code that implements the method provided in the embodiment of the present application.

[0103] For more details on how the processor 1101 implements the above functions, please refer to the descriptions in the previous method embodiments, which will not be repeated here.

[0104] This embodiment also provides a computer storage medium, which stores computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes the above-mentioned related method steps to implement the model training method and recommendation method in the above-mentioned embodiment.

[0105] This embodiment also provides a computer program product. When the computer program product is run on an electronic device, the electronic device executes the above-mentioned related steps to implement the model training method and recommendation method in the above-mentioned embodiment.

[0106] In addition, an embodiment of the present application also provides a device, which can specifically be a chip, component or module, and the device may include a connected processor and memory; wherein the memory is used to store computer-executable instructions, and when the device is running, the processor can execute the computer-executable instructions stored in the memory to enable the chip to execute the model training method and recommendation method in the above-mentioned method embodiments.

[0107] Among them, the electronic device, computer storage medium, computer program product or chip provided in this embodiment is used to execute the corresponding method provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding method provided above, and will not be repeated here.

[0108] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0109] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the modules or units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0110] The units described as separate components may or may not be physically separate, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0111] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0112] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling a device (which can be a single-chip microcomputer, chip, etc.) or a processor to execute all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, and other media that can store program code.

[0113] The above are only specific embodiments of the present application, but the scope of protection of the present application is not limited thereto. Any changes or replacements within the technical scope disclosed in this application should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.

Claims

1. A model training method, characterized in that: The method comprises: Obtain user behavior data on preset products; Constructing an expanded sample based on the preset prompt words and the behavioral data; Determining a first loss value of a product recommendation model based on the behavioral data; Determining a second loss value of the product recommendation model based on the expanded sample; The product recommendation model is trained according to the first loss value and the second loss value.

2. The model training method according to claim 1, characterized in that The step of constructing an expanded sample based on the preset prompt words and the behavior data includes: Selecting a target product from the multiple products to be recommended based on the behavior data, product information of the multiple products to be recommended, and the prompt word; The expanded sample is constructed according to the target product.

3. The model training method according to claim 2, characterized in that The selecting a target product from the plurality of products to be recommended based on the behavior data, product information of the plurality of products to be recommended, and the prompt word includes: Based on the behavior data, the product information of the plurality of products to be recommended, and the prompt words, using a pre-trained language model, predicting a first predicted probability that the user will generate a preset behavior for each product to be recommended; The recommended product corresponding to the largest first predicted probability is determined as the target product.

4. The model training method according to claim 2, characterized in that The step of constructing the expanded sample according to the target product includes: Based on the user identifier of the user, the product identifier of the target product, and the product identifier of any remaining product among the multiple products to be recommended except the target product, triple data is constructed to obtain the expanded sample.

5. The model training method according to claim 1, characterized in that The behavior data includes a behavior tag of the user for the preset product, and determining a first loss value of the product recommendation model based on the behavior data includes: Based on the characteristic information of the user, using the product recommendation model to predict a second predicted probability that the user will perform a preset behavior on the preset product; The first loss value is calculated based on the second predicted probability and the behavior label of the preset product.

6. The model training method according to claim 1, characterized in that The expanded sample includes a product identifier of each product in a product combination determined based on a plurality of products to be recommended, and determining a second loss value of the product recommendation model based on the expanded sample includes: Predicting, based on the user's feature information, a third predicted probability of the user for each product in the product combination using the product recommendation model; The second loss value is calculated based on the third predicted probability of each commodity in the commodity combination.

7. The model training method according to claim 1, characterized in that The step of training the product recommendation model according to the first loss value and the second loss value includes: Determining a regularization loss value of the product recommendation model based on model parameters of the product recommendation model; Determining a total loss value of the product recommendation model based on the first loss value, the second loss value, and the regularization loss value; The product recommendation model is trained based on the total loss value.

8. A recommendation method, characterized in that: The method comprises: Based on the target user's user information, the product recommendation model is used to predict the recommendation scores of multiple objects; Determine the recommended object to be recommended to the target user according to the recommendation score of each object; Wherein, the product recommendation model is obtained by the model training method according to any one of claims 1 to 7.

9. An electronic device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the model training method according to any one of claims 1 to 7 or the recommendation method according to any one of claim 8 is implemented.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the model training method according to any one of claims 1 to 7 or the recommendation method according to any one of claim 8.