A method and system for decoupling and flexible activation of role-playing middle-level intelligent agent characters
By using multi-layered structured character modeling and a flexible activation mechanism, the problem of the single character design of role-playing intelligent agents is solved, and the dynamic adjustment of character multifacetedness and situational sensitivity is realized, thereby enhancing the interactive fun and emotional warmth.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- PAZHOU LAB (HUANGPU)
- Filing Date
- 2026-03-02
- Publication Date
- 2026-06-09
AI Technical Summary
Existing character modeling methods for role-playing intelligent agents lack hierarchical structures, resulting in monotonous behaviors and expressions, making it difficult to reflect the multifaceted nature and situational sensitivity of the characters. Furthermore, the lack of dynamic control mechanisms affects the interactive fun and emotional warmth.
A multi-layered structured character modeling approach is adopted, dividing character information into a kernel layer, a capability layer, and a performance layer. The character expression is dynamically adjusted through flexible activation rules and contextual information to generate diverse interactive behaviors.
It achieves the goal of enhancing the diversity of expression and emotional changes while maintaining consistency of roles, improving the contextual relevance of interactive feedback, and increasing the fun and emotional warmth of interaction.
Smart Images

Figure CN122173603A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of large language model technology, and in particular relates to a method and system for decoupling and elastically activating the persona of a mid-level intelligent agent in role-playing. Background Technology
[0002] With the increasing capabilities of large language models in natural language generation, multi-turn dialogue, and contextual understanding, role-playing agents based on large language models have gradually become an important research direction in the field of artificial intelligence. These agents are widely used in scenarios such as immersive interaction, virtual role-playing, emotional companionship, interactive narrative, and game NPCs (non-player characters).
[0003] Currently, role-playing-based human-computer natural language dialogue agents have been widely applied in fields such as engaging teaching, immersive interaction, and emotional companionship. Among these applications, the consistency of the character's persona and the fun of the interaction are core factors influencing the quality of the user experience. Existing role-playing dialogue generation systems typically establish the persona by injecting character description text or rule prompts into the model at the initial stage of the dialogue and retaining this persona information throughout the interaction.
[0004] However, such role-playing agents typically employ a "flat character modeling + full activation loading" structure, which mixes different levels of elements such as personality, abilities, and performance style into a single textual whole, all participating in reasoning. Due to the lack of a hierarchical structure linking abstract personality traits to concrete interactive behaviors, the system cannot dynamically activate the agent's character elements based on the dialogue context. This results in the agent maintaining character consistency across multiple rounds of dialogue, but its behavior and expression often exhibit a singular, mechanical response pattern, failing to reflect the character's multifaceted nature, emotional changes, and situational sensitivity, thus lacking interactive fun and emotional warmth.
[0005] Furthermore, existing technologies generally lack a mechanism for dynamically controlling the hierarchical encoding and reasoning of agent personas at the algorithmic level. The influence of personas on the model-generated responses mainly depends on the implicit reasoning process of the large model. The system itself cannot decouple and flexibly activate different elements of the personas, which further limits the controllability and scalability of role-playing agents in complex interactive scenarios.
[0006] Therefore, how to break through the flat and static character modeling method and build a flexible character activation technology that can transform static characters into characters that can dynamically adjust their expression according to the interaction context during operation, thereby generating more diverse forms of expression, more varied emotional expressions, and interactive feedback that fits the context while maintaining character consistency, so that the output can reflect higher interactive fun and emotional warmth at the engineering level, has become a core technical problem that urgently needs to be solved. Summary of the Invention
[0007] To address the aforementioned problems in the prior art, this invention provides a method and system for decoupling and flexibly activating mid-level intelligent agents in role-playing.
[0008] The technical problem to be solved by this invention is achieved through the following technical solution: In a first aspect, the present invention provides a method for decoupling and flexibly activating the persona of a mid-level intelligent agent in role-playing, comprising: Receive the dialogue request for the current round from the user to the target role's intelligent agent; Based on the current dialogue request, obtain context information and load the multi-layered structured persona information corresponding to the target role intelligent agent; the multi-layered structured persona information includes kernel layer persona information, capability layer persona information and performance layer persona information; Based on the pre-set flexible activation rules and context information, the target persona information corresponding to the current round of dialogue request is obtained from the kernel layer persona information, capability layer persona information and presentation layer persona information. Based on the target persona information and pre-retrieved external role association information, generate the response result corresponding to the current round of dialogue request.
[0009] Secondly, the present invention provides a role-playing mid-level intelligent agent character decoupling and flexible activation system, comprising: The receiving module is used to receive the dialogue request for the current round input by the user to the target role intelligent agent; The information loading module is used to obtain context information based on the dialogue request of the current round and load the multi-layered structured persona information corresponding to the target role intelligent agent; the multi-layered structured persona information includes kernel layer persona information, capability layer persona information and performance layer persona information; The flexible persona activation module is used to obtain the target persona information corresponding to the current round of dialogue request from kernel-level persona information, capability-level persona information, and presentation-level persona information, based on pre-set flexible activation rules and context information. The information fusion and response generation module is used to generate the response result corresponding to the current round of dialogue request based on the target persona information and the pre-retrieved external role association information.
[0010] This invention provides a method and system for decoupling and flexibly activating the persona of a mid-level intelligent agent in role-playing. It transforms the traditional "flat persona" into a multi-layered structured persona information that can be parsed and flexibly activated. This transforms the persona from a static constraint into a driving factor that can be flexibly activated during interaction. As a result, while maintaining the consistency of the role, it improves the diversity of expression, the emotional changes and the contextual fit, and reduces the participation of irrelevant persona information in reasoning, thereby improving operational efficiency and response quality.
[0011] The present invention will now be described in further detail with reference to the accompanying drawings. Attached Figure Description
[0012] Figure 1 This is a flowchart illustrating a method for decoupling and flexibly activating a hierarchical intelligent agent in role-playing, provided by an embodiment of the present invention. Figure 2 This is a schematic diagram illustrating the processing procedure of a method for decoupling and elastically activating a hierarchical intelligent agent in role-playing according to an embodiment of the present invention. Figure 3 This is a structural block diagram of a role-playing mid-level intelligent agent character decoupling and flexible activation system according to an embodiment of the present invention; Figure 4 This is a schematic diagram of the processing procedure of a role-playing mid-level intelligent agent character decoupling and flexible activation system according to an embodiment of the present invention. Detailed Implementation
[0013] The present invention will be further described in detail below with reference to specific embodiments, but the implementation of the present invention is not limited thereto.
[0014] This invention provides a method for decoupling and elastically activating the persona of a mid-level intelligent agent in role-playing. See also... Figure 1 and Figure 2 The method includes the following steps: S10. Receive the dialogue request for the current round input by the user to the target role intelligent agent.
[0015] For example, the target role intelligent agent refers to the intelligent agent that plays the target role, and the target role can be any role, such as Figure 2 Sun Wukong in the story.
[0016] A multi-turn dialogue history and generation task can be defined as follows: Given a history dialogue The user's current input is The target role's intelligent agent's persona The goal is to generate a response. To ensure consistency with the established persona in both semantics and expression style, it can be denoted as:
[0017] in, (·) represents the "role-playing consistency generation function" under the framework of this invention, which is composed of character decoupling encoding, elastic activation, knowledge and memory retrieval and constraint decoding.
[0018] S20. Based on the current round of dialogue requests, obtain context information and load the multi-layered structured persona information corresponding to the target role agent.
[0019] The multi-layered structured persona information includes kernel-level persona information, capability-level persona information, and performance-level persona information.
[0020] For example, the context information includes at least working memory window information, associated memory information retrieved from long-term memory, and role knowledge information retrieved from the role isolation knowledge base.
[0021] Optionally, the process of pre-constructing multi-layered structured persona information corresponding to the target role intelligent agent includes: extracting role knowledge from the original narrative text of the target role using a large language model to obtain a role-isolated knowledge base; and decoupling the role-isolated knowledge base semantically to output multi-layered structured persona information corresponding to the target role intelligent agent; wherein, the kernel layer persona information includes the role's values, core motivations, personality base, and knowledge boundaries; the ability layer persona information includes the role's professional knowledge, skill list, problem-solving strategy preferences, and functions; and the performance layer persona information includes language style, catchphrases, emotional expression methods, behavioral habits, and interaction rhythm.
[0022] For example, the original narrative text of the target character includes materials such as background settings, code of conduct, typical lines, worldview, and character relationships, and can be a novel, script, etc. Let the original narrative text be denoted as... ,by Extract and summarize complete character representations (i.e., a role-isolated knowledge base containing dialogue information, sentences, and experience chunks related to the target character) from the input:
[0023] in, The specific implementation process of the human-designed reasoning and structured coding functions is as follows: 1) Load the original narrative text and pre-segment and semantically divide it, which includes three steps: 11) Segment the original narrative text according to rules such as chapters / episodes to obtain multiple initial segmented texts; 12) Perform vector-based semantic segmentation on the multiple initial segmented texts to obtain multiple intermediate segmented texts; 13) Perform fixed chunk segmentation on the multiple intermediate segmented texts to obtain multiple block fragments to avoid the tokens of the large model exceeding the limit.
[0024] 2) Call the locally deployed large language model (e.g., Qwen3-32B) to perform controlled reasoning on each chunk fragment, generating structured chunk objects that can be used for subsequent retrieval and character activation, thus obtaining the role isolation knowledge base.
[0025] Controlled reasoning includes: (21) Chunk type identification: Determine whether the chunk is mainly "dialogue type" or "narrative type"; (22) Chunk plot summary: Generate a summary of no more than the preset length based on the previous summary and the chunk type; (23) Filter out the chunks of type "dialogue" and extract the speaker and the corresponding speech content from them; (24) Role extraction: The speaker is first classified as entity / non-entity, and then role recognition is performed; (25) Disambiguation and completion of references: Without introducing new characters, combine the previous summary and the chunk type of the segment to make the references such as "he / she / the other party / you" in the segment unique, and give the corresponding basis.
[0026] (26) Role-isolated knowledge base extraction: Using a large language model (e.g., Qwen3-32B), extract role-related chunks and role-related experiences from the chunks. The output structured chunk objects include fields such as full text of chunks, chunk type, and chunk summary. Then, select conversational chunk objects to extract speaker-content pairs, detect role entities, and merge and map roles.
[0027] Next, the role isolation knowledge base will be implemented. Decoupled into at least three semantic components, forming a hierarchical structure (corresponding to...) Figure 2 (The pyramid hierarchy from abstract to concrete)
[0028] in, This represents the core layer's character information (long-term and stable), mainly including stable constraints such as values, core motivations, personality traits, and knowledge boundaries; This section represents the character profile information at the ability level (which can vary depending on the task focus), mainly including professional knowledge, skills list, problem-solving strategy preferences, and functional capabilities; This represents the persona information of the performance layer (strongly context-dependent), mainly including language style, catchphrases, emotional expression, behavioral habits, and interaction rhythm.
[0029] Among them, the core layer constrains the capability layer: core motivations and values determine whether a character pursues certain capabilities, while worldview and identity determine the scope of capabilities that can be acquired; the capability layer supports the performance layer: performance is the specific way of using capabilities, and the performance layer is the actual application of capabilities in specific situations; the performance layer, in turn, reflects the core layer: through external behavior, users can understand the core of the character, and through language, habits, and decision-making methods, the deep characteristics of the character are reflected.
[0030] The decoupling process can extract the presentation layer from the extracted speaker-related sentences by calling a locally deployed large language model (such as Qwen3-32B), and extract the capability layer and kernel layer from the corresponding role-related text chunks.
[0031] For example, the analysis of character value cues is as follows: Please extract the core values of the character "{role}" from the paragraph above.
[0032] Definition: The underlying standards and ultimate beliefs that a character uses to judge right and wrong and weigh trade-offs are the "inner yardstick" that guides the character in making choices in critical situations. It determines what the character considers more important and what is non-negotiable. It is the deep logic that drives behavior, rather than a specific attitude or emotion.
[0033] feature: 1) Priority: When faced with conflicting options, the principle that the character always prioritizes (such as "truth > personal safety", "family > fame and fortune", "freedom > stability").
[0034] 2) Stability: Throughout the story, even when faced with major changes, temptations, or pressures, the character will not easily waver (for example, the character always refuses to exchange betrayal for benefits, which is the adherence to the value of "loyalty").
[0035] 3) Guiding: Directly determines the character's major decisions and key behaviors, rather than influencing daily trivial choices (such as the basis for judgment in core scenarios such as career choices, life-or-death decisions, and trade-offs).
[0036] 4) Internal consistency: The value judgment logic is consistent across different scenarios and there will be no contradictions (for example, if you adhere to "integrity", you will not commit fraud in business or lie in interpersonal relationships).
[0037] Output requirements: Each line outputs a core value, in the format: Value: Factual evidence / explanation about this value.
[0038] For example: Simple and pure: not pursuing utilitarian goals, but pursuing happiness and companionship.
[0039] Please use "you" as the second person to refer to the character. The extracted values should be closely related to the character's actual actions and choices in the story, avoiding generalities or deviations from the text. Extract 3-4 core values from the text each time. Please refer to the text for specific extraction methods. If the paragraph does not reflect core values related to the character, please simply reply "FALSE".
[0040] Optionally, each character element in the kernel layer character information, capability layer character information, and presentation layer character information adopts a representation method combining ontology layer and interpretation layer; wherein, ontology layer is used to represent the tags of character elements; interpretation layer is used to represent the semantic interpretation corresponding to the tags.
[0041] For example, to ensure that each level of character elements is coded, parsable, and can be flexibly activated during runtime, each character element in the kernel layer, capability layer, and presentation layer character information adopts a representation method combining an ontology layer and an interpretation layer. The ontology layer is used to represent the tags of character elements at different layers and can be stored in phrase form; the interpretation layer is used to represent the semantic interpretation corresponding to the tags, mapping the tags to behavioral tendencies and expressive constraints that the generation process can follow.
[0042] In one implementation, character elements are stored as key-value pairs: the key is the ontology layer tag, and the value is the semantic description of the interpretation layer. By aligning the tags with the semantic explanations, the corresponding rich semantics are loaded simultaneously when the character is activated, providing semantic support for the character.
[0043] For example, for a personality element of the target character "Wukong", the ontological label could be "unruly", and the explanatory label could be: "not yielding to any authority, adhering to one's own will and independent personality, and showing a strong sense of resistance to unfair treatment".
[0044] Finally, the decoupled result Stored in a hierarchical semantic format for later elastic activation.
[0045] S30. Based on the pre-set flexible activation rules and context information, obtain the target persona information corresponding to the current round of dialogue request from the kernel layer persona information, capability layer persona information and presentation layer persona information.
[0046] Optionally, step S30 may specifically include: S301. Based on the pre-set flexible activation rules and context information, determine the activation weights corresponding to the kernel layer persona information, capability layer persona information, and presentation layer persona information.
[0047] The activation weights are used to indicate which character elements to retrieve from the kernel-level character information, capability-level character information, and presentation-level character information. The activation weights can be scalars, vectors, or gating masks.
[0048] For example, differentiated activation (flexible activation rules) is implemented for different levels of personas: the core layer is continuously activated, the capability layer is activated on demand, and the presentation layer is dynamically adjusted. Formalized as: for each level... Calculate the activation weights for each level based on context information. .
[0049] in It can be a scalar, vector, or gated mask: 1. Kernel layer can be configured A value of all 1s indicates that the stability constraint is not suppressed throughout the entire process; 2. Regarding the capability layer It can be obtained through task or intent recognition and ability matching, such as question answering, comforting, teaching, etc., which trigger different subsets of abilities; 3. For the presentation layer It can be obtained by combining emotional state, topic domain, and dialogue stage, so that the same character can present different aspects in different contexts.
[0050] The activation weights of the capability layer and the presentation layer can be determined in the following two ways: In one alternative implementation, step S301 may specifically include: A1. Pre-encode each character element in the ability layer character information and the performance layer character information into an ability layer character semantic vector and a performance layer character semantic vector.
[0051] A2. Encode the current round of dialogue requests and context information into a semantic query representation.
[0052] A3. Based on the semantic query representation, perform semantic similarity retrieval on the semantic vectors of the ability layer persona and the performance layer persona to determine the activation weights corresponding to the ability layer persona information and the performance layer persona information.
[0053] For example, the current dialogue request and context information are encoded into a semantic query representation; the persona elements of the capability layer and presentation layer are pre-encoded into semantic vectors and indexed; at runtime, semantic similarity retrieval is used to recall the group most relevant to the current context from the persona elements as a candidate set; then, the activated capability layer persona elements and presentation layer persona elements are determined from the candidate set, i.e., the activation weights corresponding to capability layer persona information and presentation layer persona information. Specifically, the persona elements of the capability layer and presentation layer are uniformly included in the same vector index (or unified candidate pool) for semantic retrieval and recall. The semantic vector encoding can be implemented using the text-embedding-v4 model; after reranking each persona element in the candidate set using the qwen3-rerank model, the TopK (K can be flexibly set according to the actual situation, such as Top2) are selected as the activated capability layer persona elements and presentation layer persona elements.
[0054] The advantage of this approach is that the recalled candidate set is highly relevant to the current context, and the activation process is controllable and scalable.
[0055] In another alternative implementation, step S301 may specifically include: Input the current round's dialogue request, context information, and multi-layered structured persona information into the large language model, and output the activation weights corresponding to the ability layer persona information and the performance layer persona information.
[0056] For example, the current dialogue request, contextual information, and multi-layered structured persona information are input into a large language model (e.g., the Qwen3-32B model). The large language model infers based on task intent, contextual cues, and persona constraints, and outputs activated ability-level persona elements and performance-level persona elements (i.e., the activation weights corresponding to ability-level persona information and performance-level persona information). It can also output corresponding style control suggestions (e.g., more serious / more relaxed, more restrained / more enthusiastic, stronger emotion / weaker emotion, etc.).
[0057] The following are examples of the prompt words used: You are the agent's capability activation engine. Based on the dialogue context, determine whether a specific capability needs to be activated and provide performance guidance.
[0058] ## Core Concepts An intelligent agent is an individual with independent thought; its ability activation should be **naturally revealed**, rather than mechanically triggered.
[0059] ## Key Principles 1. **Optional:** No special abilities are needed for casual conversation; simply return empty. 2. **Avoid mechanical matching:** A user's sadness doesn't mean they must be comforted. You can choose to offer companionship, change the subject, etc. 3. **Less is more:** Activate a maximum of 1-2 abilities; better to have fewer than more. ## Output Format json { "should_activate": true / false, "activated_capabilities": [ { "type": "Language style / behavior / interaction style / learning ability", "name": "Ability Name", "how_to_show": "How exactly to demonstrate this ability in a reply (in one sentence)?" } ], "response_tone": "The overall tone of this round of responses (e.g., lighthearted banter / gentle concern / curious follow-up / casual conversation)", "expression_hint": "Suggestions for expression (e.g., use reduplicated words, use more lively modalities, keep it brief, etc.)" } **Notice**: When `should_activate` is false, other fields can be omitted or left empty. - `activated_capabilities` can have a maximum of 2 - `how_to_show` should be specific and executable, not vague.
[0060] The advantage of this approach is that it can leverage the comprehensive judgment of high-level semantics and implicit intentions by a large model to achieve dynamic scheduling that is more in line with the logic of the role.
[0061] It should be noted that step S301 can be implemented using any one or a combination of the above two methods, and this embodiment does not impose any restrictions on this.
[0062] S302. Based on the activation weights corresponding to the kernel layer persona information, capability layer persona information, and presentation layer persona information, obtain the target persona information corresponding to the current round of dialogue request from the multi-layer structured persona information.
[0063] For example, based on the activation weights corresponding to the kernel layer persona information, capability layer persona information, and presentation layer persona information, the activation persona components at each level at time t are obtained: This allows us to combine the target persona information corresponding to the current round of dialogue requests.
[0064] S40. Based on the target persona information and the pre-retrieved external role association information, generate the response result corresponding to the current round of dialogue request.
[0065] Optionally, step S40 may specifically include: Based on the current dialogue request and context information, retrieve the target role's role knowledge information related to the current dialogue scenario from the role isolation knowledge base, and retrieve the target role's associated memory information from the target role's long-term memory.
[0066] For example, to ensure consistency in settings, this embodiment retrieves two types of external information at runtime: 1. Role Knowledge Information: Retrieve knowledge fragments related to the context from the role-isolated knowledge base: ,in This represents the role knowledge information retrieved at time t (such as role experience, relational network constraints, fixed facts, etc.).
[0067] 2. Associating Memory Information: Retrieving memories from long-term memory related to the current dialogue request: ,in This represents the associated memory information retrieved at time t (such as the user's chat page, topic, events shared by the user and the target agent, user preferences, etc.).
[0068] Then, in the decoding phase, the activated target persona information, along with the retrieved character knowledge information and associated memory information, are used as input constraints to generate the response result corresponding to the dialogue request in the current round:
[0069] in To generate the decoding function, a large language model (such as the Qwen3-32B model) can be used for specific implementation, where: 1. As inviolable hard constraints, system-level rules (such as values and knowledge boundaries); 2. As an option for ability (e.g., writing ability, reasoning ability, etc.); 3. As "expression and emotion rendering control" (e.g., tone, word choice, emotional intensity, interaction style); 4. and As a constraint on facts and continuity, the generated content is subject to fact verification, alignment settings, and continuity maintenance.
[0070] This forms a collaborative generation mechanism of persona consistency constraints and knowledge consistency constraints, avoiding behavioral distortion caused by persona drift or context overriding.
[0071] Finally, the long-term memory of the target agent can be updated based on the response results corresponding to the current round's dialogue request (e.g., extracting persistent facts, user preferences, and phased events) to support continuous and consistent interaction in subsequent rounds.
[0072] The present invention provides a method for decoupling and elastically activating the persona of a mid-level intelligent agent in role-playing, which has the following advantages compared with the prior art: 1. A hierarchical and decoupled character modeling approach enables fine-grained, interpretable, and scalable character control: This invention, through layered and decoupled modeling of character design, structurally distinguishes and organizes character design elements at different abstract levels. It clearly differentiates the core personality traits, abilities and strategic characteristics, and specific expressions of a character at different levels, thereby achieving: (1) Able to control the character design in a fine-grained manner, and flexibly adjust the character's ability focus or expression mode without affecting the consistency of the core personality; (2) The character structure has clear hierarchical semantics, making the generation path of character behavior clear and traceable, and improving the interpretability of the system; (3) Supports independent expansion and combination of different levels of character design, which facilitates free customization and rapid expansion according to application needs, and reduces the cost of character construction and maintenance.
[0073] 2. Introduce a flexible activation mechanism to enhance the versatility of roles and their adaptability in interactions: Existing technologies typically employ a full-activation character loading method, injecting all character information uniformly each time a character is generated. This lacks the ability to respond to different situations and user differences, and can easily lead to a stereotyped character performance.
[0074] This invention, based on hierarchical character modeling, introduces a flexible activation mechanism, enabling character elements at different levels to be dynamically activated according to runtime context and user characteristics, thereby achieving: (1) It can activate different aspects of the character in different interactive situations, reflecting the multifaceted nature of the character in terms of emotions, behavior and expression, and avoiding a single fixed mode of output; (2) Dynamically activate character elements according to the current dialogue task and context changes to make the character response more in line with the specific situation; (3) Supports character activation adjustment based on user input, improving the personalization and naturalness of role-playing interaction.
[0075] 3. Adopting a semantic encoding / decoding architecture improves system stability and engineering feasibility: In existing technologies, character control mainly relies on implicit reasoning during the model generation process. The system lacks a clear semantic reasoning process for character, making it difficult to explicitly manage and control the loading, use, and constraint of character information. As a result, character drift and inconsistency are prone to occur in complex tasks, multi-turn interactions, or contextual input.
[0076] This invention models the role-playing process from the perspective of semantic encoding and decoding system architecture. During the encoding process, arbitrary text information is used as input to construct and maintain a knowledge graph related to the role. At the same time, the role's persona is modeled in a hierarchical structure, thereby uniformly encoding "persona + knowledge" into a parsable and computable structured semantic representation. During runtime, the task guidance mechanism analyzes the current interaction goal and context, selects and generates a set of activated character elements from the hierarchical character settings, and retrieves effective knowledge subgraphs / knowledge fragments related to the current task from the knowledge graph. Subsequently, during the decoding process, the system inputs "activated character elements + effective knowledge subgraphs / knowledge fragments" as structured generation constraints into the response generation module to obtain the final output that conforms to the character's personality and is consistent with the task objective.
[0077] Through the above processing flow of "source information → (encoding: knowledge graph + hierarchical persona) → (task guidance: activating persona + effective knowledge) → (decoding: response generation)," the following can be achieved: (1) Structured and controllable: It transforms the character design from unparseable overall text prompts into structured semantic information of "hierarchical character design + knowledge graph", supports computation, scheduling and combination, and reduces the dependence on the implicit reasoning ability of the model; (2) Clear and stable reasoning process: A clear information reasoning path is formed at the system level from source information to encoding, to task guidance activation, and then to decoding and generation, so that the character setting constraints and knowledge injection are traceable, thereby improving the consistency of roles and the stability of output; (3) The project is feasible and scalable: It facilitates modular management and verification of character design and knowledge in the project implementation, supports selective loading and reuse by task, reduces context redundancy and reasoning overhead, and supports rapid expansion of new roles, new abilities or new knowledge sources.
[0078] On the other hand, embodiments of the present invention also provide a system for decoupling and flexibly activating the persona of a mid-level intelligent agent in role-playing, referring to... Figure 3 The system specifically includes: The receiving module 301 is used to receive the dialogue request of the current round input by the user to the target role intelligent agent; The information loading module 302 is used to obtain context information based on the dialogue request of the current round and load the multi-layer structured persona information corresponding to the target role intelligent agent; the multi-layer structured persona information includes kernel layer persona information, capability layer persona information and performance layer persona information; The flexible persona activation module 303 is used to obtain the target persona information corresponding to the current round of dialogue request from the kernel layer persona information, capability layer persona information and presentation layer persona information according to the pre-set flexible activation rules and context information. The information fusion and response generation module 304 is used to generate the response result corresponding to the current round of dialogue request based on the target persona information and the pre-retrieved external role association information.
[0079] For example, refer to Figure 4 The system may also include: (1) Preprocessing module: Input the original narrative text of the target character (such as novels, scripts, etc.), standardize and segment the original narrative text, extract key information, and provide structured knowledge information for subsequent retrieval and activation.
[0080] (2) Role isolation module: In multi-role or multi-session scenarios, the knowledge, memory and character parameters of different roles are isolated for storage and retrieval to prevent cross-role pollution.
[0081] (3) Memory Management and Retrieval Module: Maintains the working memory window and long-term memory bank; according to Construct a query and return it. And write back updates based on the response results of each round.
[0082] (4) Role Knowledge Base Retrieval Module: Maintains the role knowledge base and relationship graph; based on... return It is used for knowledge consistency, knowledge illusion, and knowledge boundary constraints.
[0083] (5) Character coding module: The original narrative text is encoded during the offline or initialization phase. Encoded as and decoupled into It can be stored and loaded quickly at runtime.
[0084] (6) Flexible Personality Activation Module: Calculation And generate , , This enables a scheduling strategy that ensures the kernel layer is always active while the capability and presentation layers are dynamically activated.
[0085] (7) Information fusion and response generation module: fusing context, , Activating character settings and executing collaborative constraint decoding Generate and output response .
[0086] Through the above system structure, the present invention forms a closed loop in engineering: "encoding (character structuring) - activation (runtime scheduling) - retrieval (knowledge / memory alignment) - generation (cooperative constraint decoding) - update (memory write-back)," thereby supporting realistic, multifaceted, and consistent role-playing interactions.
[0087] For details on the system, please refer to the steps of the first aspect of the method for decoupling and elastically activating a mid-level intelligent agent in role-playing, which will not be elaborated here.
[0088] This embodiment provides a role-playing mid-level intelligent agent persona decoupling and elastic activation system, which has the following advantages: (1) By using a hierarchical persona modeling method, the role persona is decoupled into multiple levels with different stability and functional attributes, realizing a structured representation from abstract personality to specific interactive performance; (2) By introducing a persona semantic encoding and decoding mechanism, the persona can be encoded offline and decoded and selectively activated in combination with the dialogue context and user intent during the running phase; (3) By using an intent- or task-driven elastic activation mechanism, different levels of personas can be flexibly activated while maintaining the core consistency of the role, so that the role can present different performances according to the situation; (4) Reduce the participation of persona information unrelated to the current interaction in reasoning, and improve the system's operating efficiency and response quality; (5) Fundamentally improve the realism, fun and controllability of role-playing intelligent agents in application scenarios such as immersive interaction, emotional companionship and fun teaching.
[0089] It should be noted that the terms "first," "second," etc., are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Rather, they are merely examples of apparatuses and methods consistent with some aspects of the invention.
[0090] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the present invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Furthermore, those skilled in the art can combine and integrate the different embodiments or examples described in this specification.
[0091] Although the invention has been described herein in conjunction with various embodiments, those skilled in the art will understand and implement other variations of the disclosed embodiments by reviewing the accompanying drawings and the disclosure in carrying out the claimed invention. In the description of the invention, the word "comprising" does not exclude other components or steps, "a" or "an" does not exclude a plurality, and "a plurality" means two or more, unless otherwise explicitly specified. Furthermore, while different embodiments may describe certain measures, this does not mean that these measures cannot be combined to produce good results.
[0092] The above description, in conjunction with specific preferred embodiments, provides a further detailed explanation of the present invention. It should not be construed that the specific implementation of the present invention is limited to these descriptions. For those skilled in the art, various simple deductions or substitutions can be made without departing from the concept of the present invention, and all such modifications and substitutions should be considered within the scope of protection of the present invention.
Claims
1. A method for decoupling and elastically activating the persona of a mid-level intelligent agent in role-playing, characterized in that, include: Receive the current round of dialogue request input by the user to the target role's intelligent agent; Based on the dialogue request of the current round, obtain context information and load the multi-layered structured persona information corresponding to the target role agent; the multi-layered structured persona information includes kernel layer persona information, capability layer persona information and performance layer persona information; Based on the pre-set flexible activation rules and the context information, the target persona information corresponding to the current round of dialogue request is obtained from the kernel layer persona information, the capability layer persona information and the presentation layer persona information; Based on the target persona information and the pre-retrieved external role association information, the response result corresponding to the current round of dialogue request is generated.
2. The method for decoupling and elastically activating hierarchical intelligent agents in role-playing according to claim 1, characterized in that, The process of pre-constructing multi-layered structured persona information corresponding to the target role intelligent agent includes: A large language model is used to extract character knowledge from the original narrative text of the target character to obtain a character-isolated knowledge base; then, the character-isolated knowledge base is decoupled at the semantic level to output the multi-layered structured persona information corresponding to the target character agent; The core layer character information includes the character's values, core motivations, personality traits, and knowledge boundaries; the ability layer character information includes the character's professional knowledge, skill set, problem-solving strategy preferences, and functions; and the performance layer character information includes language style, catchphrases, emotional expression, behavioral habits, and interaction rhythm.
3. The method for decoupling and elastically activating hierarchical intelligent agents in role-playing according to claim 2, characterized in that, Each character element in the kernel layer character information, the capability layer character information, and the presentation layer character information is represented using a combination of ontology layer and interpretation layer. The ontology layer is used to represent the tags of the character design elements; the interpretation layer is used to represent the semantic interpretation corresponding to the tags.
4. The method for decoupling and elastically activating hierarchical intelligent agents in role-playing according to claim 1, characterized in that, The step of obtaining the target persona information corresponding to the current round of dialogue request from the kernel-level persona information, the capability-level persona information, and the presentation-level persona information according to the pre-set flexible activation rules and the context information includes: Based on the pre-set flexible activation rules and the context information, the activation weights corresponding to the kernel layer persona information, the capability layer persona information, and the presentation layer persona information are determined; the activation weights are used to indicate the acquisition of corresponding persona elements from the kernel layer persona information, the capability layer persona information, and the presentation layer persona information; wherein, the activation weights are scalars, vectors, or gating masks; Based on the activation weights corresponding to the kernel layer persona information, the capability layer persona information, and the presentation layer persona information, the target persona information corresponding to the current round of dialogue request is obtained from the multi-layer structured persona information; wherein, the activation weight corresponding to the kernel layer persona information is 1.
5. The method for decoupling and elastically activating hierarchical intelligent agents in role-playing according to claim 4, characterized in that, The step of determining the activation weights corresponding to the kernel-level persona information, the capability-level persona information, and the presentation-level persona information based on pre-set flexible activation rules and the context information includes: Each character element in the ability layer character information and the performance layer character information is pre-encoded as an ability layer character semantic vector and a performance layer character semantic vector. The current round of dialogue request and the context information are encoded into a semantic query representation; Based on the semantic query representation, semantic similarity retrieval is performed on the semantic vector of the capability layer persona and the semantic vector of the performance layer persona to determine the activation weights corresponding to the capability layer persona information and the performance layer persona information.
6. A method for decoupling and elastically activating hierarchical intelligent agents in role-playing according to any one of claims 4 or 5, characterized in that, The step of determining the activation weights corresponding to the kernel-level persona information, the capability-level persona information, and the presentation-level persona information based on pre-set flexible activation rules and the context information includes: The current round of dialogue request, the context information, and the multi-layered structured persona information are input into the large language model, and the activation weights corresponding to the ability layer persona information and the performance layer persona information are output.
7. The method for decoupling and elastically activating hierarchical intelligent agents in role-playing according to claim 2, characterized in that, The step of generating the response result corresponding to the current round of dialogue request based on the target persona information and pre-retrieved external role association information includes: Based on the dialogue request of the current round and the context information, the target character's role knowledge information related to the current dialogue scenario is retrieved from the role isolation knowledge base, and the target character's associated memory information is retrieved from the target character agent's long-term memory.
8. A system for decoupling and flexibly activating a mid-level intelligent agent in role-playing, characterized in that, include: The receiving module is used to receive the dialogue request for the current round input by the user to the target role intelligent agent; The information loading module is used to obtain context information based on the dialogue request of the current round, and load the multi-layered structured persona information corresponding to the target role agent; the multi-layered structured persona information includes kernel layer persona information, capability layer persona information and performance layer persona information; The flexible persona activation module is used to obtain the target persona information corresponding to the current round of dialogue request from the kernel layer persona information, the capability layer persona information and the presentation layer persona information according to the pre-set flexible activation rules and the context information. The information fusion and response generation module is used to generate the response result corresponding to the current round of dialogue request based on the target persona information and the pre-retrieved external role association information.