Multi-role dialogue generation method and device based on large model, equipment and medium

By initializing a dynamic character network and environment perception interface in a multi-character dialogue system, building a memory index, and dynamically updating character features based on environmental feature information, the problems of rigid character behavior and insufficient dialogue control are solved, and the accuracy and logic of dialogue generation are improved.

CN120706441APending Publication Date: 2025-09-26INSPUR ENTERPRISE CLOUD TECHNOLOGY (SHANDONG) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510934071.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-08
Publication Date
2025-09-26

AI Technical Summary

Technical Problem

Existing technologies in multi-character dialogue generation have problems such as rigid character behavior patterns, high dialogue control error rate, insufficient integration of environmental factors, and poor long-term dialogue memory management, resulting in low dialogue generation accuracy.

Method used

By initializing the dynamic role network and environmental perception interface, building a memory index, combining physical environment data, social organization relationships and dialogue events to generate environmental feature information, dynamically updating role features, and using a large model to generate dialogue text, dialogue communication is achieved.

Benefits of technology

It improves the accuracy of multi-role dialogue generation and the adaptability of dialogue logic, reduces the error rate in emergencies, and enhances the orderliness of dialogue and information management capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120706441A_ABST
    Figure CN120706441A_ABST
Patent Text Reader

Abstract

The invention discloses a multi-role dialogue generation method and device based on a large model, equipment and a medium, and relates to the field of artificial intelligence, and the method comprises the steps: initializing a dynamic role network and an environment perception interface in a multi-role dialogue system, and constructing a memory index based on a historical dialogue corpus to complete an initialization operation; wherein the dynamic role network comprises knowledge data, emotion data and behavior data of each target role in the multi-role dialogue system; in the current scene, environment feature information is generated based on the physical environment data, the social organization relation of each target role, the current dialogue event and the environment perception interface, role features of each target role are updated based on the environment feature information, and updated role features are obtained; and generating a dialogue text based on the memory index, the environment feature information, the updated role features and the large model, so as to perform dialogue communication among the target roles by using the dialogue text. Therefore, the dialogue generation precision can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence, and in particular to a method, device, equipment and medium for generating multi-role dialogues based on a large model. Background Art

[0002] In recent years, large language models in the field of artificial intelligence have shown great application potential in the generation of multi-role dialogues. However, in actual complex scenario applications, their technical limitations have gradually become apparent and urgently need to be broken through.

[0003] From a technical perspective, existing technologies often construct role features using fixed attribute templates, resulting in rigid role behavior patterns. For example, in medical training systems, the knowledge base of doctor roles is manually updated, making it difficult to dynamically expand knowledge during conversations. In terms of dialogue control, mainstream solutions rely on predefined dialogue trees or finite state machines. When faced with complex open domain scenarios, once an emergency occurs that exceeds the preset rules, such as an emergency simulation scenario, the system error rate soars and the dialogue logic cannot be restored. At the level of environmental factor integration, existing technologies simply process scene parameters as text labels and lack quantitative modeling of the physical environment and social relationships. During virtual negotiations, it is difficult to consider the impact of changes in role power relations on strategies. In terms of long-term dialogue memory management, the traditional fixed-length historical window mechanism has caused a surge in the forgetting rate of key information in thousands of rounds of dialogue.

[0004] Therefore, how to improve the accuracy of dialogue generation in multi-role dialogue is a technical problem that needs to be solved urgently. Summary of the Invention

[0005] In view of this, the present invention aims to provide a method, apparatus, device, and medium for generating multi-role dialogues based on a large model, which can improve the accuracy of dialogue generation in multi-role dialogues. The specific scheme is as follows:

[0006] In a first aspect, the present application provides a method for generating multi-role dialogues based on a large model, comprising:

[0007] In a multi-role dialogue system, a dynamic role network and an environment perception interface are initialized, and a memory index is constructed based on historical dialogue data to complete the initialization operation; wherein the dynamic role network includes knowledge data, emotion data, and behavior data of each target role in the multi-role dialogue system; and the memory index is a storage structure for storing dialogue text;

[0008] In the current scenario, environmental feature information is generated based on the physical environment data, the social organizational relationships of each target role, the current dialogue event, and the environmental perception interface, and the role features of each target role are updated based on the environmental feature information to obtain updated role features;

[0009] A dialogue text is generated based on the memory index, the environmental feature information, the updated character features and the large model, so as to use the dialogue text to conduct dialogue exchanges between the target characters.

[0010] Optionally, initializing the dynamic role network and the environment perception interface, and building a memory index based on historical dialogue data, includes:

[0011] When the multi-role dialogue system is started, a preset character feature parameter file is loaded to instantiate a dynamic character network;

[0012] Initialize the environment perception interface based on the configuration file of the current scene;

[0013] The historical dialogue data is loaded to construct a memory index based on the time axis, the character emotion axis, and the dialogue logic axis using the historical dialogue data.

[0014] Optionally, the generating of environmental feature information based on the physical environment data, the social organizational relationships of the target characters, the current dialogue event, and the environment perception interface includes:

[0015] Using preset physical sensors to obtain physical environment data of the current scene, and calculating the node centrality of the social organization structure diagram related to each target role, so as to analyze the social organization structure diagram and obtain social organization relationships;

