Multi-round dialogue emotion ethical coordination generation method, system and device based on risk perception, medium and product
By constructing a joint risk sentiment analyzer and a strategy planner, and dynamically adjusting dialogue strategies, the problem of balancing emotional support and ethical constraints in large language models is solved, achieving an organic unity of emotion and ethics, and improving user trust and interaction quality.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- UNIV OF ELECTRONICS SCI & TECH OF CHINA
- Filing Date
- 2025-12-31
- Publication Date
- 2026-04-17
AI Technical Summary
Existing large language models struggle to balance emotional support and ethical constraints, increasing the risk of ethically inappropriate or socially harmful responses. They are unable to adapt to complex contexts, impacting user trust and interaction quality.
A joint risk sentiment analyzer, strategy planner, and response generator are constructed. By combining risk sentiment analysis, strategy planning, and response generation, an organic unity of emotional sensitivity and ethical constraints is achieved, and dialogue strategies are dynamically adjusted to adapt to the emotional and ethical needs in multi-round dialogues.
It achieves an organic unity of emotional support and ethical constraints, avoids information loss and inconsistency caused by traditional separate processing, dynamically generates personalized response strategies, ensures the coherence and progressiveness of dialogue, and improves user trust and interaction quality.
Smart Images

Figure CN121880558A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence dialogue system technology, and in particular to a method, system, device, medium and product for generating multi-turn dialogue emotional ethics coordination based on risk perception. Background Technology
[0002] With the rapid development of Large Language Models (LLMs) technology, LLM-based intelligent dialogue systems are being deeply embedded in emotionally and ethically sensitive areas such as mental health, education, and social care. As applications expand into high-impact environments, user expectations have shifted from task completion and factual accuracy to emotionally resonant and socially responsible interactions.
[0003] LLM-based dialogue systems need to demonstrate empathy—the ability to recognize and appropriately respond to users' emotional states. Empathic responses foster trust, deepen user engagement, and improve the quality of interaction. However, as LLMs become more expressive and adaptive, the risk of generating ethically inappropriate or socially harmful responses also increases. Real-world dialogues often involve morally sensitive content, including disclosures of illegal activities, harmful intentions, or discriminatory language. In this context, systems not only need to demonstrate empathy but must also assess ethical risks and respond in a way that aligns with societal values.
[0004] Balancing empathy and ethical alignment presents a core challenge in human-AI dialogue. Existing LLMs often perform well in one dimension while neglecting the other. LLM applications focused on empathy may reinforce problematic user behaviors through overaffirmation or excessive emotional identification. Safety-oriented LLM deployments rely on static filters or rule-based classifiers, which cannot adapt to complex contexts, leading to overly general or inappropriate interventions, reducing user trust, and limiting practical effectiveness.
[0005] When users present morally ambiguous or emotionally vulnerable input, existing LLMs may provide rigid, adversarial responses or adopt a one-size-fits-all ethical standard without adjusting to the user's emotional state. For example, when faced with a user's moral dilemma and emotional conflict, the system may fail to understand their vulnerability and respond in a way that alienates the user. This inherent tension constitutes a key obstacle to the secure deployment of LLMs. To address this, we propose a risk-aware, multi-turn dialogue-based method, system, device, medium, and product for generating emotional and ethical coordination. Summary of the Invention
[0006] The purpose of this invention is to overcome the shortcomings of the prior art and provide a method, system, device, medium and product for generating emotional and ethical coordination in multi-turn dialogues based on risk perception. By constructing a joint risk sentiment analyzer, strategy planner and response generator, it achieves the organic unity of emotional sensitivity and ethical constraints, and dynamically balances the user's emotional support needs and moral guidance goals in multi-turn dialogues.
[0007] On the one hand, this invention provides a method for generating multi-turn dialogue-based emotional ethics coordination based on risk perception, which includes the following steps:
[0008] Step 1: Construct a joint risk sentiment analyzer to comprehensively analyze user input, including:
[0009] Dialogue information acquisition and context construction: Acquire the current round of user input and the corresponding multi-round dialogue history, and integrate the multi-round dialogue history with the current round of user input to form dialogue context information for joint analysis;
[0010] Comprehensive prompt construction: Based on the dialogue context information, a joint analysis prompt is constructed. The joint analysis prompt includes at least: dialogue history, current user messages, and joint analysis task requirements. The joint analysis task requirements include ethical risk assessment, emotional state recognition, and behavioral guidelines extraction, thereby enabling the joint risk sentiment analyzer to complete multi-task joint analysis in a single reasoning process.
[0011] Ethical risk classification output: The large language model is invoked to reason about the joint analysis prompts, and the ethical risk category is output based on the preset ethical risk classification system;
[0012] Composite Emotional State Recognition Output: Based on the joint analysis prompts, identify the user's composite emotional state in the current dialogue context and generate an emotional description in natural language form; the emotional description includes at least an emotional type or a composite emotional phrase description;
[0013] Contextualized Behavior Guidelines Extraction and Output: Based on the joint analysis prompts, extract no more than a preset number (preferably three) of contextualized behavior guidelines from the dialogue history and current user input. The contextualized behavior guidelines are normative statements related to behaviors or situations explicitly mentioned in the dialogue, used to limit the value judgment boundaries of subsequent strategy planning and response generation.
[0014] Organization and output of joint analysis results: Ethical risk categories, sentiment descriptions, and contextualized behavioral guidelines are organized into structured joint analysis results output, which are used as input conditions for the strategy planner;
[0015] Step 2: Build a strategy planner to generate a response strategy description for the current round based on the joint analysis results of Step 1. The response strategy description is a strategy guide in natural language form, which is used to limit the communication stance and intervention method of subsequent responses.
[0016] Step 3: Build a response generator to generate a natural language response for the current round based on the response strategy description generated in Step 2.
[0017] Furthermore, in step 1, the ethical risk categories include six categories: serious illegal acts, ethical violations, moral conflicts, social misconduct, potentially harmful behaviors, and benign dialogue; the ethical risk categories are used to define the risk category basis for subsequent dialogue processing.
[0018] Furthermore, in step 1, when the composite emotional state recognition output is performed, the emotional description may further include a description of the triggering factors to characterize the contextualized reasons for the user's emotions.
[0019] Furthermore, step 2 specifically includes:
[0020] The first round of mapping selection strategy generation: In the first round of the dialogue, based on the ethical risk category output by the joint risk sentiment analyzer, the ethical risk category is mapped to a preset seed strategy library, and at least one seed strategy corresponding to the ethical risk category is selected from it, and the selected seed strategy is used as the initial response strategy; wherein, the seed strategy library includes a set of predefined strategy semantic units for different ethical risk categories, each strategy semantic unit corresponds to a basic communication intention or intervention method, which is used to limit the basic direction of the dialogue strategy;
[0021] Reference generation strategy for the second round and subsequent rounds: In the second round and subsequent rounds of dialogue, the strategy planner does not directly reuse the seed strategy. Instead, it uses the strategy direction represented by the seed strategy as a reference, and combines the current dialogue history, the latest ethical risk category, the user's emotional state, and contextualized behavioral guidelines to dynamically construct a large language model inference prompt for strategy generation, i.e., a strategy generation inference prompt. The large language model is then used to generate a response strategy description that is more suitable for the current context. The generated response strategy description is used to summarize the main strategy direction that should be adopted in the current round.
[0022] Adaptive adjustment of strategies in multi-turn dialogues: During multi-turn dialogues, the strategy planner achieves adaptive adjustment by dynamically constructing strategy generation reasoning prompts; wherein, the strategy generation reasoning prompts include at least the dialogue history, the current ethical risk category, the user's emotional state, and contextualized behavioral guidelines;
[0023] Furthermore, the response strategy description includes: fusing or refining the strategy semantics corresponding to one or more seed strategies, but is not limited to the fixed expression form of the seed strategies.
[0024] Furthermore, the strategy generation reasoning prompts may include prompting requirements for constraining strategy generation. These prompting requirements include at least: when unresolved ethical risks exist in the dialogue history, the response strategy description should continue to address these risks; and strategies should be avoided in different dialogue rounds, reflecting meaningful adjustments to the communication stance. Through these reasoning prompts, the large language model outputs response strategy descriptions that match the current context in different dialogue rounds; when relevant ethical risks persist in subsequent rounds, the generated response strategy descriptions maintain a continuous focus on these risks; and when ethical risks change or are mitigated, the generated response strategy descriptions adjust their strategy direction accordingly.
[0025] Furthermore, step 3 specifically includes:
[0026] Multi-condition input construction: Dialogue history, response strategy description, ethical risk category, user emotional state, and behavioral guidelines are used as input conditions for the generative model. The input conditions are organized in the form of structured prompts and provided to the large language model. The response strategy description is used to limit the overall communication stance and intervention direction of the current response. The ethical risk category and behavioral guidelines are used to limit the ethical boundaries of the response content. The user emotional state is used to limit the language tone and emotional expression of the response.
[0027] Policy-constrained conditional generation: The response generator adopts a prompt-based generation mechanism, which imposes generation constraints on the large language model in the generation prompts; the generation constraints are embedded in the structured prompts in natural language form to limit the generation space of the large language model, but do not limit its specific wording or expression.
[0028] Response generation and output: Under the premise of satisfying the generation constraints, the large language model is called to generate a natural language response for the current round, and the generated natural language response is used as the final output of this round of dialogue.
[0029] Furthermore, the generation constraints include:
[0030] (1) The generated response should follow the communication objectives and strategic direction indicated in the response strategy description;
[0031] (2) The generated response should match the user's emotional state in terms of language expression, so as to reflect the understanding and response to the user's emotions;
[0032] (3) The generated responses must not violate the aforementioned code of conduct in terms of content stance, and should provide guidance on relevant ethical issues when necessary in the current context.
[0033] On the other hand, the present invention also discloses a multi-turn dialogue emotion and ethics coordination generation system based on risk perception, including: a joint risk emotion analysis module, a strategy planning module, a response generation module, and a dialogue history management module;
[0034] The joint risk sentiment analysis module is used to assess the ethical risk level and identify the emotional state of user input, generate contextualized behavioral guidelines, and output joint analysis results; that is, to execute step 1 based on the configured joint risk sentiment analyzer.
[0035] The strategy planning module, connected to the joint risk sentiment analysis module, is used to formulate high-level response strategies that take into account both emotional sensitivity and ethical constraints based on the joint analysis results, and output measurement guidance; that is, to execute step 2 based on the configured strategy planner.
[0036] The response generation module, connected to the strategy planning module, is used to generate the final natural language response based on the strategy guidance; that is, the response generator based on the configuration executes step 3.
[0037] The dialogue history management module is used to maintain and update the context information of multi-turn dialogues, providing historical dialogue data support for each module.
[0038] Furthermore, the joint risk sentiment analysis module adopts a structured reasoning approach based on a large language model, and outputs ethical classifications, sentiment descriptions, and behavioral guidelines in a unified JSON format to ensure the consistency and interpretability of the analysis results.
[0039] Furthermore, the strategy planning module includes:
[0040] A seed strategy library stores preset strategy templates corresponding to each ethical risk level.
[0041] A dynamic policy generator that generates personalized policies in real time based on dialogue context and user state;
[0042] The strategy selection mechanism uses a seed strategy in the first round of dialogue and a dynamically generated strategy in subsequent rounds.
[0043] Furthermore, the response generation module adopts a multi-layered conditional generation architecture, taking dialogue history, response strategy, ethical constraints, and emotional guidance as multiple input conditions, and generating response content that meets the expected goals through a large language model.
[0044] In another aspect, the present invention also discloses a computer device, including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the method of the present invention.
[0045] On the other hand, the present invention also discloses a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method of the present invention.
[0046] In another aspect, the present invention also discloses a computer program product, including a computer program that, when executed by a processor, implements the method of the present invention.
[0047] The technical solution provided by this invention brings at least the following beneficial effects:
[0048] (1) Unified processing mechanism: By using a joint risk sentiment analyzer, the unified processing of sentiment perception and ethical risk assessment is achieved, avoiding the information loss and inconsistency problems caused by traditional separate processing;
[0049] (2) Refined hierarchical management: A six-level ethical risk classification system was established, and corresponding handling strategies were adopted for different risk levels, thus realizing refined management of ethical violations;
[0050] (3) Dynamic strategy adjustment: Based on the history of multiple rounds of dialogue and the current context, a personalized response strategy is dynamically generated to ensure the coherence and progressiveness of the dialogue;
[0051] (4) Balance optimization: Achieve an organic balance between emotional sensitivity and ethical constraints through the strategy planner, and avoid overly conservative or overly emotional responses;
[0052] (5) High interpretability: The structured output format provides clear analytical basis and decision-making logic, enhancing the interpretability and credibility of the system. Attached Figure Description
[0053] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0054] Figure 1 A flowchart of a multi-turn dialogue-based emotional ethics coordination and generation system based on risk perception is provided for an embodiment of the present invention.
[0055] Figure 2 This is a schematic table illustrating the classification of ethical risks and corresponding seed strategies in embodiments of the present invention.
[0056] Figure 3 This is a radar chart diagram showing the performance comparison between the embodiment of the present invention and the baseline model under different ethical risk levels. Detailed Implementation
[0058] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be described in detail and completely below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Generally, the components of the embodiments of the present invention described and shown in the accompanying drawings can be arranged and designed using different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely represents selected embodiments of the present invention.
[0059] To address the difficulty in balancing emotional support and ethical constraints in existing dialogue systems, the inventors of this invention conducted an in-depth analysis of the behavioral patterns of large language models in multi-turn dialogues, discovering three key observations: 1) Emotional state and ethical risk are often interrelated; users are more likely to engage in ethical violations when expressing negative emotions, and traditional separate processing methods cannot capture this correlation; 2) Emotional evolution and risk accumulation in multi-turn dialogues exhibit obvious dynamic characteristics, requiring holistic analysis and gradual intervention based on historical context; 3) Different types and degrees of ethical risks require differentiated processing strategies; a "one-size-fits-all" approach may harm users' emotions or reduce the effectiveness of intervention.
[0060] Based on the above findings, embodiments of the present invention provide a risk-aware, multi-turn dialogue sentiment and ethics coordination generation method. This method decomposes the complex response generation task into three sequentially executed stages: analysis, planning, and generation, including joint risk sentiment analysis, strategy planning, and response generation. Preferably, each processing step can be implemented through prompt-based inference based on a large language model, requiring no additional model fine-tuning, and exhibiting good flexibility and scalability. See also Figure 1 It includes the following steps:
[0061] S1. Construct a joint risk sentiment analyzer:
[0062] In each round of the conversation, upon receiving the latest input from the user, the analyzer performs a unified, joint analysis process, incorporating the complete conversation history. This process does not view emotion or risk in isolation, but rather assesses both within the same context for comprehensive evaluation.
[0063] In terms of ethical risk assessment, the analyzer categorizes user input into a predefined, hierarchical ethical risk classification system. Referring to Table 1, this system can include at least six levels: 1. Serious illegal behavior; 2. Ethical violation; 3. Moral conflict; 4. Social inappropriate behavior; 5. Potentially harmful behavior; 6. Benign dialogue. This classification allows the system to adopt appropriate handling methods and communication strategies based on the severity and nature of the risk category.
[0064] Table 1
[0065]
[0066] In terms of sentiment analysis, the Joint Risk Sentiment Analyzer is not limited to traditional single sentiment labels (such as "happy" or "sad"), but generates more nuanced and complex free-text descriptions, such as "ashamed but defensive" or "anxious but hopeful." This open-ended approach can more accurately capture the mixed emotions and inner conflicts of users in complex situations.
[0067] In addition, the analyzer generates one to three contextualized Rules of Thumb (RoTs) based on the dialogue content. These rules are concise normative statements that directly relate to the specific behaviors mentioned in the dialogue and impose value judgments on them, such as "insulting others during disagreements is wrong." These rules provide a clear and interpretable ethical basis for subsequent strategy planning and response generation.
[0068] In one implementation, the joint risk sentiment analyzer outputs structured joint analysis results, including at least ethical risk categories, sentiment descriptions, and contextualized behavioral guidelines (RoTs), which are used as input conditions for the strategy planner.
[0069] The final synthesis hint template format built by the analyzer is as follows:
[0070]
[0071] S2. Constructing the strategy planner:
[0072] The strategy planner is the decision center of this invention. Based on the output of the joint risk sentiment analyzer, it generates response strategy descriptions to guide the generation of the next round of responses. These response strategy descriptions are policy guidelines in natural language form, used to define the communication stance and intervention methods for that round of responses. This planner employs an innovative hybrid planning mechanism, combining preset seed strategies with dynamic generation to balance stability and contextual adaptability in multi-round dialogues.
[0073] In the first round of the dialogue (t=1), to establish an appropriate tone of communication at the outset, the strategy planner employs a "seed strategy selection" model. Specifically, based on the initial ethical risk categories output by the joint risk sentiment analyzer, these categories are mapped to a pre-designed pool of seed strategies, such as... Figure 2 As shown, a seed strategy corresponding to the ethical risk category is selected from the options to generate or determine the initial response strategy description for the opening round. For example, when the ethical risk category is "social misconduct," "respect-oriented nudge" can be selected as the corresponding seed strategy reference.
[0074] Starting from the second round (t>1), as the dialogue information gradually becomes richer, the strategy planner switches to "reference generation" mode. In this mode, the strategy planner does not directly reuse the seed strategy, but instead uses the strategy direction represented by the seed strategy as a reference, combined with the current dialogue history, the latest ethical risk category, the user's emotional state, and behavioral guidelines, to dynamically construct a large language model inference prompt for strategy generation. It then generates a response strategy description more suitable for the current dialogue context by calling the large language model. For example, it generates strategy guidance in natural language form such as "While expressing empathy, clearly correct their misconceptions."
[0075] During multi-turn dialogues, the strategy planner adaptively adjusts its strategies by dynamically constructing reasoning prompts for strategy generation. These prompts include at least the dialogue history, the current category of ethical risk, the user's emotional state, and behavioral guidelines. They further include requirements for constraining strategy generation, such as: if unresolved ethical risks exist in the dialogue history, these risks should be addressed in the response strategy description; and strategies should be avoided in different dialogue rounds, reflecting meaningful adjustments to the communication stance. Through these reasoning prompts, the large language model outputs response strategy descriptions that match the current context in different dialogue rounds, thus maintaining continuous attention when ethical risks persist and adjusting the strategy direction accordingly when ethical risks change or are mitigated.
[0076] The template format for generating strategy planning prompts is as follows:
[0077]
[0078] S3. Construct a response generator:
[0079] The response generator is the execution center of this invention. Its task is to output the final user-facing natural language response based on the response policy description generated by the policy planner. Unlike traditional dialogue models that generate responses solely based on dialogue history, the response generator in this embodiment is subject to explicit policy constraints during the generation process.
[0080] Specifically, the response generator uses the dialogue history, the output of the joint risk sentiment analyzer (including ethical risk categories, user sentiment descriptions, and behavioral guidelines), and the response strategy description generated by the strategy planner as input conditions for the generation model, and provides them to the large language model in the form of structured prompts. The response strategy description is used to limit the overall communication stance and intervention method of the response generation, the ethical risk categories and behavioral guidelines are used to limit the ethical boundaries of the response content, and the user sentiment description is used to guide the language tone and emotional expression of the response.
[0081] Through the aforementioned policy-based conditional generation mechanism, the response generator maintains the coherence and relevance of the response content while ensuring that the generated results are consistent with the results of the preceding analysis and policy planning in terms of tone, stance, and value orientation. This achieves a coordinated unity of emotional care and ethical guidance in multi-round dialogues.
[0082] The format of the generated response prompt template is as follows:
[0083]
[0084] The generation effect of the present invention will be further tested through experiments below.
[0085] To verify the effectiveness and robustness of the embodiments of the present invention, a series of comprehensive experiments were conducted. The experiments used a test set labeled with ethical risk levels, which contained 298 multi-turn dialogue samples selected from the publicly available dataset *Prosocial Dialogues* and re-labeled according to the six-level ethical risk classification system of the present invention. To simulate challenging interactions in the real world, an adversarial user simulator was also designed, generating user input through two modes: fixed replay and contextual paraphrasing.
[0086] The methods of this invention (applied to the Llama-3-8B-Instruct model and the GPT-4o model, respectively) were compared with various existing technical models, including the COSMO-3B model focusing on prosocial dialogue, the Emotional-Llama-8B model focusing on emotional interaction, and general dialogue models such as Llama-2-7b-chat. Evaluation was conducted across four dimensions: respectful tone, ethical guidance, empathy, and specificity and engagement. The experimental results are shown in Table 2, where each cell reports the utterance level / dialogue level score (in "U / D" format), and arrows indicate improvements of this invention compared to the corresponding baseline models.
[0087] Table 2
[0088]
[0089] Experimental results show that, compared with all baseline models, the model applying the method and system of this invention achieves significant performance improvements across all four evaluation dimensions. Particularly in the two core and often contradictory dimensions of "ethical guidance" and "empathy," this invention achieves a superior balance, demonstrating its ability to provide emotionally resonant responses while maintaining a clear ethical stance. Furthermore, this invention exhibits higher consistency and robustness when facing different levels of ethical risk scenarios, with performance fluctuations far less than other models.
[0090] Furthermore, this invention demonstrates greater consistency and robustness when facing different levels of ethical risk scenarios, as can be seen from [the following text is missing from the original] Figure 3 Further explanation. Figure 3 The distribution of average dialogue-level scores for embodiments of the present invention across six different ethical risk levels is visualized using a radar chart. As can be seen from the chart, compared to the baseline model, the system applying the method of the present invention exhibits a more robust and smoother performance radar chart profile, indicating stable and excellent performance across all risk levels, from "harmless dialogue" to "serious illegal behavior." Particularly in complex scenarios such as "moral dilemmas" and "ethical violations," which demand high levels of contextual understanding and value judgment, the performance score of the baseline model shows a significant dip in the radar chart, while the performance curve of the present invention does not exhibit this phenomenon, demonstrating its superior risk adaptability and behavioral consistency, and verifying the effectiveness of the present invention's round-by-round dynamic adjustment of the dialogue strategy.
[0094] This invention effectively solves the problems of excessive emotionalization or conservatism in traditional solutions by dynamically adjusting the dialogue strategy round by round. It can build a safer and more emotionally resonant dialogue agent in complex ethical situations, thereby improving the quality and trust level of human-computer interaction.
[0095] In an exemplary embodiment, the present invention also provides a computing device, which includes a memory, a processor, and a computer program stored in the memory. The processor executes the computer program to implement a risk-aware multi-turn dialogue emotional ethics coordination generation method provided by the present invention.
[0096] In an exemplary embodiment, the present invention also provides a computer-readable storage medium storing a computer program / instructions thereon, which, when executed by a processor, implements a risk-aware-based multi-turn dialogue emotional ethics coordination generation method provided in the present invention.
[0097] In one possible implementation, the aforementioned computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a compact disc read-only memory (CD-ROM), magnetic tape, and an optical data storage device, etc.
[0098] In an exemplary embodiment, the present invention also discloses a computer program product, including a computer program / instruction, which, when executed by a processor, implements a risk-aware multi-turn dialogue emotional ethics coordination generation method provided in the present invention.
[0099] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
[0100] The above descriptions are merely some embodiments of the present invention. For those skilled in the art, various modifications and improvements can be made without departing from the inventive concept of the present invention, and all such modifications and improvements fall within the scope of protection of the present invention.
Claims
1. A method for generating multi-turn dialogue-based emotional ethics coordination based on risk perception, characterized in that, Includes the following steps: Step 1: Construct a joint risk sentiment analyzer to comprehensively analyze user input, including: Dialogue information acquisition and context construction: Acquire the current round of user input and the corresponding multi-round dialogue history, and integrate the multi-round dialogue history with the current round of user input to form dialogue context information for joint analysis; Comprehensive prompt construction: Based on the dialogue context information, a joint analysis prompt is constructed, which includes at least: dialogue history, current user messages, and joint analysis task requirements; the joint analysis task requirements include ethical risk assessment, emotional state recognition, and behavioral guidelines extraction. Ethical risk classification output: The large language model is invoked to reason about the joint analysis prompts, and the ethical risk category is output based on the preset ethical risk classification system; Composite Emotional State Recognition Output: Based on the joint analysis prompts, identify the user's composite emotional state in the current dialogue context and generate an emotional description in natural language form; the emotional description includes at least an emotional type or a composite emotional phrase description; Contextualized behavior guidelines extraction output: Based on the joint analysis prompts, extract no more than a preset number of contextualized behavior guidelines from the dialogue history and current user input. The contextualized behavior guidelines are normative statements related to behaviors or situations explicitly mentioned in the dialogue. Organization and output of joint analysis results: Ethical risk categories, sentiment descriptions, and contextualized behavioral guidelines are organized into structured joint analysis results output; Step 2: Build a strategy planner to generate a response strategy description for the current round based on the joint analysis results. The response strategy description is a strategy guide in natural language form, which is used to limit the communication stance and intervention methods generated in subsequent responses. Step 3: Build a response generator to generate a natural language response for the current round based on the generated response strategy description.
2. The method as described in claim 1, characterized in that, Step 2 specifically includes: The first round of mapping selection strategy generation: In the first round of the dialogue, based on the ethical risk category output by the joint risk sentiment analyzer, the ethical risk category is mapped to a preset seed strategy library, and at least one seed strategy corresponding to the ethical risk category is selected from it, and the selected seed strategy is used as the initial response strategy; wherein, the seed strategy library includes a set of predefined strategy semantic units for different ethical risk categories, and each strategy semantic unit corresponds to a basic communication intention or intervention method. Reference generation strategy for the second round and subsequent rounds: In the second round and subsequent rounds of dialogue, the strategy planner uses the strategy direction represented by the seed strategy as a reference, and combines the current dialogue history, the latest ethical risk category, the user's emotional state, and contextualized behavioral guidelines to dynamically construct a large language model inference prompt for strategy generation, namely, strategy generation inference prompt; and generates a response strategy description corresponding to the current context through the large language model; the generated response strategy description is used to summarize the main strategy direction to be adopted in the current round; Adaptive adjustment of strategies in multi-turn dialogues: During multi-turn dialogues, the strategy planner achieves adaptive adjustment by dynamically constructing strategy generation reasoning prompts; wherein, the strategy generation reasoning prompts include at least the dialogue history, the current ethical risk category, the user's emotional state, and contextualized behavioral rules.
3. The method as described in claim 2, characterized in that, The response strategy description is as follows: to fuse or refine the policy semantics corresponding to one or more seed strategies.
4. The method as described in claim 2, characterized in that, The strategy generation reasoning prompts also include prompt requirements for constraining strategy generation, which include at least the following: when there are unresolved ethical risks in the dialogue history, the risk should be continued in the response strategy description; and strategies should be avoided in different dialogue rounds, and meaningful adjustments to the communication stance should be reflected.
5. The method as described in claim 1, characterized in that, Step 3 specifically includes: Multi-condition input construction: Dialogue history, response strategy description, ethical risk category, user emotional state, and behavioral guidelines are used as input conditions for the generative model. The input conditions are organized in the form of structured prompts and provided to the large language model. The response strategy description is used to limit the overall communication stance and intervention direction of the current response. The ethical risk category and behavioral guidelines are used to limit the ethical boundaries of the response content. The user emotional state is used to limit the language tone and emotional expression of the response. Policy-constrained conditional generation: The response generator adopts a prompt-based generation mechanism, which imposes generation constraints on the large language model in the generation prompts; the generation constraints are embedded in the structured prompts in natural language form to limit the generation space of the large language model. Response generation and output: Under the premise of satisfying the generation constraints, the large language model is called to generate a natural language response for the current round, and the generated natural language response is used as the final output of this round of dialogue.
6. The method as described in claim 5, characterized in that, The constraints to be generated include: (1) The generated response should follow the communication objectives and strategic direction indicated in the response strategy description; (2) The generated response should match the user's emotional state in terms of language expression, so as to reflect the understanding and response to the user's emotions; (3) The generated responses must not violate the aforementioned code of conduct in terms of content stance, and should provide guidance on relevant ethical issues when necessary in the current context.
7. A multi-turn dialogue-based emotional ethics coordination and generation system based on risk perception, characterized in that, include: It integrates a risk sentiment analysis module, a strategy planning module, a response generation module, and a dialogue history management module; in, The joint risk sentiment analysis module is used to assess the ethical risk level of user input, identify the sentiment state, generate contextualized behavioral guidelines, and output joint analysis results. The strategy planning module, connected to the joint risk sentiment analysis module, is used to develop high-level response strategies that take into account both emotional sensitivity and ethical constraints based on the joint analysis results, and output measurement guidance. The response generation module, connected to the strategy planning module, is used to generate the final natural language response based on the strategy guidance. The dialogue history management module is used to maintain and update the context information of multi-turn dialogues, providing historical dialogue data support for each module.
8. A computer device, comprising a memory, a processor, and a computer program stored in the memory, characterized in that, The processor executes the computer program to implement the steps of the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the computer program performs the steps of the method according to any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that, When executed by a processor, the computer program performs the steps of the method according to any one of claims 1 to 6.