Virtual object-based dialogue generation method and device, equipment, storage medium
By updating the parameters of the dialogue generation model for virtual objects and adjusting the learning rate based on dialogue feedback data, the flexibility and accuracy issues of virtual object dialogue generation methods are resolved, achieving more natural and personalized dialogue interaction.
Patent Information
- Application Number
- CN202411732109.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-27
- Publication Date
- 2025-10-21
- Estimated Expiration
- 2044-11-27
AI Technical Summary
Existing methods for generating dialogue using virtual objects lack flexibility and struggle to adapt to the ever-changing dialogue needs of the target object, resulting in inaccurate and impersonal dialogue content.
By obtaining the initial question text from the target audience, an initial response is generated using a pre-defined dialogue generation model. The learning rate parameter is then updated based on the dialogue feedback data, and the model parameters are adjusted to generate dialogue content that better meets the needs of the target audience.
It improves the flexibility and accuracy of virtual object dialogue generation, enabling it to better adapt to the personalized needs of the target object and provide a natural and coherent interactive experience.
Smart Images

Figure CN119720963B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology and is applicable to the field of financial technology, and in particular to a method and apparatus, device, and storage medium for generating a dialogue based on a virtual object. Background Art
[0002] Artificial Intelligence (AI)-based character dialogue refers to technology that uses AI-generated virtual characters to simulate human conversational behavior. Furthermore, AI-based character dialogue can be applied to tasks such as virtual assistants in fintech, customer service systems, and character dialogue in games. The core of character dialogue based on virtual objects lies in its ability to simulate human language communication, analyzing user input and generating appropriate responses, thereby engaging in continuous, multi-round conversations with the target object.
[0003] Currently, technologies for generating virtual character dialogues typically use preset dialogue templates, rules, or learned dialogue strategies to respond to questions input by the target subject. However, because these virtual characters' dialogue behaviors (such as the responses generated based on the target subject's input) and dialogue styles typically use fixed parameters set during the initial training phase, the dialogue content of the virtual subject's responses is inaccurate and lacks flexibility, making it difficult to better adapt to the target subject's ever-changing dialogue needs. Therefore, proposing a virtual character-based dialogue generation method that can flexibly adjust the virtual subject's dialogue behavior and dialogue style to improve the accuracy of dialogue responses has become a pressing technical problem. Summary of the Invention
[0004] The main purpose of the embodiments of the present application is to propose a method and device, equipment, and storage medium for generating conversations based on virtual objects, which can flexibly adjust the behavior and style of the generated conversation content of the virtual objects and improve the accuracy of conversation responses.
[0005] To achieve the above objectives, a first aspect of an embodiment of the present application provides a method for generating a dialogue based on a virtual object, the method comprising:
[0006] Get the target object's initial question text;
[0007] Performing dialogue generation on the initial question text based on a preset dialogue generation model to obtain initial answer content, wherein the preset dialogue generation model is provided with an initial learning rate parameter and an initial model parameter, wherein the initial learning rate parameter is used to indicate the degree to which the preset dialogue generation model adjusts the content style and content behavior associated with the initial answer content;
[0008] Acquire dialogue feedback data fed back by the target object in response to the initial response content, and acquire target feedback response content that matches the dialogue feedback data;
[0009] Updating the initial learning rate parameter based on the dialogue feedback data to obtain a target learning rate parameter;
[0010] performing dialogue generation on the dialogue feedback data based on the preset dialogue generation model and the target learning rate parameter to obtain predicted feedback reply content, wherein the target learning rate parameter is used to indicate the degree to which the preset dialogue generation model adjusts the content style and content behavior associated with the predicted feedback reply content;
[0011] Based on the target learning rate parameter, the dialogue feedback data, the target feedback response content, and the predicted feedback response content, the initial model parameters are updated to obtain a current dialogue generation model, and dialogue generation is performed according to the current dialogue generation model.
[0012] In some embodiments, updating the initial model parameters based on the target learning rate parameter, the dialogue feedback data, the target feedback response content, and the predicted feedback response content to obtain the current dialogue generation model includes:
[0013] Obtaining a predicted feedback response sequence from the predicted feedback response content;
[0014] constructing an initial loss function based on the predicted feedback response sequence, the dialogue feedback data, and the initial model parameters;
[0015] Construct a target reward function based on dialogue feedback data;
[0016] Performing a function calculation on the target feedback reply content and the predicted feedback reply content based on the target reward function to obtain a target reward value;
[0017] Constructing a model loss function based on the initial loss function, the target reward value, and a preset reward weight of the target reward value;
[0018] Model parameters are updated based on the model loss function, the target learning rate parameter, and the initial model parameters to obtain the current dialogue generation model.
[0019] In some embodiments, constructing an initial loss function based on the predicted feedback response sequence, the dialogue feedback data, and the initial model parameters includes:
[0020] Constructing a time step interval based on a target time step matched by the predicted feedback response sequence, wherein the target time step is an interval endpoint of the time step interval;
[0021] obtaining a sequence of predicted feedback reply intervals from the predicted feedback reply content based on the time step intervals;
[0022] performing a time step prediction based on the predicted feedback response sequence, the predicted feedback response interval sequence, the dialogue feedback data, and the initial model parameters to obtain a predicted output probability for the target time step, the predicted output probability being used to indicate a degree of matching of the predicted feedback response sequence predicted by the preset dialogue generation model based on the target time step;
[0023] The predicted output probability is logarithmically calculated based on the target time step and the total number of preset time steps to obtain the initial loss function.
[0024] In some embodiments, updating the model parameters based on the model loss function, the target learning rate parameter, and the initial model parameters to obtain the current dialogue generation model includes:
[0025] Performing gradient calculation on the initial model parameters based on the model loss function to obtain a gradient loss function;
[0026] Performing function adjustment on the gradient loss function based on the target learning rate to obtain an adjusted loss function;
[0027] Performing model parameter updates on the initial model parameters based on the adjusted loss function to obtain target model parameters;
[0028] The preset dialogue generation model is adjusted based on the target model parameters to obtain the current dialogue generation model.
[0029] In some embodiments, the preset dialogue generation model includes a preset policy network and a preset value network, and adjusting the preset dialogue generation model based on the target model parameters to obtain the current dialogue generation model includes:
[0030] extracting a cumulative reward value from the target model parameters;
[0031] Performing gradient calculation on the cumulative reward value to obtain a cumulative reward gradient value;
[0032] Extracting initial strategy parameters and initial value parameters from the initial model parameters;
[0033] Performing parameter updates on the initial strategy parameters based on the cumulative reward gradient value and the target learning rate parameter to obtain target strategy parameters;
[0034] Performing parameter updates on the initial value parameter based on the cumulative reward gradient value and the target learning rate parameter to obtain a target value parameter;
[0035] Adjusting the parameters of the preset strategy network based on the target strategy parameters to obtain an adjusted strategy network;
[0036] Adjusting the parameters of the preset value network based on the target value parameters to obtain an adjusted value network;
[0037] The current dialogue generation model is constructed based on the adjusted policy network and the adjusted value network.
[0038] In some embodiments, performing a function calculation on the target feedback reply content and the predicted feedback reply content based on the target reward function to obtain a target reward value includes:
[0039] Calculating the similarity between the target feedback reply content and the predicted feedback reply content to obtain a feedback reply similarity value;
[0040] Performing feedback data detection on the conversation feedback data based on a preset feedback text detection model to obtain an object feedback score;
[0041] Performing emotion detection on the conversation feedback data based on the object feedback score to obtain an object emotion score;
[0042] The target reward value is obtained by performing a weighted calculation on the feedback response similarity value, the object feedback score, and the object emotion score.
[0043] In some embodiments, updating the initial learning rate parameter based on the dialogue feedback data to obtain a target learning rate parameter includes:
[0044] extracting the dialogue interaction time and frequency from the dialogue feedback data;
[0045] performing interaction time detection on the dialogue feedback data based on the dialogue interaction time to obtain a dialogue interaction time score;
[0046] performing interaction frequency detection on the dialogue feedback data based on the dialogue interaction frequency to obtain a dialogue interaction frequency score;
[0047] performing feedback score calculation on the object emotion score, the conversation interaction time score, and the conversation interaction frequency score to obtain an implicit feedback score;
[0048] Calculating the difference between the preset expected feedback score of the target object and the implicit feedback score to obtain a feedback score difference;
[0049] The initial learning rate parameter is updated based on the feedback score difference to obtain the target learning rate parameter.
[0050] To achieve the above-mentioned purpose, a second aspect of an embodiment of the present application provides a virtual object-based dialogue generation device, the system comprising:
[0051] The first acquisition module is used to obtain the initial question text of the target object;
[0052] a first generation module configured to generate a dialogue based on a preset dialogue generation model for the initial question text to obtain initial response content, wherein the preset dialogue generation model is provided with an initial learning rate parameter and an initial model parameter, wherein the initial learning rate parameter is used to indicate the degree to which the preset dialogue generation model adjusts the content style and content behavior associated with the initial response content;
[0053] A second acquisition module is configured to acquire dialogue feedback data fed back by the target object in response to the initial response content, and acquire target feedback response content that matches the dialogue feedback data;
[0054] A learning rate parameter updating module, configured to update the initial learning rate parameter based on the dialogue feedback data to obtain a target learning rate parameter;
[0055] a second generation module, configured to perform dialogue generation on the dialogue feedback data based on the preset dialogue generation model and the target learning rate parameter to obtain predicted feedback reply content, wherein the target learning rate parameter is used to indicate the degree to which the preset dialogue generation model adjusts the content style and content behavior associated with the predicted feedback reply content;
[0056] A parameter updating module is used to update the initial model parameters based on the target learning rate parameter, the dialogue feedback data, the target feedback response content, and the predicted feedback response content to obtain a current dialogue generation model, and perform dialogue generation according to the current dialogue generation model.
[0057] To achieve the above-mentioned purpose, the third aspect of an embodiment of the present application proposes an electronic device, which includes a memory and a processor, the memory stores a computer program, and when the processor executes the computer program, it implements any method proposed in the first aspect of the embodiment of the present application.
[0058] To achieve the above-mentioned purpose, the fourth aspect of the embodiments of the present application further proposes a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements any method proposed in the first aspect of the embodiments of the present application.
[0059] The embodiments of the present application propose a virtual object-based dialogue generation method, apparatus, device, and storage medium. The method obtains an initial question text of a target object and performs dialogue generation on the initial question text based on a preset dialogue generation model to obtain initial reply content. The preset dialogue generation model is provided with an initial learning rate parameter and an initial model parameter. The initial learning rate parameter is used to indicate the degree of adjustment of the preset dialogue generation model to the content style and content behavior associated with the initial reply content. Further, dialogue feedback data fed back by the target object on the initial reply content is obtained, and target feedback reply content matching the dialogue feedback data is obtained. Further, the initial learning rate parameter is updated based on the dialogue feedback data to obtain a target learning rate parameter. The dialogue feedback data is performed based on the preset dialogue generation model and the target learning rate parameter to obtain predicted feedback reply content. The target learning rate parameter is used to indicate the degree of adjustment of the preset dialogue generation model to the content style and content behavior associated with the predicted feedback reply content. Further, the initial model parameters are updated based on the target learning rate parameter, the dialogue feedback data, the target feedback reply content, and the predicted feedback reply content to obtain a current dialogue generation model, and dialogue generation is performed according to the current dialogue generation model. Compared to related technologies that generate dialogues through preset dialogue templates, rules, or learned dialogue strategies, the dialogue content replied by the virtual object is likely to be inaccurate and lacks flexibility, making it difficult to better adapt to the target object's ever-changing dialogue needs. When generating dialogues, the present application can update the learning rate parameters of the preset dialogue generation model based on the dialogue feedback data of the target object on the reply content, thereby adjusting the content style and content behavior of the reply content generated by the preset dialogue generation model, and adjusting the preset dialogue generation model in combination with the updated learning rate parameters to obtain the current dialogue generation model, so as to generate dialogues for subsequent question texts. Therefore, the present application can flexibly adjust the behavior and style of the generated dialogue content of the virtual object and improve the accuracy of the dialogue response. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] Figure 1 This is a flow chart of a method for generating a dialogue based on a virtual object provided in an embodiment of the present application;
[0061] Figure 2 yes Figure 1 A flowchart of the specific method of step S140;
[0062] Figure 3 yes Figure 1 A flowchart of the specific method of step S160;
[0063] Figure 4 yes Figure 3 A flowchart of the specific method of step S320;
[0064] Figure 5 yes Figure 3 A flowchart of the specific method of step S340;
[0065] Figure 6 yes Figure 3 A flowchart of the specific method of step S360;
[0066] Figure 7 yes Figure 6 A flowchart of the specific method of step S640;
[0067] Figure 8 This is a module structure diagram of a virtual object-based dialogue generation device provided in an embodiment of the present application;
[0068] Figure 9 This is a hardware structure diagram of the electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0069] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0070] It should be noted that although the device schematics illustrate functional module divisions and the flowcharts illustrate logical sequences, in certain circumstances, the steps shown or described may be performed in a sequence that differs from the module divisions in the device or the sequence in the flowcharts. The terms "first," "second," and so on, in the specification, claims, and drawings, are used to distinguish similar items and are not necessarily used to describe a specific sequence or precedence.
[0071] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which this application pertains. The terms used herein are for the purpose of describing the embodiments of this application only and are not intended to limit this application.
[0072] First, let’s analyze some of the terms used in this application:
[0073] Artificial Intelligence (AI) is a new technical discipline that studies and develops theories, methods, technologies, and application systems for simulating, extending, and expanding human intelligence. A branch of computer science, AI seeks to understand the essence of intelligence and create new intelligent machines that can respond in a manner similar to human intelligence. Research in this field includes robotics, speech recognition, image recognition, natural language processing, and expert systems. AI can simulate the information processes of human consciousness and thinking. It also encompasses theories, methods, technologies, and application systems that use digital computers or digital computer-controlled machines to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results.
[0074] Natural Language Processing (NLP): NLP uses computers to process, understand, and apply human languages (such as Chinese and English). NLP is a branch of artificial intelligence and an interdisciplinary subject between computer science and linguistics. It is often referred to as computational linguistics. Natural language processing includes grammatical analysis, semantic analysis, and text understanding. Natural language processing is commonly used in technical fields such as machine translation, handwritten and printed character recognition, speech recognition and text-to-speech conversion, information retrieval, information extraction and filtering, text classification and clustering, public opinion analysis, and opinion mining. Natural language processing involves data mining related to language processing, machine learning, knowledge acquisition, knowledge engineering, artificial intelligence research, and linguistic research related to language computing.
[0075] Large Language Model (LLM): It is an artificial intelligence technology based on deep learning. It learns the grammar, semantics, and contextual information of the language by training on large amounts of text data, thereby being able to model natural language text.
[0076] Artificial Intelligence (AI)-based character dialogue refers to technology that uses AI-generated virtual characters to simulate human conversational behavior. An AI character dialogue system is a computer program that can simulate human conversational behavior, typically driven by NLP and machine learning technologies. These systems generate conversation content through pre-trained language models and exhibit specific character traits and behaviors when interacting with objects. In addition, dialogues based on AI virtual characters can be applied to task scenarios such as virtual assistants in fintech, customer service systems, and game character dialogues to provide personalized and humanized interactive experiences. The core of character dialogues based on virtual objects lies in their ability to simulate human language communication, analyzing user input and generating appropriate responses to conduct continuous multi-round conversations with the target object.
[0077] Currently, related technologies for generating character dialogues based on virtual objects typically respond to questions input by the target object through preset dialogue templates, rules, or learned dialogue strategies. However, because the dialogue behavior (such as the response text generated based on the target object's input) and dialogue style of these virtual characters are often fixed parameters set during the initial training phase, the dialogue content of the virtual object's responses is inaccurate and lacks flexibility, making it difficult to better adapt to the target object's ever-changing dialogue needs. Furthermore, existing systems often lack anthropomorphism when handling emotionally rich or highly personalized dialogues, failing to meet the target object's expectations for natural interaction. As such, the AI character dialogue systems used in related technologies have significant deficiencies in flexibility, naturalness, and meeting the target object's personalized needs. Therefore, how to propose a method for generating dialogues based on virtual objects that can flexibly adjust the virtual object's dialogue behavior and dialogue style to improve the accuracy of dialogue responses has become a pressing technical problem.
[0078] Based on this, the virtual object-based dialogue generation method, device, equipment, and storage medium provided in the embodiments of the present application can flexibly adjust the behavior and style of the virtual object's generated dialogue content and improve the accuracy of dialogue responses.
[0079] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Artificial Intelligence (AI) is the theory, method, technology, and application system that uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use knowledge to achieve optimal results.
[0080] Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interaction systems, and mechatronics. AI software technologies primarily encompass computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning / deep learning.
[0081] The virtual object-based dialogue generation method provided in the embodiment of the present application relates to the field of artificial intelligence technology. The virtual object-based dialogue generation method provided in the embodiment of the present application can be applied to a terminal, can be applied to a server side, or can be software running in a terminal or a server side. In some embodiments, the terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer or a smart watch, etc.; the server can be an independent server, or it can be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms; the software can be an application that implements a virtual object-based dialogue generation method, etc., but is not limited to the above forms.
[0082] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, and the like. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, and the like that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments in which tasks are performed by remote processing devices connected via a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media, including storage devices.
[0083] It should be noted that in each specific embodiment of the present application, when it comes to the need to perform relevant processing based on data related to the identity or characteristics of the object, such as the object's reply information, object historical data, and object identity information, the object's permission or consent will be obtained first, and the collection, use, and processing of such data will comply with relevant laws, regulations, and standards. In addition, when the embodiment of the present application needs to obtain the sensitive personal information of the object, the object's separate permission or consent will be obtained through a pop-up window or by jumping to a confirmation page. After clearly obtaining the object's separate permission or consent, the necessary object-related data for the normal operation of the embodiment of the present application will be obtained.
[0084] Please refer to Figure 1 , Figure 1It is an optional flowchart of the virtual object-based dialogue generation method provided in an embodiment of the present application. In some embodiments of the present application, the virtual object-based dialogue generation method of the embodiment of the present application includes but is not limited to steps S110 to S160.
[0085] Step S110, obtaining the initial question text of the target object;
[0086] Step S120, performing dialogue generation on the initial question text based on a preset dialogue generation model to obtain initial answer content;
[0087] Step S130: obtaining dialogue feedback data fed back by the target object in response to the initial response content, and obtaining target feedback response content that matches the dialogue feedback data;
[0088] Step S140, updating the initial learning rate parameter based on the dialogue feedback data to obtain the target learning rate parameter;
[0089] Step S150 , performing dialogue generation on the dialogue feedback data based on a preset dialogue generation model and a target learning rate parameter to obtain predicted feedback response content;
[0090] Step S160 , based on the target learning rate parameters, the dialogue feedback data, the target feedback response content, and the predicted feedback response content, the initial model parameters are updated to obtain the current dialogue generation model, and dialogue generation is performed according to the current dialogue generation model.
[0091] In some embodiments, in steps S110 to S160, the present application can generate dialogue content using a preset dialogue generation model and adjust the model's output of the AI character's content behavior and style based on dialogue feedback data provided by the target subject regarding the initial response. In other words, the present application can automatically optimize the preset dialogue generation model during the interaction process, enabling the AI character to better adapt to the target subject's personalized needs and preferences, thereby providing a more natural and coherent interactive experience.
[0092] In step S110 of some embodiments, the initial question text refers to the question information entered by the target subject in an application system with a virtual object dialogue. For example, in the insurance field of FinTech, the target subject is a user who inquires about insurance products (such as social insurance, medical insurance, etc.). In this case, the target subject can exchange information with an intelligent robot (i.e., a virtual object set up in the insurance system) in the insurance system, and the information entered by the target subject is equivalent to the initial question text. In this case, the initial question text may include the question the target subject wants to ask, the target subject's response content, etc., without specific limitation.
[0093] In step S120 of some embodiments, the preset dialogue generation model is an artificial intelligence technology specifically designed to simulate the interactive process of human conversation. This model can understand and generate natural language to achieve effective communication with the target audience. The preset dialogue generation model used in this application refers to a predefined model that can generate dialogue responses based on the input question text.
[0094] The preset dialogue generation model has an initial learning rate parameter and initial model parameters. The initial learning rate parameter indicates the degree to which the preset dialogue generation model adjusts the content style and content behavior associated with the initial response content. Specifically, the initial learning rate parameter is a hyperparameter that controls the speed of parameter updates during model training. During the learning process, the learning rate determines the magnitude of model weight updates. The initial model parameters refer to the parameter settings obtained after the preset dialogue generation model is trained. These parameters determine the current behavior and performance of the preset dialogue generation model. The content style associated with the initial response content refers to the style of the response content currently generated by the preset dialogue generation model, such as formal, informal, or humorous. The content behavior associated with the initial response content refers to the behavior of the response content currently generated by the preset dialogue generation model, such as directly answering the question, providing suggestions, or asking for more information. Furthermore, the degree of adjustment refers to how the initial learning rate parameter affects the model's adjustment of the response content style. Furthermore, a higher initial learning rate parameter may result in larger changes in the model's style, while a lower initial learning rate parameter may result in more subtle adjustments.
[0095] It's understandable that when the preset dialogue generation model processes the initial question text input by the target participant, it generates responses based on the preset initial learning rate and initial model parameters. The initial learning rate influences how the model adjusts the style and behavior of its generated responses. Specifically, it determines the model's sensitivity or magnitude to these style and behavior adjustments when generating responses. This controls how the model reacts to the input question when generating responses, ensuring that they more closely align with the expected conversational style and behavior.
[0096] It should be noted that when generating the reply content, the preset dialogue generation model can first understand the initial question text entered by the target object, which usually involves understanding the grammar, semantics and context of the language. Furthermore, the preset dialogue generation model can maintain the state of the dialogue, understand the flow of the dialogue, and decide what actions should be taken at each stage of the dialogue. In order to make the dialogue coherent, the preset dialogue generation model can record the historical dialogue between the target object and the virtual object, and construct smooth, natural and relevant reply content. Among them, the preset dialogue generation model adopted in this application can be constructed based on the model structure of deep learning, such as LLM, Recurrent Neural Network (RNN), Long Short-Term Memory Network (LSTM), Transformer, etc., which are not specifically limited here.
[0097] It should be noted that when the preset dialogue generation model has not been adjusted, the initial learning rate parameter of this application can be a fixed parameter, and the parameter can be set to any value between 0.001 and 0.01, and can be selected through cross-validation or experiments to ensure the stability of the preset dialogue generation model in the initial stage.
[0098] In step S130 of some embodiments, further, after the target object obtains the initial reply content, the present application can collect and analyze the target object's dialogue feedback data, that is, user feedback. At this time, the dialogue feedback data can be positive, negative or neutral, and the dialogue feedback data can be obtained through direct input from the target object (such as ratings, comments) or through indirect interaction data (such as user emotional changes and response time, etc.) to obtain the target object's evaluation, rating, further question text or other forms of response. The target feedback reply content refers to the matching reply content queried in the preset content library based on the object feedback data, as the reply content expected by the target object.
[0099] It's important to note that in practical applications, the dialogue generation system can actively or passively collect feedback from the target user on the AI character's performance after each interaction or at specific intervals. This data, known as conversation feedback, allows users to understand their satisfaction with and acceptance of the initial responses. Furthermore, based on this feedback data, the AI character's behavior and conversational style can be dynamically adjusted, enhancing the naturalness and flexibility of the character's interactions.
[0100] In step S140 of some embodiments, the present application may further update the initial learning rate parameters based on the dialogue feedback data to obtain target learning rate parameters. In other words, the present application may use the dialogue feedback data as a basis for adjusting the learning rate parameters. The target learning rate parameters are the updated new learning rate parameters, which reflect the adjustments made by the preset dialogue generation model based on the dialogue feedback data, so that the preset dialogue generation model can better adapt to the preferences and needs of the target object and improve the quality and relevance of the dialogue. In addition, by lowering or increasing the learning rate, the system can control the speed of model parameter updates, thereby affecting the speed at which the model adapts to new information and the effect of dialogue generation.
[0101] For example, if user feedback indicates that the responses generated by the conversation are not accurate or relevant enough, the system may increase the learning rate to adjust the model parameters more quickly and improve the accuracy of the responses. Conversely, if the responses are already good enough, the system may reduce the learning rate to avoid over-adjustment and maintain model stability. As can be seen, an excessively large learning rate may cause the model to oscillate around the optimal solution, or in extreme cases, cause the model to diverge. While an excessively small learning rate can ensure eventual convergence of the model, it will significantly slow down model training and may cause the model to become trapped in a local optimal solution. In this way, by accurately adjusting the initial learning rate parameter, automatic optimization of the preset conversation generation model can be achieved, improving the user experience.
[0102] Please refer to Figure 2 , Figure 2 140 is a flowchart of a specific method of step S140 provided in an embodiment of the present application. In some embodiments of the present application, step S140 may specifically include but is not limited to steps S210 to S260.
[0103] Step S210, extracting the dialogue interaction time and dialogue interaction frequency from the dialogue feedback data;
[0104] Step S220: performing interaction time detection on the dialogue feedback data based on the dialogue interaction time to obtain a dialogue interaction time score;
[0105] Step S230, performing interaction frequency detection on the dialogue feedback data based on the dialogue interaction frequency to obtain a dialogue interaction frequency score;
[0106] Step S240 , calculating a feedback score based on the subject's emotion score, the conversation interaction time score, and the conversation interaction frequency score to obtain an implicit feedback score;
[0107] Step S250, performing a difference calculation between the preset expected feedback score and the implicit feedback score of the target object to obtain a feedback score difference;
[0108] Step S260: Update the initial learning rate parameter based on the feedback score difference to obtain the target learning rate parameter.
[0109] In step S210 of some embodiments, when updating the learning rate parameters, the present application can determine whether the current reply content has achieved the expected result of the target object by introducing implicit feedback scoring to dynamically adjust the learning rate parameters. Specifically, the dialogue interaction time and dialogue interaction frequency between the target object and the dialogue system can be extracted from the dialogue feedback data. Among them, if the target object spends a long time in the dialogue process with the dialogue system, it can be indicated that the target object has a high degree of acceptance of the reply content generated by the dialogue system, otherwise it indicates that the target object is dissatisfied with the generated reply content. The frequency of dialogue between the target object and the dialogue system can also reflect implicit feedback. For example, a higher dialogue frequency indicates that the target object is interested in the reply content generated by the system, and a lower frequency means that the generated reply content does not meet expectations. In this way, these data can be used to analyze the target object's participation and the fluency of the dialogue.
[0110] In step S220 of some embodiments, the present application may further evaluate the length of time it takes the target subject to respond to the system, i.e., the conversation interaction time. For example, the conversation interaction time indicates how often the target subject replies to the reply content. A score, i.e., a conversation interaction time score, may be assigned based on this time, reflecting the timeliness of the target subject's response.
[0111] In step S230 of some embodiments, the present application may further provide a score for the conversation interaction frequency, namely, a conversation interaction frequency score, which reflects the activity and participation of the target object.
[0112] In step S240 of some embodiments, the present application may further perform a feedback score calculation on the object's emotion score, conversation interaction time score, and conversation interaction frequency score to obtain an implicit feedback score.
[0113] It should be noted that the subject sentiment score is determined by performing sentiment detection on the conversation feedback data. By analyzing the target subject's emotional information (such as facial expression, tone of voice, and text sentiment analysis), we can determine the target subject's emotional state during the conversation. If the sentiment tends to be negative, it indicates that the target subject is dissatisfied with the conversation response; otherwise, it indicates satisfaction. The specific calculation process of the subject sentiment score is described in the subsequent examples and is not detailed here.
[0114] It should be noted that the implicit feedback score is calculated by weighting the object sentiment score, conversation interaction time score, and conversation interaction frequency score: Implicit Feedback Score = w1 * Object Sentiment Score + w2 * Conversation Interaction Time Score + w3 * Conversation Interaction Frequency Score. w1 is the sentiment analysis weight corresponding to the object sentiment score, indicating the degree to which the object sentiment score, determined by the target object's emotional state (positive or negative), influences the implicit feedback score; w2 is the interaction time weight corresponding to the conversation interaction time score, indicating the degree to which the conversation interaction time score influences the implicit feedback score; and w3 is the interaction time weight corresponding to the conversation interaction time score, indicating the degree to which the conversation interaction frequency score influences the implicit feedback score.
[0115] In step S250 of some embodiments, the preset expected feedback score is a preset target subject's expected feedback score for the generated dialogue content, which is equivalent to a score threshold. For example, a high score corresponds to a smaller learning rate change, and a low score corresponds to a larger learning rate change. In this way, the present application can compare the preset expected feedback score with the actual implicit feedback score and calculate the difference. This difference can be used to evaluate the difference between system performance and the target subject's expectations.
[0116] In step S260 of some embodiments, the initial learning rate parameter may be further adjusted based on the feedback score difference to obtain a new target learning rate parameter. If the difference is large, it may mean that the model needs to be adjusted more quickly to meet the expectations of the target object, and the learning rate parameter may be increased; if the difference is small, it may mean that the model needs to be adjusted more stably to avoid overreaction, and the learning rate parameter may be reduced.
[0117] It should be noted that the process of calculating the target learning rate parameter can be shown in the following formula 1:
[0118]
[0119] Among them, α represents the target learning rate parameter, α0 represents the initial learning rate parameter, and β represents the preset adjustment coefficient, which is used to control the sensitivity of the learning rate parameter change and can be adjusted according to actual needs; f target represents the preset expected feedback score, f actual Represents the implicit feedback rating.
[0120] In step S150 of some embodiments, the target learning rate parameter is used to indicate the degree to which the preset dialogue generation model adjusts the content style and content behavior associated with the predicted feedback response content based on the adjusted learning rate parameter. In other words, the application can use the adjusted learning rate parameter to regenerate predicted feedback response content corresponding to the dialogue feedback data to predict the response that the target participant may expect.
[0121] In step S160 of some embodiments, the present application may further combine the target learning rate parameter, the dialogue feedback data, the target feedback response content, and the predicted feedback response content to adjust the initial model parameters and generate a current dialogue generation model. This current dialogue generation model is then used to continue dialogue generation, improving the model's accuracy and adaptability to generate responses that better meet the target audience's expectations.
[0122] In the above embodiment, the application can analyze the collected feedback using natural language processing technology and understand the emotions, needs, and preferences of the user feedback through a large language model. Then, reinforcement learning methods are used to optimize the generation parameters of the preset dialogue generation model, so that the behavior and conversation style of the AI character can better adapt to the user's personalized needs.
[0123] In some embodiments, the present application can further optimize the model by optimizing the loss function of the preset dialogue generation model, that is, the loss function at this time can include a reward signal of user feedback.
[0124] Please refer to Figure 3 , Figure 3 160 is a flowchart of a specific method of step S160 provided in an embodiment of the present application. In some embodiments of the present application, step S160 may specifically include but is not limited to steps S310 to S360.
[0125] Step S310, obtaining a predicted feedback reply sequence from the predicted feedback reply content;
[0126] Step S320, constructing an initial loss function based on the predicted feedback response sequence, the conversation feedback data, and the initial model parameters;
[0127] Step S330, constructing a target reward function based on the dialogue feedback data;
[0128] Step S340, performing a function calculation on the target feedback reply content and the predicted feedback reply content based on the target reward function to obtain a target reward value;
[0129] Step S350, constructing a model loss function based on the initial loss function, the target reward value, and a preset reward weight of the target reward value;
[0130] Step S360: Update the model parameters based on the model loss function, the target learning rate parameters, and the initial model parameters to obtain the current dialogue generation model.
[0131] In step S310 of some embodiments, the predicted feedback reply content of the present application refers to the reply content of a predicted feedback reply sequence containing T (T is a positive integer) time steps, and the predicted feedback reply sequence may include a series of elements for representing words, phrases or smaller language units for subsequent analysis and calculation.
[0132] In step S320 of some embodiments, an initial loss function may be constructed using the predicted feedback response sequence, the dialogue feedback data, and the initial model parameters. This function is used to evaluate the difference between the model's predictions and the target object's actual feedback, and to guide the adjustment of the model parameters.
[0133] Please refer to Figure 4 , Figure 4 4. This is a flowchart of a specific method of step S320 provided in an embodiment of the present application. In some embodiments of the present application, step S320 may specifically include but is not limited to steps S410 to S440.
[0134] Step S410, constructing a time step interval based on the target time step matched by the predicted feedback response sequence;
[0135] Step S420, obtaining a predicted feedback reply interval sequence from the predicted feedback reply content based on the time step interval;
[0136] Step S430 , performing time step prediction based on the predicted feedback response sequence, the predicted feedback response interval sequence, the conversation feedback data, and the initial model parameters to obtain a predicted output probability for the target time step;
[0137] Step S440 , performing logarithmic calculation on the predicted output probability based on the target time step and the total number of preset time steps to obtain an initial loss function.
[0138] In step S410 of some embodiments, the time step matched by the predicted feedback reply sequence may be recorded as the target time step, for example, the predicted feedback reply sequence y t The corresponding target time step is time step t. At this time, the time step interval constructed based on the target time step is [1, t-1], and the target time step is the interval endpoint of the time step interval.
[0139] In step S420 of some embodiments, the present application may obtain a predicted feedback reply interval sequence from the predicted feedback reply content based on the time step interval, which includes a feedback reply sequence corresponding to each time step in the time step interval.
[0140] In some embodiments, in steps S430 and S440, the present application may further perform time step prediction based on the predicted feedback response sequence, the predicted feedback response interval sequence, the dialogue feedback data, and the initial model parameters to obtain a predicted output probability for the target time step, and the predicted output probability is used to indicate the degree of match of the predicted feedback response sequence predicted by the preset dialogue generation model based on the target time step. Furthermore, the present application may perform a logarithmic calculation on the predicted output probability based on the target time step and the total number of preset time steps to obtain an initial loss function. The specific calculation process for determining the predicted output probability for the target time step in the present application is shown in Formula 2 below:
[0141]
[0142] In Formula 2, L1(θ) represents the initial loss function, T represents the total number of preset time steps, and y t represents the prediction feedback reply sequence, y 1:t-1 represents the predicted feedback response interval sequence, x represents the dialogue feedback data, θ represents the initial model parameters, P(y t |y 1:t-1 ,x;θ) represents the time step y before the given 1:t-1 (i.e. from y1 to y t ) and input x, generate the current time step y t Here P is the probability distribution, i.e. the predicted output probability at the target time step.
[0143] In step S330 of some embodiments, the present application may further construct a target reward function based on the dialogue feedback data. This function is used to evaluate the performance of the dialogue system and provide positive or negative feedback to motivate the model to develop in a better direction.
[0144] In step S340 of some embodiments, the present application may further perform a function calculation on the target feedback response content and the predicted feedback response content based on the target reward function to obtain a target reward value. In other words, the present application may determine the target reward value based on the subject's feedback data, and adjust the model based on the target reward value to make the model's generated dialogue more consistent with the target subject's expectations.
[0145] Please refer to Figure 5 , Figure 5 3 is a flowchart of a specific method of step S340 provided in an embodiment of the present application. In some embodiments of the present application, step S340 may specifically include but is not limited to steps S510 to S540.
[0146] Step S510, calculating the similarity between the target feedback reply content and the predicted feedback reply content to obtain a feedback reply similarity value;
[0147] Step S520: performing feedback data detection on the conversation feedback data based on a preset feedback text detection model to obtain an object feedback score;
[0148] Step S530, performing sentiment detection on the conversation feedback data based on the object feedback score to obtain the object sentiment score;
[0149] Step S540: Perform weighted calculation on the feedback response similarity value, the object feedback score, and the object sentiment score to obtain a target reward value.
[0150] In step S510 of some embodiments, when determining the target reward value, the present application may consider the object feedback score and the sentiment positivity, that is, the higher the object feedback score and the more positive the sentiment analysis result, the greater the reward value. Specifically, a similarity calculation method (such as cosine similarity, Jaccard similarity, or edit distance) can be used to quantify the similarity between the target feedback reply content and the predicted feedback reply content to obtain a feedback reply similarity value.
[0151] In step S520 of some embodiments, a preset feedback text detection model may be further used to analyze the conversation feedback data. This model may be based on natural language processing technology to identify key features of the conversation feedback data and provide a score to evaluate the quality or relevance of the conversation feedback data.
[0152] In step S530 of some embodiments, the present application may further utilize sentiment analysis technology to further analyze the sentiment tendency in the dialogue feedback data, such as positive, negative, or neutral, based on the object feedback score, and quantify it to obtain an object sentiment score.
[0153] In step S540 of some embodiments, to comprehensively consider the similarity of responses, the quality of feedback, and the sentiment of the responses, the application may perform a weighted calculation on the response similarity value, the subject feedback score, and the subject sentiment score to obtain a target reward value. This weighted calculation assigns different weights to each factor based on its importance, ultimately resulting in a target reward value. This reward value reflects the overall performance of the dialogue system in the dialogue interaction.
[0154] In step S350 of some embodiments, the present application may combine the initial loss function, the target reward value, and the preset reward weight to construct a model loss function. This function comprehensively considers the accuracy of the model prediction and the performance of the dialogue system, and is used to guide the optimization of the model parameters. The specific calculation process of the model loss function can be seen in the following formula 3:
[0155]
[0156] In Formula 3, L(θ) represents the model loss function, λ represents the preset reward weight, Represents the target reward function used to evaluate the predicted feedback response content of the preset dialogue generation model The target reward value between the actual target feedback response content y, and the specific form of the reward function can be flexibly adjusted according to the actual task scenario without limitation. It represents the weighted value of the target reward function subtracted from the initial loss function, indicating that if the value of the target reward function is higher (that is, the model's prediction is better), then this part will reduce the total loss, thereby encouraging the model to learn better parameters.
[0157] In step S360 of some embodiments, the present application may further use the model loss function and the target learning rate parameters to update the initial model parameters, and this process involves gradient descent or other optimization algorithms, the purpose of which is to reduce model loss, improve model performance, and generate more accurate dialogue responses.
[0158] In the above embodiment, the present application can use object feedback data to optimize model parameters through reinforcement learning, and gradually adjust the dialogue content generated by the model to make it more coherent and in line with user expectations in long-term interactions. For example, when the preset dialogue generation model is a model built based on LLM, the present application dynamically optimizes the model by introducing user feedback signals, so that the generated dialogue content is more in line with user expectations, thereby improving the user experience. In addition, the present application can not only process directly input object feedback data, but also combine indirect data such as sentiment analysis, usually through long-term continuous learning to achieve multi-dimensional optimization of the performance of AI characters, flexibly adjust the behavior and style of the generated dialogue content of virtual objects, and improve the accuracy of dialogue responses.
[0159] Please refer to Figure 6 , Figure 6 3 is a flowchart of a specific method of step S360 provided in an embodiment of the present application. In some embodiments of the present application, step S360 may specifically include but is not limited to steps S610 to S640.
[0160] Step S610, performing gradient calculation on the initial model parameters based on the model loss function to obtain a gradient loss function;
[0161] Step S620, adjusting the gradient loss function based on the target learning rate to obtain an adjusted loss function;
[0162] Step S630, updating the initial model parameters based on the adjusted loss function to obtain target model parameters;
[0163] Step S640 , adjusting the preset dialogue generation model based on the target model parameters to obtain a current dialogue generation model.
[0164] In step S610 of some embodiments, when adjusting the model, the present application may use a gradient descent algorithm to derive the model loss function with respect to the initial model parameters to obtain a gradient. This gradient represents the direction in which the loss function rises at the current parameter point, and the opposite direction represents the direction in which the parameters are updated.
[0165] In step S620 of some embodiments, the gradient is further multiplied by the target learning rate parameter to obtain an adjusted gradient, i.e., an adjusted loss function. This adjusted loss function is used to update the model parameters, and the learning rate determines the magnitude of the update.
[0166] In some embodiments, in steps S630 and S640, the original initial model parameters may be further added with the adjusted gradient (or subtracted, depending on the implementation of the optimization algorithm) to obtain updated model parameters, i.e., target model parameters, to find the parameter values that minimize the loss function. The target model parameters are then used to replace the original model parameters to obtain a new, optimized preset dialogue generation model, i.e., the current dialogue generation model. This model should be able to provide better performance in subsequent dialogue generation tasks. Based on this, the calculation process for determining the target model parameters in this application can be shown in the following formula 4:
[0167]
[0168] In Formula 4, θ new represents the target model parameters, θ old represents the initial model parameters, represents the adjusted loss function, and α represents the target learning rate parameter.
[0169] In the above embodiment, the present application can continuously iterate the parameter optimization process so that the preset dialogue generation model can gradually learn better parameter configurations, thereby improving its performance in the dialogue generation task. The present application can achieve adaptive updates and reinforcement learning, that is, the present application can use reinforcement learning to enable the model to not only pay attention to the feedback in the current dialogue, but also to how to optimize the overall strategy in multiple rounds of interaction to adapt to the long-term preferences and needs of different users. In addition, the reinforcement learning of the present application introduces a reward mechanism, which allows the model to learn how to continuously improve in future dialogues based on user feedback, thereby forming a more intelligent and personalized dialogue strategy.
[0170] It should be noted that the preset dialogue generation model includes a preset policy network and a preset value network. The preset policy network is used to determine what dialogue response the system should generate in each dialogue state. The preset value network is used to estimate the long-term rewards of the current state and action, thereby determining whether a certain action is worth taking in a certain state.
[0171] Please refer to Figure 7 , Figure 7 4 is a flowchart of a specific method of step S640 provided in an embodiment of the present application. In some embodiments of the present application, step S640 may specifically include but is not limited to steps S710 to S780.
[0172] Step S710, extracting the accumulated reward value from the target model parameters;
[0173] Step S720, performing gradient calculation on the cumulative reward value to obtain a cumulative reward gradient value;
[0174] Step S730, extracting initial strategy parameters and initial value parameters from the initial model parameters;
[0175] Step S740, updating the initial policy parameters based on the cumulative reward gradient value and the target learning rate parameter to obtain the target policy parameters;
[0176] Step S750, updating the initial value parameter based on the cumulative reward gradient value and the target learning rate parameter to obtain the target value parameter;
[0177] Step S760, adjusting the parameters of the preset strategy network based on the target strategy parameters to obtain an adjusted strategy network;
[0178] Step S770, adjusting the parameters of the preset value network based on the target value parameters to obtain an adjusted value network;
[0179] Step S780: construct a current dialogue generation model based on the adjusted policy network and the adjusted value network.
[0180] In some embodiments, during steps S710 and S720 of the model generation dialogue, the present application may record the reward value obtained at each step of the model and accumulate it to obtain a cumulative reward value. Furthermore, the cumulative reward value may be differentiated with respect to the model parameters to obtain a cumulative reward gradient value. This cumulative reward gradient value indicates how the model parameters affect the accumulation of rewards, that is, determines the rate of change of the cumulative reward value relative to the model parameters.
[0181] In step S730 of some embodiments, in reinforcement learning, since the preset dialogue generation model of the present application includes a preset strategy network (determining the choice of action) and a preset value network (evaluating the value of the current state), the parameters of these two parts can be extracted from the initial model parameters to obtain the initial strategy parameters and the initial value parameters.
[0182] In steps S740 to S770 of some embodiments, further, the present application may use the cumulative reward gradient value and the target learning rate parameter to adjust the initial policy parameters in order to obtain higher rewards in subsequent dialogue generation. Similarly, the cumulative reward gradient value and the target learning rate parameter may be used to adjust the initial value parameter to improve the accuracy of the preset value network's assessment of the state value. Further, the present application may apply the updated target policy parameters to the preset policy network for parameter adjustment to obtain an adjusted policy network, and apply the target value parameters to the preset value network for parameter adjustment to obtain an adjusted value network.
[0183] In step S780 of some embodiments, the present application can construct a new current dialogue generation model by integrating the adjusted policy network and the adjusted value network. This model should be able to provide better performance in subsequent dialogue generation tasks.
[0184] It should be noted that this application can adjust the policy network based on the rewards of user feedback, and the reinforcement learning algorithm will make the next dialogue generation more in line with user expectations. This application can use the policy gradient method to update the preset policy network. In addition, the value network estimates the "long-term rewards" of the current dialogue state. When the model generates a dialogue and receives user feedback, the system will not only consider the immediate reward, but also estimate the rewards that may be obtained in the future under this state. Therefore, the preset value network of this application can be updated using the Q-learning algorithm, and the updated value network helps the model better judge when to generate a more detailed response and when to simplify the answer, thereby improving the long-term satisfaction of users.
[0185] It should be noted that the non-Company's software tools or components that appear in the embodiments of this application are merely examples and do not represent actual use.
[0186] A method for generating conversations based on virtual objects provided in an embodiment of the present application can continuously update the policy network and the value network based on multiple rounds of user feedback, so that the AI character can adapt to user needs. In other words, the policy updates after each conversation will be accumulated into the long-term policy optimization, so that the model can not only improve the conversation generation quality in the short term, but also gradually adapt to the personalized needs of users through the reinforcement learning framework. The present application can realize the dynamic adjustment of the conversation generation model, which means that the model can make an immediate response based on user feedback in the short term, that is, the behavior of generating conversations can be adjusted based on the user's feedback in each interaction. This adjustment is an optimization for the current conversation, and the goal is to immediately improve the quality of the conversation generated by the model and make the output of the model more in line with user needs. In other words, the present application can be adjusted in the short term, and the model will quickly adjust the parameters based on user feedback after each conversation, so as to generate a response that is more in line with user expectations in the next round of conversation.
[0187] Please refer to Figure 8 , Figure 8 : is a schematic diagram of the module structure of the virtual object-based dialogue generation device provided in an embodiment of the present application. In some embodiments of the present application, the virtual object-based dialogue generation device may specifically include:
[0188] A first acquisition module 810 is used to acquire an initial question text of a target object;
[0189] A first generation module 820 is configured to generate a dialogue based on the initial question text to obtain initial response content. The preset dialogue generation model is provided with an initial learning rate parameter and an initial model parameter. The initial learning rate parameter indicates the degree to which the preset dialogue generation model adjusts the content style and content behavior associated with the initial response content.
[0190] The second acquisition module 830 is used to acquire the dialogue feedback data fed back by the target object in response to the initial reply content, and acquire the target feedback reply content that matches the dialogue feedback data;
[0191] A learning rate parameter updating module 840 is configured to update an initial learning rate parameter based on the dialogue feedback data to obtain a target learning rate parameter;
[0192] A second generation module 850 is configured to perform dialogue generation on the dialogue feedback data based on a preset dialogue generation model and a target learning rate parameter to obtain predicted feedback response content. The target learning rate parameter is used to indicate the degree to which the preset dialogue generation model adjusts the content style and content behavior associated with the predicted feedback response content.
[0193] The parameter update module 860 is used to update the initial model parameters based on the target learning rate parameters, the dialogue feedback data, the target feedback response content, and the predicted feedback response content to obtain the current dialogue generation model and perform dialogue generation based on the current dialogue generation model.
[0194] It should be noted that the virtual object-based dialogue generation device of the embodiment of the present application is used to execute the above-mentioned virtual object-based dialogue generation method, and the virtual object-based dialogue generation device of the embodiment of the present application corresponds to the above-mentioned virtual object-based dialogue generation method. For the specific training process, please refer to the above-mentioned virtual object-based dialogue generation method, which will not be described here one by one.
[0195] An embodiment of the present application also provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, the virtual object-based dialogue generation method of the above-mentioned embodiment of the present application is implemented.
[0196] The electronic device may be any intelligent terminal including a mobile phone, a tablet computer, a personal digital assistant (PDA), a car computer, etc.
[0197] The following combination Figure 9 The electronic device according to the embodiment of the present application is introduced in detail.
[0198] Please refer to Figure 9 , Figure 9 The hardware structure of an electronic device according to another embodiment is shown, including:
[0199] The processor 910 may be implemented as a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is configured to execute relevant programs to implement the technical solutions provided in the embodiments of the present application.
[0200] The memory 920 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 920 can store an operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 920 and is called by the processor 910 to execute the virtual object-based dialogue generation method of the embodiments of this application.
[0201] Input / output interface 930, used to implement information input and output;
[0202] Communication interface 940, used to implement communication interaction between this device and other devices, which can be achieved through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WiFi, Bluetooth, etc.);
[0203] bus 950 , which transmits information between various components of the device (e.g., processor 910 , memory 920 , input / output interface 930 , and communication interface 940 );
[0204] The processor 910 , the memory 920 , the input / output interface 930 , and the communication interface 940 are connected to each other in communication within the device via a bus 950 .
[0205] An embodiment of the present application also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the virtual object-based dialogue generation method of the above-mentioned embodiment of the present application.
[0206] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely arranged relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0207] The embodiments described in the embodiments of this application are intended to more clearly illustrate the technical solutions of the embodiments of this application and do not constitute a limitation on the technical solutions provided by the embodiments of this application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of this application are also applicable to similar technical problems.
[0208] Those skilled in the art will understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.
[0209] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, i.e., they may be located in one place or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of this embodiment.
[0210] Those skilled in the art will appreciate that all or some of the steps in the methods, systems, and functional modules / units in the devices disclosed above may be implemented as software, firmware, hardware, or appropriate combinations thereof.
[0211] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0212] It should be understood that in this application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0213] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0214] Units described as separate components may or may not be physically separate, and components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0215] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0216] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes multiple instructions for enabling an electronic device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes various media that can store programs, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0217] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but are not intended to limit the scope of the present invention. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and essence of the present invention should be within the scope of the present invention.
Claims
1. A method for generating dialogue based on virtual objects, characterized in that: The method comprises: Get the target object's initial question text; Performing dialogue generation on the initial question text based on a preset dialogue generation model to obtain initial answer content, wherein the preset dialogue generation model is provided with an initial learning rate parameter and an initial model parameter, wherein the initial learning rate parameter is used to indicate the degree to which the preset dialogue generation model adjusts the content style and content behavior associated with the initial answer content; Acquire dialogue feedback data fed back by the target object in response to the initial response content, and acquire target feedback response content that matches the dialogue feedback data; Updating the initial learning rate parameter based on the dialogue feedback data to obtain a target learning rate parameter; performing dialogue generation on the dialogue feedback data based on the preset dialogue generation model and the target learning rate parameter to obtain predicted feedback reply content, wherein the target learning rate parameter is used to indicate the degree to which the preset dialogue generation model adjusts the content style and content behavior associated with the predicted feedback reply content; Based on the target learning rate parameter, the dialogue feedback data, the target feedback reply content and the predicted feedback reply content, the initial model parameters are updated to obtain a current dialogue generation model, and dialogue generation is performed according to the current dialogue generation model, wherein the parameter updating of the initial model parameters based on the target learning rate parameter, the dialogue feedback data, the target feedback reply content and the predicted feedback reply content to obtain the current dialogue generation model includes: obtaining a predicted feedback reply sequence from the predicted feedback reply content; constructing an initial loss function based on the predicted feedback reply sequence, the dialogue feedback data and the initial model parameters; constructing a target reward function based on the dialogue feedback data; performing function calculation on the target feedback reply content and the predicted feedback reply content based on the target reward function to obtain a target reward value; constructing a model loss function based on the initial loss function, the target reward value and the preset reward weight of the target reward value; and updating the model parameters based on the model loss function, the target learning rate parameter and the initial model parameters to obtain the current dialogue generation model.
2. The method according to claim 1, characterized in that The constructing an initial loss function based on the predicted feedback response sequence, the dialogue feedback data, and the initial model parameters includes: Constructing a time step interval based on a target time step matched by the predicted feedback response sequence, wherein the target time step is an interval endpoint of the time step interval; obtaining a sequence of predicted feedback reply intervals from the predicted feedback reply content based on the time step intervals; performing a time step prediction based on the predicted feedback response sequence, the predicted feedback response interval sequence, the dialogue feedback data, and the initial model parameters to obtain a predicted output probability for the target time step, the predicted output probability being used to indicate a degree of matching of the predicted feedback response sequence predicted by the preset dialogue generation model based on the target time step; The predicted output probability is logarithmically calculated based on the target time step and the total number of preset time steps to obtain the initial loss function.
3. The method according to claim 1, characterized in that The updating of model parameters based on the model loss function, the target learning rate parameter, and the initial model parameters to obtain the current dialogue generation model includes: Performing gradient calculation on the initial model parameters based on the model loss function to obtain a gradient loss function; Performing function adjustment on the gradient loss function based on the target learning rate to obtain an adjusted loss function; Performing model parameter updates on the initial model parameters based on the adjusted loss function to obtain target model parameters; The preset dialogue generation model is adjusted based on the target model parameters to obtain the current dialogue generation model.
4. The method according to claim 3, characterized in that The preset dialogue generation model includes a preset strategy network and a preset value network, and the adjusting the preset dialogue generation model based on the target model parameters to obtain the current dialogue generation model includes: extracting a cumulative reward value from the target model parameters; Performing gradient calculation on the cumulative reward value to obtain a cumulative reward gradient value; Extracting initial strategy parameters and initial value parameters from the initial model parameters; Performing parameter updates on the initial strategy parameters based on the cumulative reward gradient value and the target learning rate parameter to obtain target strategy parameters; Performing parameter updates on the initial value parameter based on the cumulative reward gradient value and the target learning rate parameter to obtain a target value parameter; Adjusting the parameters of the preset strategy network based on the target strategy parameters to obtain an adjusted strategy network; Adjusting the parameters of the preset value network based on the target value parameters to obtain an adjusted value network; The current dialogue generation model is constructed based on the adjusted policy network and the adjusted value network.
5. The method according to any one of claims 1 to 4, characterized in that The performing a function calculation on the target feedback reply content and the predicted feedback reply content based on the target reward function to obtain a target reward value includes: Calculating the similarity between the target feedback reply content and the predicted feedback reply content to obtain a feedback reply similarity value; Performing feedback data detection on the conversation feedback data based on a preset feedback text detection model to obtain an object feedback score; Performing emotion detection on the conversation feedback data based on the object feedback score to obtain an object emotion score; The target reward value is obtained by performing a weighted calculation on the feedback response similarity value, the object feedback score, and the object emotion score.
6. The method according to claim 5, characterized in that The updating of the initial learning rate parameter based on the dialogue feedback data to obtain a target learning rate parameter includes: extracting the dialogue interaction time and frequency from the dialogue feedback data; performing interaction time detection on the dialogue feedback data based on the dialogue interaction time to obtain a dialogue interaction time score; performing interaction frequency detection on the dialogue feedback data based on the dialogue interaction frequency to obtain a dialogue interaction frequency score; performing feedback score calculation on the object emotion score, the conversation interaction time score, and the conversation interaction frequency score to obtain an implicit feedback score; Calculating the difference between the preset expected feedback score of the target object and the implicit feedback score to obtain a feedback score difference; The initial learning rate parameter is updated based on the feedback score difference to obtain the target learning rate parameter.
7. A virtual object-based dialogue generation device, characterized in that: The device comprises: The first acquisition module is used to obtain the initial question text of the target object; a first generation module configured to generate a dialogue based on a preset dialogue generation model for the initial question text to obtain initial response content, wherein the preset dialogue generation model is provided with an initial learning rate parameter and an initial model parameter, wherein the initial learning rate parameter is used to indicate the degree to which the preset dialogue generation model adjusts the content style and content behavior associated with the initial response content; A second acquisition module is configured to acquire dialogue feedback data fed back by the target object in response to the initial response content, and acquire target feedback response content that matches the dialogue feedback data; A learning rate parameter updating module, configured to update the initial learning rate parameter based on the dialogue feedback data to obtain a target learning rate parameter; a second generation module, configured to perform dialogue generation on the dialogue feedback data based on the preset dialogue generation model and the target learning rate parameter to obtain predicted feedback reply content, wherein the target learning rate parameter is used to indicate the degree to which the preset dialogue generation model adjusts the content style and content behavior associated with the predicted feedback reply content; A parameter updating module is configured to update the parameters of the initial model based on the target learning rate parameter, the dialogue feedback data, the target feedback reply content, and the predicted feedback reply content to obtain a current dialogue generation model, and perform dialogue generation according to the current dialogue generation model, wherein the updating of the parameters of the initial model based on the target learning rate parameter, the dialogue feedback data, the target feedback reply content, and the predicted feedback reply content to obtain the current dialogue generation model comprises: obtaining a predicted feedback reply sequence from the predicted feedback reply content; constructing an initial loss function based on the predicted feedback reply sequence, the dialogue feedback data, and the initial model parameters; constructing a target reward function based on the dialogue feedback data; performing function calculation on the target feedback reply content and the predicted feedback reply content based on the target reward function to obtain a target reward value; constructing a model loss function based on the initial loss function, the target reward value, and a preset reward weight for the target reward value; and updating the model parameters based on the model loss function, the target learning rate parameter, and the initial model parameters to obtain the current dialogue generation model.
8. An electronic device, characterized in that: The electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the method according to any one of claims 1 to 6 when executing the computer program.
9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Intention recognition method and device, electronic equipment and storage medium
CN114611529A
Dialogue generation method and device, electronic equipment and computer readable storage medium
CN116910212A