[0016] Determining a current dialogue event, and inputting the current dialogue event into a pre-trained convolutional neural network classifier, so that the convolutional neural network classifier outputs a first event conflict coefficient; wherein the event conflict coefficient is a coefficient representing the degree of dialogue contradiction between each of the target characters in the current dialogue event;

[0017] The physical environment data, the social organization relationship, and the first event conflict coefficient are input into the environment perception interface to generate environment feature information.

[0018] Optionally, updating the role characteristics of each target role based on the environmental characteristic information to obtain updated role characteristics includes:

[0019] Determining a cognitive bias correction signal in the previous round of dialogue, and determining a role weight matrix based on the current feature similarity between the target roles; the cognitive bias correction signal is a correction signal obtained by quantifying the cognitive bias generated by the target roles during the dialogue;

[0020] The environmental feature information, the cognitive bias correction signal, and the role weight matrix are input into a preset dynamic role evolution equation, and the role features of each target role are updated using the obtained equation result to obtain updated role features.

[0021] Optionally, the process of conducting a dialogue and communication between the target characters using the dialogue text includes:

[0022] Determining a dialogue event of a current round in a dialogue exchange process, and determining a feature distribution of the dialogue event and a conflict coefficient of a second event;

[0023] Determining a real-time conversation entropy value of the current conversation using a preset Shannon formula, the feature distribution, and the second event conflict coefficient; the real-time conversation entropy value is a value representing the degree of confusion of the current conversation information;

[0024] Comparing the real-time conversation entropy value with a preset lower threshold and a preset upper threshold, and obtaining a corresponding comparison result;

[0025] If the comparison result shows that the real-time conversation entropy value is greater than the preset lower threshold value and not greater than the preset upper threshold value, adding a preset scenario constraint condition to the conversation generation component in the multi-role conversation system within a first preset time period to constrain the conversation text of the next round of conversation;

[0026] If the comparison result indicates that the real-time conversation entropy value is greater than the preset upper threshold value, a preset conversation text adjustment operation is performed within a second preset time period to constrain the conversation text of the next round of conversation.

[0027] Optionally, the large model-based multi-role dialogue generation method further includes:

[0028] When the load of the multi-role dialogue system meets a preset low load condition or the number of dialogue rounds meets a preset number of rounds condition, a target dialogue sample is extracted from the memory index; the target dialogue sample is a dialogue text whose real-time dialogue entropy value is greater than the preset upper threshold value and / or whose text confidence meets a preset high confidence condition;

[0029] The dynamic role network is trained and updated using the target dialogue sample through efficient parameter fine-tuning technology.

[0030] Optionally, after generating the dialogue text based on the memory index, the environmental feature information, the updated character features, and the large model, the method further includes:

[0031] Determining the dialogue text generated in the current round, and determining the timestamp, text participant roles, and dialogue logic relevance of the dialogue text to determine metadata of the dialogue text;

[0032] The conversation text and the metadata are saved to the memory index.

[0033] In a second aspect, the present application provides a multi-role dialogue generation device based on a large model, comprising:

[0034] A system initialization module is used to initialize the dynamic character network and environment perception interface in the multi-character dialogue system, and to build a memory index based on historical dialogue data to complete the initialization operation; wherein the dynamic character network includes the knowledge data, emotion data, and behavior data of each target character in the multi-character dialogue system; the memory index is a storage structure for storing dialogue text;

[0035] A feature update module is configured to generate environmental feature information based on the physical environment data, the social organizational relationships of each target role, the current dialogue event, and the environmental perception interface in the current scenario, and to update the role features of each target role based on the environmental feature information to obtain updated role features;

[0036] A text generation module is used to generate dialogue text based on the memory index, the environmental feature information, the updated character features and the large model, so as to use the dialogue text to conduct dialogue exchanges between the target characters.

[0037] In a third aspect, the present application provides an electronic device, comprising:

[0038] Memory, used to store computer programs;

[0039] A processor is used to execute the computer program to implement the aforementioned large model-based multi-role dialogue generation method.

[0040] In a fourth aspect, the present application provides a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the aforementioned large-model-based multi-role dialogue generation method is implemented.

[0041] In this application, in a multi-role dialogue system, a dynamic role network and an environment perception interface are initialized, and a memory index is constructed based on historical dialogue data to complete the initialization operation; wherein the dynamic role network includes the knowledge data, emotional data, and behavioral data of each target role in the multi-role dialogue system; the memory index is a storage structure for storing dialogue text; in the current scene, environmental feature information is generated based on physical environment data, the social organizational relationships of each target role, current dialogue events, and the environment perception interface, and the role features of each target role are updated based on the environmental feature information to obtain updated role features; based on the memory index, the environmental feature information, the updated role features, and the large model, dialogue text is generated to use the dialogue text to conduct dialogue exchanges between the target roles. As can be seen from the above, in the startup phase of the multi-role dialogue system, the application needs to complete the initialization of the dynamic role network and the environment perception interface, as well as the operation of constructing a memory index based on historical dialogue data. After entering the current scene, the physical environment data, the social organizational relationships of the target role, the current dialogue events, and other information are integrated to generate environmental feature information through the environment perception interface. Then, based on this environmental feature information, the characteristic parameters of each target character are dynamically updated to form updated character features. Finally, the memory index, environmental feature information, and updated character features are integrated with the large model to generate dialogue text that conforms to the scene logic and character characteristics, enabling intelligent dialogue interaction between the target characters. In this way, this application can improve the accuracy of dialogue generation in multi-character dialogues by dynamically updating character features and adapting to the environment. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are merely embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.

