Dialogue risk assessment method, system and equipment based on large model and medium
By obtaining user conversation information, extracting emotional information and adaptively updating emotional dictionary methods, the shortcomings of the large language model in understanding user emotions are solved, and accurately capturing user emotions and providing dialogue output that meets risk requirements is achieved.
Patent Information
- Application Number
- CN202411655261.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-19
- Publication Date
- 2025-03-07
- Estimated Expiration
- 2044-11-19
AI Technical Summary
The existing large language models have shortcomings in understanding and responding to user emotions, and it is difficult to accurately capture the true meaning and nuances of user emotions, and the dependent static emotion dictionary cannot adapt to the diversity and dynamic nature of emotional expression in complex dialogue systems.
By obtaining user conversation information, using a big model to extract target events, psychological crisis information and emotional information, adaptively update the emotional dictionary, and determine the final answer description based on risk assessment to ensure that the dialogue output meets the risk requirements.
It accurately captures the user's true emotions and provides dialogue output that meets risk requirements, improving the adaptability of large language models in new contexts and new words.
Smart Images

Figure CN119578431A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of big models, and in particular to a conversation risk assessment method, system, device and medium based on a big model. Background Art
[0002] In recent years, with the rapid development of artificial intelligence (AI) and natural language processing (NLP), automated dialogue systems based on large language models have become a hot topic in research and application. Such systems can simulate human dialogues and interact with users in real time, not only providing information and services, but also understanding and responding to users’ emotional states and psychological needs to a certain extent.
[0003] Although current large language models are capable of processing complex language structures and conducting extensive conversations, they are often unable to deeply understand user emotions due to the lack of in-depth knowledge in professional fields. It is difficult to accurately capture the true meaning and nuances of user emotions, which leads to misunderstandings or inappropriate responses. In addition, the sentiment dictionaries that most current dialogue systems rely on are often static, which means that they work based on predefined vocabulary and sentiment labels and cannot flexibly adapt to the diversity and dynamics of emotional expression in complex dialogue systems. Therefore, when faced with rapidly changing dialogue content and user emotions, the system often cannot respond in a timely and effective manner.
[0004] Application Contents
[0005] This application provides a dialogue risk assessment method, system, device and medium based on a large model, which can accurately capture the user's true emotions and provide dialogue output that meets risk requirements.
[0006] In a first aspect, the present application provides a dialogue risk assessment method based on a large model, comprising:
[0007] Acquire user conversation information, extract information from the conversation information based on the big model, and obtain first node information, wherein the first node information includes a target event;
[0008] Extracting a key parameter set related to the first node information from a preset sentiment dictionary, interpreting the target event with the key parameter set based on the macro model, and obtaining a candidate answer description;
[0009] A risk assessment is performed on the candidate answer description based on the large model to obtain a risk assessment result, and a final answer description is determined based on the risk assessment result.
[0010] The embodiment of the present application can accurately obtain the first node information such as target events, psychological crisis information and emotional information by extracting information from the acquired dialogue information, so as to facilitate the integration of the first node information to accurately capture the user's real emotions; by extracting the key parameter set related to the first node information from the preset first emotional dictionary, the key parameter set related to the first node information can be accurately extracted from the emotional dictionary, so as to facilitate the subsequent acquisition of candidate answer descriptions that take into account the user's real emotions; by performing risk assessment on the candidate answer descriptions, it is possible to comprehensively assess whether the output response of the large model meets the risk requirements, ensure the accuracy of the risk assessment, and then provide dialogue output that meets the risk requirements. Compared with the prior art, the present application can accurately capture the user's real emotions and then provide dialogue output that meets the risk requirements.
[0011] Furthermore, before obtaining the user's conversation information, the method further includes:
[0012] Acquire first psychological data, and clean the first psychological data to obtain second psychological data, wherein the first psychological data includes professional psychological information and emotional dialogue records;
[0013] Node data and edge data are extracted from the second psychological data, and a first sentiment dictionary is constructed based on the node data and the edge data.
[0014] In this way, by introducing professional psychological information and emotional dialogue records, we can effectively deal with users' complex emotional states and psychological crises, making it easier to achieve in-depth understanding and effective response to users' emotions in the future.
[0015] Furthermore, before extracting the key parameter set related to the first node information from the preset sentiment dictionary, the method further includes:
[0016] Extracting first edge information corresponding to the first node information from the conversation information;
[0017] Inserting the first node information and the first edge information into the first sentiment dictionary to obtain a second sentiment dictionary;
[0018] The similarity values corresponding to each node and each edge in the second sentiment dictionary are calculated respectively, the nodes and edges with high similarity values are merged respectively, and the merged node attributes and edge attributes are updated respectively to obtain a sentiment dictionary.
[0019] In this way, by adaptively updating the sentiment dictionary based on user conversation information, it can ensure that the sentiment dictionary adapts to the rapid changes of complex dialogue systems, thereby improving the adaptability of the large language model to new contexts and new words, facilitating the subsequent in-depth understanding and effective response to user emotions.
[0020] Furthermore, extracting a key parameter set related to the first node information from a preset emotional dictionary, wherein the first node information also includes the first psychological crisis information and the first emotional information, is specifically:
[0021] Extracting second node information related to the first node information from a preset sentiment dictionary;
[0022] Based on the second node information, calculating the path length between the second psychological crisis information and the sentiment dictionary, and extracting the third node information with the shortest path length;
[0023] Based on the second node information, calculating the emotion similarity between the emotion dictionary and the second emotion information, and extracting the fourth node information with the highest emotion similarity;
[0024] Determine the belonging community of the first node information in different sentiment dictionary communities, and extract a community summary report corresponding to the belonging community, wherein the sentiment dictionary community is a community division result of the sentiment dictionary;
[0025] A sentiment parameter set is obtained based on the second node information, the third node information, the fourth node information and the community summary report.
[0026] In this way, by extracting the key parameter set related to the first node information from the preset first emotional dictionary, the key parameter set related to the first node information can be accurately extracted from the emotional dictionary, which facilitates the subsequent acquisition of candidate answer descriptions that take into account the user's true emotions.
[0027] Furthermore, the determining of the belonging community of the first node information in different sentiment dictionary communities is specifically:
[0028] Calculating a number of modularity values corresponding to the first node information in different sentiment dictionary communities;
[0029] Based on a plurality of said modularity values, determining modularity change values of the first node information assigned to different sentiment dictionary communities;
[0030] Based on the modularity change value, a community to which the first node information belongs is determined.
[0031] In this way, by determining the belonging community of the first node information, the subsequent global analysis and output decision of the user's emotions are facilitated, and the subsequent in-depth understanding and effective response to the user's emotions are facilitated.
[0032] Furthermore, the final answer description is determined based on the risk assessment result, specifically:
[0033] Determining whether the risk assessment result meets the preset conditions;
[0034] If the risk assessment results meet the preset conditions, the final answer description is determined;
[0035] If the risk assessment result does not meet the preset conditions, the target event is re-interpreted with the key parameter set and the candidate answer description is updated.
[0036] In this way, by performing risk assessment on the candidate answer descriptions, it is possible to comprehensively evaluate whether the output response of the large model meets the risk requirements, ensure the accuracy of the risk assessment, and then provide dialogue output that meets the risk requirements.
[0037] Furthermore, after determining the final answer description based on the risk assessment result, the method further includes:
[0038] Extract information from the answer description based on the large model to obtain fifth node information and second edge information;
[0039] The sentiment dictionary is updated based on the fifth node information and the second edge information.
[0040] In this way, by adaptively updating the sentiment dictionary based on the large model's answer description, we can ensure that the sentiment dictionary can adapt to the rapid changes of the complex dialogue system, thereby improving the adaptability of the large language model to new contexts and new words, making it easier to achieve in-depth understanding and effective response to user emotions in the future.
[0041] In a second aspect, the present application provides a dialogue risk assessment system based on a large model, including: an acquisition module, an extraction module and an assessment module;
[0042] The acquisition module is used to acquire the user's conversation information, extract information from the conversation information based on the big model, and obtain first node information, wherein the first node information includes the target event;
[0043] The extraction module is used to extract a key parameter set related to the first node information from a preset sentiment dictionary, interpret the target event with the key parameter set based on the large model, and obtain a candidate answer description;
[0044] The evaluation module is used to perform risk evaluation on the candidate answer description based on the large model, obtain a risk evaluation result, and determine a final answer description based on the risk evaluation result.
[0045] The embodiment of the present application can accurately obtain the first node information such as target events, psychological crisis information and emotional information by extracting information from the acquired dialogue information, so as to facilitate the integration of the first node information to accurately capture the user's real emotions; by extracting the key parameter set related to the first node information from the preset first emotional dictionary, the key parameter set related to the first node information can be accurately extracted from the emotional dictionary, so as to facilitate the subsequent acquisition of candidate answer descriptions that take into account the user's real emotions; by performing risk assessment on the candidate answer descriptions, it is possible to comprehensively assess whether the output response of the large model meets the risk requirements, ensure the accuracy of the risk assessment, and then provide dialogue output that meets the risk requirements. Compared with the prior art, the present application can accurately capture the user's real emotions and then provide dialogue output that meets the risk requirements.
[0046] In a third aspect, the present application provides an electronic device comprising a processor and a memory, wherein the memory stores programs or instructions that can be executed on the processor, and when the programs or instructions are executed by the processor, the steps of the large model-based dialogue risk assessment method as described in the present application are implemented.
[0047] In a fourth aspect, the present application provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the steps of large-model-based dialogue risk assessment as described in the present application are implemented. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] Figure 1 It is a flowchart of an embodiment of a dialogue risk assessment method based on a large model provided by the present application;
[0049] Figure 2 It is a flowchart of another embodiment of the dialogue risk assessment method based on a large model provided by the present application;
[0050] Figure 3 It is a structural diagram of an embodiment of a dialogue risk assessment system based on a large model provided by the present application;
[0051] Figure 4 It is a hardware structure diagram of the electronic device provided in this application. DETAILED DESCRIPTION
[0052] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0053] It should be understood that the step numbers used in this article are only for the convenience of description and are not intended to limit the order in which the steps are executed.
[0054] It should be understood that the terms used in the present specification are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the present specification and the appended claims, the singular forms "a", "an" and "the" are intended to include plural forms unless the context clearly indicates otherwise.
[0055] The terms “include” and “comprising” indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.
[0056] The term "and / or" means and includes any and all possible combinations of one or more of the associated listed items.
[0057] In recent years, AI and NLP technologies have developed rapidly, and large language model dialogue systems have become a hot topic in research and application. Large model automatic dialogue systems can not only simulate dialogues and provide services, but also respond to users' emotional states and psychological needs. However, large models lack professional in-depth knowledge and are difficult to accurately capture the true meaning of users' emotions, which can lead to misunderstandings or inappropriate responses. In addition, the emotional dictionaries that current dialogue systems rely on are mostly static and cannot adapt to the diversity and dynamism of emotional expressions in complex dialogues, making it difficult to respond promptly and effectively to rapidly changing dialogues and user emotions.
[0058] Next, the nouns involved in this application are analyzed:
[0059] Artificial intelligence (AI) is a new technical science that studies and develops theories, methods, technologies and application systems for simulating, extending and expanding human intelligence. AI is a branch of computer science that attempts to understand the essence of intelligence and produce a new type of intelligent machine that can respond in a similar way to human intelligence. Research in this field includes robotics, speech recognition, image recognition, natural language processing and expert systems. AI can simulate the information process of human consciousness and thinking. AI is also a 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 obtain the best results.
[0060] Large model is short for Large Language Model (LLM), which refers to machine learning models with large-scale parameters and complex computational structures, usually built by deep neural networks, with billions or even hundreds of billions of parameters. These models are designed to learn complex patterns and features by training massive amounts of data, so that they have strong generalization capabilities and can make accurate predictions on unseen data.
[0061] Based on this, the embodiments of the present application provide a dialogue risk assessment method, system, device and medium based on a large model, which can accurately capture the user's true emotions and provide dialogue output that meets the risk requirements.
[0062] The large-model-based conversation risk assessment method, system, device, and medium provided in the embodiments of the present application are specifically illustrated through the following embodiments. First, the large-model-based conversation risk assessment method in the embodiments of the present application is described.
[0063] The conversation risk assessment method based on a large model provided in the embodiment of the present application relates to the field of large models. The conversation risk assessment method based on a large model provided in the embodiment of the present application can be applied to a terminal, can also be applied to a server side, and can also 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, etc.; the server side can be configured as an independent physical server, or can be configured as a server cluster or a distributed system composed of multiple physical servers, and can also be configured as 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, CDN, and big data and artificial intelligence platforms; the software can be an application that implements a conversation risk assessment method based on a large model, etc., but is not limited to the above forms.
[0064] The present application can also be used in numerous 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, etc. 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, etc. 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 through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.
[0065] Embodiment 1
[0066] Please refer to Figure 1 , Figure 1 It is a flowchart of an embodiment of a dialogue risk assessment method based on a large model provided by the present application, including steps S101 to S103;
[0067] Step S101, obtaining user's conversation information, extracting information from the conversation information based on a large model, and obtaining first node information, wherein the first node information includes a target event;
[0068] In some embodiments, before obtaining the user's conversation information, it also includes: first, obtaining first psychological data, and cleaning the first psychological data to obtain second psychological data, wherein the first psychological data includes professional psychological information and emotional conversation records; secondly, extracting node data and edge data in the second psychological data, and constructing a first emotional dictionary based on the node data and the edge data.
[0069] Specifically, first, the first psychological data is obtained, wherein the first psychological data includes but is not limited to professional information documents such as information research papers, review articles, psychological counseling guidelines, and multiple rounds of emotional dialogue records, and the first psychological data is stored in a parseable format such as a text file, a database record or a spreadsheet using a database system (such as MongoDB, MySQL). Secondly, the first psychological data is cleaned, including detecting and deleting the repeated content in most of the first psychological data, using a keyword filtering algorithm and manual screening to eliminate records that are not related to emotional dialogues, and converting the first psychological data into a unified format (such as TXT or CSV), and integrating the cleaned professional psychological information and emotional dialogue records into the second psychological data. Thirdly, keywords, phrases or concepts related to psychological analysis are identified and extracted as node data and the relationship between nodes, and these relationships are extracted as edge data. The node data may include target event nodes, psychological crisis nodes, emotional nodes, etc., and the edge data may include information such as the type, strength, and direction of the relationship, and the node data and the edge data are generated into a corresponding data structure output according to the data structure format. Finally, a first sentiment dictionary is constructed based on the node data and the edge data, wherein an empty graph is created using NetworkX to store the node data and the edit data of the sentiment dictionary, and the node data and the edit data are added to the graph and stored in a Neo4j database.
[0070] In some embodiments, the target event node may be but not limited to 'Environmental Protection', 'Study Hard', etc., the psychological crisis node may be but not limited to 'Depression Risk', etc., and the emotion node may be but not limited to 'Happiness', etc.
[0071] In some embodiments, for each node, it is necessary to extract the corresponding node name entity_name, node type entity_type and node description entity_description. For 'EnvironmentalProtection', entity_name is 'EnvironmentalProtection', entity_type is 'target event node', and entity_description is 'a series of activities and concerns related to the protection of the natural environment, sustainable development, etc.'; for 'StudyHard', its entity_name is 'StudyHard', entity_type is 'target event node', e Entity_description is 'having a clear purpose of improving knowledge and skills through hard work'; for 'DepressionRisk', entity_name is 'DepressionRisk', entity_type is 'psychological crisis node', entity_description is 'potential situations that may lead to depression, such as psychological instability caused by long-term stress, major setbacks, etc.'; for the 'Happiness' node, its entity_name is 'Happiness', entity_type is 'emotion node', entity_description is 'a positive emotional state, usually manifested as pleasure, satisfaction and optimism'.
[0072] In some embodiments, by defining a task of inputting Prompt, the task can be clearly defined as identifying a specified type of node data and its edge data from the second psychological data. First, the large model is guided to identify the node data and extract the name, type and description of the node data; secondly, based on the extracted node data, the relationship between the node data, such as relationship description and relationship strength, is further identified and output as edge data; finally, the node data and edge data are output in a preset format.
[0073] It should be noted that the large model is the abbreviation of the large language model (LLM). In some embodiments, the large model can be, but is not limited to, Extract-LLM, ChatGPT series model, ERNIE3.0 Titan model, General Language Model (GLM)-130B model, etc.
[0074] In some embodiments, the database in the large model is provided with basic contents in multiple languages, including at least three basic languages: Simplified Chinese, Traditional Chinese and English, and may also include: Indian languages, Iranian languages, other Germanic languages except English, foreign language types in the Romance languages or Slavic languages, etc.
[0075] In some embodiments, the data structure in the preset format may be any one of a JSON format, a JSON5 format, a STOB format, an ENO format, an AXON format, or a BRE format.
[0076] In some embodiments, the data structure generated in JSON format can be represented as:
[0077] {
[0078] "source":<source entity name>,
[0079] "target":<target entity name>,
[0080] "relationship": <relationship description>,
[0081] "relationship_strength":<relationship strength>,
[0082] }
[0083] In this way, by introducing professional psychological information and emotional dialogue records, we can effectively deal with users' complex emotional states and psychological crises, making it easier to achieve in-depth understanding and effective response to users' emotions in the future.
[0084] It should be noted that after constructing the sentiment dictionary, the sentiment dictionary needs to be divided into communities to discover sentiment themes and patterns, so as to facilitate the subsequent detection of changes in the sentiment dictionary. Specifically, the basic sentiment dictionary is divided into communities using the Louvain algorithm, and the designed community summary prompt is used to guide the large model to generate a summary for each community. In this case, all node data and edge data in the sentiment dictionary are used as input to initialize the Louvain algorithm, and each node data is assigned to a separate community. Through an iterative process, the node data is moved to other communities to improve the modularity. The modularity calculation formula is: In the formula, A ij is the weight of the edge between nodes i and j, k i and k j are the degrees of nodes i and j (i.e., the number of edges connected to them), m is the sum of the weights of all edges in the network, and this term represents the difference between the actual edge weight and the expected edge weight. i ,c j) is the Kronecker function. When nodes i and j belong to the same community, the value is 1, and if they do not belong to the same community, the value is 0. When the modularity cannot be improved by further moving a single node, the algorithm enters the next stage to merge small communities to form larger communities. At the same time, a specific community summary prompt is used to guide the large language model (LLM) to generate a corresponding community summary report for each generated community, and the generated community summary report is optimized and adjusted to obtain the final community summary report.
[0085] It should be noted that community division is not the focus of this application, so it will not be expanded here.
[0086] It can be understood that the conversation information includes current conversation information and historical conversation information. Specifically, first, the big model obtains the user's current conversation information in real time through the chat interface, and retrieves the user's historical conversation information from the database to obtain the complete conversation context; secondly, the conversation information is preprocessed to facilitate the big model to extract information; then, the big model will understand and analyze the received preprocessed conversation information to extract the first node information, wherein the first node information includes but is not limited to target events, psychological crisis information and emotional information, and the extracted first node information is organized into a predefined format.
[0087] In some embodiments, the target event includes but is not limited to the conversation topic and user intention, etc. The conversation topic is the brief main topic that the user is currently discussing, and the user intention is the purpose that the user hopes to achieve in the conversation, such as seeking advice, expressing feelings, seeking support, etc. Psychological crisis information refers to the serious mental health risks that the user may have, such as extreme anxiety, depression, self-harm tendency, etc. Emotional information is judged based on the user's language and expression, including but not limited to: happiness, sadness, anger, anxiety, helplessness, etc.
[0088] In some embodiments, data preprocessing includes but is not limited to data cleaning of dialogue information to remove irrelevant characters in the dialogue information to ensure the purity of the text; using NLP technology to segment the dialogue information to determine the part of speech of each word; converting the text into a numerical vector form suitable for large model processing, etc.
[0089] In some embodiments, the role capabilities and tasks of the system-level Prompt of the large model can be defined first to clarify the tasks and return format of the large model; and the input-level Prompt can be constructed to integrate the user's conversation information, that is, the historical conversation information {history} and the current conversation information {user}; finally, the role definition and task description of the system-level Prompt, as well as the historical conversation information and user input of the input-level Prompt are combined to form the final Extract-Prompt to guide Extract-LLM to extract information from the conversation information and extract the user's first node information.
[0090] It should be noted that the first, second, third, fourth or fifth do not indicate the order of precedence, but only distinguish between nouns with the same source but from different sources. The first, second, third, fourth or fifth can be understood as names. The first node information is the node information extracted from the user dialogue information, the second node information is the node information related to the first node information in the sentiment dictionary, the third node information is the node information with the shortest length of the second psychological crisis path in the sentiment dictionary, the fourth node information is the node information with the highest emotional similarity to the second emotional information in the sentiment dictionary, and the fifth node information is the node information extracted from the large model answer description.
[0091] Step S102, extracting a key parameter set related to the first node information from a preset sentiment dictionary, and interpreting the target event with the key parameter set based on the macro model to obtain a candidate answer description;
[0092] In some embodiments, before extracting the key parameter set related to the first node information from the preset emotional dictionary, it also includes: first, identifying and extracting the first edge information corresponding to the first node information from the dialogue information; second, inserting the first node information and the first edge information into the first emotional dictionary to obtain a second emotional dictionary; then, respectively calculating the similarity values corresponding to each node and each edge in the second emotional dictionary, merging the nodes and edges with high similarity values respectively through an attribute matching algorithm, and updating the merged node attributes and edge attributes respectively to obtain an emotional dictionary, wherein the node similarity value is calculated according to the attributes of each node, and the edge similarity value is calculated according to the attributes of each edge. If the similarity value exceeds a preset threshold, the nodes that meet the preset threshold are merged to obtain a new node, and the edges that meet the conditions are merged to obtain a new edge, and the attributes corresponding to the new node and the new edge are updated to obtain an updated emotional dictionary.
[0093] It should be noted that the similarity value calculation method may be but is not limited to cosine similarity or Jaccard similarity coefficient.
[0094] It should be noted that the preset threshold needs to be freely set in advance according to the specific application scenario and data characteristics, and this application does not impose any restrictions.
[0095] It should be noted that the attributes of each node include: name, type, description, etc., and the attributes of each edge include: relationship description, relationship strength, etc.
[0096] In this way, by adaptively updating the sentiment dictionary based on user conversation information, it can ensure that the sentiment dictionary adapts to the rapid changes of complex dialogue systems, thereby improving the adaptability of the large language model to new contexts and new words, facilitating the subsequent in-depth understanding and effective response to user emotions.
[0097] It can be understood that after the emotional dictionary is updated based on the user's conversation information, the key parameter set related to the first node information can be extracted from the emotional dictionary, wherein the first node information also includes the first psychological crisis information and the first emotional information, specifically: first, the second node information related to the first node information is extracted from the preset emotional dictionary, wherein the breadth-first search (BFS) algorithm can be used to find all the second node information related to the first node information and the corresponding edge information, including: initializing the BFS algorithm, taking the first node information as the starting node in the emotional dictionary, starting from the starting node, traversing the adjacent nodes layer by layer, recording all the passed nodes and edges, these nodes and edges constitute a network structure related to the starting node, and storing the traversed second node information and the corresponding edge information as the relevant information of this round of conversation, recorded as {relevance}.
[0098] Secondly, based on the second node information, the path length between the second psychological crisis information and the second psychological crisis information in the sentiment dictionary is calculated, and the third node information with the shortest path length is extracted, wherein the second psychological crisis information in the second node information is determined, and the second psychological crisis information is set as the initial node, the Dijkstra algorithm is initialized, and the Dijkstra algorithm is used in the sentiment dictionary to calculate the shortest path from the starting node to all other nodes, and the third node information of the top k shortest paths is selected as output, and the path length of the third node information is recorded at the same time to guide the LLM analysis of potential risks, and the third node information is marked as {risk}.
[0099] Then, based on the second node information, the emotion similarity between the emotion dictionary and the second emotion information is calculated, and the fourth node information with the highest emotion similarity is extracted, wherein the emotion information of the second node information is determined as a reference vector, each element in the vector represents a node U connected to the user emotion graph node, and all nodes N in the emotion dictionary are extracted based on the reference vector i The eigenvector V i, where each element represents the presence or absence of a certain user emotion, and calculates each node N i With the eigenvector V i The emotion similarity value is calculated as follows: According to the emotion similarity value, the top k fourth node information with the highest emotion similarity value is selected as the output, and the emotion similarity value of the fourth node information is recorded at the same time to guide LLM to analyze the user's related emotions. The fourth node information is marked as {similar}.
[0100] Again, determining the belonging community of the first node information in different emotional dictionary communities, and extracting the community summary report corresponding to the belonging community, wherein the emotional dictionary community is the community division result of the emotional dictionary, including: respectively allocating the first node information to all communities in the emotional dictionary, calculating a number of modularity values corresponding to the first node information in different emotional dictionary communities; based on the several modularity values, determining the modularity change value of the first node information allocated to different emotional dictionary communities, wherein the calculation formula for calculating the modularity change value is: Where ΔQ is the modularity change value, is the weighted average of the edges within the community after the first node information is moved, is the weighted average value of the edges within the community before the first node information is moved; based on the modularity change value ΔQ, the belonging community of the first node information is determined, that is, the first node information is assigned to the belonging community that maximizes the module gain, and the community summary report corresponding to the belonging community is extracted to guide LLM to analyze global information. The community summary report is marked as {community_summary}.
[0101] It should be noted that the steps for determining the weight average are: for each community in the sentiment dictionary, calculate the sum of the weights of all edges within the community, then count the number of nodes within the community, and finally divide the sum of the weights of the edges within the community by the square of the number of nodes to obtain the weight average of the edges within the community. For example, assuming that a community has n nodes and the sum of the weights of the edges within the community is W, then the weight average of the edges within the community is W / (n*n).
[0102] It should be noted that modularity is an indicator to measure the quality of community division, which reflects the difference between the density of edges within the community and the density of edges in a random network.
[0103] In this way, by determining the belonging community of the first node information, the subsequent global analysis and output decision of the user's emotions are facilitated, and the subsequent in-depth understanding and effective response to the user's emotions are facilitated.
[0104] Finally, based on the second node information {relevance}, the third node information {risk}, the fourth node information {similar} and the community summary report {community_summary}, a sentiment parameter set is obtained.
[0105] In this way, by extracting the key parameter set related to the first node information from the preset first emotional dictionary, the key parameter set related to the first node information can be accurately extracted from the emotional dictionary, which facilitates the subsequent acquisition of candidate answer descriptions that take into account the user's true emotions.
[0106] It can be understood that when the emotion parameter set is obtained, the emotion parameter set is used together with the dialogue information as the input of the big model, and the target event is explained with the key parameter set based on the big model to obtain the candidate answer description; specifically, by first defining the role capabilities and tasks of the system-level Prompt of the big model to clarify the tasks of the big model and the specific response content; and constructing the input-level Prompt to obtain the emotion parameter set and the dialogue information; finally, the system-level Prompt and the input-level Prompt are combined to form the final Dialogue-Prompt, and the Dialogue-Prompt is input into the Dialogue-LLM to explain the target event with the key parameter set to obtain the candidate answer description.
[0107] In some embodiments, the target event is explained with the key parameter set to obtain candidate answer descriptions, including: obtaining the user's emotional information based on the big model, and matching the corresponding answer style based on the emotional information, explaining the target event with the answer style, and generating an answer description.
[0108] It should be noted that the target answer style is the overall style of the large model answer description. By matching the corresponding answer style according to the user's emotional information, personalized candidate answer descriptions can be provided based on the user's current emotional information, thereby improving the user experience.
[0109] In some embodiments, the response content needs to be evaluated in real time. If the response content does not contain constructive suggestions, the response content needs to be regenerated.
[0110] Step S103: perform risk assessment on the candidate answer description based on the large model to obtain a risk assessment result, and determine a final answer description based on the risk assessment result.
[0111] It can be understood that when the candidate answer description is obtained, a risk assessment will be performed on the candidate answer description. Specifically, the role capabilities and tasks of the system-level Prompt of the large model are first defined to clarify the tasks and evaluation content of the large model, wherein the role capability is "assessing output risks"; and an input-level Prompt is constructed to obtain the emotional parameter set, the dialogue information, and the candidate answer description; finally, the system-level Prompt and the input-level Prompt are combined to form the final Dialogue-Prompt, and the Dialogue-Prompt is input into Evaluate-LLM to perform a risk assessment on the candidate answer description to obtain a risk assessment result, wherein the risk assessment result includes high risk, medium risk, and low risk.
[0112] It should be noted that low-risk means that the response content has no obvious negative impact on users, and the advice and support provided can help alleviate users' negative emotions; medium-risk means that the response content may involve sensitive topics, but overall it provides positive support to users and should be used with caution; high-risk means that the response content may aggravate users' negative emotions or involve high-risk behaviors and should be avoided and alternative suggestions should be provided.
[0113] After obtaining the risk assessment result, it is necessary to determine whether the risk assessment result meets the preset conditions; if the risk assessment result meets the preset conditions, the final answer description is determined; if the risk assessment result does not meet the preset conditions, the target event is re-interpreted with the key parameter set and the candidate answer description is updated.
[0114] In some embodiments, if the risk assessment result is low risk, the candidate answer description is directly adopted as the final answer description and returned to the user.
[0115] In some embodiments, if the risk assessment result is medium risk or high risk, different rewards will be input into Dialogue-Prompt according to medium risk or high risk to re-guide Dialogue-LLM to generate a new response, where the "evaluation reason field" in the risk assessment level of the data returned by Evaluate-LLM will be marked as {analysis} as input, and the original output of Dialogue-LLM is marked as {assistant}. The reward for medium risk is: "The risk assessment of the dialogue response is medium. The response content involves sensitive topics, but it is generally positive and supportive of the user. Please combine Risk analysis, pay attention to sensitive words and re-modify the generated output, / n## Medium-risk output analysis: / n{information} / n## Medium-risk output of Dialogue-LLM: / n{assistant}"; the reward for high-risk adoption is: "The dialogue response risk assessment is advanced! ! ! The response content may aggravate the user's negative emotions or involve high-risk behaviors. It should be avoided and alternative suggestions should be provided. Please regenerate the output based on the analysis, / n## High-risk output analysis: / n{information} / n## High-risk output of Dialogue-LLM: / n{assistant}".
[0116] In this way, by performing risk assessment on the candidate answer descriptions, it is possible to comprehensively evaluate whether the output response of the large model meets the risk requirements, ensure the accuracy of the risk assessment, and then provide dialogue output that meets the risk requirements.
[0117] After the final answer description is determined based on the risk assessment result, it also includes: first, extracting information from the answer description based on the large model to obtain the fifth node information and the second edge information; second, updating the sentiment dictionary based on the fifth node information and the second edge information; specifically, using a graph processing tool (such as NetworkX) to create new nodes and edges, extracting the fifth node information and the second edge information from the answer description, and using the Neo4j database to insert the fifth node information and the second edge information into the sentiment dictionary to obtain a third sentiment dictionary, and then respectively calculating the similarity values (such as cosine similarity or Jaccard similarity coefficient) corresponding to each node and each edge in the third sentiment dictionary, merging the nodes and edges with high similarity values through an attribute matching algorithm, and updating the merged node attributes and edge attributes to obtain an updated sentiment dictionary, and re-dividing the updated sentiment dictionary into communities to obtain community division results and corresponding community summary reports for subsequent further use.
[0118] In this way, by adaptively updating the sentiment dictionary based on the large model's answer description, we can ensure that the sentiment dictionary can adapt to the rapid changes of the complex dialogue system, thereby improving the adaptability of the large language model to new contexts and new words, making it easier to achieve in-depth understanding and effective response to user emotions in the future.
[0119] The embodiment of the present application can accurately obtain the first node information such as target events, psychological crisis information and emotional information by extracting information from the acquired dialogue information, so as to facilitate the integration of the first node information to accurately capture the user's real emotions; by extracting the key parameter set related to the first node information from the preset first emotional dictionary, the key parameter set related to the first node information can be accurately extracted from the emotional dictionary, so as to facilitate the subsequent acquisition of candidate answer descriptions that take into account the user's real emotions; by performing risk assessment on the candidate answer descriptions, it is possible to comprehensively assess whether the output response of the large model meets the risk requirements, ensure the accuracy of the risk assessment, and then provide dialogue output that meets the risk requirements. Compared with the prior art, the present application can accurately capture the user's real emotions and then provide dialogue output that meets the risk requirements.
[0120] Embodiment 2
[0121] For easier understanding, please refer to Figure 2 , Figure 2 This is a flow chart of another embodiment of the dialogue risk assessment method based on a large model provided by the present application, including:
[0122] Step S201, obtaining dialogue information input by the user;
[0123] Step S202, the large model extracts information from the user's conversation information to obtain first node information;
[0124] Step S203, determining corresponding side information based on the first node information, and updating the sentiment dictionary based on the first node information and the side information;
[0125] Step S204, the large model performs matching in a preset sentiment dictionary based on the first node information to obtain a key parameter set;
[0126] Step S205, the big model interprets the target event input by the user based on the key parameter set and generates candidate answer descriptions;
[0127] In step S206, the large model performs a risk assessment on the candidate answer descriptions and obtains a risk assessment result. If the risk assessment result does not meet the preset conditions, it is necessary to re-interpret the target event input by the user based on the current candidate answer description and the key parameter set until the generated candidate answer description meets the preset conditions, and the answer description is returned to the user; if the risk assessment result meets the preset conditions, the final answer description is determined and returned to the user.
[0128] Step S207: updating the sentiment dictionary based on the answer description.
[0129] It should be noted that the above steps S201 to S207 have been fully described in the first embodiment, and thus will not be described again here.
[0130] Embodiment 3
[0131] Please refer to Figure 3 , Figure 3 It is a structural diagram of an embodiment of a dialogue risk assessment system based on a large model provided by the present application, including an acquisition module 100, an extraction module 200 and an assessment module 300;
[0132] The acquisition module 100 is used to acquire the user's conversation information, extract information from the conversation information based on the big model, and obtain first node information, wherein the first node information includes a target event;
[0133] The extraction module 200 is used to extract a key parameter set related to the first node information from a preset sentiment dictionary, interpret the target event with the key parameter set based on the large model, and obtain a candidate answer description;
[0134] The evaluation module 300 is used to perform risk evaluation on the candidate answer description based on the large model, obtain a risk evaluation result, and determine a final answer description based on the risk evaluation result.
[0135] Since the information interaction, execution process, etc. between the modules in the above-mentioned big model-based dialogue risk assessment system are based on the same concept as the embodiment of the big model-based dialogue risk assessment method of the first aspect of the present invention, the technical effects achieved are basically the same. For specific contents, please refer to the description in the first embodiment of the method of the present invention, and will not be repeated here.
[0136] The device embodiments described above are merely illustrative, wherein the modules described as separate components may or may not be physically separated, i.e., may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the method of this embodiment.
[0137] See also Figure 4 , Figure 4 The hardware structure of a terminal device of another embodiment is illustrated, and the terminal device includes:
[0138] The processor 401 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application;
[0139] The memory 402 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 402 can store an operating system and other applications. When the technical solution provided in the embodiment of this specification is implemented by software or firmware, the relevant program code is stored in the memory 402, and the processor 401 calls and executes the dialogue risk assessment method based on a large model in the embodiment of this application;
[0140] Input / output interface 403, used to implement information input and output;
[0141] Communication interface 404, used to realize communication interaction between the device and other devices, which can be realized by wired mode (such as USB, network cable, etc.) or wireless mode (such as mobile network, WIFI, Bluetooth, etc.);
[0142] Bus 405 , which transmits information between various components of the device (e.g., processor 401 , memory 402 , input / output interface 403 , and communication interface 404 );
[0143] The processor 401 , the memory 402 , the input / output interface 403 and the communication interface 404 are connected to each other in communication within the device via the bus 405 .
[0144] The present invention also provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the large model-based dialogue risk assessment method as described in the first embodiment above is implemented.
[0145] A person skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-monitorable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.
[0146] The specific embodiments described above further illustrate the purpose, technical solutions and beneficial effects of the present application in detail. It should be understood that the above description is only a specific embodiment of the present application and is not intended to limit the scope of protection of the present application.
[0147] It is particularly pointed out that for those skilled in the art, any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of this application should be included in the protection scope of this application.
Claims
1. A dialogue risk assessment method based on a large model, characterized in that: include: Acquire user conversation information, extract information from the conversation information based on the big model, and obtain first node information, wherein the first node information includes a target event; Extracting a key parameter set related to the first node information from a preset sentiment dictionary, interpreting the target event with the key parameter set based on the macro model, and obtaining a candidate answer description; A risk assessment is performed on the candidate answer description based on the large model to obtain a risk assessment result, and a final answer description is determined based on the risk assessment result.
2. The dialogue risk assessment method based on a large model according to claim 1 is characterized in that: Before obtaining the user's conversation information, the method further includes: Acquire first psychological data, and clean the first psychological data to obtain second psychological data, wherein the first psychological data includes professional psychological information and emotional dialogue records; Node data and edge data are extracted from the second psychological data, and a first sentiment dictionary is constructed based on the node data and the edge data.
3. The dialogue risk assessment method based on a large model according to claim 2 is characterized in that: Before extracting the key parameter set related to the first node information from the preset sentiment dictionary, the method further includes: Extracting first edge information corresponding to the first node information from the conversation information; Inserting the first node information and the first edge information into the first sentiment dictionary to obtain a second sentiment dictionary; The similarity values corresponding to each node and each edge in the second sentiment dictionary are calculated respectively, the nodes and edges with high similarity values are merged respectively, and the merged node attributes and edge attributes are updated respectively to obtain a sentiment dictionary.
4. The dialogue risk assessment method based on a large model according to claim 1 is characterized in that: The step of extracting a key parameter set related to the first node information from a preset emotional dictionary, wherein the first node information also includes first psychological crisis information and first emotional information, is specifically: Extracting second node information related to the first node information from a preset sentiment dictionary; Based on the second node information, calculating the path length between the second psychological crisis information and the sentiment dictionary, and extracting the third node information with the shortest path length; Based on the second node information, calculating the emotion similarity between the emotion dictionary and the second emotion information, and extracting the fourth node information with the highest emotion similarity; Determine the belonging community of the first node information in different sentiment dictionary communities, and extract a community summary report corresponding to the belonging community, wherein the sentiment dictionary community is a community division result of the sentiment dictionary; A sentiment parameter set is obtained based on the second node information, the third node information, the fourth node information and the community summary report.
5. The method for evaluating dialogue risk based on a large model according to claim 4 is characterized in that: The determining of the belonging community of the first node information in different sentiment dictionary communities is specifically: Calculating a number of modularity values corresponding to the first node information in different sentiment dictionary communities; Based on a plurality of said modularity values, determining modularity change values of the first node information assigned to different sentiment dictionary communities; Based on the modularity change value, a community to which the first node information belongs is determined.
6. The method for evaluating dialogue risk based on a large model according to claim 1, characterized in that: The final answer description determined based on the risk assessment result is specifically: Determining whether the risk assessment result meets the preset conditions; If the risk assessment result meets the preset conditions, the final answer description is determined; If the risk assessment result does not meet the preset conditions, the target event is re-interpreted with the key parameter set and the candidate answer description is updated.
7. The method for evaluating dialogue risk based on a large model according to claim 1, characterized in that: After determining the final answer description based on the risk assessment result, the method further includes: Extract information from the answer description based on the large model to obtain fifth node information and second edge information; The sentiment dictionary is updated based on the fifth node information and the second edge information.
8. A dialogue risk assessment system based on a large model, characterized in that: include: Acquisition module, extraction module and evaluation module; The acquisition module is used to acquire the user's conversation information, extract information from the conversation information based on the big model, and obtain first node information, wherein the first node information includes the target event; The extraction module is used to extract a key parameter set related to the first node information from a preset sentiment dictionary, interpret the target event with the key parameter set based on the large model, and obtain a candidate answer description; The evaluation module is used to perform risk evaluation on the candidate answer description based on the large model, obtain a risk evaluation result, and determine a final answer description based on the risk evaluation result.
9. An electronic device, characterized in that: It includes a processor and a memory, wherein the memory stores a program or instruction that can be run on the processor, and when the program or instruction is executed by the processor, the steps of the dialogue risk assessment method based on a large model as described in any one of claims 1 to 7 are implemented.
10. A readable storage medium, characterized in that: The readable storage medium stores a program or instruction, and when the program or instruction is executed by the processor, the steps of dialogue risk assessment based on a large model as described in any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Event public opinion data analysis method and device
CN111061876A
Knowledge-enhanced product question and answer community user dialogue emotion recognition method and system
CN118821045A
Cognitive Ranking of Terms Used During a Conversation
US20190243917A1
System to detect, assess and counter disinformation
US20220164643A1
chatbots
WO2010078614A1
Cited By
Medical question and answer risk control method and device
CN120767013A
Online customer service abnormal session detection method and device, storage medium and terminal
CN121958471A