Resource acquisition method and device based on generative model, equipment and storage medium
Through the resource acquisition method based on the generative model, short-term, medium-term and long-term resource sequences are constructed using the user's historical behavior data to generate personalized recommendation content, solving the problem that existing recommendation systems are difficult to capture users' long-term interests, and achieving more efficient resource matching and recommendation accuracy.
Patent Information
- Application Number
- CN202510125624.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-26
- Publication Date
- 2025-06-03
- Estimated Expiration
- 2045-01-26
AI Technical Summary
The existing recommendation system is difficult to effectively capture the long-term interests of users during the recall and sorting stages, resulting in a lack of personalization and diversity in recommendation results and poor user experience.
Using a resource acquisition method based on a generative model, short-term, medium-term and long-term resource sequences are extracted from the user's historical behavior, corresponding prompt words are constructed, and generative models are input to generate target resources.
It improves the matching degree between the target resources and the resources required by users, improves the accuracy and personalization of recommendations, and improves the user experience.
Smart Images

Figure CN120086435A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technologies, and in particular, to technical fields such as generative models, large models, resource recall, and resource recommendation. Background Art
[0002] In the recall stage of the recommendation process, methods such as deep graph collaborative filtering, multi-modal content recall, or deep tree retrieval are usually adopted to preliminarily screen out items that a user may be interested in from a huge content library. In the ranking stage of the recommendation process, modules such as an attention mechanism are usually introduced to assign weights to the historical behaviors of the user to capture the interests of the user in each period. And, in the online service stage, usually only the short-term behaviors of the user are used to obtain the recommendation results. Summary of the Invention
[0003] The present disclosure provides a resource acquisition method, device, equipment, and storage medium based on a generative model.
[0004] According to one aspect of the present disclosure, there is provided a resource acquisition method based on a generative model, including:
[0005] Obtaining a resource sequence within a target time range from multiple first resources of a first object;
[0006] Obtaining a prompt word corresponding to each target time range according to each resource sequence;
[0007] Inputting each prompt word into a generative model to obtain a target resource corresponding to the first object within each target time range as output.
[0008] According to another aspect of the present disclosure, there is provided a training method for a generative model, including:
[0009] Inputting a resource sequence in a training sample into a generative model to be trained to obtain an output resource;
[0010] Calculating the value of a loss function according to the output resource and positive and negative samples in the training sample;
[0011] Adjusting the parameters of the generative model to be trained according to the value of the loss function to obtain a trained generative model.
[0012] According to another aspect of the present disclosure, there is provided a resource acquisition device based on a generative model, including:
[0013] A resource sequence acquisition module, configured to obtain a resource sequence within a target time range from multiple first resources of a first object;
[0014] A prompt word acquisition module, configured to obtain a prompt word corresponding to each target time range according to each resource sequence;
[0015] An output module, configured to input each of the prompt words into a generative model to obtain the target resources corresponding to the first object for each of the target time ranges as output.
[0016] According to another aspect of the present disclosure, there is provided a training device for a generative model, including:
[0017] A resource acquisition module, configured to input a resource sequence in a training sample into a generative model to be trained to obtain an output resource;
[0018] A loss calculation module, configured to calculate the value of a loss function according to the output resource and positive and negative samples in the training sample;
[0019] An adjustment module, configured to adjust parameters of the generative model to be trained according to the value of the loss function to obtain a trained generative model.
[0020] According to another aspect of the present disclosure, there is provided an electronic device, including:
[0021] At least one processor; and
[0022] A memory communicatively connected to the at least one processor; wherein,
[0023] The memory stores instructions executable by the at least one processor, and when the instructions are executed by the at least one processor, the at least one processor is enabled to execute any method in the embodiments of the present disclosure.
[0024] According to another aspect of the present disclosure, there is provided a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause the computer to execute any method in the embodiments of the present disclosure.
[0025] According to another aspect of the present disclosure, there is provided a computer program product, including a computer program, and when the computer program is executed by a processor, it implements any method in the embodiments of the present disclosure.
[0026] According to the present disclosure, based on the resource sequences of the first object in different time ranges, the next target resources that the first object may need can be obtained, improving the matching degree between the target resources and the resources required by the first object, improving the accuracy of acquisition, and further improving the experience of the first object.
[0027] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it used to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. Description of the Drawings
[0028] The accompanying drawings are used to better understand the present solution and do not constitute a limitation to the present disclosure. Among them:
[0029] Figure 1 is a schematic flowchart of a resource acquisition method based on a generative model according to an embodiment of the present disclosure;
[0030] Figure 2 is a schematic flowchart of a resource acquisition method based on a generative model according to another embodiment of the present disclosure;
[0031] Figure 3 is a schematic flowchart of a resource acquisition method based on a generative model according to another embodiment of the present disclosure;
[0032] Figure 4 is a schematic flowchart of a resource acquisition method based on a generative model according to another embodiment of the present disclosure;
[0033] Figure 5 is a schematic flowchart of a resource acquisition method based on a generative model according to another embodiment of the present disclosure;
[0034] Figure 6 is a schematic flowchart of a resource acquisition method based on a generative model according to another embodiment of the present disclosure;
[0035] Figure 7 is a schematic flowchart of a training method for a generative model according to an embodiment of the present disclosure;
[0036] Figure 8 is a schematic flowchart of a training method for a generative model according to another embodiment of the present disclosure;
[0037] Figure 9 is a schematic structural diagram of a generative model according to an embodiment of the present disclosure;
[0038] Figure 10 is a schematic flowchart of a resource recommendation method based on a generative model according to an embodiment of the present disclosure;
[0039] Figure 11 is a schematic structural diagram of a recall path according to an embodiment of the present disclosure;
[0040] Figure 12 is a schematic structural diagram of a resource acquisition device based on a generative model according to an embodiment of the present disclosure;
[0041] Figure 13 is a schematic structural diagram of a resource acquisition device based on a generative model according to another embodiment of the present disclosure;
[0042] Figure 14Schematic structural diagram of a training device for a generative model according to an embodiment of the present disclosure;
[0043] Figure 15 Schematic structural diagram of a training device for a generative model according to another embodiment of the present disclosure;
[0044] Figure 16 Block diagram of an electronic device for implementing the embodiments of the present disclosure. Detailed implementation manners
[0045] The exemplary embodiments of the present disclosure will be described below with reference to the accompanying drawings. Various details of the embodiments of the present disclosure are included to facilitate understanding, and they should be considered merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope of the present disclosure. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted below.
[0046] Figure 1 Flowchart of a resource acquisition method 100 based on a generative model according to an embodiment of the present disclosure. The method may include:
[0047] S101. Obtain a resource sequence within a time range from multiple first resources of a first object;
[0048] S102. Obtain a prompt word corresponding to each target time range according to each resource sequence;
[0049] S103. Input each prompt word into the generative model to obtain a target resource corresponding to the first object within each target time range as output.
[0050] In the embodiments of the present disclosure, the first resource may be a resource obtained based on a first object. The resource may include, but is not limited to, images, videos, audios, articles, object dynamics, etc. For example, the first object may be a user, and the first resource may be a resource obtained based on the user's satisfaction behavior (or called interested behavior). For example, the user's satisfaction behavior may include: click, play, like, share, comment, etc., and the present disclosure does not limit this. The first resource may include some time characteristics, such as generation time, the occurrence time of the first object's satisfaction behavior with respect to the first resource, the collection time of the first resource, etc. According to the above occurrence time and / or collection time of the first resource, the time range where the first resource is located can be determined. The time range usually includes a start time and an end time. For example, 0 days - 15 days, 15 days to 45 days, and 45 days to 180 days, etc. According to different target time ranges, multiple resource sequences can be extracted from multiple first resources, and the resources in each resource sequence can be called second resources. For example, among multiple first resources, there are resource A, resource B, and resource C corresponding to the like behavior, resource D and resource E corresponding to the comment behavior, resource F and resource G corresponding to the play behavior, and resource H corresponding to the share behavior. Among them, the resources within 0 days - 15 days include resource A, resource D, and resource F, which can be represented as resource sequence 1, the resources within 15 days - 45 days include resource C, resource E, and resource G, which can be represented as resource sequence 2, and the resources within 15 days - 180 days include resource C, resource E, and resource G, which can be represented as resource sequence 3.
[0051] In the embodiments of the present disclosure, the division of the above target time range is only an example and not a limitation. The start time and / or end time of the target time range can be flexibly changed according to the requirements of the actual application scenario. After extracting a resource sequence from the first resources for a target time range, the resource sequence within the target time range can be added to the prompt of the generative model. Then, the prompt is input into the trained generative model, and the target resource for the target time range is obtained through the trained generative model. For example, inputting the prompt including the resource sequence that the user is interested in within 0 days - 15 days into the trained generative model, the target resources that the user may be interested in can be obtained. Inputting the prompt including the resource sequence that the user is interested in within 45 days - 180 days into the trained generative model, the target resources that the user may be interested in can be obtained.
[0052] In the embodiments of the present disclosure, during the training process of the generative model, the training samples used may include multiple resources of interest within a target time range. The thus-trained generative model can support obtaining resources that a user may be interested in subsequently based on various resources of interest to the user within a target time range. The generative model in the embodiments of the present disclosure may also be referred to as a generative recall model, a generative recommendation model, etc.
[0053] According to the embodiments of the present disclosure, based on the resource sequences of a first object within different time ranges, the next target resource that the first object may need can be obtained, improving the matching degree between the target resource and the resources required by the first object, improving the accuracy of acquisition, and further improving the experience of the first object.
[0054] Figure 2 FIG. 200 is a schematic flowchart of a resource acquisition method 200 based on a generative model according to another embodiment of the present disclosure. The method 200 can be used to implement step S102 in the resource acquisition method 100 based on a generative model. In one implementation, the method 200 includes: For each of the resource sequences, obtaining a prompt word corresponding to each of the target time ranges, further including:
[0055] S201. Sort the second resources in each of the resource sequences according to confidence terms;
[0056] S202. Obtain a first number of third resources from the sorted second resources in the order of confidence scores; wherein, the confidence score is obtained according to the confidence term;
[0057] S203. Obtain the prompt word based on the third resources.
[0058] In the embodiments of the present disclosure, one or more resource sequences can be extracted from multiple first resources. Each resource sequence may include one or more second resources. For the second resources in each resource sequence, they can be sorted according to one or more confidence terms.
[0059] In the embodiments of the present disclosure, the confidence score can represent the degree of association between the second resource and the target resource. In one example, the higher the confidence score, the higher the degree of association between the second resource and the target resource. In this case, a first number of third resources can be screened out from the sorted second resources in the order of decreasing confidence scores. In another example, the lower the confidence score, the higher the degree of association between the second resource and the target resource. In this case, a first number of third resources can be screened out from the sorted second resources in the order of increasing confidence scores.
[0060] In the embodiments of the present disclosure, a first quantity, such as 30 or 50, of resources can be selected from the sorted resource sequence as the resources ranked at the front. For example, the first 30 or 50 resources can be selected from the sorted resource sequence. The resources obtained after the selection can be referred to as the third resources.
[0061] In the embodiments of the present disclosure, a first quantity of the third resources within the filtered target time range can be added to the prompt corresponding to this time range. For example, after sorting the resource sequence that the user is interested in within 0 days to 15 days, the first 40 resources are selected and added to the prompt. Another example is that after sorting the resource sequence that the user is interested in within 45 days to 180 days, the first 50 resources are selected and added to the prompt. Then, the prompt is input into the trained generative model, and the target resources that the user may be interested in can be obtained.
[0062] In the embodiments of the present disclosure, the confidence score of a certain resource can be calculated based on one or more confidence items. For example, each confidence item of the resource can have a corresponding score and weight, and the confidence score of the resource can be obtained by weighted summation of the scores and weights of all confidence items.
[0063] According to the embodiments of the present disclosure, by sorting first and then constructing a prompt based on the sorting result, a prompt that better meets the needs of the first object can be obtained, thereby improving the accuracy of the result obtained by the generative model and enhancing the satisfaction of the first object.
[0064] In one implementation, the confidence item includes one or more of a confidence interest category, a confidence interest author, and a confidence interest behavior.
[0065] In the embodiments of the present disclosure, a confidence item may represent an item that an object is interested in or satisfied with. For example, confidence interest categories, confidence interest authors, and confidence interest behaviors, etc. Confidence interest categories may include key elements for constructing an object portrait. The confidence interest categories of an object can be obtained by collecting the object's historical behaviors. For example, if an object often browses technology articles and buys electronic products, then a high preference for the "technology" interest category will be marked in the object portrait. Confidence interest category tags can accurately depict the object's interest areas, including but not limited to multiple dimensions such as entertainment (e.g., movies, music), lifestyle (e.g., fitness, food), learning (e.g., languages, academic research), etc., providing a basis for subsequent personalized recommendations. In a recommendation system, the content created by confidence interest authors can be clustered. For example, a well-known author in the technology field often writes articles about artificial intelligence, and these articles will be classified under the specific technology topic of artificial intelligence. When an object is interested in this author, the system will recommend other relevant artificial intelligence articles by this author, as well as similar content by other authors under the same topic. Confidence interest behaviors can represent various behaviors including that the object is interested in or satisfied with certain resources, such as browsing web content, clicking on product links, play duration on a video platform, purchase behaviors on an e-commerce platform, likes and comments on a social platform, etc.
[0066] In the embodiments of the present disclosure, the resources in the resource sequence can be sorted first according to confidence interest behaviors and then according to confidence interest categories; it can also be sorted first according to confidence interest authors, then according to confidence interest behaviors, and finally according to confidence interest categories; it can also be sorted by calculating the total score according to a certain weight based on the scores corresponding to each confidence item. For example, in the resource sequence from 0 days to 15 days, there are resource A (martial arts) that has been liked, resource B (science fiction) that has been liked, resource C (science fiction) that has been commented on, resource D (martial arts) that has been commented on, and resource F (movie) that has been played. First, sorting according to confidence interest behaviors (play > comment > like) gives the resource sequence of resource F -> resource C -> resource D -> resource A -> resource B, and then sorting according to confidence interest categories (science fiction > martial arts) gives the resource sequence of resource F -> resource C -> resource D -> resource B -> resource A.
[0067] In the embodiments of the present disclosure, one or more of the confidence interest categories, confidence interest authors, and confidence interest behaviors may have corresponding weights and / or confidence levels. Based on these weights and / or confidence levels, the total confidence level of a certain resource can be calculated, and then the resources can be sorted according to the total confidence levels of multiple resources. An example of a method for calculating the total confidence level is as follows: The weight of the confidence interest category A1 is w1, and the confidence level is s1; the weight of the confidence interest category A2 is w2, and the confidence level is s2. The weight of the confidence interest author B1 is w3, and the confidence level is s3. The weight of the confidence interest behavior C1 is w4, and the confidence level is s4; the weight of the confidence interest behavior C2 is w5, and the confidence level is s5. If a certain resource meets the category A1, the author B1, and the behavior C2, then the total confidence level of this resource is: S1 = w1 × s1 + w3 × s3 + w5 × s5.
[0068] According to the embodiments of the present disclosure, resources in a resource sequence within different time ranges can be sorted and filtered according to various confidence items, which improves the matching degree between the target resource and the resources required by the first object, thereby improving the accuracy of the retained resources and further improving the experience of the first object.
[0069] Figure 3 FIG. 7 is a schematic flowchart of a resource acquisition method 300 based on a generative model according to another embodiment of the present disclosure. The method 300 can be used to implement the resource acquisition method 100 based on the generative model. In one implementation, the method 300 includes:
[0070] S301. Obtain the first resource from the initial resource set of the first object according to the abnormal behavior information of the first object; wherein, the resources in the initial resource set are obtained according to the behavior information of the first object.
[0071] In the embodiments of the present disclosure, resources that meet the behavior information, such as resources involved in the interested behavior, of an object within a certain time range can be collected and stored in the initial resource set. However, although some behaviors can indicate that the user is interested in a certain resource, the interest may not be strong. For example, quickly swiping past a certain video, although the video is opened but the playing time is extremely short, etc. These behaviors can be regarded as abnormal behaviors. After deleting these resources from the initial resource set, the remaining resources can be called the first resources.
[0072] According to the embodiments of the present disclosure, after deleting the resources corresponding to the abnormal behaviors, the retained first resources are resources that can reflect the important needs of the object or the resources that the object is more interested in. By performing subsequent steps such as screening, sorting, and constructing prompt words based on these resources, the matching degree between the target resource and the resources required by the first object is improved, the accuracy of acquisition is improved, and the experience of the first object is further improved.
[0073] In one implementation, the number of the target time ranges is multiple.
[0074] In the embodiments of the present disclosure, multiple time ranges can be delimited according to requirements. For example, resources can be divided into short-term resources and long-term resources according to time. Resources can also be divided into short-term resources, medium-term resources, and long-term resources according to time. Resources can further be divided into first time range resources, second time range resources, third time range resources, etc. according to time.
[0075] Figure 4 FIG. 400 is a flowchart of a resource acquisition method 400 based on a generative model according to another embodiment of the present disclosure. The method 400 can be used to implement step S101 in the resource acquisition method 100 based on a generative model. In one implementation, the method 400 includes: obtaining a resource sequence within one or more target time ranges from multiple first resources of a first object, further including one or more of the following steps:
[0076] S401: Obtaining a first resource sequence according to a second resource whose time feature among the multiple first resources is within a first time range;
[0077] S402: Obtaining a second resource sequence according to a second resource whose time feature among the multiple first resources is within a second time range; wherein, the second time range is before the first time range;
[0078] S403: Obtaining a third resource sequence according to a second resource whose time feature among the multiple first resources is within a third time range; wherein, the third time range is before the second time range.
[0079] In the embodiments of the present disclosure, the first time range can be regarded as a short-term time range, the second time range can be regarded as a medium-term time range, and the third time range can be regarded as a long-term time range. Here, short-term, medium-term, and long-term can be understood as the time difference from the current moment. The one with the shortest time difference is short-term, the one with the longest time difference is long-term, and the one with the intermediate time difference is medium-term. The division of these three time ranges is only an example rather than a limitation. In actual application scenarios, they can also be divided according to other types, such as four, five, or more time ranges. Corresponding resource sequences can be respectively extracted from the multiple first resources of the first object according to different time ranges.
[0080] For example, multiple first resources of a first object may include an overall satisfaction sequence. The first time range may be 0 - 15 days, the second time range may be 15 - 45 days, and the third time range may be 45 - 180 days. For the overall satisfaction sequence, a first satisfaction sequence can be extracted according to the first time range; a second satisfaction sequence can be extracted according to the second time range; and a third satisfaction sequence can be extracted according to the third time range. The first satisfaction sequence can be called a short - term satisfaction sequence, the second satisfaction sequence can be called a medium - term satisfaction sequence, and the third satisfaction sequence can be called a long - term satisfaction sequence. Specifically, for example, resource A with a timestamp of 3 days, resource D with a timestamp of 0 days, and resource F with a timestamp of 9 days for the satisfaction behavior are in the short - term satisfaction sequence within 0 - 15 days; resource B with a timestamp of 20 days and resource C with a timestamp of 17 days for the satisfaction behavior are in the medium - term satisfaction sequence within 15 - 45 days; and resource E, resource G, and resource H with timestamps greater than 45 days for the satisfaction behavior are in the long - term satisfaction sequence within 45 - 180 days.
[0081] According to an embodiment of the present disclosure, satisfaction sequences for different time ranges can be obtained from multiple first resources of a first object according to different time ranges, providing a basis for mining the long - term, medium - term, and short - term interests of the object.
[0082] Figure 5 It is a schematic flowchart of a resource acquisition method 500 based on a generative model according to another embodiment of the present disclosure. The method 500 can be used to implement step S103 in the resource acquisition method 100 based on a generative model. In one implementation, the method 500 includes: inputting the prompt words corresponding to each target time range into the generative model to calculate the target resources within each target time range for the first object, which further includes one or more of the following steps:
[0083] S501: Input the prompt words corresponding to the first time range into the generative model to calculate the first target resources within the first time range for the first object;
[0084] S502: Input the prompt words corresponding to the second time range into the generative model to calculate the second target resources within the second time range for the first object;
[0085] S503: Input the prompt words corresponding to the third time range into the generative model to calculate the third target resources within the third time range for the first object.
[0086] In the embodiments of the present disclosure, the prompt words corresponding to the target time range may include all or part of the target resources within the target time range. The target time range includes the first time range, the second time range, and the third time range in the above embodiments. The resources within the first time range include the first resource sequence, the resources within the second time range include the second resource sequence, and the resources within the third time range include the third resource sequence.
[0087] The prompt words corresponding to the first time range can be constructed based on the first resource sequence. For example, all of the first resource sequence can be added to the prompt words corresponding to the first time range. Alternatively, the first resource sequence can be sorted, and the first number of resources ranked at the front can be added to the prompt words corresponding to the first time range.
[0088] The prompt words corresponding to the second time range can be constructed based on the second resource sequence. For example, all of the second resource sequence can be added to the prompt words corresponding to the second time range. Alternatively, the second resource sequence can be sorted, and the first number of resources ranked at the front can be added to the prompt words corresponding to the second time range.
[0089] The prompt words corresponding to the third time range can be constructed based on the third resource sequence. For example, all of the third resource sequence can be added to the prompt words corresponding to the third time range. Alternatively, the third resource sequence can be sorted, and the first number of resources ranked at the front can be added to the prompt words corresponding to the third time range.
[0090] In some examples, taking the first resource sequence as the first satisfaction sequence, the second resource sequence as the second satisfaction sequence, and the third resource sequence as the third satisfaction sequence as an example, the resources in these resource sequences can be sorted according to the confidence terms. Then, the first number of satisfactory resources in the sorted first satisfaction sequence, second satisfaction sequence, and third satisfaction sequence are respectively selected. The first number of satisfactory resources in the first satisfaction sequence are added to the prompt words to obtain the first prompt words, the first number of satisfactory resources in the second satisfaction sequence are added to the prompt words to obtain the second prompt words, and the first number of satisfactory resources in the third satisfaction sequence are added to the prompt words to obtain the third prompt words. In this case, the prompt words corresponding to the first time range can be the first prompt words, the prompt words corresponding to the second time range can be the second prompt words, and the prompt words corresponding to the third time range can be the third prompt words.
[0091] In the embodiments of the present disclosure, if the resource sequence within a certain time range does not exist, then the prompt words corresponding to that time range will not be generated either, and only the prompt words corresponding to other time ranges can be processed.
[0092] In the embodiments of the present disclosure, the first prompt can be embedded to obtain a first representation corresponding to the first prompt. The first representation can be input into a generative model for calculation to obtain the next one or more interest representations of the first representation. By performing transformation and decoding processing on the next one or more interest representations of the first representation, one or more first target resources can be obtained. The second prompt can be embedded to obtain a second representation corresponding to the second prompt. The second representation can be input into a generative model for calculation to obtain the next one or more interest representations of the second representation. By performing transformation and decoding on the next one or more interest representations of the second representation, one or more second target resources can be obtained. The third prompt can be embedded to obtain a third representation corresponding to the third prompt. The third representation can be input into a generative model for calculation to obtain the next one or more interest representations of the third representation. By performing transformation and decoding processing on the next one or more interest representations of the third representation, one or more third target resources can be obtained.
[0093] According to the embodiments of the present disclosure, different target resources can be obtained based on prompts corresponding to different time ranges through a generative model, and the obtained results can cover a wider time range and are more likely to meet the needs of the object. For example, the generative model can generate target resources corresponding to the long-term, medium-term, and short-term interests of the object respectively according to prompts with interest characteristics, improving the matching degree between the target resources and the resources required by the first object, enhancing the accuracy of acquisition, and further enhancing the experience of the first object.
[0094] Figure 6 FIG. 600 is a schematic flowchart of a resource acquisition method 600 based on a generative model according to another embodiment of the present disclosure. The method 600 can be used to implement the resource acquisition method 100 based on a generative model. In one implementation, the method 600 further includes:
[0095] S601. Determine the recommended resources for the first object according to one or more of the first target resource, the second target resource, and the third target resource.
[0096] In the embodiments of the present disclosure, the resource finally recommended to the first object, i.e., the recommended resource, can be selected from one or more of the first target resource, the second target resource, and the third target resource. The confidence or score of the target resource can be calculated based on one or more confidence items, and one or more of the first target resource, the second target resource, and the third target resource can be sorted. One or more resources ranked higher are selected from the sorting result as the recommended resource. Such a recommended resource can be understood as a resource that the object is more interested in. For example, when sorting the first target resources A and B, the second target resources C and D, and the third target resource E, and the sorting result is ACDBE, A can be selected as the recommended resource, or A and B can be selected as the recommended resource. In addition, one or more resources can also be randomly selected from one or more of the first target resource, the second target resource, and the third target resource as the recommended resource. Further selecting the recommended resource from the various calculated target resources improves the matching degree between the target resource and the resource required by the first object, improves the acquisition accuracy, and further improves the experience of the first object.
[0097] Figure 7 FIG. 4 is a schematic flowchart of a training method 700 of a generative model according to an embodiment of the present disclosure. In one embodiment, the method may include:
[0098] S701: Input the resource sequence in the training sample into the generative model to be trained, and obtain an output resource;
[0099] S702: Calculate the value of the loss function according to the output resource and the positive and negative samples in the training sample;
[0100] S703: Adjust the parameters of the generative model to be trained according to the value of the loss function to obtain a trained generative model.
[0101] In the embodiments of the present disclosure, the training sample may include a resource sequence, positive samples, and negative samples. The resource sequence of the training sample can be collected based on the object's satisfactory behavior (or called interested behavior). The time range of the resource sequence can cover long-term, medium-term, and short-term, and specific explanations and examples can refer to the relevant explanations in the above embodiments. For example, collect the resources involved in behaviors such as liking, commenting, forwarding, and playing within a period of time (covering long-term, medium-term, and short-term) to obtain a resource sequence. The generative model to be trained can calculate and output one or more resources, i.e., output resources, based on the input resource sequence.
[0102] In the embodiments of the present disclosure, the positive samples may include the resources for which the object has actually shown an interested behavior; the negative samples may include the resources for which the object has actually shown an uninterested behavior. The value of the loss function can be calculated according to the output resource, positive samples, and negative samples of the generative model.
[0103] In the embodiments of the present disclosure, a loss function can be constructed using output resources, positive samples, and negative samples. After inputting the training samples into the generative model to obtain the output resources, the output resources, positive samples, and negative samples in the training samples can be substituted into the loss function to calculate the value of the loss function. Then, it is determined whether the value of the loss function reaches the training expectation. If the training expectation has not been reached, the parameters in the generative model to be trained, such as the parameters of the embedding layer or the parameters of the transformation decoder layer, are updated by backpropagation. Further, the training samples (which can be new or original) can be reused to pass through the generative model to be trained to obtain new output resources. Then, the value of the loss function is calculated based on the new output resources, new positive samples, and new negative samples. The above steps can be repeatedly executed until the value of the loss function reaches the training expectation, and the trained generative model is obtained.
[0104] According to the embodiments of the present disclosure, through the resource sequence, positive samples, and negative samples in the training samples, the generative model can be trained, and the trained generative model can generate resources that more meet the needs of the object.
[0105] In one implementation, the resource sequence in the training sample includes one or more of the following:
[0106] The resource sequence within the first time range;
[0107] The resource sequence within the second time range; wherein the second time range is before the first time range;
[0108] The resource sequence within the third time range; wherein the third time range is before the second time range.
[0109] In the embodiments of the present disclosure, the time range of the resource sequence can be pre-annotated. The first time range can be regarded as short-term, the second time range can be regarded as medium-term, and the third time range can be regarded as long-term. For example, the first time range can be 0-15 days, the second time range can be 15-45 days, and the third time range can be 45-180 days. According to the embodiments of the present disclosure, resource sequences of different time ranges can be obtained, so that the generative model can learn the requirements of different time ranges, such as long-term, medium-term, and short-term interest characteristics.
[0110] Figure 8 It is a schematic flowchart of a training method 800 of a generative model according to another embodiment of the present disclosure. The method 800 can be used to implement the step S701 in the training method 700 of the generative model. In one implementation, the method 800 includes: Inputting the resource sequence in the training sample into the generative model to be trained to obtain the output resources, which further includes:
[0111] S801, input the resource sequence into the generative model to be trained, process the resource sequence through the embedding layer of the generative model to be trained, and obtain a first embedding vector corresponding to the resource sequence;
[0112] S802, processing the first embedding vector through a conversion decoder layer of the generative model to be trained to obtain a second embedding vector;
[0113] S803: Obtain the output resource based on the second embedding vector.
[0114] In an embodiment of the present disclosure, a resource sequence may be input into a generative model for processing; the resource sequence may include resources within multiple time ranges. In the embedding layer of the generative model to be trained, the input resource sequence may be converted into a representation corresponding to the resource sequence, such as a first embedding vector. Then, the conversion decoder layer of the generative model to be trained may be calculated based on the representation of the resource sequence to obtain a representation of the output resource, such as a second embedding vector.
[0115] In the disclosed embodiment, a generative model is a model that can learn data such as resource distribution and generate new samples. The generative model not only focuses on the category labels of the data, but also captures the overall distribution of the data. For example, in a recall scenario, the model can embed the input resource sequence to obtain a first embedding vector. These first embedding vectors contain the key semantic information of the resource sequence and can be reconstructed by the decoder.
[0116] In the embodiment of the present disclosure, during the recall process, the similarity (such as cosine similarity, etc.) between the second embedding vector and the embedding vector in the resource library is compared to determine whether the resource in the resource library should be recalled. This method of generating a new representation can mine deeper semantic associations of resources and improve the accuracy and efficiency of recall.
[0117] In the disclosed embodiments, the generative recall model may adopt a neural network-based architecture. For example, an embedding layer-decoder structure may be adopted, where the encoder maps the input prompt to a low-dimensional latent space representation. For example, in an encoder based on a transformer architecture, the sequence information of the input prompt is processed through an embedding layer to convert the prompt into an encoded representation. The decoder may then reconstruct the sequence information of the prompt from this encoded representation or generate an encoded representation of other resources related to the input. In a recall scenario, the decoder may be used to generate an encoded representation of the next resource of the query for better matching.
[0118] According to an embodiment of the present disclosure, the input prompt can be processed by the embedding layer and the conversion decoder layer of the generative model to generate an output resource, and then the generative model can be trained. The trained generative model can obtain a resource that better meets the needs of the first object.
[0119] In one implementation, as Figure 8 shown, the method 800 can be used to implement step S702 in the training method 700 of the generative model. The method 800 includes: calculating the value of the loss function according to the output resource and the positive and negative samples in the training sample, further including:
[0120] S804. Calculate the value of the loss function according to the output resource, one positive sample, and multiple negative samples.
[0121] In an embodiment of the present disclosure, the value of the loss function can be calculated based on the output resource, one positive sample, and multiple negative samples. An optional calculation method is as follows:
[0122]
[0123] where L InfoNCE represents the loss function, z p represents the embedding vector of the output resource obtained by the model, z j represents the embedding vector of the positive sample, z i represents the embedding vector of the negative sample, τ is the temperature coefficient used to control the smoothness of the result distribution, the labels of the samples are divided into positive and negative samples, there is only one positive sample each time, and there are multiple negative samples. The meaning of this loss function is to select the only positive sample from the mixed set of positive and negative samples to complete the training of the model.
[0124] According to an embodiment of the present disclosure, the generative model can be trained using the loss value calculated by the loss function constructed from the output resource, positive sample, and negative sample of the generative model, so as to improve the accuracy of the result obtained by the generative model.
[0125] In one implementation, as Figure 8 shown, the method 800 can also be used to implement step S703 in the training method 700 of the generative model. The method 800 includes: adjusting the parameters of the generative model to be trained according to the value of the loss function to obtain the trained generative model, further including:
[0126] S805. Perform backpropagation gradient adjustment on the parameters according to the value of the loss function, and obtain the trained generative model when the value of the loss function reaches the set value.
[0127] In the embodiments of the present disclosure, an expected value of a loss function can be preset. In the case where the value of the loss function does not reach the set value, the method of reverse gradient can be used to update the parameters of the generative model. Then, the resource sequence in the training sample is input into the generative model again to obtain an output resource, and the loss function is recalculated. The above training process can be repeatedly executed until the value of the loss function reaches the expected value, and the trained generative model is obtained. According to the embodiments of the present disclosure, the parameters of the generative model to be trained are updated by reverse gradient according to the value of the loss function, and the trained generative model can generate target resources that meet the needs of the object, such as long-term, medium-term, and short-term interests.
[0128] In order to capture the long-term and short-term interests of users, on the one hand, long-term confidence interest points of users can be mined during the recall stage, and corresponding resource recall channels can be constructed; on the other hand, user interest replay can be strengthened during the ranking and fusion stage. This way is likely to result in insufficient personalization of the recommendation results and cannot improve the push results according to the long-term behavior changes of users. In addition, the online service stage does not pay attention to depicting the long-term interests of users, exacerbating the lack of long-term interests in the recommendation results, and ultimately may cause a decline in user activity or even user loss.
[0129] The generative recommendation large model is constructed with a large amount of historical behavior data in the embodiments of the present disclosure. Based on the short-term, medium-term, and long-term interactions and satisfactory playback sequences of users, the model prompt (Prompt) is optimized, and relevant resources that users may like are generated end-to-end, improving the model's ability to capture users' long-term interests. The embodiments of the present disclosure provide a recommendation system architecture based on a generative model to solve the problem of interest forgetting in the current recommendation system. Through deep learning technology, especially the Transformer, a generative recall model is constructed, and the Prompt of the model is optimized during the online service stage, comprehensively analyzing the short-term and long-term interest dynamics of users. Through Prompt optimization, the system can capture both the instantaneous interest changes (short-term interests) and persistent preferences (long-term interests) of users, generating more personalized and diverse recommendation content. The generative model considers the past behavior of users to obtain new fields and new content that users may be interested in, thereby improving the recommendation accuracy and significantly improving the user experience at the same time.
[0130] The generative medium- and long-term interest modeling in the embodiments of the present disclosure can include: an offline training part and an online service part. The following will be introduced separately.
[0131] 1. Offline training
[0132] Figure 9It is a schematic structural diagram of a generative model according to an embodiment of the present disclosure. The model as a whole consists of an input embedding layer and a Transformer Decoder, and uses an autoregressive method to obtain the next content of interest to the user, belonging to a large generative recommendation model. The input of the model is the user's satisfactory sequence of resources (items). After passing through the Embedding layer and the Transformer Decoder layer, the next satisfactory resource of the user is output. The obtained result is compared with the positive and negative samples to calculate the Information Noise Contrastive Estimation Loss (InfoNCE Loss), and the backpropagation gradient is obtained to update the model parameters.
[0133] Using the satisfactory sequence of the user within a period of time, such as 0 - 180 days, as the input data to train the model can enable the model to have the ability to capture the long - and medium - term interests of the user. The time range of the satisfactory sequence can cover the long - term, medium - term, and short - term. For example, 0 to 15 days is the short - term, 15 days to 45 days is the medium - term, and 45 days to 180 days is the long - term. The satisfactory resources can be collected according to the user's satisfactory behavior in each long - term, medium - term, and short - term. For example, the satisfactory resources collected according to the user's satisfactory behavior from 0 to 15 days include item1, item2... The satisfactory resources collected according to the user's satisfactory behavior from 15 days to 45 days include item1 + n, item2 + n... The satisfactory resources collected according to the user's satisfactory behavior from 45 days to 180 days include item1 + m, item2 + m... These satisfactory resources can form a satisfactory sequence and be used as part of the training samples of the generative model. The training samples of the generative model can also include positive samples and negative samples. The loss function of the generative model can be constructed based on the satisfactory resources, positive samples, and negative samples obtained by the generative model.
[0134] For example, a training sample includes a satisfactory sequence within 0 - 180 days, a positive sample, and several negative samples. Inputting the satisfactory sequence into the generative model can obtain the output resources. Then, substituting the output resources, a positive sample, and multiple negative samples into the loss function, the value of the loss function can be calculated. An example of the calculation formula of a loss function is as follows:
[0135]
[0136] where z p represents the embedding vector of the satisfactory resources obtained by the model, z j represents the embedding vector of the positive sample, z iThe embedding vector represents the negative sample, and τ is the temperature coefficient, which is used to control the smoothness of the result distribution. The labels of the samples are divided into positive samples and negative samples. Each time, it can include one positive sample and several negative samples. In this way, through this loss function, the only positive sample can be selected from the set mixed with positive and negative samples, thereby completing the training of the model.
[0137] 2. Online service
[0138] Figure 10 It is a schematic flowchart of a resource recommendation method 1000 based on a generative model according to an embodiment of the present disclosure, as Figure 10 shown, including:
[0139] S1001. Construct a user satisfaction sequence. Collect the historical interaction behavior data of users, including but not limited to: clicks, plays, likes, shares, comments, etc.
[0140] S1002. Divide short, medium, and long-term interests. According to the timestamp, the historical behaviors of users are divided into three categories: short-term interests, medium-term interests, and long-term interests. Short-term interests: user behaviors within 0-15 days, capturing the user's recent interest dynamics; Medium-term interests: user behaviors within 15-45 days, reflecting the user's continuous interests in the medium term; Long-term interests: user behaviors within 45-180 days, showing the user's long-term interest tendency.
[0141] S1003. Filter abnormal data such as fast swipes to ensure the reliability of the Prompt.
[0142] S1004. Introduce confidence interest categories, confidence interest authors, confidence interest behaviors, etc., and adjust the Prompt word order. For each type of satisfaction sequence in different periods (i.e., different time ranges), sort them according to the degree of user interest. If a certain resource hits the user's confidence interest category, confidence author, confidence interest behavior, etc., it will have a higher weight. After sorting, each type of satisfaction sequence can only retain the first n, for example, 50 resources.
[0143] S1005. Construct 3 recall paths.
[0144] Figure 11 It is a schematic structural diagram of a recall path according to an embodiment of the present disclosure. The short, medium, and long-term satisfaction sequences of users are respectively used as Prompts, and after being estimated by a generative recommendation large model, short, medium, and long-term user interest representations are respectively generated. For example, as Figure 11As shown, by inputting the satisfaction sequence of the user in the past 0 - 15 days into the generative recall model, resources that the user is interested in recently (or in the short term) can be generated; by inputting the satisfaction sequence of the user in the past 15 - 45 days into the generative recall model, resources that the user is interested in in the medium and long term can be generated; by inputting the satisfaction sequence of the user in the past 45 - 180 days into the generative recall model, resources that the user is interested in in the long term can be generated.
[0145] S1006. Construct an index service based on the multi-modal representation of resources, retrieve the next (Next) satisfactory resource according to the user representation, and recall the content that the user is interested in in the short, medium, and long terms.
[0146] S1007. Integrate the recall results of the three online prediction channels and pass them to the sorting layer.
[0147] For the specific functions and examples of each module and sub-module of the device in the embodiments of the present disclosure, reference may be made to the relevant descriptions of the corresponding steps in the above method embodiments, which will not be elaborated here.
[0148] In the technical solution of the present disclosure, the acquisition, storage, and application of the user's personal information involved all comply with the provisions of relevant laws and regulations and do not violate public order and good customs.
[0149] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0150] Figure 12 It is a schematic structural diagram of a resource acquisition device 1200 based on a generative model according to an embodiment of the present disclosure. In one implementation, the device includes:
[0151] A resource sequence acquisition module 1201, configured to acquire a resource sequence within a target time range from a plurality of first resources of a first object;
[0152] A prompt word acquisition module 1202, configured to acquire a prompt word corresponding to each of the target time ranges according to the resource sequence;
[0153] An output module 1203, configured to input each of the prompt words into a generative model to obtain a target resource corresponding to the first object for each of the target time ranges as output.
[0154] Figure 13 It is a schematic structural diagram of a resource acquisition device 1300 based on a generative model according to another embodiment of the present disclosure. The device 1300 may include: a resource sequence acquisition module 1301, a prompt word acquisition module 1302, and an output module 1303. The functions of the above modules may refer to the functions of each module of the resource acquisition device 1200 based on a generative model in the above embodiments. In one implementation, the prompt word acquisition module 1302 includes:
[0155] A sorting sub-module 13021, configured to sort the second resources in each of the resource sequences according to confidence items;
[0156] A first acquisition sub-module 13022, configured to acquire a first quantity of third resources from the sorted second resources in the order of confidence scores;
[0157] A second acquisition sub-module 13023, configured to acquire the prompt word based on the third resources.
[0158] In one implementation manner, the confidence items include one or more of a confidence interest category, a confidence interest author, and a confidence interest behavior.
[0159] In one implementation manner, as Figure 13 shown, the apparatus 1300 further includes:
[0160] A resource acquisition module 1304, configured to acquire the first resources from the initial resource set of the first object according to the abnormal behavior information of the first object; wherein, the resources in the initial resource set are acquired according to the behavior information of the first object.
[0161] In one implementation manner, the number of the target time ranges is multiple.
[0162] In one implementation manner, the resource sequence acquisition module 1301 is further configured to perform one or more of the following steps:
[0163] Obtain a first resource sequence according to the second resources whose time characteristics among the multiple first resources are in a first time range;
[0164] Obtain a second resource sequence according to the second resources whose time characteristics among the multiple first resources are in a second time range; wherein, the second time range is before the first time range;
[0165] Obtain a third resource sequence according to the second resources whose time characteristics among the multiple first resources are in a third time range; wherein, the third time range is before the second time range.
[0166] In one implementation manner, the output module 1303 is further configured to perform one or more of the following steps:
[0167] Input the prompt word corresponding to the first time range into a generative model to calculate a first target resource within the first time range for the first object;
[0168] Input the prompt word corresponding to the second time range into a generative model to calculate a second target resource within the second time range for the first object;
[0169] Input the prompt corresponding to the third time range into the generative model to calculate the third target resource for the first object within the third time range.
[0170] In one implementation, as Figure 13 shown, the apparatus 1300 further includes:
[0171] A recommended resource determination module 1305, configured to determine the recommended resources for the first object according to one or more of the first target resource, the second target resource, and the third target resource.
[0172] Figure 14 FIG. 13 is a schematic structural diagram of a training apparatus 1400 for a generative model according to an embodiment of the present disclosure. In one implementation, the apparatus 1400 includes:
[0173] A resource acquisition module 1401, configured to input the resource sequence in the training sample into the generative model to be trained to obtain an output resource;
[0174] A loss calculation module 1402, configured to calculate the value of the loss function according to the output resource and the positive and negative samples in the training sample;
[0175] An adjustment module 1403, configured to adjust the parameters of the generative model to be trained according to the value of the loss function to obtain a trained generative model.
[0176] In one implementation, the resource sequence in the training sample includes one or more of the following:
[0177] The resource sequence within the first time range;
[0178] The resource sequence within the second time range; wherein the second time range is before the first time range;
[0179] The resource sequence within the third time range; wherein the third time range is before the second time range.
[0180] Figure 15 FIG. 14 is a schematic structural diagram of a training apparatus 1500 for a generative model according to another embodiment of the present disclosure. The apparatus 1500 may include: a resource acquisition module 1501, a loss calculation module 1502, and an adjustment module 1503. The functions of the above modules may refer to the functions of the respective modules of the training apparatus 1500 for the generative model in the above embodiment. In one implementation, the resource acquisition module 1501 includes:
[0181] An input sub-module 15011 is configured to input a resource sequence into the generative model to be trained, and process the resource sequence through an embedding layer of the generative model to be trained, so as to obtain a first embedding vector corresponding to the resource sequence;
[0182] A decoding sub-module 15012 is configured to process the first embedding vector through a conversion decoder layer of the generative model to be trained to obtain a second embedding vector;
[0183] An output sub-module 15013 is configured to obtain the output resource based on the second embedding vector.
[0184] In one implementation manner, the loss calculation module 1502 is further configured to calculate a value of the loss function according to the output resource, one positive sample, and multiple negative samples.
[0185] In one implementation manner, the adjustment module 1503 is further configured to perform back-gradient adjustment on the parameter according to the value of the loss function, and obtain the trained generative model when the value of the loss function reaches a set value.
[0186] Figure 16 FIG. shows a schematic block diagram of an exemplary electronic device 1600 that can be used to implement embodiments of the present disclosure. The electronic device is intended to represent various forms of digital computers, such as, a laptop computer, a desktop computer, a workbench, a personal digital assistant, a server, a blade server, a mainframe computer, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as, a personal digital assistant, a cellular phone, a smart phone, a wearable device, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0187] As Figure 16 shown, the device 1600 includes a computing unit 1601, which can execute various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 1602 or a computer program loaded from a storage unit 1608 into a random access memory (RAM) 1603. In the RAM 1603, various programs and data required for the operation of the device 1600 can also be stored. The computing unit 1601, the ROM 1602, and the RAM 1603 are connected to each other through a bus 1604. An input / output (I / O) interface 1605 is also connected to the bus 1604.
[0188] Multiple components in device 1600 are connected to I / O interface 1605, including: an input unit 1606, such as a keyboard, a mouse, etc.; an output unit 1607, such as various types of displays, speakers, etc.; a storage unit 1608, such as a disk, an optical disc, etc.; and a communication unit 1609, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 1609 allows device 1600 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.
[0189] The computing unit 1601 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 1601 include but are not limited to a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 1601 executes the various methods and processes described above, such as the resource acquisition method based on a generative model and / or the training method of a generative model. For example, in some embodiments, the resource acquisition method based on a generative model and / or the training method of a generative model can be implemented as a computer software program, which is tangibly included in a machine-readable medium, such as the storage unit 1608. In some embodiments, part or all of the computer program can be loaded and / or installed onto device 1600 via the ROM 1602 and / or the communication unit 1609. When the computer program is loaded into the RAM 1603 and executed by the computing unit 1601, one or more steps of the resource acquisition method based on a generative model and / or the training method of a generative model described above can be executed. Alternatively, in other embodiments, the computing unit 1601 can be configured to execute the resource acquisition method based on a generative model and / or the training method of a generative model in any other suitable manner (e.g., by means of firmware).
[0190] The various embodiments of the systems and techniques described above in this document can be implemented in digital electronic circuitry, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on a chip (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include: being implemented in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be a special-purpose or general-purpose programmable processor that receives data and instructions from a storage system, at least one input device, and at least one output device, and transmits the data and instructions to the storage system, the at least one input device, and the at least one output device.
[0191] The program code for implementing the methods of the present disclosure can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when the program codes are executed by the processor or controller, the functions / operations specified in the flowchart and / or block diagram are implemented. The program code can be executed entirely on the machine, partially on the machine, as a stand-alone software package partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0192] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in connection with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0193] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, speech input, or tactile input).
[0194] The systems and techniques described herein can be implemented in a computing system including backend components (e.g., as a data server), or a computing system including middleware components (e.g., an application server), or a computing system including frontend components (e.g., a user computer having a graphical user interface or a web browser through which the user can interact with an implementation of the systems and techniques described herein), or a computing system including any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local area network (LAN), wide area network (WAN), and the Internet.
[0195] A computer system can include a client and a server. The client and the server are generally remote from each other and typically interact through a communication network. The client - server relationship is created by computer programs running on the respective computers and having a client - server relationship with each other. The server can be a cloud server, or a server of a distributed system, or a server incorporating a blockchain.
[0196] It should be understood that the various forms of the processes shown above can be used, with steps reordered, added, or deleted. For example, the steps recited in this disclosure can be executed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and no limitation is imposed herein.
[0197] The above - described specific embodiments do not constitute a limitation on the protection scope of the present disclosure. Those skilled in the art should understand that various modifications, combinations, sub - combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the principles of the present disclosure shall be included within the protection scope of the present disclosure.
Claims
1. A resource acquisition method based on a generative model, comprising: Acquire a resource sequence within a target time range from a plurality of first resources of a first object; According to each of the resource sequences, obtaining a prompt word corresponding to each of the target time ranges; Each of the prompt words is input into a generative model to obtain an output of the first object corresponding to each target resource within the target time range.
2. The method according to claim 1, wherein: The acquiring, according to each of the resource sequences, a prompt word corresponding to each of the target time ranges includes: Sorting the second resources in each of the resource sequences according to the confidence items; Acquire a first number of third resources from the sorted second resources in order of confidence scores, wherein the confidence scores are obtained based on the confidence items; Based on the third resource, the prompt word is obtained.
3. The method according to claim 2, wherein: The trust item includes one or more of a trusted interest category, a trusted interest author, and a trusted interest behavior.
4. The method according to any one of claims 1 to 3, further comprising: According to the abnormal behavior information of the first object, the first resource is obtained from an initial resource set of the first object; wherein the resources in the initial resource set are obtained according to the behavior information of the first object.
5. The method according to any one of claims 1 to 4, wherein: There are multiple target time ranges.
6. A method for training a generative model, comprising: Input the resource sequence in the training sample into the generative model to be trained to obtain the output resource; Calculating a value of a loss function according to the output resource and the positive samples and negative samples in the training samples; The parameters of the generative model to be trained are adjusted according to the value of the loss function to obtain a trained generative model.
7. The method according to claim 6, wherein: The step of inputting the resource sequence in the training sample into the generative model to be trained to obtain the output resource includes: Inputting the resource sequence into the generative model to be trained, processing the resource sequence through the embedding layer of the generative model to be trained, and obtaining a first embedding vector corresponding to the resource sequence; Processing the first embedding vector through a conversion decoder layer of the generative model to be trained to obtain a second embedding vector; The output resource is obtained based on the second embedding vector.
8. The method according to claim 6 or 7, wherein: The calculating the value of the loss function according to the output resource and the positive samples and the negative samples in the training samples includes: The value of the loss function is calculated according to the output resource, one of the positive samples and a plurality of the negative samples.
9. The method according to any one of claims 6 to 8, wherein: The step of adjusting the parameters of the generative model to be trained according to the value of the loss function to obtain the trained generative model includes: The parameters are reversely adjusted in gradient according to the value of the loss function, and when the value of the loss function reaches a set value, the trained generative model is obtained.
10. A resource acquisition device based on a generative model, comprising: A resource sequence acquisition module, used to acquire a resource sequence within a target time range from a plurality of first resources of a first object; A prompt word acquisition module, used for acquiring a prompt word corresponding to each target time range according to each resource sequence; The output module is used to input each of the prompt words into a generative model to obtain the output of the first object corresponding to each target resource within the target time range.
11. The device according to claim 10, wherein: The prompt word acquisition module includes: A sorting submodule, used for sorting the second resources in each of the resource sequences according to the confidence items; A first acquisition submodule, configured to acquire a first number of third resources from the sorted second resources in order of confidence scores; wherein the confidence scores are obtained based on the confidence items; The second acquisition submodule is used to acquire the prompt word based on the third resource.
12. The device according to claim 11, wherein The trust item includes one or more of a trusted interest category, a trusted interest author, and a trusted interest behavior.
13. The device according to any one of claims 10 to 12, further comprising: A resource acquisition module is used to acquire the first resource from an initial resource set of the first object according to abnormal behavior information of the first object; wherein the resources in the initial resource set are acquired according to the behavior information of the first object.
14. The device according to any one of claims 10 to 13, wherein: There are multiple target time ranges.
15. A training device for a generative model, comprising: The resource acquisition module is used to input the resource sequence in the training sample into the generative model to be trained to obtain the output resource; A loss calculation module, used to calculate the value of the loss function according to the output resource and the positive samples and negative samples in the training samples; An adjustment module is used to adjust the parameters of the generative model to be trained according to the value of the loss function to obtain a trained generative model.
16. The device according to claim 15, wherein: The resource acquisition module includes: An input submodule, used for inputting a resource sequence into the generative model to be trained, processing the resource sequence through an embedding layer of the generative model to be trained, and obtaining a first embedding vector corresponding to the resource sequence; A decoding submodule, configured to process the first embedding vector through a conversion decoder layer of the generative model to be trained to obtain a second embedding vector; An output submodule is used to obtain the output resource based on the second embedding vector.
17. The device according to claim 15 or 16, wherein: The loss calculation module is further used to calculate the value of the loss function according to the output resource, one positive sample and multiple negative samples.
18. The device according to any one of claims 15 to 17, wherein: The adjustment module is also used to perform reverse gradient adjustment on the parameters according to the value of the loss function, and obtain the trained generative model when the value of the loss function reaches a set value.
19. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1 to 5 or any one of claims 6 to 9.
20. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-5 or any one of claims 6-9.
21. A computer program product, comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 5 or any one of claims 6 to 9.
Citation Information
Patent Citations
Commodity cue word index construction method and device
CN114971816A
Resource selection model training method, resource selection method, device and equipment
CN116756570A
Content recommendation method and device, recommendation model training method and device, medium and equipment
CN117251639A
Resource recommendation method and device, storage medium and electronic equipment
CN117609612A
Text generation model training method, text generation method and answer generation method
CN118364060A