[0043] Figure 1 This is a flow chart of a method for generating multi-role dialogue based on a large model disclosed in this application;

[0044] Figure 2 This is a flowchart of a specific method for generating multi-role dialogue based on a large model disclosed in this application;

[0045] Figure 3 This is a schematic diagram of the structure of a multi-role dialogue generation device based on a large model disclosed in this application;

[0046] Figure 4 This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION

[0047] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.

[0048] Currently, existing technologies often use fixed attribute templates to construct role features, resulting in rigid role behavior patterns. For example, in medical training systems, the update of the doctor role knowledge base relies on manual labor, making it difficult to dynamically expand knowledge in conversations. In terms of dialogue control, mainstream solutions rely on predefined dialogue trees or finite state machines. Faced with complex scenarios in open domains, once an emergency occurs that exceeds the preset rules, such as an emergency simulation scenario, the system error rate soars and the dialogue logic cannot be restored. At the level of environmental factor fusion, existing technologies simply process scene parameters as text labels and lack quantitative modeling of the physical environment and social relationships. During virtual negotiations, it is difficult to consider the impact of changes in role power relations on strategies. In terms of long-term dialogue memory management, the traditional fixed-length historical window mechanism causes a surge in the forgetting rate of key information in thousands of rounds of dialogue. To this end, the present application provides a multi-role dialogue generation method, device, equipment and medium based on a large model, which can improve the accuracy of dialogue generation in multi-role dialogues.

[0049] See also Figure 1 As shown, the embodiment of the present invention discloses a method for generating multi-role dialogue based on a large model, comprising:

[0050] Step S11: In a multi-role dialogue system, initialize a dynamic role network and an environment perception interface, and construct a memory index based on historical dialogue data to complete the initialization operation; wherein, the dynamic role network includes the knowledge data, emotion data, and behavior data of each target role in the multi-role dialogue system; and the memory index is a storage structure for storing dialogue text.

[0051] In this embodiment, when the multi-role dialogue system is activated, it first loads a preset character characteristic parameter file containing the basic characteristic parameters of each target character. These parameters are then parsed and instantiated to construct a dynamic character network. During the instantiation process, each target character is assigned corresponding knowledge data, emotional data, and behavioral data, as defined in the parameter file. Knowledge data includes, but is not limited to, professional domain knowledge and common sense; emotional data includes, but is not limited to, emotional tendencies and emotional expression patterns; and behavioral data includes, but is not limited to, language style and behavioral habits. This allows the dynamic character network to truly reflect the characteristics of each target character.

[0052] Next, the environment perception interface is initialized based on the current scene's configuration file. The current scene's configuration file contains information such as the scene type and background. By reading and processing this information, the environment perception interface can perceive the state of the dialogue environment and provide the environment for subsequent dialogue generation.

[0053] Furthermore, historical dialogue data is loaded and used to construct a memory index based on the timeline, character emotion axis, and dialogue logic axis. The timeline is used to arrange dialogue texts in the chronological order of their occurrence, allowing the system to retrieve historical dialogues in chronological order. The character emotion axis classifies and indexes dialogue texts based on the emotional information expressed by each character in the dialogue, allowing the system to understand the emotional changes of each target character in historical dialogues. The dialogue logic axis organizes dialogue texts based on the topic, logical relationships, etc., ensuring that the system can grasp the overall logical context of the dialogue. By constructing this three-dimensional memory index, the system can more efficiently store and retrieve historical dialogue information, providing rich historical information support for the generation of multi-character dialogues.

[0054] When building a memory index, historical conversation data is preprocessed, including word segmentation, part-of-speech tagging, and sentiment analysis, to extract key information from the conversation. For example, the conversation text is segmented to obtain word sequences; sentiment analysis algorithms are used to determine the emotional tendencies of each character in the conversation; and the conversation's theme and logical relationships are determined based on the content. This processed information is then indexed and stored along the timeline, character emotion axis, and conversation logic axis, forming a complete memory index structure.

[0055] Furthermore, it is understood that the dynamic character network is not fixed after initialization. The knowledge, emotion, and behavior data within the dynamic character network are dynamically updated and optimized based on the character's interactions and environmental changes during subsequent conversations to ensure that the dynamic character network can continue to accurately reflect the character's characteristics. The environmental perception interface also monitors environmental changes in real time, promptly updating environmental status information to provide the latest environment for conversation generation. The memory index also continuously adds new conversation text during the conversation, enriching historical conversation information and enabling the system to better utilize historical conversation information to generate multi-character conversations that meet scenario requirements.

[0056] Step S12: In the current scenario, environmental feature information is generated based on the physical environment data, the social organizational relationships of each target role, the current dialogue event, and the environmental perception interface, and the role features of each target role are updated based on the environmental feature information to obtain updated role features.

[0057] In this embodiment, in the current scene, the physical environment data of the current scene is first obtained using preset physical sensors. The preset physical sensors include but are not limited to temperature sensors, humidity sensors, light sensors, sound sensors, etc., which can collect physical parameters in the scene in real time.

