Content generation method and device based on generative model, electronic equipment and storage medium
By acquiring user preference information and using generative models to generate content under the constraints of preference information, the problem of unstable output quality of generative models is solved, and the generation results are made more responsive and in line with user needs, thus improving the user experience.
Patent Information
- Application Number
- CN202511330697.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-17
- Publication Date
- 2026-01-23
AI Technical Summary
The output quality of existing generative models is unstable, leading to a decline in user experience, difficulty in responding to user preferences in a timely manner, and affecting the relevance and satisfaction of the generated results.
By acquiring user preference information, generative models are used to generate content under the constraints of preference information. This includes acquiring target historical content, determining the current preference category and updating the preference category set with timestamps, dynamically adjusting the generation direction, and reflecting changes in user interests in real time.
It improves the relevance of generated content and user satisfaction, ensures that the generated results meet user needs, improves the application experience of generative models, and enhances the model's real-time response capability.
Smart Images

Figure CN121389987A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of data processing, and particularly relates to a content generation method based on a generative model, a content generation device based on a generative model, an electronic device and a computer readable storage medium. BACKGROUND
[0002] The generative model is rapidly developing in the direction of higher precision, stronger versatility and self-adaptation. Compared with traditional models, the generative model has the ability to autonomously learn from massive data and generate high-quality content, can flexibly cope with diversified tasks, has shown strong generation and understanding capabilities in natural language processing, image generation and other fields, and has become one of the core technologies to promote the evolution of artificial intelligence. However, the output quality of the current generative model is still unstable, which can easily reduce the user experience. SUMMARY
[0003] The application provides a content generation method based on a generative model, a content generation device based on a generative model, an electronic device and a computer readable storage medium. The generative model can actively perceive user preferences and guide the content generation direction accordingly. This process is almost imperceptible to users, but can make the results more in line with user needs, thereby improving relevance and satisfaction and improving the application experience of the generative model.
[0004] In a first aspect, the application provides a content generation method based on a generative model, comprising: Before the generative model outputs target content based on the current guide text, if the user's preference information marked on the output content is obtained, the generative model is instructed to output the target content based on the current guide text under the constraint of the preference information.
[0005] Further, the preference information is obtained by the following steps: Obtain target historical content; the target historical content is part / whole historical content associated with preset feedback information; Obtain the preference information based on the target historical content.
[0006] Further, the target historical content is the historical content output in the last round; obtaining the preference information based on the target historical content comprises: Determine at least one current preference category of the target historical content based on a preset classification model; the current preference category is a preference category in the preset preference categories that matches the target historical content; Determine the preference information based on the current preference category.
[0007] Further, determining the preference information based on the current preference category comprises: determining a target preference category based on the current preference category; the target preference category is the current preference category with the highest correlation score; updating a pre-constructed preference category set based on the target preference category and the corresponding timestamp; the updated preference category set records historical preference categories and corresponding timestamps, and the historical preference categories at least include the target preference category; determining a preset number of historical preference categories with the latest timestamps in the updated preference category set as the preference information.
[0008] Further, when the feedback information is positive feedback information, updating the pre-constructed preference category set based on the target preference category and the corresponding timestamp, comprising: in the case that the same historical preference category as the target preference category has been recorded in the preference category set, updating the timestamp of the corresponding historical preference category based on the timestamp corresponding to the target preference category; in the case that it is determined that the same historical preference category as the target preference category has not been recorded in the preference category set, and it is determined that the number of historical preference categories does not exceed the maximum capacity, determining the target preference category as a new historical preference category, and adding the new preference category and the corresponding timestamp to the preference category set; in the case that it is determined that the same historical preference category as the target preference category has not been recorded in the preference category set, and it is determined that the number of historical preference categories exceeds the maximum capacity, deleting the historical preference category with the earliest timestamp, determining the target preference category as a new historical preference category, and adding the new preference category and the corresponding timestamp to the preference category set.
[0009] Further, when the number of preference categories is more than one, determining the preference information based on the current preference category, comprising: determining each preference category as the preference information; Correspondingly, after outputting the target content based on the current guide text under the constraint of the preference information, further comprising: Before outputting the target content based on the guide text of the next n rounds, if the historical content output in the previous round is not associated with the feedback information, determining the preference information from each current preference category; n is a positive integer, and 1≤n≤m-1, m is the number of each current preference category; wherein the number of current preference categories corresponding to the previous round is more than the number of current preference categories corresponding to the current round.
[0010] Further, the target historical content is the historical content output in the last round; determining the preference information based on the target historical content, comprising: determining whether there is a target keyword matching the keyword in the target historical content; in the case that the target keyword exists in the target historical content, determining the preference information based on the target keyword.
[0011] In a second aspect, the present application provides a content generation apparatus based on a generative model, comprising: The output module is configured to, in a case where the preference information of the user for the output content is acquired, instruct the generative model to output the target content based on the current guide text under the constraint of the preference information before the generative model outputs the target content based on the current guide text.
[0012] In a third aspect, the present application provides an electronic device, which comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the steps of the method of the first aspect when executing the computer program.
[0013] In a fourth aspect, the present application provides a computer readable storage medium, which stores a computer program, and the computer program implements the steps of the method of the first aspect when executed by a processor.
[0014] In a fifth aspect, the present application provides a computer program product, which comprises a computer program, and the computer program implements the steps of the method of the first aspect when executed by one or more processors.
[0015] The present application has the beneficial effects that, before the generative model generates the target content based on the current guide text, if the preference information of the user is acquired, the generative model is instructed to generate the target content under the constraint of the preference information. This generation method is different from the prior art which mainly relies on the user to actively set or limit the output content, and can actively acquire and understand the user's preference for the output content from the model side, and constrain the output direction in the generation process. In this way, the complex operation caused by the user's frequent intervention in the generation process can be avoided, and the generation result can be made more in line with the actual needs of the user with little user awareness, thereby significantly improving the relevance of content generation and user satisfaction, and improving the application experience of the generative model.
[0016] It can be understood that the beneficial effects of the second aspect to the fifth aspect can be understood with reference to the related description in the first aspect, which will not be repeated here. BRIEF DESCRIPTION OF DRAWINGS
[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiments or prior art description will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0018] Figure 1 is a flowchart of a content generation method based on a generative model provided by an embodiment of the present application; Figure 2 is a structural schematic diagram of a content generation device based on a generative model provided by an embodiment of the present application; Figure 3 is a structural schematic diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0019] In the following description, for the purpose of explanation and not limitation, specific details are set forth, such as particular system configurations, techniques, etc., in order to provide a thorough understanding of the embodiments of the present application. However, it will be apparent to those skilled in the art that the present application can be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
[0020] In related art, generative models are rapidly developing towards higher accuracy, stronger generality and self-adaptation. However, the output quality of current generative models still has instability problems, which can easily reduce user experience.
[0021] To solve this problem, the present application provides a content generation method based on a generative model. Unlike the prior art which mainly relies on user active setting or limiting output content, the content generation method can actively obtain and understand user preferences for output content from the model side, and constrain the output direction during the generation process. In this way, not only can the complex operation caused by frequent user intervention in the generation process be avoided, but also the generation result can be made more in line with the actual needs of the user with almost no user awareness, thereby significantly improving the relevance of content generation and user satisfaction, and improving the application experience of generative models.
[0022] Among them, the generative model can include but is not limited to the following types: text generation model, such as large language model (Large Language Model, LLM), dialogue model, machine translation model, text summarization model, etc.; image generation model, such as diffusion model (Diffusion Model), generative adversarial network (Generative Adversarial Network, GAN), etc., which can be used for image generation, image inpainting or image editing; video generation model, such as multi-modal generation model based on diffusion or time series modeling, which can be used for video synthesis, video prediction; audio generation model, such as speech synthesis model, music generation model; and other multi-modal generation model, such as cross-modal generation model capable of simultaneously processing text, image, audio or video. The control method proposed by the present application will be described below through specific embodiments.
[0023] The content generation method based on the generative model provided in the embodiments of the present application can be applied to electronic devices such as mobile phones, tablet computers, vehicle-mounted devices, augmented reality (AR) / virtual reality (VR) devices, notebook computers, ultra-mobile personal computers (UMPCs), netbooks, personal digital assistants (PDAs), and the like. The embodiments of the present application do not limit the specific type of electronic device.
[0024] To illustrate the technical solutions proposed in the present application, the electronic device will be taken as the execution subject to describe each embodiment.
[0025] Figure 1 A schematic flowchart of the content generation method based on the generative model provided in the present application is shown, which includes the following steps: In step 110, after the generative model receives the current guide text, the electronic device determines whether the preference information of the user for the output content label is obtained.
[0026] After the generative model receives the current guide text, it is first determined whether the preference information of the user for the output content label is obtained.
[0027] For example, the preference information can be the personalized demand preset by the user in the system in advance, or the result automatically inferred based on the feedback information of the user for the historical content. The preference information can cover at least one preference category, such as a preference for concise and clear answers, a focus on detailed and hierarchical descriptions, a tendency to specific expression style content, or a preference for a certain type of theme content such as travel and food.
[0028] By identifying the preference information of the user before content generation, the electronic device can provide a clear guide direction for the generative model, thereby avoiding a significant deviation between the generation result and the user's expectation and improving the relevance of the generation result and the user's satisfaction.
[0029] In step 120, when the electronic device determines that the preference information of the user for the output content label is obtained, the generative model is instructed to output the target content based on the current guide text under the constraint of the preference information.
[0030] When the electronic device determines that the preference information of the user has been acquired, the generative model can be instructed to generate and output the target content in combination with the current guide text under the constraint of the preference information. This generation method can make the output result more consistent with the personalized needs and use habits of the user while maintaining natural fluency. Unlike the existing technology which mainly relies on the user to actively limit the output content, the generation of the target content is actively perceived and understood by the model side, and then the output direction is adaptively adjusted in the generation process, thereby improving the relevance of the generation result and the user satisfaction in the case of low user perception, and improving the overall application experience of the generative model.
[0031] In step 130, the electronic device determines that the preference information of the user for the output content marker has not been acquired, and outputs the target content based on the current guide text.
[0032] When the electronic device determines that the preference information of the user has not been acquired, the generative model can generate the target content based on the current guide text without the constraint of the preference. This processing method can ensure that effective content can still be generated in the scenario lacking preference information, avoid the generation process being limited or interrupted, and at the same time ensure the availability and coherence of the output content.
[0033] In the embodiments of the present application, the electronic device can realize personalized guidance and adaptive control of the output content of the generative model through the above steps. When the user preference information is acquired, the generative model is instructed to generate the target content under the constraint of the preference, so that the output result is more consistent with the needs and habits of the user, thereby improving the relevance, coherence and user satisfaction of the generated content. When the preference information is lacking, the target content is directly output based on the current guide text in order to ensure the availability and stability of content generation. Compared with the method of the prior art which mainly relies on the user to actively limit the output content, in the present method, the electronic device can guide the model side to actively perceive the user preference, realize content adjustment with low perception, and generate target content that fits the user preference, thereby effectively improving the application experience of the generative model. Obviously, the target content has the characteristics of consistency, reliability and personalization of the generation result, which helps to enhance the use frequency and effectiveness of the model in actual application scenarios, and realizes the dual improvement of user experience and model application value.
[0034] In the prior art, in response to user feedback on historical content, such as like, dislike, copy or share feedback operations, the corresponding historical content is usually taken as a training sample and utilized in the model updating process. However, in actual application, it is found that such user feedback information cannot immediately affect the output results of the subsequent generative model, and its effect depends on the optimization training process of the model. Since the model training itself has a high computational cost, compared with the feedback time of the user, the update time often has a significant delay, which is usually several hours or even several days. In addition, if a historical content is not selected into the training sample, the corresponding feedback information will have no effect at all. As can be seen, the processing method of the prior art makes it difficult to reflect the individualization and adaptability of the generation results in a timely manner, which will limit the user interaction experience and reduce the ability of the model in immediate response.
[0035] In some embodiments, in order to actively respond to user feedback on historical content, the electronic device will perform the following steps: Step A1, the electronic device acquires target historical content.
[0036] The target historical content is part or all of the historical content associated with the preset feedback information. The preset feedback information refers to the operation information performed by the user on the historical content, such as like, dislike, copy or share, etc. In other words, part or all of the historical content on which the user generates feedback operations can be taken as target historical content.
[0037] Illustratively, if the generative model has output three historical contents, and two of them have been operated by the user, then both of them can be determined as target historical content; or only one of them can be selected as target historical content, for example, the one closest in time, or in the case where different feedback operations are set with different weights, the one with higher feedback operation weight can be selected, so as to realize a more flexible and efficient target historical content determination method.
[0038] By acquiring the target historical content, the electronic device can associate the user's real feedback behavior with the specific content, thereby providing more targeted constraint data for subsequent preference identification, and making the output results more in line with user preferences.
[0039] Step A2, the electronic device acquires preference information based on the target historical content. After obtaining the target historical content, the electronic device can analyze and process it to extract user preference information. Specifically, the electronic device can extract keywords such as entity names, topic names, or concept names from the target historical content; the electronic device can also determine the preference category corresponding to the target historical content, such as the theme content it belongs to (such as travel, food), or the description style it embodies (such as concise answer or detailed description). Through the above analysis, the electronic device can extract representative preference features from the user's interactive behavior and convert the user's subjective preference into objective data that can be recognized and utilized by the model. In this way, the generative model can constrain and guide the subsequent generation process according to these preference information, thereby improving the pertinence of the generation result and user satisfaction.
[0040] In this embodiment, the electronic device can quickly and real-time extract and apply personalized preference information based on the user's real feedback, so that the output result of the subsequent generative model is more in line with the user's expectations, thereby overcoming the problem of delayed feedback effect and untimely personalized effect in the prior art.
[0041] In some embodiments, in order to improve the real-time effect of the preference information on the output result, the target historical content is preferably the historical content of the last round of output, that is, the last round of reply output by the model. Based on this, specifically, the preference information is obtained based on the target historical content, including: Step A21, the electronic device determines at least one current preference category of the target historical content based on a preset classification model.
[0042] The current preference category refers to the category that best matches the target historical content among the preset multiple preference categories. In order to more accurately determine the current preference category from the target historical content, a classification model can be used. For example, traditional machine learning models (such as support vector machine SVM, Naive Bayes, or XGBoost), deep learning models (such as convolutional neural network CNN, recurrent neural network RNN, or BERT), and large language models (such as GPT, T5, ChatGPT) can be used.
[0043] Specifically, the target historical content is input into the selected classification model for processing, and the current preference category corresponding to the target historical content can be output, thereby providing a basis for subsequent generation of preference information.
[0044] Step A22, the electronic device determines the preference information based on the current preference category.
[0045] After obtaining the current preference category, the preference information acting on the subsequent reply can be further determined based on the current preference category. Illustratively, when there is only one current preference category, the category can be directly taken as the preference information; when there is more than one current preference category, part or all of the categories can be selected as the preference information according to actual needs.
[0046] Further, in order to be able to combine the user's past feedback operations, the selected multiple current preference categories can also be filtered or weighted to ultimately determine the preference information that is more in line with the user's characteristics. As can be seen, the determination method of the preference information has flexibility and diversity, and can be adjusted according to different application scenarios and user needs.
[0047] In the embodiments of the present application, the electronic device can quickly extract user preference information in real time based on the target historical content, and apply it to the subsequent content generation of the generative model. Through this method, the user's subjective preference is converted into objective data that the model can recognize and utilize, so that the generation result is more in line with the user's demand in terms of style, theme and / or content direction. Moreover, regardless of the number of current preference categories, the electronic device can flexibly determine the preference information, thereby accurately constraining and guiding the generated content. With this mechanism, the generative model can adjust the output content in real time, improve the relevance and personalization degree of the generation result, effectively improve the user interaction experience, and enhance the user's trust and dependence on the generative model.
[0048] In some embodiments, the step of determining the current preference category based on the classification model specifically includes: Step A211, the electronic device determines the correlation score between the target historical content and each of the preset preference categories based on the preset classification model.
[0049] In order to map the natural language historical content to the preset preference category space and obtain the "matching degree" or "correlation score" of each preference category to the content, the electronic device can achieve this in multiple ways based on the classification model.
[0050] Illustratively, the target historical content can be input into a supervised classifier (softmax output probability), or it can be first encoded into a semantic vector by a BERT model, and then the cosine similarity with the semantic vector of each preference category is calculated; a large language model can also be used for zero-shot / natural language inference to return the confidence of each category.
[0051] Exemplarily, using the BERT classifier to classify the "I like short and to-the-point answers" historical content, the model can output: {concise: 0.87; detailed: 0.05; travel: 0.02; food: 0.01} or get the similarity scores in the form of vector similarity: {concise: 0.82; travel: 0.35}. In implementation, attention should be paid to the classification of category types (topic category, style category, structure category, etc.), and different models or different scoring mechanisms can be used for different types (for example, a semantic classifier is used for the style category, and a topic retrieval / semantic similarity is used for the topic category). In addition, scoring calibration (mapping scores of different models to a unified scale), noise suppression, and confidence estimation should be considered.
[0052] Step A212, the electronic device determines whether there is a target relevance score in the relevance scores.
[0053] Step A213, the electronic device determines the preference category corresponding to the target relevance score as the current preference category when it is determined that the target relevance score exists.
[0054] In order to filter out the preference categories with low relevance to the target historical content, only keep the matching results that are significant enough, and thus ensure the accuracy and reliability of the current preference category, a score threshold can be set as a screening baseline.
[0055] For example, if the relevance score of a certain target historical content to the "food" category is 0.82, and the relevance score to the "travel" category is 0.76, and the score threshold is set to 0.80, only the score of the "food" category meets the requirement, and therefore the "food" is determined as the current preference category. For another example, when the score threshold is 0.70, both the "food" and "travel" categories meet the requirement, and both of them can be used as the current preference category, or one of them can be further selected according to specific needs. If the relevance scores of all categories are lower than 0.70, it means that the target historical content cannot form a significant enough match with any of the preset preference categories, indicating that the current preference category cannot be determined at this time, or the category with the highest score can be used as a backup category. In this way, the score threshold can flexibly control the matching accuracy, ensuring the accuracy of the preference category, and taking into account the individual needs in different application scenarios.
[0056] It can be understood that a target historical content can correspond to multiple preference categories at the same time, and in this case, multiple current preference categories can be determined by the classification model. For multiple current preference categories, the determination mechanism of the preference information can be flexibly set according to different application needs (for example, emphasizing the preference intensity to highlight the main preference, or emphasizing the diversity to cover a wider range of preferences).
[0057] Exemplarily, only one of the current preference categories can be selected as the preference information to ensure that the generated result is more focused and more targeted; or multiple current preference categories can all be used as the preference information, so that the generated result can take into account multiple preference directions. The specific mechanism can be flexibly determined according to actual use scenarios and requirements, and the application does not limit this.
[0058] In this embodiment, the electronic device first calculates the relevance scores of the target historical content and each preset preference category by using the classification model, and then screens in combination with the score threshold to determine only the preference categories that meet the threshold requirement as the current preference categories, so as to realize accurate identification of the potential preferences of the user. This determination process can not only avoid the interference of low-relevance categories on the result, but also ensure that the finally selected preference categories are more representative and reliable, thereby providing a clear and reliable preference guide for subsequent content generation.
[0059] In some embodiments, it can be understood that when the current preference category cannot be determined based on the target historical content, there can be two processing methods: one is to directly end the process and instruct the generative model to output the target content based on the current guide text; the other is to extract the preference information from the previously determined current preference categories to continue to provide reference for the generation process. In this way, the smooth progress of the generation process is ensured when the preference information is missing, and the influence of historical preferences on content generation is continued when the conditions allow, thereby taking into account the continuity and adaptability of generation.
[0060] In some embodiments, determining the preference information based on the current preference category includes: A221, the electronic device determines a target preference category based on the current preference category. The target preference category refers to the current preference category with the highest relevance score. When there is only one current preference category, the current preference category is the target preference category; when the number of preference categories is two or more, the relevance scores of the current preference categories can be compared, and the current preference category with the highest relevance score is determined as the target preference category.
[0061] A222, the electronic device updates the pre-constructed preference category set based on the target preference category and the corresponding timestamp.
[0062] Some users can have feedback operations on multiple pieces of historical reply information, so the electronic device can obtain the corresponding target preference category before the generative model generates a new target content each time. For example, assuming that the user likes the first piece of target historical content output by the generative model at 9:00 and copies the second piece of target historical content at 9:10, before the second piece of target historical content is output, the electronic device can determine the first target preference category based on the first piece of historical content; before the third piece of target content is generated after the second piece of target historical content, the second target preference category can be determined based on the second piece of historical content.
[0063] In order to make full use of the target historical content corresponding to different times, each target preference category can determine a corresponding time stamp in combination with its corresponding historical content. For example, the time stamp corresponding to the first target preference category is 9:00, and the time stamp corresponding to the second target preference category is 9:10. After determining a new target preference category each time, the electronic device can update the pre-constructed preference category set based on the target preference category and the corresponding time stamp.
[0064] Specifically, when the first target preference category is determined for the first time, the preference category set is empty, and at this time the first target preference category and its corresponding time stamp 9:00 can be written into the preference category set. When the second target preference category is determined subsequently, the first target preference category and its time stamp 9:00 have been stored in the preference category set. In order to distinguish the existing preference category in the set from the newly determined preference category, the first target preference category recorded in the set can be regarded as a historical preference category, and the second target preference category and its time stamp 9:10 can be added to the preference category set.
[0065] Exemplarily, at this time the preference category set can be represented as {first target preference category, 9:00; second target preference category, 9:10}, thereby providing a dynamic updated user preference reference for the generative model.
[0066] Further, assuming that the sixth piece of target content output by the generative model at 9:50 obtains the sharing feedback of the user, before the seventh piece of target content is generated, the electronic device can determine the third target preference category based on the sixth piece of target historical content, and update the preference category set according to "third target preference category, 9:50". At this time, the historical preference categories in the preference category set include the first target preference category and the second target preference category, and the updated set can record three historical preference categories corresponding to different times, thereby providing a more complete and dynamic reference for the content generation of the generative model.
[0067] A223、The electronic device determines the preset number of historical preference categories with the latest time stamp in the updated preference category set as the preference information.
[0068] The updated preference category set can record target preference categories corresponding to target historical content at different times. In order to ensure that the generative model can adapt to the latest preferences of the user when outputting the next target content, thereby improving the relevance and personalization degree of the generation result, the electronic device can select a preset number (for example, 2-5, specifically 3) of historical preference categories with the latest time stamps from the preference category set as preference information, which is used as a constraint and guide for subsequent generation of target content.
[0069] It can be understood that, in the initial stage of the construction of the preference category set, the number of historical preference categories recorded by the set is limited. When the number of recorded historical preference categories is less than or equal to the preset number, all historical preference categories in the set can be directly determined as preference information. As the interaction between the user and the generative model increases, the number of historical preference categories recorded in the set gradually increases. When the number exceeds the preset number, the latest preset number of historical preference categories can be selected based on the time stamp as the preference information.
[0070] In the embodiment, by constructing the preference category set to record target preference categories corresponding to target historical content at different times, the interest changes of the user at different time periods can be dynamically reflected while maintaining the continuity of the user preferences. By setting the preset number, on the one hand, the storage and calculation overheads caused by too many historical preference categories in the set can be avoided, and the processing efficiency of the electronic device can be improved; on the other hand, the latest user preferences can be given priority in the determination of the preference information, so that the generative model can adapt to the interest changes of the user more quickly. Therefore, when generating new content, the generative model can not only refer to the long-term preferences of the user, but also respond to the recent feedback in time, so as to balance the stability and real-time performance in the generation result, and effectively improve the relevance and personalization degree of the content.
[0071] In some embodiments, when the feedback information is positive feedback information, the pre-constructed preference category set is updated based on the target preference category and the corresponding time stamp, Step A2211, in the case that the electronic device has recorded a historical preference category identical to the target preference category in the preference category set, the time stamp of the corresponding historical preference category is updated based on the time stamp corresponding to the target preference category.
[0072] Step A2212, in the case that the electronic device determines that the preference category set does not record a historical preference category identical to the target preference category, and determines that the number of historical preference categories does not exceed the maximum capacity, the target preference category is determined as a new historical preference category, and the new preference category and the corresponding time stamp are added to the preference category set.
[0073] Step A2211. In a case where the electronic device determines that no historical preference category identical to the target preference category is recorded in the set of preference categories, and determines that the number of historical preference categories exceeds the maximum capacity, the electronic device deletes the historical preference category with the earliest timestamp, determines the target preference category as a new historical preference category, and adds the new preference category and the corresponding timestamp to the set of preference categories.
[0074] To reduce the storage and computing overheads caused by excessive historical preference categories, and to improve the real-time performance of the historical preference categories in the set of preference categories, when the feedback information is positive feedback, the electronic device can update the pre-constructed set of preference categories based on the target preference category and the corresponding timestamp: if the same preference category already exists in the set, the timestamp thereof is updated; if no identical category exists in the set and the number of categories does not exceed the maximum capacity, the category and the timestamp are directly added; if no identical category exists in the set but the number of categories has reached the maximum capacity, the historical preference category with the earliest timestamp is deleted, and the current category and the timestamp are added to the set.
[0075] Exemplarily, it is assumed that the maximum capacity of the preset set of preference categories is 3. At a certain time, the historical preference categories recorded in the set of preference categories are {science fiction, 8:00; historical documentary, 8:10}.
[0076] At 9:00, the user again provides positive feedback on the target historical content related to “science fiction” generated by the generative model. Since the same historical preference category “science fiction” already exists in the set, the electronic device updates the timestamp of “science fiction” to 9:00 to reflect the latest active time of the category.
[0077] At 9:10, the user provides positive feedback on the target historical content related to “food” for the first time. Since no historical preference category identical to “food” is recorded in the set, and the number of categories (2) in the current set does not exceed the maximum capacity (3), the electronic device can add “food” and the corresponding timestamp 9:10 to the set. At this time, the set is updated to {science fiction, 9:00; historical documentary, 8:10; food, 9:10}.
[0078] At 9:20, the user provides positive feedback on the target historical content related to “travel” for the first time. Since no historical preference category identical to “travel” is recorded in the set, and the number of categories (3) in the set has reached the maximum capacity (3), the electronic device can delete the historical preference category “historical documentary, 8:10” with the earliest timestamp in the set, and add “travel, 9:20” to the set. At this time, the set is updated to {science fiction, 9:00; food, 9:10; travel, 9:20}.
[0079] In the embodiment, the electronic device can reflect the latest interests of the user at different times by dynamically updating the set of preference categories. When a category is continuously active, its timestamp is constantly refreshed to be retained; when a new interest appears, the set can timely expand or replace the category that has not been active for a long time, thereby improving the relevance and personalization degree of the output result of the generative model to the current preference of the user.
[0080] In some embodiments, when the feedback of the user is negative feedback (for example, point down, report or ignore), the electronic device can remove the current preference category corresponding to the negative feedback from the set of preference categories to avoid the preference category from continuing to affect the generation of subsequent content.
[0081] Further, a differentiated processing strategy can also be set, for example: if it is one-time negative feedback, only the corresponding single preference category is deleted; if it is multiple continuous negative feedback, the deletion range can be increased, and even the sub-categories highly related to the category are emptied, so as to more accurately exclude the direction of interest of the user and improve the relevance of the generation result and the user satisfaction.
[0082] In some embodiments, in addition to the above-mentioned determination manner of preference information, when the number of current preference categories is more than one, the preference information can also be determined by the following steps: Step B1, the electronic device determines each preference category as the preference information.
[0083] In order to guarantee the diversity of preferences, in the case where there are multiple current preference categories, the electronic device can take all current preference categories as the preference information, thereby completely retaining the multi-dimensional preference characteristics of the user, so that the generative model can simultaneously consider different theme or style requirements in the subsequent content generation process, and more comprehensively meet the personalized expectations of the user.
[0084] Correspondingly, in order to still be able to constrain the output direction of the target content based on the preference information of the user in the case where the user does not perform a feedback operation on the historical content of the last round, after outputting the target content based on the current guide text under the constraint of the preference information, the following steps are further included: Step C1, before outputting the target content based on the guide text of the last n rounds, if the historical content output in the previous round is not associated with feedback information, the preference information is determined from each current preference category; n is a positive integer, and 1≤n≤m-1, m is the number of each current preference category; wherein the number of current preference categories corresponding to the previous round is more than the number of current preference categories corresponding to the current round.
[0085] Before the generative model generates target content based on the guided text output of the n th round, if it is found that the historical content output in the previous round has no feedback information, the electronic device can determine preference information from the current preference categories without relying on the target historical content of the previous round. This is because the historical content of the previous round can not be determined as the target historical content, and the preference information cannot be directly extracted according to the aforementioned preference category determination method. For this case, the electronic device can determine the current preference information from the plurality of current preference categories corresponding to the target historical content of the previous two rounds. Specifically, the current preference categories that affect the reply of each subsequent round can be determined from the plurality of current preference categories in a decay manner, so as to gradually adjust the preference influence while maintaining personalization.
[0086] For example, it is assumed that the user likes the target historical content output at 14:03, and the electronic device processes the content through the classification model to determine three current preference categories: “star”, “actor”, and “gossip”. At 14:10, the electronic device outputs target content based on the constraint of the three current preference categories and in combination with the corresponding guided text. The user does not provide feedback on the output content at 14:10, and in the subsequent two rounds of replies, the three current preference categories affect the generated content in a decay manner. Specifically, in the first subsequent round of replies, “star” and “gossip” are used as preference information to constrain the direction of the generated content; in the second round of replies, only “gossip” is used as preference information to continue to constrain the content generation.
[0087] The decay rule of the current preference category can be set according to actual needs, for example, it is specified to be completely decayed within a certain number of subsequent rounds, or the decay number and the reserved order of each round are determined according to the number of current preference categories. Through this mechanism, even if the output of a certain round lacks feedback, the electronic device can still determine the preference information by using the preference categories corresponding to the historical rounds, so as to maintain the personalization and stability of the generated content and improve the coherence and satisfaction of the user experience.
[0088] In this embodiment, even if the historical content of the previous round lacks user feedback, the electronic device can still determine the preference information by relying on the plurality of current preference categories corresponding to the target historical content of one round before, so as to guarantee the personalization and stability of the generated content; through the decay manner, the preference influence is reasonably adjusted over time, avoiding the excessive solidification of historical preferences; and the rare feedback operation of the user can continuously affect the generated content of the generative model in the subsequent rounds, ensuring the direction of the generated content.
[0089] In some embodiments, it can be understood that after the electronic device outputs the target content based on the preference information determined in A223, if the target content does not receive feedback operation of the user, for at least one subsequent round of reply, the electronic device can continue to use the manner of step C1 to make the plurality of historical preference information act on the subsequent content generation. Specifically, the plurality of current preference information can be replaced by the plurality of historical preference information, and the preference decay processing is performed thereon, so as to dynamically guide the content of the generative model in different subsequent outputs, so that the generation result not only maintains personalization, but also can smoothly transition the historical preference influence, and improve the stability and continuity of content generation.
[0090] In some embodiments, in addition to determining the preference information by means of the classification model, the relevant keywords can also be directly extracted from the target historical content as the preference information. Specifically, the target historical content is the historical content output in the last round; the preference information is obtained based on the target historical content, including: Step D1, the electronic device determines whether there is a target keyword matching the keyword in the target historical content.
[0091] Step D1, in the case that there is a target keyword in the target historical content, the electronic device determines the preference information based on the target keyword.
[0092] The electronic device can first determine whether the target historical content contains a target keyword matching the preset keyword. The keyword can include an entity name, a topic name or a concept name, etc. For example, the entity name can be the name of a movie director or the name of a new energy vehicle brand, the topic name can be "movie premiere" or "new energy vehicle", and the concept name can be "realism" or "intelligent driving". If the target historical content contains these target keywords, the electronic device can determine the preference information based on these keywords to constrain the content generated by the generative model in the subsequent generation. For example, if the historical content contains the name of a movie director and "movie premiere", the preference information can be directed to the movie-related theme, so as to guide the generative model to generate movie-related content in the next round of output.
[0093] In this embodiment, compared with the preference information determination method based on the classification model, the preference information determination method can more quickly capture the explicit interest of the user, reduce the computational overhead, and at the same time, convert the entity, topic or concept information in the historical content into preference constraints in real time, thereby improving the personalization and real-time response capability of the generated content.
[0094] In some embodiments, for the case where multiple preference categories (whether historical preference categories or current preference categories) are contained in the preference information at the same time, the electronic device can assign different weights to each preference category according to factors such as importance, frequency of occurrence, or time freshness of different categories, so as to reflect the primary and secondary relationship of the preference categories in the subsequent content generation process, and make the generation result more in line with the real interest orientation of the user.
[0095] For example, when updating the preference set, the electronic device can also introduce a weight mechanism for different preference categories. Specifically, the number of times each preference category appears in user interaction can be weighted, so that the preference category with higher frequency of occurrence occupies a higher weight in the set, so as to highlight the core interest of the user in subsequent content generation.
[0096] It should be understood that the size of the serial number of each step in the above embodiments does not mean the order of execution, and the execution order of each process should be determined according to its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0097] The content generation method based on the generative model corresponding to the above embodiment, Figure 2 The structure block diagram of the content generation device 2 based on the generative model provided by the embodiments of the present application is shown, and only the part related to the embodiments of the present application is shown for the convenience of description.
[0098] Referring to Figure 2 The content generation device 2 based on the generative model includes: The control module 21 is configured to, before the generative model outputs the target content based on the current guide text, in the case where the preference information of the user marked on the output content is acquired, instruct the generative model to output the target content based on the current guide text under the constraint of the preference information.
[0099] Optionally, the content generation device 2 further includes an acquisition module, which includes: The first acquisition submodule is configured to acquire target historical content; the target historical content is part / all of the historical content associated with the preset feedback information; The second acquisition submodule is configured to acquire the preference information based on the target historical content.
[0100] Optionally, the target historical content is the historical content output in the last round; and the second acquisition submodule includes: The first determination unit is configured to determine at least one current preference category of the target historical content based on a preset classification model; the current preference category is a preference category in the preset preference category that matches the target historical content; The second determination unit is configured to determine the preference information based on the current preference category.
[0101] Optionally, the second determining unit comprises: a first determining sub-unit, configured to determine a target preference category based on the current preference categories; the target preference category is a current preference category with the highest relevance score; an updating sub-unit, configured to update the pre-constructed preference category set based on the target preference category and the corresponding timestamp; the updated preference category set records historical preference categories and corresponding timestamps, and the historical preference categories at least include the target preference category; a second determining sub-unit, configured to determine a preset number of historical preference categories with the latest timestamps in the updated preference category set as the preference information.
[0102] Optionally, when the feedback information is positive feedback information, the updating sub-unit is specifically configured to: in a case where a historical preference category identical to the target preference category has been recorded in the preference category set, update the timestamp of the corresponding historical preference category based on the timestamp corresponding to the target preference category; in a case where it is determined that a historical preference category identical to the target preference category has not been recorded in the preference category set, and it is determined that the number of historical preference categories does not exceed the maximum capacity, determine the target preference category as a new historical preference category, and add the new historical preference category and the corresponding timestamp to the preference category set; in a case where it is determined that a historical preference category identical to the target preference category has not been recorded in the preference category set, and it is determined that the number of historical preference categories exceeds the maximum capacity, delete a historical preference category with the earliest timestamp, determine the target preference category as a new historical preference category, and add the new historical preference category and the corresponding timestamp to the preference category set Optionally, when the number of preference categories is more than one, the second determining unit comprises: a third determining sub-unit, configured to determine each preference category as the preference information; Correspondingly, the control module is further configured to: after outputting the target content based on the current guide text under the constraint of the preference information, before outputting the target content based on the guide text of the next n rounds, if the historical content output in the previous round is not associated with the feedback information, determine the preference information from the current preference categories; n is a positive integer, and 1≤n≤m-1, m is the number of the current preference categories; wherein the number of the current preference categories corresponding to the previous round of output is more than the number of the current preference categories corresponding to the current round of output.
[0103] Optionally, the target historical content is the historical content output in the last round; and the second obtaining sub-module comprises: a third determining unit, configured to determine whether there is a target keyword matching the keyword in the target historical content; The fourth determining unit is used to determine preference information based on the target keywords when the target keywords exist in the target's historical content.
[0104] It should be noted that the information interaction and execution process between the above-mentioned devices / units are based on the same concept as the method embodiments of this application. For details on their specific functions and technical effects, please refer to the method embodiments section, and they will not be repeated here.
[0105] Figure 3 This is a schematic diagram of the physical layer structure of an electronic device provided in an embodiment of this application. Figure 3 As shown, the electronic device 3 of this embodiment includes: at least one processor 30 ( Figure 3 (Only one is shown) a processor, a memory 31, and a computer program 32 stored in the memory 31 and executable on at least one processor 30. When the processor 30 executes the computer program 32, it implements the steps in any of the above embodiments of the content generation method based on a generative model, for example... Figure 1 Steps 110-130 are shown.
[0106] The processor 30 may be a central processing unit (CPU), or it may be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor.
[0107] In some embodiments, memory 31 may be an internal storage unit of electronic device 3, such as a hard disk or memory of electronic device 3. In other embodiments, memory 31 may also be an external storage device of electronic device 3, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc. equipped on electronic device 3.
[0108] Further, the memory 31 can include both an internal storage unit of the electronic device 3 and an external storage device. The memory 31 is used to store operating systems, application programs, Boot Loaders, data, and other programs, etc., such as program codes of computer programs, etc. The memory 31 can also be used to temporarily store data that has been output or will be output.
[0109] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the above-mentioned division of functional units and modules is exemplified, and in actual application, the above-mentioned functions can be completed by different functional units and modules according to needs, that is, the internal structure of the above-mentioned device is divided into different functional units or modules to complete all or part of the functions described above. Each functional unit and module in the embodiment can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit. In addition, the specific name of each functional unit and module is only for convenient distinction, and does not limit the protection scope of the present application. The specific working process of the unit and module in the above system can refer to the corresponding process in the foregoing method embodiments, which will not be described here.
[0110] The embodiments of the present application also provide a computer readable storage medium, which stores a computer program. The computer program is executed by a processor to implement the steps in each of the above method embodiments.
[0111] The embodiments of the present application provide a computer program product. When the computer program product is run on an electronic device, the electronic device is caused to implement the steps in each of the above method embodiments.
[0112] The integrated unit, if implemented in the form of a software function unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on such understanding, the present application can implement all or part of the processes in the above-mentioned embodiment methods through a computer program to instruct related hardware to complete. The above-mentioned computer program can be stored in a computer readable storage medium, and the computer program can implement the steps of each method embodiment when executed by a processor. The above-mentioned computer program includes computer program code, which can be in the form of source code, object code, executable files or some intermediate forms. The above-mentioned computer readable medium at least includes any entity or device capable of carrying the computer program code to the photographing device / electronic device, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal and a software distribution medium. For example, a U disk, a mobile hard disk, a magnetic disk or an optical disk, etc.
[0113] In the above embodiments, the description of each embodiment has its own focus, and the parts not described or recorded in detail in a certain embodiment can be referred to the related description of other embodiments.
[0114] Those skilled in the art can appreciate that the units and algorithm steps of the examples described in combination with the embodiments disclosed herein can be implemented in electronic hardware or a combination of computer software and electronic hardware. Whether the functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. The skilled person can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.
[0115] In the embodiments provided by the present application, it should be understood that the disclosed apparatus / network device and method can be implemented in other ways. For example, the above-described apparatus / network device embodiments are merely schematic, for example, the division of the above-mentioned modules or units is only a logical function division, and actual implementation can have another division manner, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the displayed or discussed each other can be indirect coupling or communication connection through some interfaces, devices or units, and can be electrical, mechanical or other forms.
[0116] The units described as separate parts above can or can not be physically separate, and the parts shown as units can or can not be physical units, that is, can be located in one place, or can be distributed to multiple network units. Part or all of the units can be selected to achieve the purpose of the embodiment scheme according to actual needs.
[0117] The above embodiments are only used to illustrate the technical solutions of the present application, but not limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that the technical solutions recorded in the foregoing embodiments can still be modified, or some technical features can be replaced by equivalents; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application.
Claims
1. A method of content generation based on a generative model, characterized by, The method comprises the following steps: Before the generative model outputs target content based on the current guide text, if preference information of the user marked on the output content is obtained, the generative model is instructed to output the target content based on the current guide text under the constraint of the preference information.
2. The generative model-based content generation method of claim 1, wherein, The preference information is obtained by the following steps: Obtain target historical content; the target historical content is part / whole historical content associated with preset feedback information; Obtain the preference information based on the target historical content.
3. The generative model-based content generation method of claim 2, wherein, The target historical content is historical content output in the last round; the preference information is obtained based on the target historical content, comprising: Determine at least one current preference category of the target historical content based on a preset classification model; the current preference category is a preference category matching the target historical content in the preset preference categories; Determine the preference information based on the current preference category.
4. The generative model-based content generation method of claim 3, wherein, The determination of the preference information based on the current preference category comprises: Determine a target preference category based on the current preference category; the target preference category is the current preference category with the highest relevance score; Update a pre-constructed preference category set based on the target preference category and the corresponding timestamp; the updated preference category set records historical preference categories and corresponding timestamps, and the historical preference categories at least include the target preference category; Determine a preset number of historical preference categories with the latest timestamps in the updated preference category set as the preference information.
5. The generative model-based content generation method of claim 4, wherein, When the feedback information is positive feedback information, the updating of the pre-constructed preference category set based on the target preference category and the corresponding timestamp comprises: In the case that the same historical preference category as the target preference category has been recorded in the preference category set, update the timestamp of the corresponding historical preference category based on the timestamp corresponding to the target preference category; In the case that it is determined that the same historical preference category as the target preference category is not recorded in the preference category set, and it is determined that the number of historical preference categories does not exceed the maximum capacity, determine the target preference category as a new historical preference category, and add the new preference category and the corresponding timestamp to the preference category set; In the case that it is determined that the same historical preference category as the target preference category is not recorded in the preference category set, and it is determined that the number of historical preference categories exceeds the maximum capacity, delete the historical preference category with the earliest timestamp, determine the target preference category as a new historical preference category, and add the new preference category and the corresponding timestamp to the preference category set.
6. The generative model-based content generation method of claim 3, wherein, When the number of preference categories is more than one, the determination of the preference information based on the current preference category comprises: Determine each of the preference categories as the preference information; Correspondingly, the method further comprises the following steps after the target content is output based on the current guide text under the constraint of the preference information: Before the target content is output based on the guiding text of the n-th round, if the historical content output in the previous round is not associated with the feedback information, the preference information is determined from each of the current preference categories; n is a positive integer, and 1≤n≤m-1, m is the number of each of the current preference categories; wherein the number of the current preference categories corresponding to the previous round output is more than the number of the current preference categories corresponding to the current round output.
7. The generative model-based content generation method of claim 2, wherein, The target historical content is the historical content output in the previous round; the preference information is obtained based on the target historical content, including: determining whether there is a target keyword matching the keyword in the target historical content; in the case that the target keyword exists in the target historical content, the preference information is determined based on the target keyword.
8. A content generation apparatus based on a generative model, characterized by, including: The output module is configured to, before the generative model outputs target content based on the current guiding text, in the case that the preference information of the user to the output content is acquired, instruct the generative model to output the target content based on the current guiding text under the constraint of the preference information.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, The processor executes the computer program to realize the content generation method based on the generative model as claimed in any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, the computer program comprising instructions that, when executed by a computer, cause the computer to perform the method of any one of claims 1 to 9. The computer program is executed by the processor to realize the content generation method based on the generative model as claimed in any one of claims 1 to 7.