Object recommendation method and device
By acquiring and generating vector data of historical objects, generating text based on task types, and using large target models for object recommendation, the problem of reduced inter-domain migration performance and low execution efficiency in the existing technology is solved, and the accuracy and accuracy of object recommendation are improved. efficiency.
Patent Information
- Application Number
- CN202410704154.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-31
- Publication Date
- 2024-08-30
AI Technical Summary
The performance of existing recommendation models decreases when migrating between domains, and the execution efficiency is low when using object names as context, which affects the performance of the model within the domain.
By obtaining the vector data of historical objects that the user has interacted with, the target encoder model is used to generate vector data that characterizes object attributes, and text is generated based on the task type. The target large model is used to determine the object recommendation results and realize personalized recommendation of objects.
It improves the efficiency and accuracy of object recommendation, avoids performance degradation when migrating between fields, and makes the recommendation results more in line with the user's personalized preferences.
Smart Images

Figure CN118568348A
Abstract
Description
Technical Field
[0001] The present application relates to the field of intelligent recommendation technology, and in particular to an object recommendation method and device. Background Art
[0002] After years of development, personalized recommendations have become a standard feature of Internet products. In popular applications such as e-commerce, information, music, and short videos, personalized recommendation systems are one of the core components.
[0003] At present, most recommendation tasks based on recommendation models generally use the ID or name of the user's historical interaction object as context for model reasoning. However, when the object ID is used as the context, the recommendation model can only learn the relationship between object IDs in the current domain during training. In the new domain, the recommendation model needs to be retrained to learn the relationship between object IDs in the new domain, resulting in performance degradation during inter-domain migration. When the object name is used as the context, although the performance degradation during inter-domain migration can be alleviated, the longer the object name, the lower the execution efficiency, and it also affects the performance of the model in the domain. Summary of the invention
[0004] An embodiment of the present application provides an object recommendation method, including: in response to a target recommendation task, obtaining at least one historical object that a user has interacted with; obtaining first vector data based on the historical object, the first vector data representing attributes of the historical object in multiple dimensions; generating a first text based on a task type of the target recommendation task and the first vector data; and determining an object recommendation result based on the first text using a target macro model.
[0005] In some embodiments, obtaining the first vector data according to the historical object includes: querying a vector database according to the object identifier of the historical object, wherein vector data of multiple objects are stored in the vector database; if the vector database contains target vector data corresponding to the object identifier, determining the target vector data as the first vector data; if the target vector data does not exist in the vector database, generating the first vector data according to the historical object using a target encoder model.
[0006] In some embodiments, the target encoder model includes a target encoder and a target feedforward neural network. According to the historical object, the target encoder model is used to generate first vector data, including: obtaining attribute information of the historical object in multiple dimensions; using the target encoder to encode the attribute information to generate the first encoded data; according to the first encoded data, using the target feedforward neural network to generate the first vector data.
[0007] In some embodiments, a first text is generated based on the task type of the target recommendation task and the first vector data, including: determining a target task template from multiple task templates based on the task type, each task template representing a descriptive text template of a task type; and generating the first text based on the first vector data and the target task template.
[0008] In some embodiments, the process of determining the target big model includes: obtaining multiple historical object samples that the sample user has interacted with based on the historical interaction data of the sample user; obtaining second vector data based on the historical object samples, the second vector data representing the attributes of the historical object samples in multiple dimensions; generating a data set based on the historical interaction data, the second vector data and a variety of task templates, each task template representing a descriptive text template of a task type; fine-tuning the parameters of the initial big model based on the data set, and determining the initial big model that has completed parameter fine-tuning as the target big model.
[0009] In some embodiments, a data set is generated based on the second vector data and multiple task templates, including: filling in each task template based on the historical interaction data and the second vector data to generate multiple sets of model input texts and standard recommendation results under different task types; generating the data set based on the model input texts and standard recommendation results.
[0010] In some embodiments, the process of determining the target encoder model includes: obtaining attribute texts of multiple object samples, each attribute text including attribute description information of the corresponding object sample in multiple dimensions; adjusting the parameters of the initial encoder model according to the attribute texts and the initial large model of frozen parameters, and determining the initial encoder model after the parameter adjustment as the target encoder model, and the model structure of the initial large model and the target large model is the same.
[0011] In some embodiments, the initial encoder model includes an initial encoder and an initial feedforward neural network, and the parameters of the initial encoder model are adjusted according to the attribute text and the initial large model of frozen parameters, including: masking the attribute text to obtain masked text; inputting the attribute text and the masked text into the initial encoder respectively to obtain second encoded data corresponding to the attribute text, and third encoded data corresponding to the masked text; based on the second encoded data, using the initial feedforward neural network to generate third vector data; based on the third vector data, using the initial large model of frozen parameters to obtain reconstructed text corresponding to the third vector data; based on the second encoded data, the third encoded data and the reconstructed text, the parameters of the initial encoder and the initial feedforward neural network are adjusted.
[0012] In some embodiments, the second encoded data includes a second text vector and multiple second word vectors, the third encoded data includes a third text vector and multiple third word vectors, and the parameters of the initial encoder and the initial feedforward neural network are adjusted according to the second encoded data, the third encoded data and the reconstructed text, including: determining multiple word texts according to each of the third word vectors, comparing each word text of the same object sample with the attribute text, and determining the mask loss; taking the second text vector and the third text vector of the object sample as a positive sample pair, taking the second text vector of the object sample and the second text vector of other object samples as a negative sample pair, and determining the contrastive learning loss according to the positive sample pair and the negative sample pair; comparing the reconstructed text of the same object sample with the attribute text to determine the reconstruction loss; adjusting the parameters of the initial encoder according to the mask loss, the contrastive learning loss and the reconstruction loss, and adjusting the parameters of the initial feedforward neural network according to the reconstruction loss.
[0013] An embodiment of the present application also provides an object recommendation device, including: a first acquisition module, used to obtain at least one historical object that a user has interacted with in response to a target recommendation task; a second acquisition module, used to obtain first vector data based on the historical object, the first vector data representing the attributes of the historical object in multiple dimensions; a generation module, used to generate a first text based on the task type of the target recommendation task and the first vector data; a determination module, used to determine the object recommendation result based on the first text using a target macro model. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] In order to more clearly illustrate the technical solution of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0015] Figure 1 A flowchart of an object recommendation method according to an embodiment of the present application;
[0016] Figure 2 A flowchart of obtaining first vector data according to an embodiment of the present application;
[0017] Figure 3 A flowchart of generating a first text according to an embodiment of the present application;
[0018] Figure 4 A flowchart of a process for determining a target macro model according to an embodiment of the present application;
[0019] Figure 5 A flowchart of generating a data set according to an embodiment of the present application;
[0020] Figure 6 A flowchart of a process for determining a target encoder model according to an embodiment of the present application;
[0021] Figure 7 This is a flow chart of adjusting parameters of an initial encoder model according to an embodiment of the present application;
[0022] Figure 8 A schematic diagram of the principle of determining a target encoder model and a target large model according to an embodiment of the present application;
[0023] Fig. 9 This is a structural block diagram of an object recommendation device according to an embodiment of the present application. DETAILED DESCRIPTION
[0024] Various aspects and features of the present application are described herein with reference to the accompanying drawings.
[0025] It should be understood that various modifications may be made to the embodiments of the present application. Therefore, the above description should not be considered as limiting, but only as an example of an embodiment. Other modifications within the scope and spirit of the present application will occur to those skilled in the art.
[0026] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate embodiments of the present application and, together with the general description of the present application given above and the detailed description of the embodiments given below, serve to explain the principles of the present application.
[0027] These and other characteristics of the present application will become apparent from the following description of a preferred form of embodiment given as a non-limiting example with reference to the accompanying drawings.
[0028] It should also be understood that although the present application has been described with reference to some specific examples, those skilled in the art will be able to readily implement many other equivalent forms of the present application.
[0029] The above and other aspects, features and advantages of the present application will become more apparent in view of the following detailed description when taken in conjunction with the accompanying drawings.
[0030] Specific embodiments of the present application are described hereinafter with reference to the accompanying drawings; however, it should be understood that the embodiments applied for are merely examples of the present application, which may be implemented in a variety of ways. Well-known and / or repeated functions and structures are not described in detail to avoid unnecessary or redundant details that obscure the present application. Therefore, the specific structural and functional details applied for herein are not intended to be limiting, but merely serve as a basis and representative basis for the claims to teach those skilled in the art to use the present application in a variety of ways with substantially any suitable detailed structure.
[0031] This specification may use the phrases "in one embodiment," "in another embodiment," "in yet another embodiment," or "in other embodiments," all of which may refer to one or more of the same or different embodiments according to the present application.
[0032] An object recommendation method in an embodiment of the present application obtains at least one historical object that a user has interacted with, and obtains a first vector quantity based on the historical object. Since the first vector quantity represents the attributes of the historical object in multiple dimensions, it achieves a complete representation of the attributes of the historical object and avoids performance degradation during migration between domains, so that the object recommendation result is more in line with the user's personalized representation, thereby improving the efficiency and accuracy of object recommendation.
[0033] like Figure 1 As shown, the method comprises the following steps:
[0034] Step S101 , in response to a target recommendation task, obtaining at least one historical object that a user has interacted with.
[0035] In this embodiment, the target recommendation task can be issued by the user, or can be automatically triggered when a trigger condition is met, or can be issued by other servers. At least one historical object that the user has interacted with can be obtained based on the user's historical interaction data, wherein the user can be one user or multiple users.
[0036] The historical object may be, for example, any one of commodities, videos, music, audio books, news information, articles, e-books, etc. For example, if the historical object is a commodity, the user's historical interaction data may be the user's commodity purchase record, commodity browsing record, commodity evaluation record, and commodity record added to the shopping cart within a preset historical period (such as one month or one week). If the historical object is a video, the user's historical interaction data may be the user's video browsing record, video viewing record, favorited videos, liked videos, rewarded videos, saved videos, evaluated videos, and video evaluation content within a preset historical period. Different users have different user identifiers, and the user's historical interaction data may be obtained based on the user's user identifier.
[0037] Step S102: acquiring first vector data according to the historical object, wherein the first vector data represents attributes of the historical object in multiple dimensions.
[0038] After obtaining the historical object, first vector data is obtained according to the historical object, and the first vector data represents the attributes of the historical object in multiple dimensions. For example, if the historical object is a product, the first vector data may represent the attributes of the product in dimensions such as name, ID, price, brand, product description, product sales, and product praise. If the historical object is a video, the first vector data may represent the attributes of the video in dimensions such as name, content, theme, keyword, sensitivity, duration, number of views, video producer, number of favorites, and number of likes.
[0039] Step S103: Generate a first text according to the task type of the target recommendation task and the first vector data.
[0040] The target recommendation task belongs to a specific task type, and target recommendation tasks of different task types correspond to different forms of recommendation results. For example, the task type of the target recommendation task may include any one of sequence recommendation, explainable recommendation, object rating recommendation, and object label recommendation, where sequence recommendation can be to determine the object sequence recommended to the user from the candidate object set, explainable recommendation can be to provide an explanation of the candidate object set from the user's perspective, object rating recommendation can be to infer the user's rating of the object, and object label recommendation can be to determine a preset number of object labels from the historical objects that the user has interacted with.
[0041] Those skilled in the art can flexibly set target recommendation tasks of different task types according to different objects and required recommendation results.
[0042] The first text is generated according to the task type of the target recommendation task and the first vector data, and the object recommendation result is subsequently determined by the target macro model. In the specific application scenario of the present application, the first text is the prompt word text to be input into the target macro model.
[0043] Step S104: Determine an object recommendation result using a target macro model according to the first text.
[0044] The big model refers to a deep neural network model trained with massive data, whose huge data and parameter scale enable the emergence of intelligence and show human-like intelligence. In this embodiment, a target big model is pre-set, and the target big model is used to infer the first text, thereby inferring the object recommendation result.
[0045] The object recommendation result may be recommended to the user later, or the object or information recommended to the user may be determined based on the object recommendation result. For example, if the object recommendation result is a product sequence, the product sequence may be recommended to the user. If the object recommendation result is an inferred user rating of a product, if the rating is higher than a preset rating, a product similar to the product may be determined as a product recommended to the user.
[0046] Optionally, the target large model can adopt any one of the large models including ChatGPT, Claude, Gemini, Mistral, Llama, GrokxAI, etc.
[0047] The object recommendation method of the embodiment of the present application obtains at least one historical object that the user has interacted with in response to the target recommendation task; obtains first vector data based on the historical object, the first vector data representing the attributes of the historical object in multiple dimensions; generates a first text based on the task type of the target recommendation task and the first vector data; and determines the object recommendation result using the target macro model based on the first text. Since the first vector quantity represents the attributes of the historical object in multiple dimensions, the attributes of the historical object are fully represented, and the performance degradation during the migration between domains is avoided, so that the object recommendation result is more in line with the user's personalized representation, thereby improving the efficiency and accuracy of object recommendation.
[0048] In some embodiments of the present application, first vector data is obtained according to the historical object, such as Figure 2 As shown, the following steps are included:
[0049] Step S1021: query a vector database according to the object identifier of the historical object, wherein the vector database stores vector data of multiple objects.
[0050] In this embodiment, a vector database is pre-established, and the vector database stores vector data of multiple objects. Each vector data represents the attributes of the corresponding object in multiple dimensions. The vector data in the vector database may correspond to one type of object, such as only including vector data of multiple commodities, or may correspond to multiple types of objects, such as including vector data of multiple commodities and multiple videos. The vector data of commodities and the vector data of videos may be stored in different areas of the vector database, respectively. The historical object has a unique corresponding object identifier. The vector database is queried according to the object identifier of the historical object, and step S1022 or step S1023 is executed according to different query results.
[0051] Step S1022: If the vector database contains target vector data corresponding to the object identifier, the target vector data is determined as the first vector data.
[0052] If the vector database contains target vector data corresponding to the object identifier, the target vector data is directly determined as the first vector data.
[0053] Step S1023: If the target vector data does not exist in the vector database, the first vector data is generated using a target encoder model according to the historical object.
[0054] If the target vector data does not exist in the vector database, it is necessary to generate the first vector data according to the historical object. Specifically, the first vector data is generated according to the historical object using a pre-trained target encoder model.
[0055] By setting up a vector database, the first vector data can be directly determined when the target vector data exists in the vector database, so that the first vector data can be quickly determined, thereby improving the inference efficiency of the target large model. When the target vector data does not exist in the vector database, the first vector data can be generated using the target encoder model, ensuring that the first vector data is reliably obtained.
[0056] In some embodiments of the present application, the target encoder model includes a target encoder and a target feedforward neural network, and generating first vector data using the target encoder model according to the history object includes:
[0057] Obtaining attribute information of the historical object in multiple dimensions;
[0058] Encoding the attribute information using the target encoder to generate the first encoded data;
[0059] The first vector data is generated using the target feedforward neural network according to the first encoded data.
[0060] In this embodiment, the target encoder model includes a target encoder and a target feedforward neural network, which can obtain the attribute information of the historical object in multiple dimensions according to the object identifier of the historical object, and can also determine the attribute information of the historical object in multiple dimensions according to the attribute information input by the user. The acquired attribute information is input into the target encoder, and the target encoder encodes the attribute information to generate first encoded data, and then the first encoded data is input into the target feedforward neural network, and the target feedforward neural network maps the first encoded data to the vector space and dimension that conforms to the target large model, thereby generating first vector data.
[0061] The attribute information is encoded through a target encoder, and the encoded data is mapped into a vector space and dimension that conforms to the target large model using a target feedforward neural network, so that the data form of the first vector data matches the target large model, thereby achieving efficient and accurate generation of the first vector data.
[0062] In some embodiments of the present application, the attribute information of the historical object in multiple dimensions is a text including the attributes of the historical object in multiple dimensions. By setting the attribute information in text form, the portability of recommendation tasks between different fields is ensured.
[0063] In some embodiments of the present application, a first text is generated according to the task type of the target recommendation task and the first vector data, such as Figure 3As shown, including:
[0064] Step S1031 : determining a target task template from a plurality of task templates according to the task type, wherein each task template represents a description text template of a task type.
[0065] In this embodiment, multiple task templates are pre-established, each task template represents a description text template of a task type. Among the multiple task templates, a task template that meets the task type of the target recommended task is determined as a target task template.
[0066] In the specific application scenario of the present application, the task template includes an input template and an output template. Table 1 shows examples of different task templates when the object is a commodity.
[0067] Table 1
[0068]
[0069]
[0070] In Table 1, the angle brackets “<>” indicate the insertion positions of user and product information.<user_name> Indicates the user name;<candidate_list> Represents a candidate item or item set;<history_list> It represents the historical product sequence of user interaction;<target_item> Indicates the product name of the target product.
[0071] Step S1032: Generate the first text according to the first vector data and the target task template.
[0072] After determining the target task template, the first text is generated according to the first vector data and the target task template. Specifically, the user's historical interaction data may be obtained first, and the target task template is filled in according to the user's historical interaction data and the first vector data to generate the first text.
[0073] By setting multiple task templates, the target task module matching the task type can be quickly determined, thereby improving the generation efficiency of the first text.
[0074] In some embodiments of the present application, Figure 4 As shown, the process of determining the target large model includes the following steps:
[0075] Step S201 : acquiring a plurality of historical object samples with which the sample user has interacted according to the historical interaction data of the sample user.
[0076] In this embodiment, the target large language model is obtained by fine-tuning the parameters of the initial large model. First, multiple users are selected as sample users, and multiple historical object samples that the sample users have interacted with are obtained based on the historical interaction data of the sample users.
[0077] The historical object sample may be, for example, any one of commodities, videos, music, audio books, news information, articles, e-books, etc. For example, if the historical object sample is a commodity sample, the historical interaction data of the sample user may be the commodity purchase record, commodity browsing record, commodity evaluation record, commodity added to the shopping cart record, etc. of the sample user within a preset historical period (such as one month or one week). Different sample users have different user identifiers, and the historical interaction data of the sample user may be obtained according to the user identifier of the sample user.
[0078] Step S202: acquiring second vector data according to the historical object sample, wherein the second vector data represents attributes of the historical object sample in multiple dimensions.
[0079] After obtaining the historical object sample, the second vector data is obtained according to the historical object sample, and the second vector data represents the attributes of the historical object sample in multiple dimensions. For example, if the historical object sample is a commodity sample, the second vector data can represent the attributes of the commodity sample in dimensions such as name, ID, price, brand, commodity description, commodity sales, and commodity praise. If the historical object sample is a video sample, the second vector data can represent the attributes of the video sample in dimensions such as name, content, theme, keyword, sensitivity, duration, number of views, video producer, number of collections, and number of likes.
[0080] In some embodiments of the present application, obtaining second vector data according to the historical object sample includes:
[0081] querying a vector database according to the sample identifier of the historical object sample, wherein the vector database stores vector data of multiple objects;
[0082] If the vector database contains target vector data corresponding to the sample identifier, the target vector data corresponding to the sample identifier is determined as the second vector data;
[0083] If the target vector data corresponding to the sample identifier does not exist in the vector database, the second vector data is generated using a target encoder model according to the historical object sample.
[0084] In this embodiment, the vector database is the vector database in step S1021. The historical object sample has a unique corresponding sample identifier. The vector database is queried according to the sample identifier. If the vector database has target vector data corresponding to the sample identifier, the target vector data corresponding to the sample identifier is directly determined as the second vector data. If the target vector data corresponding to the sample identifier does not exist in the vector database, it is necessary to generate the second vector data according to the historical object sample. Specifically, the second vector data is generated according to the historical object sample using a pre-trained target encoder model.
[0085] The target encoder is the target encoder in step S1023. The specific process of generating the second vector data according to the historical object samples using the pre-trained target encoder model is similar to the process of generating the first vector data, which will not be repeated here.
[0086] By setting up a vector database, the second vector data can be directly determined when the target vector data corresponding to the sample identifier exists in the vector database, so that the second vector data can be quickly determined, thereby improving the efficiency of fine-tuning the parameters of the initial large model. When the target vector data corresponding to the sample identifier is in the vector database, the target encoder model can be used to generate the second vector data, ensuring that the second vector data is reliably obtained.
[0087] Step S203: generating a data set according to the historical interaction data, the second vector data and a plurality of task templates, each task template representing a description text template of a task type.
[0088] In this embodiment, each task template is the same as the task template in step S1031, and a data set is generated according to the historical interaction data, the second vector data and a plurality of task templates, and the parameters of the initial large model are subsequently fine-tuned according to the data set.
[0089] Step S204, fine-tuning the parameters of the initial large model based on the data set, and determining the initial large model after the parameter fine-tuning as the target large model.
[0090] In this embodiment, an initial large model is determined, the initial large model has the same model structure as the target large model, parameters of the initial large model are fine-tuned based on the data set, and the initial large model after parameter fine-tuning is determined as the target large model.
[0091] Optionally, any one of methods including FFT, loRA, QloRA, AdaLoRA, Child-Tuning, etc. can be used to fine-tune parameters.
[0092] By generating a data set through historical interaction data, second vector data and multiple task templates, the data set is made compatible with multiple task types, so that the initial large model can learn the potential correlation between different types of tasks, thereby improving the generalization ability of the target large model.
[0093] In some embodiments of the present application, a data set is generated according to the second vector data and a plurality of task templates, such as Figure 5 As shown, the following steps are included:
[0094] Step S2031, filling in each of the task templates according to the historical interaction data and the second vector data, and generating multiple groups of model input texts and standard recommendation results under different task types.
[0095] As shown in Table 1, one or more insertion positions are set in each task template. According to different task types, the corresponding data in the historical interaction data and the second vector data are filled in each insertion position to generate multiple groups of model input texts and standard recommendation results under different task types.
[0096] Step S2032, generating the data set according to the model input text and the standard recommendation results.
[0097] In this embodiment, a data set is generated based on the model input text and the standard recommendation results. When fine-tuning the parameters of the initial large model, the model input text is input into the initial large model to obtain the recommendation results output by the initial large model, and the recommendation results are compared with the standard recommendation results corresponding to the model input text (such as determining the similarity between the two), thereby determining the loss of the initial large model, and fine-tuning the parameters of the initial large model according to the loss to reduce the loss.
[0098] By generating multiple sets of model input texts and standard recommendation results under different task types, the formed data set is made compatible with multiple task types, which enables the initial large model to learn multiple task types during parameter fine-tuning, thereby improving the generalization ability of the target large model.
[0099] In some embodiments of the present application, Figure 6 As shown, the process of determining the target encoder model includes the following steps:
[0100] Step S301: Acquire attribute texts of multiple object samples, each attribute text including attribute description information of the corresponding object sample in multiple dimensions.
[0101] In this embodiment, the object sample can be any one of commodities, videos, music, audio books, news information, articles, e-books, etc. For example, if the object sample is a commodity, the attribute description information may include the attributes of the commodity in dimensions such as name, ID, price, brand, commodity description, commodity sales, and commodity praise.
[0102] Step S302, adjusting the parameters of the initial encoder model according to the attribute text and the initial large model of frozen parameters, determining the initial encoder model after parameter adjustment as the target encoder model, and the model structure of the initial large model and the target large model is the same.
[0103] An initial encoder model and an initial large model are established in advance. The initial large model and the target large model have the same model structure. After obtaining the attribute text of multiple object samples, the parameters of the initial large model are frozen. The parameters of the initial encoder model are adjusted according to the attribute text and the initial large model with frozen parameters. After the parameter adjustment is completed, the target encoder model is determined.
[0104] The initial large model is a downstream model of the initial encoder model. The parameters of the initial encoder model are adjusted through the initial large model with attribute text and frozen parameters. Since the data of the downstream model is taken into consideration, the parameters of the initial encoder model can be adjusted more accurately, thereby obtaining a more accurate target encoder model.
[0105] In some embodiments of the present application, the initial encoder model includes an initial encoder and an initial feedforward neural network, and the initial encoder model is parameterized according to the attribute text and the initial large model of the frozen parameters, such as Figure 7 As shown, the following steps are included:
[0106] Step S3021, masking the attribute text to obtain masked text.
[0107] In this embodiment, the initial encoder model includes an initial encoder and an initial feedforward neural network. After completing parameter adjustment of the initial encoder and the initial feedforward neural network, a target encoder and a target feedforward neural network are obtained, thereby obtaining a target encoder model.
[0108] Masking refers to randomly masking or replacing words in the attribute text, and obtaining masked text after masking the attribute text.
[0109] Step S3022: Input the attribute text and the mask text into the initial encoder respectively to obtain second encoded data corresponding to the attribute text and third encoded data corresponding to the mask text.
[0110] The attribute text and the mask text are respectively input into the initial encoder, and the initial encoder encodes them to obtain the second encoded data corresponding to the attribute text and the third encoded data corresponding to the mask text.
[0111] Step S3023: Generate third vector data using the initial feedforward neural network according to the second encoded data.
[0112] The second coded data is input into the initial feedforward neural network, and the initial feedforward neural network maps the second coded data to a vector space and dimension that conforms to the initial large model to obtain third vector data.
[0113] Step S3024: Based on the third vector data, using the initial large model with frozen parameters, obtain the reconstructed text corresponding to the third vector data.
[0114] After the third vector data is generated, reasoning is performed based on the third vector data using the initial large model with frozen parameters to obtain a reconstructed text corresponding to the third vector data.
[0115] Step S3025, adjusting parameters of the initial encoder and the initial feedforward neural network according to the second encoded data, the third encoded data and the reconstructed text.
[0116] The corresponding model loss can be determined according to the second encoded data, the third encoded data and the reconstructed text, and the parameters of the initial encoder and the initial feedforward neural network are adjusted according to the model loss, thereby further improving the accuracy of the parameter adjustment.
[0117] In some embodiments of the present application, the second encoded data includes a second text vector and a plurality of second word vectors, the third encoded data includes a third text vector and a plurality of third word vectors, and adjusting parameters of the initial encoder and the initial feedforward neural network according to the second encoded data, the third encoded data and the reconstructed text includes:
[0118] Determine a plurality of word texts according to each of the third word vectors, compare each word text with the attribute text of the same object sample, and determine a mask loss;
[0119] Taking the second text vector and the third text vector of the object sample as a positive sample pair, taking the second text vector of the object sample and the second text vectors of other object samples as negative sample pairs, and determining a contrastive learning loss according to the positive sample pair and the negative sample pair;
[0120] Compare the reconstructed text with the attributed text of the same object sample to determine the reconstruction loss;
[0121] The parameters of the initial encoder are adjusted according to the mask loss, the contrastive learning loss and the reconstruction loss, and the parameters of the initial feedforward neural network are adjusted according to the reconstruction loss.
[0122] In this embodiment, the second encoded data includes a second text vector and a plurality of second word vectors, and the third encoded data includes a third text vector and a plurality of third word vectors. Three model losses are determined based on the second encoded data, the third encoded data and the reconstructed text, namely, mask loss, contrastive learning loss and reconstruction loss. The greater the difference between each word text and the attribute text, the greater the mask loss. When the second text vector and the third text vector of the object sample are similar, but not similar to the second text vectors of other object samples, the contrastive learning loss should be smaller. When the second text vector and the third text vector of the object sample are not similar, but similar to the second text vectors of other object samples, the contrastive learning loss should be larger. The greater the difference between the reconstructed text and the attribute text of the same object sample, the greater the reconstruction loss.
[0123] In the specific application scenario of the present application, the initial encoder and the target encoder adopt PLM (Pre-trained Language Model), and the mask loss is MLM (Masked Language Modeling) loss.
[0124] By determining the mask loss, the initial encoder can learn the contextual relationship of the object, so as to better represent the object. By determining the contrastive learning loss, the similarity between the generated vectors can be prevented from being too large, so that the initial encoder can distinguish the difference between different objects and model objects with missing information more robustly. By determining the reconstruction loss, the initial large model can learn the relationship between object vectors and different tasks in the recommendation field with less training data, thus realizing few-sample training.
[0125] In some embodiments of the present application, after determining the target encoder model for which parameter adjustment is completed as the target encoder model, the method further includes:
[0126] According to all objects in the object set, using the target encoder model to generate vector data corresponding to each object;
[0127] The vector data corresponding to each object is stored in the vector database.
[0128] In this embodiment, by generating a vector database, when fine-tuning the parameters of the initial large model or using the target large model for inference, if historical object samples or historical objects exist in the object set, the vector data in the vector database can be used directly, thereby improving the efficiency of fine-tuning the parameters of the initial large model or improving the inference efficiency of the target large model.
[0129] In order to further explain the technical idea of the present application, the technical solution of the present application is now described in combination with specific application scenarios.
[0130] The present application provides an object recommendation method, which is applied to product recommendation and includes the following steps:
[0131] Step S11, in response to the target recommendation task, obtaining at least one historical commodity that the user has interacted with.
[0132] Step S12, obtaining first vector data according to historical commodities.
[0133] The vector database is queried according to the product identification of historical products. If the vector database contains target vector data corresponding to the product identification, the target vector data is determined as the first vector data. If the target vector data does not exist in the vector database, the first vector data is generated according to the historical products using the target encoder model.
[0134] Step S13: determining a target task template from a plurality of task templates according to the task type.
[0135] Examples of each task template are shown in Table 1. For example, if the task type is sequence recommendation, the task template corresponding to the sequence recommendation is used as the target task template.
[0136] Step S14, obtaining the user's historical interaction data, filling in the target task template according to the user's historical interaction data and the first vector data, and generating the first text.
[0137] Step S15, determining the product recommendation result using the target macro model according to the first text.
[0138] Before executing step S11, it is necessary to determine the target encoder model and the target large model, such as Figure 8 As shown, it includes the first step and the second step. The first step includes the following processes:
[0139] Step S21, obtaining attribute texts of multiple product samples, each attribute text including attribute description information of the corresponding product sample in multiple dimensions.
[0140] Step S22, masking the attribute text to obtain masked text.
[0141] Step S23, input the attribute text and the mask text into the initial encoder respectively, obtain the second encoded data corresponding to the attribute text, and the third encoded data corresponding to the mask text, the second encoded data includes a second text vector (C) and multiple second word vectors (e1, e2, e3...en), and the third encoded data includes a third text vector (C) and multiple third word vectors (e1, e2, e3...en).
[0142] Step S24, generating third vector data (I) using an initial feedforward neural network based on the second encoded data.
[0143] Step S25, based on the third vector data, using the initial large model with frozen parameters, obtain the reconstructed text corresponding to the third vector data.
[0144] The initial large model includes LLM-embedding and LLM-decoder. LLM stands for Large Language Model.
[0145] Step S26, determining multiple word texts according to each third word vector, comparing each word text of the same product sample with the attribute text, and determining the mask loss.
[0146] Step S27, taking the second text vector and the third text vector of the product sample as a positive sample pair, taking the second text vector of the product sample and the second text vectors of other product samples as a negative sample pair, and determining the contrastive learning loss according to the positive sample pair and the negative sample pair.
[0147] Step S28, comparing the reconstructed text and the attribute text of the same product sample to determine the reconstruction loss.
[0148] Step S29, adjusting the parameters of the initial encoder according to the mask loss, contrastive learning loss and reconstruction loss, adjusting the parameters of the initial feedforward neural network according to the reconstruction loss, and determining the target encoder and target feedforward neural network that have completed parameter adjustment as the target encoder model.
[0149] The second step includes the following process:
[0150] Step S31, obtaining multiple historical commodity samples (commodity 1, commodity 2 ... commodity n) with which the sample user has interacted according to the historical interaction data of the sample user, and forming a commodity set based on the historical commodity samples.
[0151] Step S32, inputting the attribute information of all commodities in the commodity set in multiple dimensions into the target encoder to obtain encoded data (C1, C2...Cn).
[0152] Step S33, based on the encoded data, use the target feedforward neural network to generate vector data (I1, I2...In) corresponding to each product, and save the vector data corresponding to each product into a vector database.
[0153] Step S34, obtaining the second vector data of each historical commodity sample from the vector database.
[0154] Step S35, filling in each task template according to the historical interaction data and the second vector data, and generating multiple groups of model input texts and standard recommendation results under different task types.
[0155] Step S36, generating a data set based on the model input text and standard recommendation results.
[0156] Step S37, fine-tuning the parameters of the initial large model based on the data set, and determining the initial large model after the parameter fine-tuning as the target large model.
[0157] Among them, when fine-tuning the parameters of the initial large model, the model input text is input into the initial large model to obtain the recommendation results output by the initial large model, and the recommendation results are compared with the standard recommendation results corresponding to the model input text to determine the loss of the initial large model, and the parameters of the initial large model are fine-tuned according to the loss to reduce the loss.
[0158] As shown in Tables 2, 3 and 4, they are the results of evaluating the product recommendation results of baseline (Llama-7b), product full information text representation, product vector pre-training V1 and product vector pre-training V2 using different evaluation indicators when the task types are product rating recommendation, sequence recommendation and explainable recommendation.
[0159] Table 2
[0160]
[0161]
[0162] Table 3
[0163]
[0164] Table 4
[0165]
[0166]
[0167] In Table 2, Table 3 and Table 4, the total size of all product sample data is 256. In the baseline (Llama-7b), the product is represented by the product name; in the product vector pre-training V1, only the reconstruction loss is used to adjust the parameters of the initial encoder model; the product vector pre-training V2 corresponds to the object recommendation method of the embodiment of the present application, and the mask loss, contrastive learning loss and reconstruction loss are used to adjust the parameters of the initial encoder model. It can be seen from Table 2, Table 3 and Table 4 that the product recommendation results obtained by the object recommendation method of the embodiment of the present application are better.
[0168] The present application also proposes an object recommendation device, such as Fig. 9As shown, it includes: a first acquisition module, used to obtain at least one historical object that the user has interacted with in response to a target recommendation task; a second acquisition module, used to obtain first vector data based on the historical object, the first vector data representing the attributes of the historical object in multiple dimensions; a generation module, used to generate a first text based on the task type of the target recommendation task and the first vector data; a determination module, used to determine the object recommendation result based on the first text using a target large model.
[0169] In a specific application scenario, the second acquisition module is specifically used to: query a vector database based on the object identifier of the historical object, where vector data of multiple objects are stored; if the vector database contains target vector data corresponding to the object identifier, determine the target vector data as the first vector data; if the target vector data does not exist in the vector database, generate the first vector data based on the historical object using a target encoder model.
[0170] In a specific application scenario, the target encoder model includes a target encoder and a target feedforward neural network. The second acquisition module is also specifically used to: obtain the attribute information of the historical object in multiple dimensions; use the target encoder to encode the attribute information to generate the first encoded data; and use the target feedforward neural network to generate the first vector data based on the first encoded data.
[0171] In a specific application scenario, the generation module is specifically used to: determine a target task template from multiple task templates according to the task type, each task template represents a description text template of a task type; generate the first text according to the first vector data and the target task template.
[0172] In a specific application scenario, the process of determining the target big model includes: obtaining multiple historical object samples that the sample user has interacted with based on the historical interaction data of the sample user; obtaining second vector data based on the historical object samples, the second vector data representing the attributes of the historical object samples in multiple dimensions; generating a data set based on the historical interaction data, the second vector data and a variety of task templates, each task template representing a descriptive text template of a task type; fine-tuning the parameters of the initial big model based on the data set, and determining the initial big model that has completed parameter fine-tuning as the target big model.
[0173] In a specific application scenario, a data set is generated based on the second vector data and multiple task templates, including: filling in each task template based on the historical interaction data and the second vector data to generate multiple groups of model input texts and standard recommendation results under different task types; generating the data set based on the model input texts and standard recommendation results.
[0174] In a specific application scenario, the process of determining the target encoder model includes: obtaining attribute texts of multiple object samples, each attribute text including attribute description information of the corresponding object sample in multiple dimensions; adjusting the parameters of the initial encoder model according to the attribute texts and the initial large model of frozen parameters, and determining the initial encoder model that has completed the parameter adjustment as the target encoder model, and the model structure of the initial large model and the target large model is the same.
[0175] In a specific application scenario, the initial encoder model includes an initial encoder and an initial feedforward neural network, and the parameters of the initial encoder model are adjusted according to the attribute text and the initial large model of frozen parameters, including: masking the attribute text to obtain masked text; inputting the attribute text and the masked text into the initial encoder respectively to obtain second encoded data corresponding to the attribute text, and third encoded data corresponding to the masked text; based on the second encoded data, using the initial feedforward neural network to generate third vector data; based on the third vector data, using the initial large model of frozen parameters to obtain reconstructed text corresponding to the third vector data; based on the second encoded data, the third encoded data and the reconstructed text, the parameters of the initial encoder and the initial feedforward neural network are adjusted.
[0176] In a specific application scenario, the second encoded data includes a second text vector and multiple second word vectors, and the third encoded data includes a third text vector and multiple third word vectors. The parameters of the initial encoder and the initial feedforward neural network are adjusted according to the second encoded data, the third encoded data and the reconstructed text, including: determining multiple word texts according to each of the third word vectors, comparing each word text of the same object sample with the attribute text, and determining the mask loss; taking the second text vector and the third text vector of the object sample as a positive sample pair, and taking the second text vector of the object sample and the second text vector of other object samples as a negative sample pair, and determining the contrastive learning loss according to the positive sample pair and the negative sample pair; comparing the reconstructed text of the same object sample with the attribute text to determine the reconstruction loss; adjusting the parameters of the initial encoder according to the mask loss, the contrastive learning loss and the reconstruction loss, and adjusting the parameters of the initial feedforward neural network according to the reconstruction loss.
[0177] The object recommendation device of the embodiment of the present application includes a first acquisition module, which is used to obtain at least one historical object that the user has interacted with in response to a target recommendation task; a second acquisition module, which is used to obtain first vector data based on the historical object, and the first vector data represents the attributes of the historical object in multiple dimensions; a generation module, which is used to generate a first text based on the task type of the target recommendation task and the first vector data; a determination module, which is used to determine the object recommendation result using the target large model based on the first text. Since the first vector quantity represents the attributes of the historical object in multiple dimensions, the attributes of the historical object are fully represented, and the performance degradation during the migration between domains is avoided, so that the object recommendation result is more in line with the user's personalized representation, thereby improving the efficiency and accuracy of object recommendation.
[0178] An embodiment of the present application further provides an electronic device, including a processor and a memory, wherein an executable program is stored in the memory, and the processor executes the executable program to perform the object recommendation method of each embodiment of the present application.
[0179] The electronic device in the embodiment of the present application may be a terminal, or may be other devices other than a terminal. For example, the electronic device may be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, a mobile Internet device (MID), an augmented reality (AR) / virtual reality (VR) device, a robot, a wearable device, an ultra-mobile personal computer (UMPC), a netbook or a personal digital assistant (PDA), etc., and may also be a server, a network attached storage (NAS), a personal computer (PC), a television (TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present disclosure.
[0180] The memory may include a RAM (Random Access Memory) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0181] The above-mentioned processor can be a general-purpose processor, including CPU, NP (Network Processor), etc.; it can also be DSP (Digital Signal Processing), ASIC (Application Specific Integrated Circuit), FPGA (Field Programmable Gate Array) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0182] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is 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 a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integration. The available medium can be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk), etc.
[0183] The above embodiments are only exemplary embodiments of the present application and are not intended to limit the present application. The protection scope of the present application is defined by the claims. Those skilled in the art may make various modifications or equivalent substitutions to the present application within the essence and protection scope of the present application, and such modifications or equivalent substitutions shall also be deemed to fall within the protection scope of the present application.
Claims
1. An object recommendation method, comprising: In response to the target recommendation task, obtaining at least one historical object interacted by the user; Acquire first vector data according to the historical object, where the first vector data represents attributes of the historical object in multiple dimensions; Generate a first text according to the task type of the target recommendation task and the first vector data; According to the first text, an object recommendation result is determined using a target macro model.
2. The object recommendation method according to claim 1, wherein obtaining first vector data according to the historical object comprises: querying a vector database according to the object identifier of the historical object, wherein the vector database stores vector data of a plurality of objects; If the vector database contains target vector data corresponding to the object identifier, determining the target vector data as the first vector data; If the target vector data does not exist in the vector database, the first vector data is generated using a target encoder model according to the historical object.
3. The object recommendation method according to claim 2, wherein the target encoder model comprises a target encoder and a target feedforward neural network, and generating the first vector data using the target encoder model according to the historical object comprises: Obtaining attribute information of the historical object in multiple dimensions; Encoding the attribute information using the target encoder to generate the first encoded data; The first vector data is generated using the target feedforward neural network according to the first encoded data.
4. The object recommendation method according to claim 1, generating a first text according to the task type of the target recommendation task and the first vector data, comprising: Determining a target task template from a plurality of task templates according to the task type, each task template representing a description text template of a task type; The first text is generated according to the first vector data and the target task template.
5. The object recommendation method according to claim 1, wherein the process of determining the target macro model comprises: Acquire multiple historical object samples that the sample user has interacted with according to the historical interaction data of the sample user; Acquire second vector data according to the historical object sample, where the second vector data represents attributes of the historical object sample in multiple dimensions; Generate a data set according to the historical interaction data, the second vector data and a plurality of task templates, each task template representing a description text template of a task type; The parameters of the initial large model are fine-tuned based on the data set, and the initial large model after the parameter fine-tuning is determined as the target large model.
6. The object recommendation method according to claim 5, generating a data set according to the second vector data and a plurality of task templates, comprising: Fill in each of the task templates according to the historical interaction data and the second vector data to generate multiple groups of model input texts and standard recommendation results under different task types; The data set is generated according to the model input text and standard recommendation results.
7. The object recommendation method according to claim 2, wherein the process of determining the target encoder model comprises: Acquire attribute texts of multiple object samples, each attribute text including attribute description information of the corresponding object sample in multiple dimensions; The parameters of the initial encoder model are adjusted according to the attribute text and the initial large model of frozen parameters, and the initial encoder model after the parameter adjustment is determined as the target encoder model. The model structures of the initial large model and the target large model are the same.
8. The object recommendation method according to claim 7, wherein the initial encoder model comprises an initial encoder and an initial feedforward neural network, and adjusting parameters of the initial encoder model according to the attribute text and the initial large model of frozen parameters comprises: Performing mask processing on the attribute text to obtain masked text; Inputting the attribute text and the mask text into the initial encoder respectively, obtaining second encoded data corresponding to the attribute text and third encoded data corresponding to the mask text; generating third vector data using the initial feedforward neural network according to the second encoded data; According to the third vector data, using the initial large model with frozen parameters, obtaining a reconstructed text corresponding to the third vector data; Parameters of the initial encoder and the initial feedforward neural network are adjusted according to the second encoded data, the third encoded data and the reconstructed text.
9. The object recommendation method according to claim 8, wherein the second encoded data comprises a second text vector and a plurality of second word vectors, the third encoded data comprises a third text vector and a plurality of third word vectors, and the initial encoder and the initial feedforward neural network are parameter adjusted according to the second encoded data, the third encoded data and the reconstructed text, comprising: Determine a plurality of word texts according to each of the third word vectors, compare each word text with the attribute text of the same object sample, and determine a mask loss; Taking the second text vector and the third text vector of the object sample as a positive sample pair, taking the second text vector of the object sample and the second text vectors of other object samples as negative sample pairs, and determining a contrastive learning loss according to the positive sample pair and the negative sample pair; Compare the reconstructed text with the attributed text of the same object sample to determine the reconstruction loss; The parameters of the initial encoder are adjusted according to the mask loss, the contrastive learning loss and the reconstruction loss, and the parameters of the initial feedforward neural network are adjusted according to the reconstruction loss.
10. An object recommendation device, comprising: A first acquisition module, configured to acquire at least one historical object that a user has interacted with in response to a target recommendation task; A second acquisition module, configured to acquire first vector data according to the historical object, wherein the first vector data represents attributes of the historical object in multiple dimensions; A generating module, configured to generate a first text according to a task type of the target recommendation task and the first vector data; A determination module is used to determine an object recommendation result based on the first text using a target large model.
Citation Information
Patent Citations
Questionnaire survey method and device
CN110413926A
Multimedia data processing method and device, equipment and storage medium
CN114528496A
Data processing method, device and equipment, readable storage medium and program product
CN115114480A
Expression picture recommendation method and device, electronic equipment and storage medium
CN115238177A
Object recommendation method and device, electronic equipment and readable storage medium
CN116932884A