[0058] At the same time, the node centrality of the social organizational structure diagram associated with each target role is calculated to analyze the social organizational structure diagram and obtain social organizational relationships. A social organizational structure diagram is a graph structure used to represent social relationships between roles, where nodes represent roles, edges represent relationships between roles, and edge weights represent the strength of relationships. Node centrality is a measure of the importance of a node in the graph. Common methods for calculating node centrality include degree centrality, closeness centrality, and betweenness centrality. By calculating the centrality of each node, the status and influence of each target role in the social organization can be determined, and social organizational relationships such as hierarchical relationships, collaborative relationships, and competitive relationships between roles can be analyzed.

[0059] Next, the current conversation event is determined and input into a pre-trained convolutional neural network classifier, which outputs a first-event conflict coefficient. The current conversation event refers to the content of the conversation currently occurring in the current scenario. The type and content of the conversation event are determined by performing semantic analysis and topic identification on the current conversation text. The pre-trained convolutional neural network classifier is a deep learning-based classification model trained on large-scale conversation data and capable of identifying the potential degree of conflict in different conversation events. The first-event conflict coefficient represents the degree of conflict between each target character in the current conversation event. A larger coefficient indicates a higher degree of conflict.

[0060] Furthermore, the physical environment data, social organizational relationships, and the first-event conflict coefficient are input into the environmental perception interface to generate environmental feature information. The environmental perception interface is an information fusion and processing module that integrates and analyzes information from different sources and types. After receiving the physical environment data, social organizational relationships, and the first-event conflict coefficient, the environmental perception interface first performs feature extraction on these information, converting the raw data into feature vectors. For example, feature extraction of parameters such as temperature and humidity in the physical environment data generates a feature vector representing environmental comfort; social organizational relationships are quantified to generate feature vectors representing the social status of the characters and the strength of the relationships. The environmental perception interface then fuses these feature vectors, integrating them into a comprehensive environmental feature vector (i.e., environmental feature information) through weighted summation and nonlinear transformation. This environmental feature information comprehensively reflects factors such as the current scene's physical environment, social relationships, and the degree of dialogue conflict.

[0061] After generating environmental feature information, the system further determines cognitive bias correction signals from the previous round of conversation and determines a role weight matrix based on the current feature similarity between each target role. This cognitive bias correction signal quantifies the cognitive biases generated by each target role during the conversation. In multi-role conversations, due to the varying knowledge backgrounds, emotional states, and cognitive abilities of each role, they may interpret and judge the same conversation content differently, leading to cognitive biases. The system analyzes the conversation content and feedback from each role in the previous round of conversation to identify potential cognitive biases and quantify them as cognitive bias correction signals.

[0062] The role weight matrix is ​​determined based on the current feature similarity between each target role. The system first calculates the feature similarity between each target role. This feature similarity can be calculated based on multiple dimensions, including the target role's knowledge data, emotional data, and behavioral data. For example, by calculating the cosine similarity between the knowledge vectors of two roles, the degree of similarity in their knowledge domain can be determined. Alternatively, by comparing the emotional expression patterns of the two roles, their emotional similarity can be determined. Then, based on these feature similarity values, the role weight matrix is ​​constructed. Clearly, the role weight matrix reflects the relative importance and influence of each target role in the conversation, with higher weight values ​​indicating a greater role's influence in the conversation.

[0063] Finally, the environmental feature information, cognitive bias correction signal, and role weight matrix are input into a preset dynamic role evolution equation. The resulting equation is then used to update the role characteristics of each target character, yielding updated role characteristics. This preset dynamic role evolution equation takes environmental feature information, cognitive bias correction signal, and role weight matrix as inputs and, through a series of mathematical operations and transformations, outputs the updated role characteristics. This updated value is then applied to the original role characteristics of each target character, achieving the updated role characteristics.

[0064] Step S13: Generate a dialogue text based on the memory index, the environmental feature information, the updated character features, and the large model, so as to use the dialogue text to conduct dialogue exchanges between the target characters.

[0065] In this embodiment, after generating a conversation text, the conversation text generated in the current round is first determined. The timestamp, the roles involved in the conversation, and the logical relevance of the conversation are then determined to determine the conversation text metadata. This metadata together constitutes the basic descriptive information of the conversation text, providing an important basis for conversation management and analysis. Next, the conversation text and metadata are stored in a memory index. The memory index utilizes a multi-level, multi-dimensional storage structure, enabling efficient management and retrieval of conversation information.

[0066] During the conversation, the current round of dialogue events is continuously monitored, and the feature distribution and second-event conflict coefficient of the dialogue event are determined. The feature distribution is the distribution obtained by statistically analyzing the various features of the dialogue event. Using the preset Shannon formula, the feature distribution, and the second-event conflict coefficient, the real-time dialogue entropy value of the current conversation is determined. The real-time dialogue entropy value represents the degree of information chaos in the current conversation and is calculated based on the Shannon entropy concept in information theory. It should be noted that higher real-time dialogue entropy values ​​indicate more chaotic dialogue information and a less organized and consistent communication between characters. Conversely, lower real-time dialogue entropy values ​​indicate more organized dialogue information and smoother and more efficient communication between characters.

[0067] After obtaining the real-time conversation entropy value, it is compared with a preset lower and upper threshold, and the corresponding comparison results are obtained. The preset lower and upper thresholds are used to determine whether the level of conversation chaos is within an acceptable range. If the comparison results indicate that the real-time conversation entropy value is greater than the preset lower threshold but not greater than the preset upper threshold, it indicates that the conversation information chaos is at a moderate level. In this case, preset scenario constraints are added to the conversation generation component in the multi-role dialogue system within a first preset time period to constrain the conversation text of the next round of conversation. Preset scenario constraints are a series of rules and restrictions pre-set based on the characteristics and requirements of the current scenario, such as topic scope, language style, and emotional tendency. By adding these constraints, the conversation can be guided towards a more orderly and meaningful direction, reducing the level of chaos in the conversation.

[0068] In a specific embodiment, if the comparison results indicate that the real-time conversation entropy value is greater than a preset upper threshold, it indicates that the conversation information is too chaotic and there are serious problems with communication between the characters. In this case, a preset conversation text adjustment operation is performed within a second preset time period to constrain the conversation text of the next round of conversation. Preset conversation text adjustment operations include but are not limited to topic guidance, point of view integration, and emotion regulation.

[0069] In addition, in this embodiment, when the load of the multi-role dialogue system meets the preset low load condition or the number of dialogue rounds meets the preset number of rounds condition, the target dialogue sample will be extracted from the memory index. The target dialogue sample is a dialogue text whose real-time dialogue entropy value is greater than the preset upper threshold value and / or a dialogue text whose text confidence meets the preset high confidence condition. The dialogue text whose real-time dialogue entropy value is greater than the preset upper threshold value usually contains fierce conflicts and complex interactions between characters. These dialogue samples are of great value for training dynamic character networks. The dialogue text whose text confidence meets the preset high confidence condition refers to dialogue samples with high confidence in the generated quality. These samples usually have high semantic coherence and logic, and can provide reliable data support for the training of dynamic character networks.

[0070] After obtaining the target dialogue sample, the dynamic character network is trained and updated using efficient parameter fine-tuning technology. This technique is a highly efficient fine-tuning method for large pre-trained models. It adjusts only some of the model's parameters while keeping others unchanged. This significantly reduces training costs and computing resource consumption while ensuring effective training. During training, the target dialogue sample is input into the dynamic character network, and a loss function is calculated using a backpropagation algorithm. The parameters of the dynamic character network are then adjusted based on the loss function's value. Through continuous iterative training, the dynamic character network learns the patterns and regularities in the target dialogue sample, thereby improving its performance in multi-character dialogue generation tasks.

[0071] As can be seen from the above, during the startup phase of the multi-role dialogue system, this application needs to complete the initialization of the dynamic role network and the environment perception interface, as well as the operation of building a memory index based on historical dialogue materials. After entering the current scene, the physical environment data, the social organizational relationship of the target role, the current dialogue event and other information are integrated to generate environmental feature information through the environment perception interface. Then, based on the environmental feature information, the feature parameters of each target role are dynamically updated to form updated role features. Finally, the memory index, environmental feature information, updated role features and the large model are integrated to generate a dialogue text that conforms to the scene logic and role characteristics, and realize intelligent dialogue interaction between the target roles. In this way, this application can improve the accuracy of dialogue generation in multi-role dialogues by dynamically updating role features and adapting to the environment.

[0072] The following combination Figure 2 The schematic diagram shown in FIG. 1 specifically illustrates the technical solution of the embodiment of the present application.

[0073] Specifically, at the startup stage of the multi-role dialogue system, a pre-defined role feature parameter file is loaded to instantiate the dynamic role network. This role feature parameter file contains the initial knowledge dimension weight matrix, emotional tendency vector, and behavior pattern probability table for each role. Meanwhile, the environmental perception interface is initialized according to the configuration file of the target application scenario, which defines the physical environment parameters, social relationship structure template, and quantization rules for event conflict levels. Also, the dialogue entropy value controller is initialized, setting the thresholds for the safety zone (e.g., H ≤ 2.5), warning zone (e.g., 2.5 < H ≤ 3.0), and out-of-control zone (e.g., H > 3.0) for entropy value regulation. Here, H is the dialogue entropy value, 2.5 is the preset threshold lower limit, and 3.0 is the preset threshold upper limit. This dialogue entropy value controller mainly monitors and manages the dialogue state during the subsequent process of dialogue communication between target roles using dialogue texts. Finally, the historical dialogue corpus is loaded, and a three-dimensional memory index based on the time decay axis, emotional intensity axis, and logical association axis is constructed using the memory loop checker as the basis for subsequent dialogue consistency.

[0074] At the beginning of each round of dialogue generation loop, physical environment data is read in real-time through physical sensors. The social organization structure diagram of the current scene is parsed, and the node centrality is calculated to quantify the social relationship graph. Combining the current dialogue event content, a pre-trained CNN (Convolutional Neural Network) classifier is used to evaluate and output the event conflict coefficient (i.e., the first event conflict coefficient). The collected physical environment data, the parsing results of the social relationship graph, and the output event conflict coefficient are input into the initialized environmental perception interface. Inside this interface, a graph attention network is used to process social relationship data and fuse it with physical and event features, finally generating a 64-dimensional environmental feature encoding matrix (i.e., environmental feature information) representing the comprehensive state of the current scene.

[0075] Using the generated environmental feature encoding matrix, the cognitive bias correction signal generated from the previous round of dialogue obtained from the memory loop checker, and the role interaction weight matrix calculated in real-time based on the current feature similarity between roles, substitute them into the following dynamic role evolution equation to update the role features.

[0076] [[ID=,10]];

[0077] In the formula, is the environmental fusion coefficient, is the environmental feature encoding matrix, is the role interaction coefficient, is the memory correction coefficient, is the role interaction weight matrix, [[ID=2,5]]is the matrix representing the cognitive bias correction signal, is the transpose operation, Represents the multiplication operation between matrices, For the current character characteristics, The character features after a round of character evolution, that is, the features of the current character features that are updated;

[0078] Furthermore, based on the updated character feature matrix and the generated environmental feature encoding matrix, the underlying large language model is driven to generate the multi-character dialogue text for this round. During this generation process, the feature dimension distribution of the dialogue events is recorded. Using the improved Shannon entropy formula and the current event conflict coefficient, the real-time dialogue entropy value of the current dialogue round is calculated to quantify the confusion of the dialogue information.

[0079] The corresponding control strategy is triggered based on the calculated real-time conversation entropy value and the preset threshold range (i.e., the range divided by the preset lower threshold limit and the preset upper threshold limit). Specifically, when the real-time conversation entropy value is in the safe zone, the natural conversation flow is maintained and no intervention is made. When the real-time conversation entropy value is in the warning zone, scenario constraints are injected into the conversation generation module within less than 200ms (i.e., the first preset time period) to limit the divergence of the conversation. When the real-time conversation entropy value is in the out-of-control zone, emergency recovery operations are performed within less than 500ms (i.e., the second preset time period).

[0080] Emergency recovery operations include triggering character behavior pattern reorganization, activating memory reinforcement signals, and feeding the reorganization and reinforcement signals back to the dialogue generation module to attempt to restore dialogue logical coherence. Triggering character behavior pattern reorganization involves temporarily adjusting character interaction weights or behavior probabilities based on the current environment and high entropy state. Activating the memory reinforcement signal instructs the memory loop verifier to enhance the storage of recent key information.

[0081] The generated conversation text and its associated metadata (such as timestamp, participating characters, emotional intensity, and logical relevance) are then fed into the memory loop verifier. It should be noted that the verifier operates in a three-dimensional memory coordinate system. After the conversation text and associated metadata are fed into the memory loop verifier, an exponential decay function is applied to the historical conversation information, attenuating its intensity, with particular attention paid to non-core information. The semantic similarity between the new information and the historical memory is calculated, and the confidence level of key information is assessed. Logical contradictions or discrepancies in key facts between the new conversation content and the reinforced historical memory are identified. If significant cognitive bias is detected, a cognitive bias correction signal is generated. This signal is used as input in the next character update to reversely correct the large model's cognition.

[0082] Additionally, offline optimization is performed during periods of low system load (pre-set low load conditions) or after a certain number of conversation rounds (pre-set round number conditions) is reached. This involves extracting conversation samples (target conversation samples) from the memory loop verifier that have high confidence and / or are generated in the out-of-control zone.

[0083] Furthermore, using the extracted dialogue samples, the dynamic character network is incrementally trained using efficient parameter fine-tuning techniques to update the character's knowledge, emotion, and behavior parameters. Furthermore, Bayesian optimization methods can be used to automatically adjust the environment fusion coefficient, character interaction coefficient, and memory correction coefficient in the dynamic evolution equation based on the coherence score of recent dialogues to maximize overall dialogue quality.

[0084] Accordingly, see Figure 3 As shown, the embodiment of the present application provides a multi-role dialogue generation device based on a large model, comprising:

[0085] The system initialization module 11 is used to initialize the dynamic role network and environment perception interface in the multi-role dialogue system, and to build a memory index based on the historical dialogue data to complete the initialization operation; wherein the dynamic role network includes the knowledge data, emotion data, and behavior data of each target role in the multi-role dialogue system; the memory index is a storage structure for storing dialogue text;

[0086] A feature updating module 12 is configured to generate environmental feature information based on the physical environment data, the social organizational relationships of each target character, the current dialogue event, and the environmental perception interface in the current scenario, and to update the role features of each target character based on the environmental feature information to obtain updated role features;

[0087] The text generation module 13 is used to generate a dialogue text based on the memory index, the environmental feature information, the updated character features and the large model, so as to use the dialogue text to conduct dialogue exchanges between the target characters.

[0088] As can be seen from the above, during the startup phase of the multi-role dialogue system, this application needs to complete the initialization of the dynamic role network and the environment perception interface, as well as the operation of building a memory index based on historical dialogue materials. After entering the current scene, the physical environment data, the social organizational relationship of the target role, the current dialogue event and other information are integrated to generate environmental feature information through the environment perception interface. Then, based on the environmental feature information, the feature parameters of each target role are dynamically updated to form updated role features. Finally, the memory index, environmental feature information, updated role features and the large model are integrated to generate a dialogue text that conforms to the scene logic and role characteristics, and realize intelligent dialogue interaction between the target roles. In this way, this application can improve the accuracy of dialogue generation in multi-role dialogues by dynamically updating role features and adapting to the environment.

[0089] In some specific implementations, the system initialization module 11 specifically includes:

[0090] A network instantiation unit, configured to load a preset character feature parameter file to instantiate a dynamic character network after the multi-character dialogue system is started;

[0091] An interface initialization unit, used to initialize the environment perception interface based on the configuration file of the current scene;

[0092] The index construction unit is used to load historical dialogue data to use the historical dialogue data to construct a memory index based on the time axis, the character emotion axis and the dialogue logic axis.

[0093] In some specific implementations, the feature updating module 12 specifically includes:

[0094] a relationship determination unit, configured to obtain physical environment data of the current scene using a preset physical sensor, and calculate the node centrality of a social organization structure diagram related to each of the target roles, so as to parse the social organization structure diagram and obtain social organization relationships;

[0095] a coefficient determination unit, configured to determine a current dialogue event and input the current dialogue event into a pre-trained convolutional neural network classifier, so that the convolutional neural network classifier outputs a first event conflict coefficient; wherein the event conflict coefficient is a coefficient representing the degree of dialogue contradiction between each target character in the current dialogue event;

[0096] An information determination unit is used to input the physical environment data, the social organization relationship and the first event conflict coefficient into the environment perception interface to generate environment feature information.

[0097] In some specific implementations, the feature updating module 12 specifically includes:

[0098] a matrix determination unit, configured to determine a cognitive bias correction signal in the previous round of dialogue, and determine a role weight matrix based on the current feature similarity between the target roles; the cognitive bias correction signal is a correction signal obtained by quantifying the cognitive bias generated by the target roles during the dialogue;

[0099] A feature updating unit is used to input the environmental feature information, the cognitive bias correction signal and the role weight matrix into a preset dynamic role evolution equation, and use the obtained equation result to update the role features of each target role to obtain updated role features.

[0100] In some specific implementations, the text generation module 13 specifically includes:

[0101] An event information determination unit, configured to determine a dialogue event of a current round in a dialogue exchange process, and determine a feature distribution of the dialogue event and a conflict coefficient with a second event;

[0102] An entropy value determining unit, configured to determine a real-time conversation entropy value of the current conversation using a preset Shannon formula, the characteristic distribution, and the second event conflict coefficient; the real-time conversation entropy value is a value representing a degree of confusion of the current conversation information;

[0103] An entropy value comparison unit is used to compare the real-time conversation entropy value with a preset lower threshold value and a preset upper threshold value, and obtain a corresponding comparison result;

[0104] a conditional injection unit, configured to, if the comparison result indicates that the real-time dialogue entropy value is greater than the preset lower threshold value and not greater than the preset upper threshold value, add a preset scenario constraint condition to the dialogue generation component in the multi-role dialogue system within a first preset time period to constrain the dialogue text of the next round of dialogue;

[0105] An operation execution unit is configured to execute a preset dialogue text adjustment operation within a second preset time period to constrain the dialogue text of the next round of dialogue if the comparison result indicates that the real-time dialogue entropy value is greater than the preset upper threshold value.

[0106] In some specific implementations, the large model-based multi-role dialogue generation device further includes:

[0107] A sample determination unit is configured to extract a target dialogue sample from the memory index when the load of the multi-role dialogue system meets a preset low load condition or the number of dialogue rounds meets a preset number of rounds condition; the target dialogue sample is a dialogue text whose real-time dialogue entropy value is greater than the preset upper threshold value and / or whose text confidence meets a preset high confidence condition;

[0108] A network updating unit is used to train and update the dynamic character network using the target dialogue sample through efficient parameter fine-tuning technology.

[0109] In some specific implementations, the text generation module 13 further includes:

[0110] a metadata determination unit, configured to determine the dialogue text generated in the current round, and determine the timestamp, text participant roles, and dialogue logic relevance of the dialogue text, so as to determine metadata of the dialogue text;

[0111] A data storage unit is used to store the conversation text and the metadata in the memory index.

[0112] Furthermore, the embodiment of the present application also discloses an electronic device, Figure 4 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content in the diagram should not be considered as any limitation on the scope of use of this application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps of the large model-based multi-role dialogue generation method disclosed in any of the aforementioned embodiments. In addition, the electronic device 20 in this embodiment may specifically be an electronic computer.

[0113] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device. The communication protocol it follows is any communication protocol that can be applied to the technical solution of this application and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world. Its specific interface type can be selected according to specific application needs and is not specifically limited here.

[0114] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or CD, etc. The resources stored thereon can include an operating system 221, a computer program 222, etc., and the storage method can be temporary storage or permanent storage.

[0115] The operating system 221 is used to manage and control the hardware devices and computer program 222 on the electronic device 20, and can be Windows Server, NetWare, Unix, Linux, etc. In addition to including a computer program capable of implementing the large model-based multi-role dialogue generation method performed by the electronic device 20 as disclosed in any of the aforementioned embodiments, the computer program 222 may further include a computer program capable of implementing other specific tasks.

[0116] Furthermore, this application discloses a computer-readable storage medium for storing a computer program. When executed by a processor, the computer program implements the aforementioned method for generating multi-role dialogues based on a large model. The specific steps of this method can be found in the corresponding content disclosed in the aforementioned embodiments and will not be further elaborated here.

[0117] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from the other embodiments. Reference can be made to the descriptions of the identical or similar parts between the various embodiments. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple, and the relevant parts can be referred to the descriptions of the methods.

[0118] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0119] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0120] Finally, it should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or device comprising the element.

[0121] The above is a detailed introduction to the technical solution provided by the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for those skilled in the art, according to the ideas of the present application, there may be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A multi-role dialogue generation method based on a large model, characterized in that: include: In a multi-role dialogue system, a dynamic role network and an environment perception interface are initialized, and a memory index is constructed based on historical dialogue data to complete the initialization operation; wherein the dynamic role network includes knowledge data, emotion data, and behavior data of each target role in the multi-role dialogue system; and the memory index is a storage structure for storing dialogue text; In the current scenario, environmental feature information is generated based on the physical environment data, the social organizational relationships of each target role, the current dialogue event, and the environmental perception interface, and the role features of each target role are updated based on the environmental feature information to obtain updated role features; A dialogue text is generated based on the memory index, the environmental feature information, the updated character features and the large model, so as to use the dialogue text to conduct dialogue exchanges between the target characters.

2. The method for generating multi-role dialogues based on a large model according to claim 1, characterized in that: Initializing the dynamic role network and environment perception interface, and building a memory index based on historical dialogue data, includes: When the multi-role dialogue system is started, a preset character feature parameter file is loaded to instantiate a dynamic character network; Initialize the environment perception interface based on the configuration file of the current scene; Load historical dialogue data to use the historical dialogue data to construct a memory index based on the time axis, the character emotion axis, and the dialogue logic axis.

3. The method for generating multi-role dialogues based on a large model according to claim 1, characterized in that: The generating of environmental feature information based on the physical environment data, the social organizational relationship of each target role, the current dialogue event, and the environmental perception interface includes: Using preset physical sensors to obtain physical environment data of the current scene, and calculating the node centrality of the social organization structure diagram related to each target role, so as to analyze the social organization structure diagram and obtain social organization relationships; Determining a current dialogue event, and inputting the current dialogue event into a pre-trained convolutional neural network classifier, so that the convolutional neural network classifier outputs a first event conflict coefficient; wherein the event conflict coefficient is a coefficient representing the degree of dialogue contradiction between each of the target characters in the current dialogue event; The physical environment data, the social organization relationship, and the first event conflict coefficient are input into the environment perception interface to generate environment feature information.

4. The method for generating multi-role dialogues based on a large model according to claim 1, characterized in that: The updating of the role characteristics of each target role based on the environmental feature information to obtain updated role characteristics includes: Determining a cognitive bias correction signal in the previous round of dialogue, and determining a role weight matrix based on the current feature similarity between the target roles; the cognitive bias correction signal is a correction signal obtained by quantifying the cognitive bias generated by the target roles during the dialogue; The environmental feature information, the cognitive bias correction signal, and the role weight matrix are input into a preset dynamic role evolution equation, and the role features of each target role are updated using the obtained equation result to obtain updated role features.

5. The method for generating multi-role dialogue based on a large model according to claim 1, characterized in that: The process of conducting a dialogue and communication between the target characters using the dialogue text includes: Determining a dialogue event of a current round in a dialogue exchange process, and determining a feature distribution of the dialogue event and a conflict coefficient of a second event; Determining a real-time conversation entropy value of the current conversation using a preset Shannon formula, the feature distribution, and the second event conflict coefficient; the real-time conversation entropy value is a value representing the degree of confusion of the current conversation information; Comparing the real-time conversation entropy value with a preset lower threshold and a preset upper threshold, and obtaining a corresponding comparison result; If the comparison result shows that the real-time conversation entropy value is greater than the preset lower threshold value and not greater than the preset upper threshold value, adding a preset scenario constraint condition to the conversation generation component in the multi-role conversation system within a first preset time period to constrain the conversation text of the next round of conversation; If the comparison result indicates that the real-time conversation entropy value is greater than the preset upper threshold value, a preset conversation text adjustment operation is performed within a second preset time period to constrain the conversation text of the next round of conversation.

6. The method for generating multi-role dialogues based on a large model according to claim 5, characterized in that: Also includes: When the load of the multi-role dialogue system meets a preset low load condition or the number of dialogue rounds meets a preset number of rounds condition, extracting a target dialogue sample from the memory index; The target conversation sample is a conversation text whose real-time conversation entropy value is greater than the preset upper threshold value and / or a conversation text whose text confidence meets a preset high confidence condition; The dynamic role network is trained and updated using the target dialogue sample through efficient parameter fine-tuning technology.

7. The method for generating multi-role dialogue based on a large model according to any one of claims 1 to 6, characterized in that: After generating the dialogue text based on the memory index, the environmental feature information, the updated character features and the large model, the method further includes: Determining the dialogue text generated in the current round, and determining the timestamp, text participant roles, and dialogue logic relevance of the dialogue text to determine metadata of the dialogue text; The conversation text and the metadata are saved to the memory index.

8. A multi-role dialogue generation device based on a large model, characterized in that: include: A system initialization module is used to initialize the dynamic character network and environment perception interface in the multi-character dialogue system, and to build a memory index based on historical dialogue data to complete the initialization operation; wherein the dynamic character network includes the knowledge data, emotion data, and behavior data of each target character in the multi-character dialogue system; the memory index is a storage structure for storing dialogue text; A feature update module is configured to generate environmental feature information based on the physical environment data, the social organizational relationships of each target role, the current dialogue event, and the environmental perception interface in the current scenario, and to update the role features of each target role based on the environmental feature information to obtain updated role features; A text generation module is used to generate dialogue text based on the memory index, the environmental feature information, the updated character features and the large model, so as to use the dialogue text to conduct dialogue exchanges between the target characters.

9. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, configured to execute the computer program to implement the large model-based multi-role dialogue generation method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that Used to store a computer program; wherein, when the computer program is executed by a processor, the method for generating multi-role dialogue based on a large model as described in any one of claims 1 to 7 is implemented.