An active real-time interactive system based on LLM

By constructing an LLM-based proactive real-time interactive system, the problem of existing AI systems lacking initiative and self-awareness is solved, realizing the system's autonomy and adaptability, improving environmental perception and decision-making flexibility, and ensuring the safety of system behavior.

CN120598039BActive Publication Date: 2025-12-16BEIJING ZHIMING ERXING NETWORK TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510675026.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-05-23
Publication Date
2025-12-16
Estimated Expiration
2045-05-23

AI Technical Summary

Technical Problem

Existing AI systems lack initiative, self-awareness, environmental perception, planning capabilities, and decision-making mechanisms, making it difficult to form a complete autonomous intelligent system.

Method used

A proactive real-time interactive system based on LLM is constructed, including a self-awareness module, a real-time perception module, a proactive planning module, a situational decision-making module, a dynamic execution module, an emotion engine module, an adaptive interaction module, and a security control module. Through multi-dimensional feature vector representation of system role attributes, hierarchical memory storage, multimodal data processing, multi-path planning, situational decision-making, and dynamic resource allocation, the system achieves autonomy and adaptability.

Benefits of technology

It has enabled the system to proactively plan and make decisions, improved the accuracy of environmental perception and the flexibility of decision-making, ensured the safety and autonomy of the system's behavior, overcome the limitations of passive response, established self-awareness, and enhanced its adaptability to dynamic scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120598039B_ABST
    Figure CN120598039B_ABST
Patent Text Reader

Abstract

The application discloses an active real-time interaction system based on LLM, which comprises a self-cognition module, a real-time perception module, an active planning module, a situational decision-making module, a dynamic execution module, an emotion engine module, an adaptive interaction module and a safety control module. The system adopts a multi-dimensional vector to represent role attributes, constructs a hierarchical memory storage structure to record interaction experience, generates an environment state vector through multi-modal data processing technology, generates a multi-path execution plan through a target task decomposition algorithm, formulates real-time decisions based on multi-dimensional decision factors, maps abstract decisions to instruction sequences and monitors the execution process, simulates system emotional states and influences decision expression, dynamically adjusts interaction strategies according to user characteristics, evaluates decision rationality and starts corresponding intervention mechanisms. The modules form a closed-loop workflow through standardized data interfaces, overcoming the problems of passive response, lack of self-cognition, limited environmental perception, single planning capability and lack of flexibility in decision-making of traditional AI systems, and realizing active service, self-evolution and safety control of the system.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the field of artificial intelligence, and particularly relates to an active real-time interaction system based on LLM. BACKGROUND

[0002] With the rapid development of artificial intelligence technology, large language models (LLM) have made significant progress in natural language processing. However, existing AI systems still have obvious limitations: they mainly work in a passive response mode and lack initiative; they only have memory capabilities for users and lack self-awareness; their environmental perception is limited and it is difficult to integrate multi-source data; their planning capabilities are single and they cannot handle multi-target trade-offs; their decision-making mechanisms lack flexibility and it is difficult to dynamically adjust strategies.

[0003] Existing technologies such as rule systems, traditional machine learning models, and first-generation LLM applications usually only implement partial functions and cannot form a complete autonomous intelligent system. Some systems implement basic environmental perception but lack integration with decision-making systems; some have simple planning capabilities but cannot handle unexpected situations during execution.

[0004] Therefore, a new architecture is needed that organically combines self-awareness, autonomous planning, environmental perception, and decision execution to build an AI real-time system with true autonomy and adaptability. SUMMARY

[0005] To solve the above technical problems, the present application provides an active real-time interaction system based on LLM, which includes a self-awareness module, a real-time perception module, an active planning module, a situational decision-making module, a dynamic execution module, an emotional engine module, an adaptive interaction module, and a safety control module.

[0006] The self-awareness module is used to build and maintain the system's self-representation, characterized by: representing the system's role attributes through a multi-dimensional feature vector; using a hierarchical storage structure of short-term memory, medium-term memory, and long-term memory to record system interaction experience, and using a time decay function for memory management; defining a set of quantitative indicators including task success rate, response quality score, knowledge coverage rate, learning efficiency, and adaptability index to evaluate system capability development; implementing an experience pattern extraction algorithm based on frequency threshold to form a system knowledge base.

[0007] The real-time perception module is used to process multi-source environmental data, characterized by: performing multi-modal data standardization conversion to unify different types of input such as text, images, audio, and video into an internal representation format; constructing an information reliability scoring function based on source attributes, timeliness, and content consistency; generating a structured environmental vector containing three-dimensional states of time, user, and system; applying a priority dynamic allocation algorithm based on data importance, real-time requirements, and processing complexity to adjust computing resource allocation;

[0008] The active planning module is used for generating a system action plan, and is characterized by: performing a classification and decomposition algorithm for information targets, state targets, capability targets and experience targets, converting system targets into a specific task set; generating a multi-path execution plan containing a main path and an alternative path, each path defining a trigger condition and a resource requirement; updating the execution plan through a dual mechanism of timing triggering and event triggering; and using an adjacency matrix to represent task dependency relationships;

[0009] The situational decision-making module is used for making real-time decisions, and is characterized by: calculating task priority scores based on multiple dimensions of decision-making factors such as importance, urgency, environment matching degree and dependency impact degree; modeling resource allocation as a constraint optimization problem and solving an optimal scheme; applying special solving strategies for different types of task conflicts such as resource conflicts, time conflicts and target conflicts; implementing a formal decision-making model based on a state transition system to ensure the determinacy of the decision-making process;

[0010] The dynamic execution module is used for converting decisions into actions, and is characterized by: mapping abstract decisions into specific instruction sequences through a hierarchical conversion architecture; establishing an execution checkpoint system at preset nodes; generating a structured feedback report containing task identification, completion status, performance indicators, effect evaluation, exception records, environmental changes and decision evaluation; and implementing a dynamic path adjustment mechanism based on a hybrid method of rules and models;

[0011] The emotion engine module is used for simulating system emotional states, and is characterized by: using a multi-dimensional vector representing basic emotional types to represent system emotional states; defining the relationship between environmental events and internal events and emotional changes through an event-emotion mapping matrix; defining an influence function of emotional states on system decisions and expressions; and implementing a time decay mechanism based on differentiated decay coefficients;

[0012] The adaptive interaction module is used for implementing personalized interaction, and is characterized by: constructing a multi-dimensional user feature model containing knowledge level, expression preference, reaction mode, interaction rhythm, attention duration, learning style, decision-making mode and emotional characteristics through historical interaction analysis; dynamically adjusting interaction parameters according to user features and the current situation; optimizing interaction strategies using a multi-armed bandit algorithm; and implementing adaptive adjustment of interaction methods based on a multi-source feedback mechanism;

[0013] The safety control module is used for ensuring the safety of system behavior, and is characterized by: defining a system allowed behavior space based on a rule base and an example set; performing rationality evaluation of decisions in dimensions of role consistency, content safety, resource rationality, safety impact and ethical compliance; starting corresponding intervention mechanisms according to risk levels; and providing a multi-level behavior explanation generation function.

[0014] The present application has the following advantages:

[0015] 1. Overcome the limitations of passive response: Through task autonomous decomposition and multi-path planning technology, the system can generate an execution plan containing main and backup paths in advance, and dynamically adjust according to environmental changes, realizing the transformation from passive response to active planning.

[0016] 2. Establish self-cognition ability: Experience pattern extraction and ability monitoring and evaluation mechanism enables the system to identify repeated patterns and extract them as knowledge, while monitoring its own ability development, realizing the cognition and continuous evolution of its own state.

[0017] 3. Break through the limitations of environmental perception: Multi-modal data unified processing and information reliability evaluation technology realizes the fusion processing of multiple types of input data, improves the accuracy of environmental state representation, and enhances the adaptability of the system to dynamic scenes.

[0018] 4. Improve decision flexibility: Context-aware decision-making and dynamic resource allocation technology enables the system to adjust decision-making strategies according to environmental state and task requirements, optimizes resource allocation through mathematical optimization models, and improves decision flexibility.

[0019] 5. Ensure the safety of system behavior: Multi-dimensional decision evaluation and hierarchical intervention mechanism ensures that the system remains autonomous while its behavior is controllable, providing safety assurance for practical applications. BRIEF DESCRIPTION OF DRAWINGS

[0020] Figure 1 The architecture schematic diagram of the system described in the present application is shown;

[0021] Figure 2 The working step flow chart of the system described in the present application is shown; DETAILED DESCRIPTION

[0022] The exemplary embodiments of the present application will be described in detail below with reference to the accompanying drawings.

[0023] In combination Figure 1 The present application provides an active real-time interactive system based on LLM, including a self-cognition module, a real-time perception module, an active planning module, a context decision-making module, a dynamic execution module, an emotional engine module, an adaptive interaction module, and a safety control module. The above-mentioned modules form an information exchange network through standardized data interfaces, and build a complete closed-loop system architecture.

[0024] In the active real-time interactive system based on LLM, the self-cognition module is the core component of the system for building and maintaining self-representation, which realizes the continuous monitoring and cognition of the system's own state, interaction experience and ability development through specific technical means. The technical implementation of the self-cognition module described in the present application mainly includes multi-dimensional vector representation of system role attributes, establishment and management of hierarchical memory storage structure, execution of experience pattern extraction algorithm, and definition and calculation of system ability evaluation index.

[0025] Specifically, the self-cognition module adopts an 8-dimensional vector characterizing the system role attributes, which is defined as:

[0026] R = [r1, r2, r3, r4, r5, r6, r7, r8] T

[0027] Each component in the above vector respectively represents: r1 - professional knowledge level, used to quantify the breadth and depth of the system's professional knowledge; r2 - emotional expression ability, representing the system's ability to recognize and convey emotional information; r3 - interaction style preference, depicting the personalized features exhibited by the system in interaction; r4 - task processing efficiency, measuring the speed and resource occupation of the system's task execution; r5 - learning ability, reflecting the system's rate of extracting knowledge from experience; r6 - creative thinking level, representing the system's ability to generate innovative solutions; r7 - social interaction ability, quantifying the system's level of understanding social rules and establishing relationships; r8 - moral and ethical standards, measuring the degree to which the system's behavior conforms to ethical norms. Each component is limited to the closed interval [0, 1], with a larger value indicating a stronger corresponding ability. The system reads preset values from a dedicated configuration file when initially configured, with the initial vector set as r1 = 0.75, r2 = 0.60, r3 = 0.70, r4 = 0.80, r5 = 0.65, r6 = 0.70, r7 = 0.65, and r8 = 0.90.

[0028] Further, during the system's continuous operation, the self-cognition module updates the system role attribute vector every 24 hours, using the following iterative algorithm:

[0029]

[0030] wherein, represents the i-th dimensional attribute value at time t, represents the updated value, η is the learning rate parameter, with a value range of [0.01, 0.1], and in this embodiment, η = 0.05; is the i-th dimensional attribute change amount, calculated by the following multi-index weighting formula:

[0031]

[0032] wherein, m i represents the number of indexes affecting the i-th dimensional attribute; w ij is the weight coefficient of the j-th index on the i-th dimensional attribute, satisfying the normalization condition and are the measurement values of the j-th index in the current period and the last period, respectively; Φ ij(·,·) is a change amount calculation function, different calculation methods are adopted according to the index type, and the difference value is calculated for the accuracy and evaluation classification index: The ratio calculation is used for quantity and frequency type indexes: The value range of is limited to the interval [-0.1, 0.1], and the boundary value is taken when it exceeds the range.

[0033] Taking the professional knowledge level dimension (r1) as an example, the indexes affecting its change include knowledge application accuracy (weight coefficient w 11 = 0.4), knowledge coverage range (weight coefficient w 12 = 0.35) and knowledge update frequency (weight coefficient w 13 = 0.25). Knowledge application accuracy is calculated by the proportion of correct application of knowledge by the system in the task execution process, knowledge coverage range is measured by the ratio of the number of professional fields covered by the system knowledge base to the total predefined fields, and knowledge update frequency is evaluated by the number of new knowledge units added per unit time.

[0034] The learning rate parameter η is set to 0.05 based on the balance of system stability and adaptability. This value makes the system role attribute gradually evolve under the action of different influencing factors, avoids drastic changes due to single evaluation fluctuations, while maintaining effective response to environmental changes, ensuring that the system can form accurate self-cognition over time.

[0035] Through the above technical solutions, the self-cognition module realizes the dynamic adjustment mechanism of the system role attribute, enabling the system to continuously optimize its own characteristic representation based on interaction experience. The system role attribute vector provides services to other functional modules through a standardized data interface, guiding the system's decision-making and behavior generation in different scenarios.

[0036] Further, to realize effective storage and management of system interaction experience, the self-cognition module constructs a hierarchical memory storage structure based on human memory mechanisms, including short-term memory, intermediate-term memory and long-term memory. Short-term memory uses a circular buffer data structure and is defined as a fixed capacity circular queue:

[0037]

[0038] In the formula, M represents the whole set of memory items, m i ∈M represents a single memory item, which includes the following fields: record ID (using UUID format to ensure global uniqueness), timestamp (accurate to millisecond level), session ID, user ID, interaction content (including input and response text), media type, execution result status and feedback score. The execution result status uses a hierarchical classification method, which is defined as follows:

[0039] Full success: if and only if the task completion rate is no less than 95%, the user satisfaction score is no less than 4.5 (out of 5), and the system resource utilization is in the optimal interval [40%, 70%];

[0040] Success but room for improvement: if the task completion rate is in the interval [80%, 95%), or the user satisfaction score is in the interval [3.5, 4.5), or the system resource utilization is in the interval [20%, 40%) or (70%, 85%];

[0041] Partial success: if the task completion rate is in the interval [50%, 80%), or the user satisfaction score is in the interval [2.5, 3.5), or the system resource utilization is in the interval [10%, 20%];

[0042] Unsuccessful: if the task completion rate is less than 50%, or the user satisfaction score is less than 2.5, or the system resource utilization is less than 10% or greater than 85%.

[0043] When the above multiple conditions conflict, the lowest execution result state is taken as the final state. The system resource utilization is calculated by the following weighted average formula:

[0044] R util = 0.5·R cpu + 0.3·R mem + 0.2·R net

[0045] In the formula, R cpu is the CPU usage, R mem is the memory occupancy, and R net is the network bandwidth occupancy, all in percentage.

[0046] When the self-cognition module receives a new record, it calculates its importance score I mem :

[0047] I mem = α1·F user + α2·F novel + α3·F emotion + α4·F task

[0048] In the formula, the weight coefficients are α1 = 0.4, α2 = 0.2, α3 = 0.2, and α4 = 0.2, and the calculation methods of each factor are as follows:

[0049] The user feedback factor F user is obtained by linear normalization of the user score:

[0050]

[0051] where s user is the user score, s max = 5 is the highest score.

[0052] novelty factor F novel is calculated based on the maximum similarity between the current record and existing memories:

[0053]

[0054] where M exist is the existing memory set, Sim(m new ,m j ) is the similarity between records, which is a weighted combination of content similarity and context similarity:

[0055] Sim(m i ,m j ) = β1·Sim content (m i ,m j ) + β2·Sim context (m i ,m j )

[0056] The weight coefficients are β1= 0.7 and β2= 0.3. The content similarity is calculated using the cosine distance:

[0057]

[0058] where and are the text content TF-IDF vectors (dimension 1000) of records m i and m j , respectively. The context similarity is calculated as follows:

[0059] Sim context (m i ,m j ) = 0.4·(δ session (m i ,m j ) + δ user (m i ,m j )) + exp(-|t i -t j | / 86400) / 5

[0060] where δ session (m i ,m j ) is the session ID matching indicator function, which takes the value 1 if the session IDs are the same and 0 otherwise; δ user (m i ,mj ) is the matching function for user ID, 1 if same, otherwise 0; t i and t j are the record time stamp (unit: second) and the time difference converted by exponential decay function, respectively, and 86400 is the number of seconds in a day.

[0061] The emotion factor F emotion is calculated by the amplitude of emotion change during the interaction:

[0062]

[0063] where, and are the 6-dimensional emotion vectors at the beginning and end of the interaction (including joy, sadness, anger, fear, surprise, and disgust), respectively, and ||·||2is the Euclidean distance norm, E max = 5.0 is the preset maximum emotion change value. The emotion vector is extracted from the interaction text by a dedicated sentiment analysis algorithm.

[0064] The task factor F task considers the task type, complexity, and urgency comprehensively:

[0065] F task = γ1·W type + γ2·C complex + γ3·U urgent

[0066] The weight coefficients are γ1= 0.5, γ2= 0.3, and γ3= 0.2. W type is the task type weight, with preset values: assistant decision (1.0), content generation (0.8), question answering (0.7), interactive dialogue (0.6), and information retrieval (0.5). The task complexity C complex is calculated by:

[0067]

[0068] where, n step is the number of task execution steps, n max = 20 is the preset maximum step number; r cpu is the task CPU usage rate, r max = 100% is the maximum CPU usage rate; n dep is the number of task dependency relationships, n dep,max = 10 is the maximum dependency relationship number. The task urgency U urgentAccording to the time limit condition classification evaluation, specifically defined as: taking 1.0 when there is a clear emergency identifier; taking 0.8 when there is a time limit and the remaining time is not more than 1 hour; taking 0.6 when there is a time limit and the remaining time is not more than 1 day; taking 0.4 when there is a time limit and the remaining time is not more than 1 week; taking 0.2 when there is a time limit but the remaining time is more than 1 week; taking 0.0 when there is no time limit or emergency identifier.

[0069] Based on the importance score I calculated mem , the system adopts a threshold shunt strategy to process new records: when I mem < 0.5, the record is added to short-term memory; when 0.5 ≤ I mem < 0.8, the record is transferred to medium-term memory; when I mem ≥ 0.8, the record is directly saved to long-term memory.

[0070] Further, the medium-term memory in the self-cognition module is implemented in a key-value pair database structure, storing records with importance scores between 0.5 and 0.8, with an upper limit of 1000 items in capacity. To optimize memory management efficiency, the system implements a time decay mechanism for medium-term memory, with memory importance decreasing exponentially over time:

[0071] I mem (t0+Δt) = I mem (t0)·exp(-λ decay ·Δt)

[0072] In the formula, λ decay = 0.1 is the decay coefficient, and Δt is the elapsed time (unit: days). When the memory importance falls below 0.2, the system will automatically delete the memory item; if the memory is frequently accessed, causing the importance to be re-evaluated to exceed 0.8, it will be upgraded to long-term memory.

[0073] In particular, the self-cognition module maintains a medium-term memory state table, recording the real-time importance score, the latest access time, and the cumulative access count of each memory item. When a memory item is accessed, its importance score is updated as follows:

[0074]

[0075] In the formula, μ gain = 0.05 is the gain coefficient, and v count is the access count, taking the logarithmic function to make the importance gain decrease with the increase of access count. This mechanism ensures that the memory importance evolves reasonably under the dual effects of time decay and access promotion, and the memory item that is frequently accessed will have its importance increased to offset the effects of time decay, while the memory item that is not accessed for a long time will gradually reduce its importance until it is cleared.

[0076] Further, the long-term memory of the self-cognition module adopts a graph structure G LTM =(V, E, W) stores high-value knowledge units, where V represents the set of nodes (knowledge units), E represents the set of edges (inter-knowledge association), and W represents the set of edge weights (association strength). Each knowledge unit contains the following attribute fields: knowledge ID, content description, applicable condition, association example, credibility, creation time, update time, and usage frequency. The association strength w ij ∈W between knowledge units i and j is calculated based on co-occurrence frequency:

[0077]

[0078] where N ij is the number of times that knowledge units i and j are applied together; N i and N j are the number of times that knowledge units i and j are applied individually. This formula is essentially the Jaccard similarity coefficient, with a value range of [0, 1], and a larger value indicates a closer association.

[0079] For knowledge units in long-term memory, the system evaluates the practicality score U value every 30 days:

[0080] U value = δ1·F freq + δ2·S success

[0081] The weight coefficients δ1 = 0.6 and δ2 = 0.4, F freq is the application frequency, and S success is the success rate. The application frequency is calculated by the ratio of the number of calls for this knowledge unit to the total number of calls for all knowledge units: F freq = n call / N total ; the success rate is calculated by the ratio of the number of successful applications of this knowledge unit to the total number of calls: S success = n success / n call . When the practicality score is below 0.1, the knowledge unit is archived or deleted, freeing up storage space.

[0082] The self-cognition module obtains system environment data and feedback information through standardized interfaces, and stores them hierarchically after importance evaluation, forming the basis for experience accumulation. The module maintains a system state record file, recording operation timestamps and result states. When the system restarts, the module reads the file first to restore the last running state, ensuring seamless continuation after system interruption and maintaining the continuity of interactive experience and self-cognition.

[0083] Further, to objectively evaluate the system's capability development process, the self-awareness module defines a set of quantitative indicator systems, including task success rate C success , response quality score C quality , knowledge coverage rate C coverage , learning efficiency C learning , and adaptability index C adapt . The task success rate is calculated by the ratio of the number of successfully completed tasks to the total number of tasks:

[0084]

[0085] The system separately counts the success rates for five core tasks (information retrieval, question answering, content generation, interactive dialogue, and decision support) to comprehensively evaluate the system's processing capabilities in different fields. The success of the task is determined based on the preset completion criteria and user feedback.

[0086] The response quality score is calculated using a multi-dimensional weighted average:

[0087]

[0088] where N resp is the total number of responses evaluated, and Q i is the quality score of the i-th response, calculated by:

[0089] Q i = ω1·A i + ω2·B i + ω3·C i + ω4·D i

[0090] The weight coefficients are ω1 = 0.4, ω2 = 0.3, ω3 = 0.2, and ω4 = 0.1. A i is the accuracy score, B i is the completeness score, C i is the fluency score, and D i is the innovation score. The accuracy score is calculated by matching key information points:

[0091]

[0092] where n match is the number of matched key information points, and n total is the total number of key information points in the standard answer. The completeness score is calculated by the problem point coverage rate:

[0093]

[0094] where n covered is the number of problem points included in the response, and nrequired The total number of points required for the problem. The fluency score considers grammar correctness, expression coherence and lexical diversity:

[0095]

[0096] where n error is the number of grammar errors, n sentence is the total number of sentences, coh i is the coherence score (range [0, 1]), div i is the lexical diversity score (range [0, 1], calculated by the proportion of non-repeated words). The novelty score assesses the uniqueness and creativity of the response content:

[0097]

[0098] where H resp is the set of historical responses, Sim(r i , r j ) is the similarity between responses, nov i is the novelty of expression score (range [0, 1], calculated by counting the proportion of uncommon expressions and innovative combinations).

[0099] The knowledge coverage indicator is calculated by the ratio of the domains covered by the system knowledge base to the total predefined domains:

[0100]

[0101] where D covered is the number of domains actually covered by the system knowledge base, D total = 100 is the total number of predefined domains. The domain coverage is determined based on the subject classification and keyword mapping of knowledge units, and at least 5 core concepts of a domain are considered to be covered if there are corresponding knowledge units in the knowledge base.

[0102] The learning efficiency indicator quantifies the rate of improvement of the system's capabilities:

[0103]

[0104] where T interval = 7 is the evaluation time interval (unit: days), K = 5 is the number of evaluated capability indicators (including the five indicators mentioned above), P i (t) is the score of the i-th capability indicator at time t, P i (t + T interval ) is the score of the same indicator after the interval. This indicator reflects the average improvement of each capability of the system in unit time.

[0105] Adaptive index evaluation system's ability to respond to environmental changes:

[0106]

[0107] In the formula, M scenario = 10 is the number of test scenarios, including user behavior mutation scenarios, task type switching scenarios, data source structure change scenarios, resource limitation scenarios, concurrent load scenarios, network delay scenarios, input mode change scenarios, interaction rhythm change scenarios, domain conversion scenarios and abnormal input scenarios. and are the performance indicators of scenario j in the original environment and the new environment respectively, and the calculation formula is:

[0108] P j = 0.4·SR j +0.3·(1-RT j / RT max )+0.3·(1-R j / R max )

[0109] In the formula, SR j is the success rate of scenario j, RT j is the average response time, RT max = 10 seconds is the maximum acceptable response time, R j is the average resource occupancy, and R max = 100% is the maximum resource occupancy.

[0110] The self-awareness module performs a comprehensive capability assessment every 7 days, generates a report containing the current value and trend of the indicators, and records the assessment timestamp and results. When the system is restarted, the module reads the record file to calculate the assessment interval. If it has been more than 7 days, it will immediately assess. If it has not been more than 7 days, it will set a timer to ensure that the assessment period is not affected by system interruptions or restarts. This mechanism ensures the continuity of the assessment period in the case of system interruption or restart.

[0111] Further, the self-awareness module implements an experience pattern extraction algorithm based on a frequency threshold. This algorithm identifies representative knowledge patterns from the system's accumulated interaction experience by performing feature extraction, similarity calculation, clustering analysis and pattern extraction on the interaction records in long-term memory. The algorithm first generates a feature vector for each record:

[0112]

[0113] In the formula, is the content feature vector, which is extracted from the text content by the TF-IDF algorithm, with a dimension of 80; Type feature vector Interaction type and task type are represented by one-hot encoding, dimension 16. Numerical feature vector Contains normalized values of response time, score, and resource consumption, dimension 32. Total dimension of feature vector is 128, providing comprehensive digital representation of memory items.

[0114] Content feature vector Composed of three parts: TF-IDF features (40 dimensions), topic distribution features (20 dimensions), and sentiment features (20 dimensions). TF-IDF features extract TF-IDF values of the most representative 40 word items in the text, with the formula:

[0115] TF-IDF(t,d,D) = TF(t,d) x IDF(t,D)

[0116] Where t represents a word item, d represents the current document, and D represents the document set; TF(t,d) is the word frequency, calculated as the number of occurrences of word item t in document d divided by the total number of words in document d; IDF(t,D) is the inverse document frequency, with the formula:

[0117]

[0118] Where |D| is the total number of documents, and |{d∈D:t∈d}| is the number of documents containing word item t. Topic distribution features extract the distribution probability of text on 20 pre-defined topics through the latent Dirichlet allocation (LDA) model. Sentiment features extract the sentiment intensity and inclination of text through a dedicated sentiment analysis algorithm.

[0119] Type feature vector Contains four groups of one-hot encoding: task type encoding (5 dimensions, including information retrieval, question answering, content generation, interactive dialogue, and auxiliary decision-making), media type encoding (5 dimensions, including text, image, audio, video, and mixed), interaction mode encoding (3 dimensions, including active, passive, and mixed), and priority encoding (3 dimensions, including high, medium, and low).

[0120] Numerical feature vector The four groups of quantitative indicators include time characteristics (8 dimensions, including total duration, response time, thinking time, interaction frequency, pause time, reading time, processing time, and sending time), user feedback characteristics (8 dimensions, including satisfaction score, engagement score, emotional change amplitude, number of questions, number of repeated requests, number of corrections, number of affirmations, and number of negations), system state characteristics (8 dimensions, including CPU usage, memory occupancy, network bandwidth usage, thread number, process number, storage read-write speed, cache hit rate, and queue length), and performance indicator characteristics (8 dimensions, including task completion rate, information accuracy, content relevance, expression fluency, response consistency, logical rigor, innovation degree, and individualization degree).

[0121] Based on the above feature vectors, the algorithm calculates the similarity matrix between records The matrix element S ij represents the similarity between record i and record j:

[0122]

[0123] The weight coefficients φ1=0.6 and φ2=0.4 represent the weights of feature similarity and semantic similarity, respectively. The cosine similarity of the feature vector is:

[0124]

[0125] The semantic similarity is calculated as:

[0126]

[0127] In the formula, and are the text content semantic vectors of records i and j (dimension 300, generated by a pre-trained word embedding model), and tanh(·) is the hyperbolic tangent function, which is used to map the similarity to the interval [-1, 1] and enhance the ability to distinguish moderate similarity.

[0128] Further, to identify experience patterns from the feature space, the algorithm uses an improved DBSCAN (Density-Based Spatial Clustering Algorithm) for clustering analysis. Unlike traditional DBSCAN, the present application uses an adaptive neighborhood radius mechanism to adapt to different density regions. The key parameters of the improved DBSCAN algorithm include the minimum sample size M points = 5 and the base neighborhood radius ε base = 0.3. The algorithm execution steps are as follows:

[0129] Step 1, calculate the k-nearest neighbor distance distribution of the data set. For each point p i , calculate the distance dk (p i ), in this embodiment k=5.

[0130] Second, compute the adaptive coefficient for each point p i , which is defined as:

[0131]

[0132] where is the average of k-nearest neighbor distances of all points. The adaptive coefficient reflects the relative density of the region where point p i is located, the larger the value, the lower the density.

[0133] Third, compute the adaptive neighborhood radius for each point:

[0134] ε(p i ) = ε base · min{2, max{0.5, ξ(p i )}}

[0135] This formula ensures that the neighborhood radius varies in the range [0.5ε base , 2ε base ], adapting to different density regions and avoiding clustering instability caused by extreme values.

[0136] Fourth, perform the DBSCAN clustering process based on the adaptive neighborhood radius. For each point p i , define the neighborhood using its adaptive neighborhood radius ε(p i ). If the number of points in the neighborhood is no less than M points , mark p i as a core point. Connect all core points that share points to form clusters, mark non-core points but in the neighborhood of a core point as boundary points and assign them to the corresponding cluster, and mark the remaining points as noise points.

[0137] Fifth, for each cluster C k formed, compute its quality evaluation index:

[0138] Density ρ k = n k / V k , where n k is the number of samples in cluster C k , and V k is the volume estimate of cluster C k , calculated by the convex hull algorithm;

[0139] Compactness represents the average similarity of point pairs within the cluster;

[0140] Stability σk By performing random sampling perturbation tests on cluster members, the robustness of the cluster structure to small changes is quantified.

[0141] If and only if cluster C k density ρ k ≥0.5, density τ k ≥0.7 and stability σ k When the threshold is ≥0.65, the cluster is considered a potential empirical pattern. These three thresholds were determined based on a large amount of experimental data and are effective in identifying patterns with statistical significance and practical value.

[0142] Furthermore, for each experience pattern identified by the self-awareness module, key features and common elements are extracted to form a knowledge unit. The knowledge unit contains the following structured fields:

[0143] (1) Knowledge ID: A unique identifier in UUID format; (2) Content description: A textual description of the experience pattern, automatically generated by extracting key content from the cluster center; (3) Applicable conditions: The environmental conditions that trigger the application of this knowledge, extracted by analyzing the common pre-state of the cluster samples; (4) Associated examples: Typical cases in the original records, selecting 3-5 samples closest to the cluster center; (5) Confidence: A comprehensive confidence index calculated based on the number, density, and stability of cluster samples; (6) Creation time: The precise timestamp of the knowledge unit generation; (7) Application frequency: The number of times it is called per unit time; (8) Success rate: The proportion of the expected results obtained after applying this knowledge.

[0144] The self-awareness module provides services to other modules in the system through a standardized RPC interface, including functions such as role attribute query, memory storage management, knowledge retrieval, and ability assessment. The interface adopts a RESTful architecture design, supports JSON data exchange, and ensures loose coupling and integration with other modules.

[0145] Through the above implementation methods, the self-awareness module of the present invention enables the accumulation, organization, and refinement of the system's self-experience, providing a knowledge foundation for the system's continuous evolution. The system quantifies its own state using role attribute vectors and capability assessment indicators, achieving awareness of its own history, capabilities, and characteristics. This self-awareness allows the system to proactively adjust its behavioral strategies based on its own characteristics and environmental needs, enhancing its adaptability and autonomy.

[0146] In the LLM-based active real-time interaction system, the real-time perception module and the self-awareness module work together to form the basis of information acquisition and processing. The real-time perception module focuses on the collection, processing and fusion of external environment data, providing real-time and accurate environment representation for the system, while the self-awareness module is responsible for the accumulation and cognitive construction of internal experience. Both of them complement each other and jointly support the intelligent decision-making and behavior generation of the system.

[0147] The main technical functions of the real-time perception module include multi-modal data standardization conversion, information reliability evaluation, environment state representation generation and dynamic allocation of computing resources. The module uses a unified technical architecture to process text, image, audio and video and other input types, and through specific preprocessing procedures, different modal data is converted into standardized internal representation format.

[0148] For text input, the system implements a complete natural language processing pipeline, including text normalization, word segmentation processing, part-of-speech tagging, dependency syntax analysis and semantic understanding. The text normalization stage performs character encoding unification, special symbol processing and spelling check; the word segmentation processing stage uses a hybrid model combining conditional random fields (CRF) and deep neural networks to accurately identify word boundaries; the part-of-speech tagging and dependency syntax analysis use pre-trained models based on the Transformer architecture to accurately extract the structural information of the text; the semantic understanding stage extracts the deep semantic content of the text through semantic role labeling (SRL) and named entity recognition (NER).

[0149] For image input, the system uses a multi-level convolutional neural network architecture to extract visual features. The image processing pipeline includes three stages: preprocessing, feature extraction and scene understanding. The preprocessing stage performs image size adjustment, color space conversion and pixel value normalization; the feature extraction stage uses a pre-trained residual network (ResNet) model to extract multi-scale visual feature maps; the scene understanding stage combines attention mechanisms and feature pyramid networks (FPN) to achieve semantic segmentation, object detection and scene graph generation for image content, ultimately generating a structured scene description.

[0150] For audio input, the system first uses an adaptive filter for noise suppression and signal enhancement, and then uses a multi-channel acoustic model to convert speech into text. At the same time, the system preserves paralinguistic information such as intonation, speech rate, volume and sound features, and analyzes the emotional state of the speaker through a dedicated emotion recognition module, ultimately generating a comprehensive representation containing semantic content and emotional labels.

[0151] For video input, the system adopts a spatio-temporal dual-stream network architecture to process the spatial and temporal dimension information of videos simultaneously. The spatial stream extracts static visual features of each frame through a convolutional neural network; the temporal stream captures the temporal patterns of actions and events through optical flow computation and a three-dimensional convolutional network. The features of the two streams are integrated through a feature fusion network to generate a unified representation containing scene, action, and event information.

[0152] The core of the multi-modal data standardization conversion is the feature fusion module, which realizes the feature alignment and information fusion of different modal data based on the cross-attention mechanism. The feature fusion process consists of three technical stages: intra-modal feature extraction, inter-modal feature alignment, and cross-modal feature fusion.

[0153] In the intra-modal feature extraction stage, the system extracts features from each modality of data Applies a modality-specific transformation function f m (·), to generate standardized features

[0154] Z m = f m (X m ) = σ(W m X m + b m )

[0155] In the formula, and are modality-specific learnable parameters, σ(·) is a nonlinear activation function, and in this embodiment, the GELU function is used. The dimension of the unified feature space d = 256 is an optimized value that balances expression ability and computational efficiency.

[0156] In the inter-modal feature alignment stage, the system realizes feature alignment by calculating the attention matrix between different modal features:

[0157]

[0158] In the formula, is the attention matrix of modality i to modality j, is the aligned representation of modality j features in modality i space. The division by operation in attention calculation is used to scale the dot product value to prevent the gradient vanishing problem caused by large dimensions.

[0159] In the cross-modal feature fusion stage, the system uses a gated fusion mechanism to integrate self-modal information and cross-modal information:

[0160]

[0161] In the formula, is a gating vector, controlling the fusion ratio of self-modal and cross-modal information; σ(·) is a sigmoid function, limiting the output in the interval [0, 1]; and is a learnable parameter; [; ] represents the vector concatenation operation; ⊙ represents the element-level multiplication; is the fused modal i feature representation.

[0162] The final fusion feature is obtained by reliability weighted average:

[0163]

[0164] where ω i is the weight of modal i, determined by the modal reliability score described below, satisfying Σ i ω i = 1.

[0165] The real-time perception module establishes an information reliability score function based on source attribute, timeliness and content consistency, which is used to quantitatively evaluate the credibility of input information. The information reliability score R reliability is calculated by three factors:

[0166] R reliability = θ1·S source + θ2·T timeliness + θ3·C consistency

[0167] The weight coefficients θ1=0.4, θ2=0.3, θ3=0.3, respectively representing the weights of source reliability, timeliness and content consistency. The specific calculation methods of the three factors are as follows:

[0168] The source reliability score S source considers the source type, historical accuracy and trustworthiness:

[0169] S source = π1·S type + π2·S history + π3·S credibility

[0170] The weight coefficients π1=0.3, π2=0.4, π3=0.3. S type is the source type score, which is rated according to the authority level of the source, with preset values including: official documents (1.0), authoritative agencies (0.9), professional platforms (0.8), mainstream media (0.7), individual experts (0.6), ordinary users (0.4). S history is the historical accuracy score, calculated by Bayesian estimation:

[0171]

[0172] where n correct is the number of historical correct information, n error is the number of historical incorrect information, and a = 1 and b = 1 are Bayesian smoothing parameters to prevent unstable estimation caused by data sparsity. credibility is the trustworthiness score, which is based on the system's historical evaluation of the source, with an initial value of 0.7 and subsequent dynamic adjustment based on interaction results.

[0173] The timeliness score T timeliness is calculated by an exponential decay function:

[0174] T timeliness = exp(-k decay · At)

[0175] where k decay is the decay coefficient and At is the time interval from information generation to the current time (in days). Different types of information use different decay coefficients: real-time data (k decay = 0.5), daily update data (k decay = 0.2), weekly update data (k decay = 0.1), monthly update data (k decay = 0.05), and static knowledge (k decay = 0.01). This differentiated decay mechanism allows the system to adjust timeliness evaluation standards according to the inherent update period of information.

[0176] The content consistency score C consistency is calculated by cross-validation:

[0177]

[0178] where N source is the total number of sources, and D norm (X i , X j ) is the normalized difference in information provided by source i and source j, calculated as:

[0179]

[0180] where D raw (X i , X j ) is the original difference (Levenshtein distance for text, relative error for numerical values, and matching degree for categories), and D threshold is the difference threshold for normalization. When there is only a single source, C consistency takes half of the source reliability score S source , indicating that information that cannot be confirmed by cross-validation has higher uncertainty.

[0181] The real-time perception module generates a structured environment vector that includes three-dimensional states: time, user, and system. As a comprehensive representation of the current environment by the system:

[0182] E env =[E time E user E system ]

[0183] In the formula, It is a time state vector. For the user state vector, Let be the system state vector, and [;] denotes the vector concatenation operation.

[0184] Time state vector E time Extraction function f from time features time (·)generate:

[0185] E time =f time (t current ,t start ,p pattern ,d deadline )

[0186] In the formula, t current t is the current timestamp. start p is the session start timestamp. pattern For the identified time pattern vector, d deadline This represents the task deadline vector. The time feature extraction function is f. time (·) includes the following processing steps: (1) Time normalization: converting absolute time into relative time and periodic time representation; (2) Periodic feature extraction: identifying periodic patterns in the time series through Fourier transform and autocorrelation analysis; (3) Stress assessment: calculating time stress indicators based on task deadline and current time.

[0187] User state vector E user User feature extraction function f user (·)generate:

[0188] E user =f user (id user ,p profile ,e emotion ,b behavior )

[0189] In the formula, id user For user ID, p profile e is a vector of user profile information. emotionis the emotional state vector, b behavior is the behavior feature vector. The user feature extraction function f user (·) includes the following processing steps: (1) user identification: retrieve user profile and history information based on user ID; (2) emotion analysis: comprehensive assessment of user emotional state through text sentiment analysis, voice emotion recognition and behavior pattern analysis; (3) behavior feature extraction: analysis of user interaction mode, reaction speed, input characteristics and decision-making tendency.

[0190] System state vector E system is generated by the system feature extraction function f system (·):

[0191] E system = f system (r resource ,c capacity ,s status ,e error )

[0192] In the formula, r resource is the resource usage vector, c capacity is the processing capacity index vector, s status is the running state code vector, e error is the error record vector. The system feature extraction function f system (·) includes the following processing steps: (1) resource monitoring: collect CPU, memory, network and storage resource usage; (2) capacity evaluation: based on current load and historical performance analysis of current processing capacity; (3) state coding: convert system running state into standardized state code vector.

[0193] The generation frequency of the environment vector E env is dynamically adjusted according to the scene requirements, and the default setting is once per second. For high change environment or critical task scene, the generation frequency can be increased to once every 100 milliseconds; for low change environment or non-critical task scene, the generation frequency can be reduced to once every 5 seconds. The generated environment vector is transmitted to other modules of the system through the standardized interface, especially the active planning module and the situational decision module, providing the basis for environmental perception for the system.

[0194] The real-time perception module applies a dynamic priority allocation algorithm to adjust the allocation of computing resources, ensuring the processing quality of critical data streams. The data stream priority P priority is calculated based on data importance, real-time requirement and processing complexity:

[0195] P priority = ψ1·I importance + ψ2·U urgency + ψ3·C complexity

[0196] Weight coefficients ψ1=0.4, ψ2=0.4, ψ3=0.2 represent the weights of data importance, real-time requirement and processing complexity respectively. importance Data importance score is related to data content relevance and criticality; urgency Real-time requirement score is related to data update frequency and time sensitivity; complexity Processing complexity score is related to data size and processing algorithm complexity.

[0197] Based on the calculated priority score, the system allocates computing resources in proportion:

[0198]

[0199] In the formula, R i Ri is the amount of resources allocated to data stream i, R total R is the total available resources, P i is the priority score of data stream i. When the system resources are tight, the data stream with a priority lower than the preset threshold will be scheduled to a low-priority processing queue, and the processing quality of high-priority data streams will be ensured by reducing the processing accuracy or delaying the processing in a way to reduce resource consumption.

[0200] Further, the real-time perception module stores the latest environmental state vector and raw input data by maintaining an environmental data cache, meeting the needs of environmental change trend analysis and data backtracking. The cache uses a time decay storage strategy to optimize storage by treating near-term and long-term data differently. In its three-level storage architecture, the first-level cache stores complete-precision data sampled within 10 minutes and 50 milliseconds; the second-level cache stores medium-precision data sampled within 6 hours and 5 seconds; and the third-level cache stores low-precision data sampled within 7 days and 1 minute, taking into account both short-term and long-term data needs and space utilization.

[0201] Through the above implementation, the real-time perception module thus realizes efficient processing and fusion of multi-source environmental data, providing accurate and timely environmental perception for the system, supporting active decision-making and behavior planning, and is the core component of the system to realize active real-time interaction.

[0202] In the active real-time interaction system architecture based on LLM of the present application, the active planning module is organically linked with the real-time perception module and the self-cognition module, and together supports the active behavior mode of the system. The active planning module receives the system role attributes and experience knowledge provided by the self-cognition module, and combines the environmental state representation generated by the real-time perception module to generate a system action plan, which is the core technical component of the system to realize initiative.

[0203] The key technical functions of the active planning module include target task decomposition, multi-path execution plan generation, task dependency management, and dynamic plan updating. The module adopts a hierarchical planning architecture, decomposes system goals from top to bottom into specific tasks, and then generates an execution plan containing the main path and alternative paths to achieve the system's prediction and response to environmental changes.

[0204] The target task decomposition algorithm executed by the active planning module adopts a hierarchical decomposition strategy to convert high-level system goals into a set of executable specific tasks. The algorithm first identifies the type of the goal, classifying it into four categories: information goal (acquire specific information), state goal (achieve a specific state), capability goal (acquire a specific capability), and experience goal (provide a specific experience). Based on the goal type, the system selects the appropriate decomposition method.

[0205] For information goals, the system uses a knowledge graph-based information demand analysis method. The specific steps include: (1) Constructing an information demand graph to convert the information demand expressed by the goal into a structured query; (2) Identifying information entities and their attributes to clarify the specific information elements that need to be acquired; (3) Determining information sources and acquisition paths, including internal knowledge bases, external data sources, and interactive acquisition; (4) Designing verification strategies to ensure the accuracy and completeness of the acquired information; (5) Generating a set of information acquisition tasks, each corresponding to an information element or a verification step.

[0206] For state goals, the system uses a state space-based inverse planning method. The specific steps include: (1) Defining the formal representation of the target state to clarify the expected values of each dimension; (2) Evaluating the difference between the current state and the target state to identify the dimensions that need to be changed; (3) Constructing a state transition graph to analyze the possible paths from the current state to the target state; (4) Reverse analyzing the state transition conditions to determine the necessary prerequisites for achieving the target state; (5) Generating a set of state transition tasks, each corresponding to a state transition step.

[0207] For capability goals, the system uses a component-based capability construction method. The specific steps include: (1) Analyzing the constituent elements of the target capability to identify core components and support components; (2) Evaluating the relevant components currently possessed by the system to determine the components that need to be added or strengthened; (3) Analyzing the dependency relationships between components to construct a capability dependency graph; (4) Designing capability acquisition and integration strategies, including learning, training, and resource allocation; (5) Generating a set of capability construction tasks, each corresponding to the acquisition or strengthening of a capability component.

[0208] For experience goals, the system adopts a factor-based experience optimization method. The specific steps include: (1) analyzing the key factors that affect the target experience, including functional factors and emotional factors; (2) building an experience evaluation model to quantify the contribution of each factor to the experience; (3) determining the optimization direction and strategy, and designing improvement plans for key factors; (4) designing experience testing and feedback mechanisms to ensure optimization effectiveness; (5) generating experience optimization task sets, each task corresponding to the optimization of an experience factor.

[0209] The core of the target task decomposition algorithm is the task generation function G task (O,C), where O represents the target description and C represents the current environment state. The function outputs a task set T = {t1, t2,..., t n}, each task t i contains the following attribute fields: task ID (unique identifier), task description (natural language description), expected result (task completion flag), preconditions (task execution conditions), resource requirements (required computing and data resources), estimated time consumption (estimated time to complete the task), priority (task importance and urgency), dependency relationship (dependency relationship with other tasks).

[0210] The task dependency relationship is represented by a directed acyclic graph (DAG) G dep = (V, E), where V is the vertex set (task) and E is the edge set (dependency relationship). For easy calculation, the dependency graph is described by an adjacency matrix A ∈ {0,1} n×n Description:

[0211]

[0212] Based on the dependency relationship, the system uses an improved critical path algorithm to calculate the earliest start time ES i and the latest start time LS i of each task:

[0213]

[0214] where d i is the estimated time consumption of task i, T max is the total time constraint. For tasks without pre-dependencies, ES i = 0; for tasks without subsequent tasks, LS i = T max -d i . At the same time, the system calculates the time slack Slack i = LS i - ES i of each task, and the tasks with zero time slack form the critical path.

[0215] The active planning module generates a multi-path execution plan containing a main path and alternative paths based on the above calculation results. The execution plan P exec is expressed as:

[0216] P exec = {p1, p2,..., p m}

[0217] where p1 is the main path, and p2,..., p m are alternative paths. Each path p k is defined as an ordered task sequence and its execution strategy:

[0218] p k = {(t k1 ,s k1 ), (t k2 ,s k2 ),..., (t kl ,s kl )}

[0219] where t ki is the i-th task in path k, and s ki is the corresponding execution strategy containing parameters such as execution time, execution mode, and quality requirements. The execution strategy s ki is defined as a set of attributes, including execution priority s ki .priority, resource allocation ratio s ki .resource, quality threshold s ki .quality, and maximum execution time s ki .timeout, etc.

[0220] The main path p1 is generated based on the optimal prediction of the current environment state, and the specific steps include: (1) selecting tasks on the critical path, whose time margin is zero and has a decisive influence on the overall plan completion time; (2) sorting tasks by the earliest start time to ensure that the dependency relationship is satisfied; (3) assigning standard execution strategies to each task to guide the specific parameters of task execution; (4) calculating the completion time and resource requirements of the main path, and evaluating the feasibility of the main path.

[0221] The alternative paths p k (k>1) are designed for different environmental changes, and each alternative path is associated with a trigger condition c k . The trigger condition c k is defined as a conditional function on the environment vector E env :

[0222]

[0223] The generation of alternative paths employs a path planning algorithm based on Monte Carlo Tree Search (MCTS). The algorithm steps include: (1) generating multiple possible environmental change scenarios according to historical data and environmental models; (2) performing Monte Carlo simulation for each scenario to evaluate the results of different task choices; (3) constructing a decision tree based on the simulation results and calculating the value of each node; (4) extracting high-value paths from the decision tree as alternative paths; (5) defining the trigger conditions of each alternative path associated with specific environmental changes.

[0224] The proactive planning module updates the execution plan through a dual trigger mechanism of timing and events. The timing trigger sets a fixed plan update period, which is 30 seconds by default; the event trigger responds to specific environmental changes or execution feedback to immediately start plan update. The plan update process includes three technical steps of plan evaluation, plan adjustment and plan generation.

[0225] Plan evaluation is based on the current environmental state and execution feedback to calculate the fitness score F adapt of the current plan.

[0226] F adapt = ζ1·P completion + ζ2·P env_match + ζ3·P efficiency

[0227] The weight coefficients ζ1=0.4, ζ2=0.3, ζ3=0.3 represent the weights of plan completion, environmental fitness and execution efficiency respectively. Plan completion P completion is the proportion of completed tasks to total tasks:

[0228]

[0229] Environmental fitness P env_match evaluates the matching degree of the current environment and the environment at the time of plan generation:

[0230]

[0231] where n E is the number of environmental features, w j is the weight of feature j, M j (·,·) is the matching degree function, which calculates the matching degree of the current environmental vector and the environmental vector at the time of plan generation on feature j, with a value range of [0, 1], and the larger the value, the higher the matching degree.

[0232] Execution efficiency P efficiency evaluates the efficiency of the executed tasks:

[0233]

[0234] where n executed is the number of completed tasks, q i ∈[0,1] is the execution quality score of task i, t i is the ratio of actual execution time and expected execution time of task i. This indicator reflects the efficiency and quality balance of system task execution.

[0235] When the fitness score F adapt is lower than the first threshold (set to 0.6 in this embodiment), the system triggers plan adjustment; when the score is lower than the second threshold (set to 0.3 in this embodiment), the system triggers complete re-planning. Plan adjustment adopts a local adjustment strategy, preserving completed and currently executing tasks, adjusting the order, strategy or replacing part of the remaining tasks. Plan adjustment steps include: (1) marking completed and currently executing tasks as fixed nodes; (2) updating environment state and task dependency; (3) recalculating the earliest start time and latest start time of remaining tasks; (4) adjusting task execution order and execution strategy; (5) adding new tasks or replacing low fitness tasks if necessary.

[0236] Complete re-planning re-executes the target task decomposition and multi-path plan generation process, completely reconstructing the execution plan. Re-planning steps include: (1) saving the current execution state and intermediate results; (2) reanalyzing system goals and environment state; (3) executing the target task decomposition algorithm to generate a new task set; (4) building a new task dependency graph; (5) generating new primary and alternative paths; (6) integrating the current execution state into the new plan to ensure smooth transition.

[0237] Further, the active planning module maintains a plan state table, recording the execution state, completion time and quality score of each task in the plan. The plan state table uses a key-value storage structure, with task ID as the key and task state object as the value. The task state object contains the following fields: current state (not started, waiting, executing, completed, canceled, failed), start time, completion time, execution time, resource usage, output result, quality score and exception record. The plan state table is used for plan evaluation and adjustment, while providing execution reference and self-monitoring information for the system, supporting long-term learning and optimization.

[0238] Through the above implementation, the active planning module of the present application realizes intelligent decomposition and dynamic planning of system goals, enabling the system to predict possible execution paths in advance and prepare alternative solutions, significantly enhancing the system's initiative and ability to cope with uncertainty. The module enables the system to quickly switch execution strategies when the environment changes, maintaining the continuity and goal-oriented nature of behavior, providing key technical support for achieving truly active interaction.

[0239] Further, in the system described in the present application, the context decision module receives the execution plan generated by the proactive planning module, combines the environment state provided by the real-time perception module, and formulates specific real-time decisions, which is the control center of the system to realize intelligent behavior. The module solves the task conflict in the execution process by scientifically allocating system resources through multi-dimensional analysis and evaluation of task priority, and ensures the rationality and efficiency of system behavior.

[0240] The context decision module calculates the task priority score based on multi-dimensional decision factors. For the set of tasks to be executed T t ={t1,t2,...,t n} at time point t i , the system calculates the priority score P i of each task t i :

[0241] P i =ρ1·I i +ρ2·U i +ρ3·E i

[0242] The weight coefficients ρ1=0.3, ρ2=0.3, ρ3=0.2, and ρ4=0.2 represent the weights of importance, urgency, environment matching degree, and dependence influence degree, respectively. The calculation methods of each factor are as follows:

[0243] The importance score I i considers the contribution of the task to the goal, the expected value, and the criticality:

[0244] I i =ν1·G i +ν2·V i +ν3·C i

[0245] The weight coefficients ν1=0.5, ν2=0.3, and ν3=0.2. The goal contribution degree G i represents the contribution proportion of task completion to the achievement of system goals, and the calculation formula is:

[0246]

[0247] where w i is the contribution weight of task i to the goal, provided by the goal task decomposition algorithm. The value score V i represents the value created by the task, and the calculation method is:

[0248]

[0249] where benefit iThe expected benefit of a task, cost i The cost of executing a task, max_value is a normalization factor. The criticality score C i represents the criticality of a task in the execution plan, which is calculated as:

[0250]

[0251] where Slack i is the time slack of a task, max_slack is the maximum time slack of all tasks. Slack i of a task on the critical path is 0, corresponding to C i = 1, indicating the highest criticality.

[0252] The urgency score U i is evaluated based on the time constraint of a task, using a piecewise linear function:

[0253]

[0254] where ES i is the earliest start time of task i, LS i is the latest start time. This function maps the current time position of a task to the interval [0, 1], reflecting the urgency of the task. When the current time t exceeds the latest start time LS i , the urgency reaches the highest value 1; when the current time t is earlier than the earliest start time ES i , the urgency is 0, indicating that the task is not ready yet.

[0255] The environment matching degree E i evaluates the suitability of the current environment for task execution:

[0256]

[0257] where m is the dimension of the environment features, ω j is the weight of feature j, F j (E env , C i ) is the matching function, which calculates the matching degree of the current environment vector E env and the applicable conditions C i of task i on feature j. The matching function uses a composite evaluation method based on rules and pattern matching to map the consistency of environment features and task conditions to the interval [0, 1].

[0258] The dependency impact degree D i considers the impact of task dependencies on the overall plan:

[0259]

[0260] where N down is the number of downstream tasks of task i (the number of tasks that depend on task i), and a = 0.5 and β = 3 are function parameters. This function maps the number of downstream tasks through a Sigmoid function to the interval [0, 1], reflecting the influence range of a task in the dependency network. The more downstream tasks, the greater the influence of the task on subsequent execution, and the higher the dependency influence degree.

[0261] Further, the context decision module models the resource allocation as a constrained optimization problem, which solves the optimal solution according to the task priority and resource demand. The resource allocation optimization model is defined as:

[0262]

[0263]

[0264] where P i is the priority score of task i, U i (r i ) is the utility function, representing the utility of task i obtaining resource r i , R total is the total available resource, and r i,min is the minimum resource requirement of task i. The utility function adopts a concave function with diminishing marginal utility:

[0265]

[0266] where λ i is a task-specific parameter that controls the rate of utility growth. This optimization problem is solved by the Lagrange multiplier method:

[0267]

[0268] By solving the equation group:

[0269]

[0270] The optimal resource allocation scheme is obtained:

[0271]

[0272] where μ is determined by the bisection method, so that the constraint condition is satisfied.

[0273] Furthermore, the scenario decision-making module applies specific resolution strategies for different types of task conflicts. Task conflicts are categorized into three types: resource conflicts, time conflicts, and goal conflicts. For resource conflicts, the system employs the aforementioned resource optimization allocation model; for time conflicts, the system uses task reordering and parallel execution strategies; and for goal conflicts, the system adopts a utility-based compromise solution.

[0274] To address time conflicts, the system executes a task reordering algorithm:

[0275] (1) Sort the tasks according to their priority to form an initial execution queue Q = [t1, t2, ..., t n (2) Check for time conflicts between adjacent tasks. If task t i and t i+1 If the execution times overlap, determine whether they can be executed in parallel: a. If the total resource requirement does not exceed the available resources and there is no dependency, mark it as parallel execution; b. Otherwise, determine the execution order based on priority and deadline; (3) If there is still a conflict after adjustment, calculate the delay cost of each task. delay (t i ):

[0276]

[0277] In the formula, ET i d represents the current estimated start time of the task. i For the duration of the task, DL i For the task deadline, Slack i ∈ = 0.01 is the time margin, and ∈ = 0.01 is the smoothing factor. The task with the lowest delay cost is selected and its execution is postponed.

[0278] To address target conflicts, the system employs a utility-based conflict resolution algorithm:

[0279] (1) Identify conflicting objectives G1 and G2, and construct the objective utility function U. G1 (x) and U G2 (x), where x is the decision variable; (2) Define the combined utility function U. combined (x)=w1·U G1 (x)+w2·U G2 (x), where w1 and w2 are the objective weights; (3) Solve for the optimal decision variables. Based on the solution results, a compromise solution is formulated to balance conflicting objectives.

[0280] Furthermore, the situational decision-making module implements a formal decision-making model to ensure the determinism and interpretability of the decision-making process. The decision-making process is represented using a state transition system:

[0281] STS = (S, A, T, s0, G)

[0282] where S is the state set, representing the possible states of the system; A is the action set, representing the operations that can be performed by the system; T: S x A → S is the transition function, defining the transition rules between states; s0 ∈ S is the initial state; G is the goal state set. The decision-making problem is transformed into finding a path from the initial state s0 to a goal state g ∈ G in the state space.

[0283] To improve decision-making efficiency, the system adopts a hierarchical decision-making architecture: (1) strategic layer: handles long-term goals and global resource allocation, with a longer decision-making period (minute level); (2) tactical layer: handles medium-term task planning and conflict resolution, with a medium decision-making period (second level); (3) operational layer: handles immediate action selection and resource scheduling, with a short decision-making period (millisecond level).

[0284] Each layer of decision-making is coordinated through a two-way information flow: the upper layer provides constraints and guidance for the lower layer, and the lower layer provides execution feedback and state updates to the upper layer. This hierarchical architecture ensures both long-term consistency and rapid response to environmental changes.

[0285] Through the above embodiments, the context decision-making module of the present application realizes a real-time decision-making mechanism based on multi-dimensional evaluation, enabling the system to dynamically adjust decision-making strategies according to the current environment and task characteristics, scientifically allocate resources, and efficiently solve execution conflicts, providing an intelligent control center for system behavior and significantly enhancing the system's situational adaptability and decision-making efficiency.

[0286] Further, in the system described in the present application, the dynamic execution module receives the decision-making instructions generated by the context decision-making module, converts abstract decisions into specific actions, executes system behavior, and provides execution feedback. This module is the execution layer of system behavior implementation, responsible for converting decision-making intentions into actual effects, while providing execution state monitoring and dynamic adjustment mechanisms.

[0287] Specifically, the dynamic execution module maps abstract decisions to specific instruction sequences. Decision-making instructions are usually high-level abstract expressions, such as "query user preferences", "generate content summary", etc., which need to be converted into specific operations that can be directly executed. The instruction mapping process adopts a hierarchical conversion architecture:

[0288]

[0289] The first layer conversion (L1) converts the abstract decision D abstract into an intermediate representation D intermediate , which clearly defines the operation object, operation type and parameter requirements of the decision; the second layer conversion (L2) converts the intermediate representation into specific instructions D concretedetermining execution methods and resource configurations; the third layer translation (L3) translates the specific instructions into executable operation sequences O executable including actual operations such as calling specific APIs, executing specific functions, etc.

[0290] Taking the "query user preference" decision as an example, the conversion process is as follows:

[0291] Abstract decision: query user preference; intermediate representation: {operation: query, object: user preference, dimension: [topic, form, difficulty], data source: [interaction history, user profile]}; specific instruction: {method: pattern matching analysis, parameter: {data range: last 50 interactions, analysis dimension: 3, confidence threshold: 0.75}, resource: {processor: medium, memory: high, priority: medium}}; executable operation: [call data retrieval API to get interaction records, execute pattern matching algorithm to analyze preferences, generate confidence report, update user model]

[0292] Further, the dynamic execution module establishes checkpoints during the execution process to realize the monitoring and adjustment of the execution process. The checkpoint setting is based on the following principles: (1) task critical stage completion point, used to verify the stage results; (2) resource consumption threshold point, used to optimize resource use; (3) execution time exceeds the expected point, used to adjust the execution strategy; (4) environmental state change point, used to respond to external changes; (5) dependent task completion point, used to coordinate the interaction between tasks.

[0293] Wherein, each checkpoint is defined as:

[0294] CP = (id, condition, action, next)

[0295] In the formula, id is the checkpoint identifier, condition is the trigger condition, action is the operation executed after triggering, and next is the next checkpoint. The checkpoint condition can be a time condition (the execution time reaches a certain value), a state condition (a certain state variable reaches a certain value), or an event condition (a certain event occurs). Checkpoint operations include continuing execution, adjusting parameters, pausing execution, terminating tasks, requesting decisions, etc.

[0296] Further, the dynamic execution module generates a structured feedback report to provide execution status and result information. The feedback report R feedbackThe feedback report includes the following key information: (1) task identification: including task ID, decision ID, and execution timestamp; (2) completion status: including completion degree, status code, and end type (normal completion, abnormal termination, etc.); (3) performance indicators: including actual execution time, resource usage, and throughput rate; (4) effect evaluation: including result quality score, target achievement degree, and user feedback; (5) exception record: including exception type, occurrence location, and impact degree; (6) environmental change: including the difference in environmental state before and after execution; (7) decision evaluation: adaptability evaluation of the original decision.

[0297] The feedback report adopts JSON format to ensure structure and parsability while maintaining sufficient extensibility. The report is delivered to the situational decision module and the self-cognition module through a standardized interface for decision adjustment and experience accumulation.

[0298] Further, the dynamic execution module implements a dynamic path adjustment mechanism based on execution state, which can adjust the execution path according to state changes during execution. The dynamic adjustment adopts a hybrid method based on rules and models: the rule engine handles the adjustment logic of predefined scenarios, and the model inference handles the adjustment strategies of complex and novel scenarios.

[0299] Path adjustment occurs in the following cases: (1) checkpoint-triggered adjustment: triggering predefined adjustment operations when checkpoint conditions are met; (2) exception handling adjustment: starting corresponding fault-tolerant mechanisms when execution exceptions occur; (3) performance optimization adjustment: adjusting resources and algorithms when execution performance is poor; (4) environmental change adjustment: re-evaluating the execution path when the environmental state changes significantly; (5) user feedback adjustment: adjusting the execution direction according to real-time user feedback.

[0300] The adjustment strategy includes four levels of parameter fine-tuning, component replacement, path switching, and re-planning, and selects the appropriate adjustment level according to the deviation degree and adjustment cost.

[0301] Further, the dynamic execution module maintains an execution state table to record the execution state and results of all tasks. The state table adopts a key-value storage structure, with task ID as the key and execution state object as the value. The execution state object contains the following fields: current phase, start time, current time, estimated remaining time, consumed resources, intermediate results, checkpoint records, and exception logs. The state table is implemented through an in-memory database, supporting high-speed read-write and transaction processing to ensure data consistency in high-concurrency execution scenarios.

[0302] Through the above implementation, the dynamic execution module of the present application realizes efficient conversion of decisions into actions and precise execution control. The system can continuously monitor the state, flexibly adjust the path, and handle abnormal situations during execution, ensuring the reliability and adaptability of behavior implementation, and providing a solid execution guarantee for the active interaction capability of the system.

[0303] Further, in the LLM-based active real-time interaction system, the emotion engine module is responsible for simulating the system emotional state, providing emotional dimension regulation for system behavior. Through emotion state modeling, emotion transition rule definition, emotion influence mechanism on decision and expression, and emotion decay mechanism, the module enables the system to have emotional intelligence, and can produce more natural and more temperature interactive experience.

[0304] The emotion engine module uses a multi-dimensional vector to represent the system emotional state. The emotion state vector is defined as:

[0305] E emotion = [e1, e2,..., e d ]

[0306] In the formula, d is the emotional space dimension, d = 6 in this embodiment, corresponding to six basic emotions: joy (e1), sadness (e2), anger (e3), fear (e4), surprise (e5) and disgust (e6). The value range of each dimension is [0, 1], and the larger the value, the higher the intensity of the emotion. The emotion state vector satisfies the normalization constraint:

[0307]

[0308] The system also maintains an emotion threshold vector which defines the appearance threshold of each emotional dimension. When the intensity of a certain dimension exceeds its threshold, the emotion will appear in the system behavior. The initial value of the threshold vector is set to [0.4, 0.5, 0.6, 0.55, 0.45, 0.65], which is the best appearance boundary based on experimental verification.

[0309] The emotion engine module defines the relationship between events and emotion changes through a mapping matrix. The event-emotion mapping matrix where n is the number of event types and d is the emotional space dimension. The matrix element M ij represents the influence intensity of event type i on emotion dimension j, and the value range is [-1, 1], positive value indicating enhancing emotion and negative value indicating suppressing emotion.

[0310] Events are divided into two categories: environmental events and internal events. Environmental events are identified by the real-time perception module, including user behavior, system notifications and environmental changes, etc.; internal events are generated by the system itself, including task completion, resource occupation and error occurrence, etc. Each event type is associated with an event intensity coefficient α i ∈ [0, 1], indicating the influence degree of the event.

[0311] When event i occurs, the system calculates the emotion change vector ΔE:

[0312] ΔE = a i • M i* ⊙(1 - E emotion )⊙I(M i* > 0) + a i • M i* ⊙E emotion ⊙I(M i* < 0)

[0313] where M i* denotes the i-th row of the mapping matrix M event , ⊙ denotes element-wise multiplication, and I(·) is the indicator function that takes 1 when the condition is satisfied, and 0 otherwise. This formula ensures that the mood change has a boundary effect: the positive effect decreases as the current mood intensity increases, and the negative effect decreases as the current mood intensity decreases.

[0314] The mood state update formula is:

[0315]

[0316] where Normalize(·) is the normalization function that ensures the sum of the components of the mood vector is 1:

[0317]

[0318] The mood engine module specifies the influence function of the mood state on system decisions and expressions. The mood influence is divided into two aspects: decision influence and expression influence. The decision influence is achieved through the mood modulation matrix M , where p is the number of decision parameters. Given the current mood state E emotion and the baseline decision parameter vector P base , the modulated decision parameter P modulated is calculated as:

[0319]

[0320] where β ∈ [0, 1] is the modulation intensity coefficient that controls the degree of mood influence on decisions. The modulation matrix M decision is constructed based on psychological research and system experimental data, representing the modulation effect of different moods on decision parameters.

[0321] The expression influence is achieved through the mood expression function F express (E emotion , C), where C is the content representation. The expression function modifies the expression style of the content, including vocabulary selection, tone intensity, sentence structure, and rhetorical devices. The expression function adopts a hybrid method based on templates and rules:

[0322] F express (E emotion , C) = γ · Ftemplate (E emotion ,C)+(1-γ)·F rule (E emotion ,C)

[0323] where γ ∈ [0, 1] is a weighting coefficient, F template (·) is a template-based expression function, F rule (·) is a rule-based expression function. The template-based method predefines a library of expression templates for each emotion, and selects the appropriate template according to the emotion intensity. The rule-based method defines language conversion rules, including vocabulary replacement, intensity adjustment, and structure transformation.

[0324] Further, the emotion engine module implements a time-based emotion intensity decay mechanism. The emotion state naturally decays over time, and the decay process follows an exponential decay model:

[0325] E emotion (t0+Δt)=E neutral +(E emotion (t0)-E neutral )·e -λ·Δt

[0326] where E neutral =[1 / d, 1 / d,..., 1 / d] is a neutral emotion state, λ is a decay coefficient, and Δt is a time interval (unit: minutes). The decay coefficients for different emotion dimensions are different, reflecting the differences in emotion duration: joy (λ1=0.05), sadness (λ2=0.03), anger (λ3=0.08), fear (λ4=0.06), surprise (λ5=0.15), and disgust (λ6=0.07). These decay coefficients are determined based on psychological research and experimental data, simulating the natural fading process of human emotions.

[0327] The emotion engine module maintains an emotion state log, recording the emotion change trajectory and triggering events. The log contains timestamp, emotion state vector, triggering event, change intensity, and impact effect information. The emotion state log is used for emotion change analysis and pattern recognition, supporting the system to learn and optimize the emotion change rules.

[0328] Through the above implementation, the emotion engine module of the present application provides emotional intelligence for the system, enabling the system to produce reasonable emotional responses according to environmental events and internal states, and modulating decisions and expressions through emotion states, achieving a more natural and more humanized interactive experience. The change and performance of the system emotion follow the psychological rules, avoiding over-performance while maintaining the necessary emotional depth, significantly enhancing the affinity and interaction quality of the system.

[0329] Further, in the LLM-based active real-time interaction system, the adaptive interaction module is responsible for implementing personalized interaction, dynamically adjusting interaction parameters, optimizing interaction strategies, and providing customized interaction experience for users according to user characteristics and situational needs. Through user feature modeling, interaction parameter adjustment, interaction strategy optimization, and feedback-driven adaptive mechanisms, the module continuously optimizes the interaction mode of the system and improves the interaction effect.

[0330] The adaptive interaction module constructs a user feature model through historical interaction analysis. The user feature model U i An 8-dimensional vector representation is adopted:

[0331]

[0332] Each dimension corresponds to knowledge level, expression preference, reaction mode, interaction rhythm, attention duration, learning style, decision-making mode, and emotional characteristics. Each dimension has a value range of 0 to 1, which is obtained through analysis and calculation of user historical interaction data.

[0333] Knowledge level dimension The complexity of user question content, the use of professional terms, and the depth of the question are analyzed and evaluated, and the calculation formula is:

[0334]

[0335] Where Q i represents the historical question set of user i (the last 20 questions), C(q) is the question complexity score, calculated based on syntactic structure complexity and number of logical relationships; T(q) is the professional term score, calculated based on the ratio of the number of professional terms to the total number of words; D(q) is the question depth score, calculated based on question hierarchy and abstraction level. The above three scores have been normalized to the interval of 0 to 1.

[0336] Expression preference dimension The user's language style, vocabulary selection, and sentence structure are analyzed and evaluated:

[0337]

[0338] Where F f (i) is the degree of formalization, calculated based on the proportion of formal language; F v (i) is the vocabulary complexity, calculated based on the average word length and the proportion of rare words; F s (i) is the structure complexity, calculated based on the length of the sentence and the number of subordinate clauses. The three parameters have been normalized to the interval of 0 to 1.

[0339] Reaction mode dimension The user's response time, response length, and message frequency are analyzed and evaluated:

[0340]

[0341] wherein, T r (i) is the average response time of users (seconds), L m (i) is the average message length (number of characters), F m (i) is the message frequency (pieces / minute). T min , T max , L min , L max , F min , F max are the preset range boundary values of the corresponding indicators, respectively: T min = 1 second, T max = 300 seconds, L min = 5 characters, L max = 500 characters, F min = 0.1 pieces / minute, F max = 10 pieces / minute.

[0342] Interaction rhythm dimension By analyzing the user interaction duration, conversation interval and single conversation message quantity, the following indicators are evaluated:

[0343]

[0344] wherein, D s (i) is the average conversation duration (minutes), I s (i) is the average interval time between conversations (hours), M s (i) is the average number of messages in a single conversation. The preset range of each parameter is: D min = 1 minute, D max = 60 minutes, I min = 1 hour, I max = 168 hours, M min = 2 pieces, M max = 50 pieces.

[0345] Attention persistence dimension By analyzing the user's duration on a single topic and topic switching frequency, the following indicators are evaluated:

[0346]

[0347] wherein, T t (i) is the average duration of a user on a single topic (minutes), S t (i) is the topic switching frequency (times / hour). The parameter range is: T t,min = 1 minute, T t,max = 30 minutes, St,min = 1 time / hour, S t,max = 20 times / hour.

[0348] Learning style dimensions Using a four-element vector representation, the user's feedback on different information presentation methods is analyzed to calculate:

[0349]

[0350] where v1 is the visual learning preference, v2 is the auditory learning preference, v3 is the reading and writing learning preference, and v4 is the kinesthetic learning preference. Each component has a value range of 0 to 1 and satisfies the normalization constraint v1 + v2 + v3 + v4 = 1. These preference values are calculated by analyzing the user's interaction frequency and feedback on different types of content.

[0351] Decision-making pattern dimensions By analyzing the user's decision-making speed, information demand, and risk attitude:

[0352]

[0353] where S d (i) is the decision-making speed, calculated by the average response time (minutes) to decision-related questions; I n (i) is the information demand, calculated by the number of times information is asked before making a decision; R a (i) is the risk attitude index, calculated by analyzing risk-related words in user expressions. Parameter range: S d,min = 1 minute, S d,max = 60 minutes, I n,min = 1 time, I n,max = 20 times, R a (i) ranges from 0 to 1.

[0354] Emotional characteristics dimensions Using a five-element vector representation, the emotional characteristics of user expressions are evaluated using sentiment analysis technology:

[0355]

[0356] where e1 is the emotional expression frequency, e2 is the positive emotional tendency, e3 is the negative emotional tendency, e4 is the emotional intensity, and e5 is the emotional fluctuation degree. Each component is calculated based on sentiment analysis of user text, with a value range of 0 to 1.

[0357] Further, to improve the accuracy and adaptability of the user feature model, the adaptive interaction module uses a hybrid modeling method combining rule-based models and machine learning models:

[0358]

[0359] where, is the rule-based feature vector, directly calculated according to the above method; is the machine learning-based feature vector, generated by the trained user behavior prediction model; a = 0.6 is the weight coefficient, which gradually decreases with the accumulation of interaction data, increasing the weight of the machine learning model. The user feature vector is updated regularly by the exponential weighted moving average method:

[0360]

[0361] where, is the feature value after the nth update, is the feature value after the (n-1)th update, is the new feature value calculated based on the last 20 interactions, and l = 0.7 is the smoothing factor, controlling the influence weight of historical data.

[0362] Further, the adaptive interaction module dynamically adjusts the interaction parameters according to the user features and the current context. The interaction parameter set P includes three categories: content parameters, form parameters, and rhythm parameters:

[0363] P = {P content ,P form ,P rhythm}

[0364] Content parameters P content control the depth, breadth, complexity, and professionalism of the interaction content; form parameters P form control the expression style, language features, structural organization, and multimedia elements of the interaction; rhythm parameters P rhythm control the response time, round length, initiative degree, and topic conversion frequency of the interaction.

[0365] The parameter adjustment function F adjust maps the user features U i , the current context C t , and the system emotion E emotion to the interaction parameters P:

[0366] P = F adjust (U i ,C t ,E emotion )

[0367] The adjustment function uses a combination of case-based reasoning (CBR) and rule-based reasoning. The case-based reasoning part uses the historical interaction case library to find the most similar case to the current situation and extract its parameter settings; the rule-based reasoning part applies predefined adjustment rules to directly calculate parameter values according to user features and context features. The results of the two parts are fused by weighting:

[0368] P = β · P CBR + (1 - β) · P rule

[0369] where β ∈ [0, 1] is a weighting coefficient, dynamically adjusted according to case similarity. The higher the similarity, the larger the value of β.

[0370] Further, the adaptive interaction module optimizes the interaction strategy using a multi-armed bandit algorithm. The system maintains a strategy library S = {s1, s2,..., s n}, each strategy s i defines a parameter configuration template under a specific context. The strategy optimization uses a multi-armed bandit (MAB) algorithm, treating each strategy as an arm, balancing exploration and exploitation to select the optimal strategy.

[0371] The strategy selection uses Upper Confidence Bound (UCB) algorithm:

[0372]

[0373] where μ i is the historical average return of strategy s i , N is the total number of attempts, n i is the number of attempts for strategy s i , and c is the exploration parameter. The return is defined as the user satisfaction score, calculated by combining explicit feedback (user ratings) and implicit feedback (interaction duration, engagement, emotional changes, etc.).

[0374] The optimization algorithm periodically updates the strategy library, removes underperforming strategies, and introduces mutation strategies to maintain the vitality and diversity of the strategy library. Strategy mutation is generated through two ways: parameter perturbation and crossover combination:

[0375] s new = Mutate(s i , σ) or s new = Crossover(s i , s j )

[0376] where Mutate(·) is a parameter perturbation function and σ is the perturbation intensity, and Crossover(·) is a strategy crossover function.

[0377] The adaptive interaction module realizes the adaptive adjustment of the interaction mode based on the feedback mechanism. The system collects three types of feedback: (1) Explicit feedback: ratings, evaluations, and preference expressions provided directly by users; (2) Implicit feedback: user behavior indicators such as response time, interaction depth, and topic switching frequency; (3) Physiological feedback: user emotion and attention indicators collected through external devices.

[0378] After the feedback data is standardized, it is used to calculate the feedback score R feedback :

[0379] R feedback = γ1·R explicit + γ2·R implicit + γ3·R physio

[0380] In the formula, γ1, γ2, γ3 are weight coefficients, and γ1+ γ2+ γ3= 1.

[0381] Based on the feedback score, the system calculates the parameter adjustment vector ΔP:

[0382]

[0383] In the formula, η is the learning rate, R threshold is the target score threshold, is the parameter gradient, indicating the influence of parameter change on the score. The parameter update formula is:

[0384] P new = P old + ΔP

[0385] The adaptive interaction module maintains a user interaction profile, recording user characteristics, interaction history, and preference changes. The profile adopts a hierarchical structure, containing static information (personal attributes, background knowledge) and dynamic information (interest changes, ability development). Profile data is protected by differential privacy technology to ensure user information security.

[0386] Through the above implementation, the adaptive interaction module of the present application realizes the personalization and adaptive adjustment of the interaction mode, so that the system can provide customized interaction experience according to user characteristics and situational needs. The module continuously improves the interaction strategy through continuous learning and optimization, improves user satisfaction, provides the system with flexible and diverse interaction performance capabilities, and significantly enhances the affinity and practical value of the system.

[0387] In the LLM-based active real-time interaction system, the safety control module is responsible for system behavior safety guarantee, through behavior boundary definition, decision rationality evaluation, risk intervention mechanism and behavior explanation generation, to ensure that the system behavior conforms to the ethical norms and safety standards. This module is the guardian of the reliable operation of the system, ensuring that the system remains autonomous while being controllable and trustworthy.

[0388] The safety control module defines the system allowed behavior space based on the rule base and example set. The behavior space B space is defined by the allowed behavior set B allowed and the prohibited behavior set B forbidden :

[0389] B space ={B allowed B forbidden}

[0390] The set of behaviors can be defined through rule descriptions and positive examples, and the rules are represented in a formal language:

[0391] R allowed ={r1,r2,...,r n}

[0392] In the formula, each rule r i Defined as a condition-behavior pair: r i =(c i ,a i ), where c i For a conditional expression, a i To allow for certain behavioral patterns, the conditional expression is represented using first-order logic formulas and includes environment state variables, user state variables, and system state variables.

[0393] The set of prohibited behaviors is also defined through rule descriptions and negative examples:

[0394] R forbidden ={r′1,r′2,...,r′ m}

[0395] In the formula, each rule r′ j Defined as a condition-behavior pair: r′ j =(c′ j ,a′ j ), where c′ j For the conditional expression, a′ j This is a prohibited behavior pattern.

[0396] Example set E examples ={e1,e2,...,e k} Contains labeled examples of system behavior, each example e l It includes contextual information, behavior descriptions, and annotations (allow or prohibit). The example set is used to concretize the rules and clarify boundary cases, providing concrete instances of the abstract definition of the rules.

[0397] The behavior boundary definition adopts a "permission-first" strategy: only explicitly permitted behaviors are considered safe behaviors, and behaviors not explicitly permitted are considered unsafe by default. This conservative strategy ensures the security of system behavior and prevents security vulnerabilities caused by incomplete rules.

[0398] The safety control module performs multi-dimensional rationality assessment on the decision. Given the decision D generated by the situational decision-making module, the safety control module performs the following assessment dimensions:

[0399] (1) Role consistency assessment: assess whether the decision conforms to the role characteristics and behavior patterns defined by the system. The assessment function is:

[0400] E role (D) = Sim(D, R profile )

[0401] where Sim(·,·) is the similarity function, R profile is the system role configuration file containing role definition, behavior criteria and values, etc.

[0402] (2) Content safety assessment: assess whether the decision content contains dangerous, illegal or inappropriate content. The assessment function is:

[0403]

[0404] where T sensitive is a set of sensitive topics including violence, discrimination, illegal activities, etc., and Score(D,t) is the relevance of decision D to topic t, which is evaluated by sensitive word detection, semantic analysis and context understanding.

[0405] (3) Resource rationality assessment: assess whether the decision is reasonable and efficient in terms of resource use. The assessment function is:

[0406]

[0407] where V(D) is the expected value of the decision, and C(D) is the resource cost of the decision, including computing resources, time resources and data resources, etc.

[0408] (4) Safety impact assessment: assess the potential impact of the decision on system and user safety. The assessment function is:

[0409] E safety (D) = 1 - max(P harm (D) · S harm (D))

[0410] where P harm (D) is the probability of potential harm, and S harm (D) is the severity of harm.

[0411] (5) Ethical compliance assessment: assess whether the decision conforms to ethical standards and moral standards. The assessment function is:

[0412]

[0413] where P ethical is a set of ethical principles, including fairness, transparency, respect for autonomy, etc., and Comply(D, p) evaluates the degree of compliance of decision D to principle p.

[0414] Overall evaluation score E total (D) is calculated by weighting:

[0415]

[0416] where w i is the weight of each dimension, satisfying In this embodiment, the weights are set as: w1=0.2 (role consistency), w2=0.25 (content safety), w3=0.15 (resource rationality), w4=0.25 (security impact), w5=0.15 (ethical compliance).

[0417] The security control module starts the corresponding level of intervention mechanism according to the evaluation result. The corresponding relationship between the intervention level and the evaluation score is:

[0418] (1) No intervention (E total (D) ≥ 0.85): The decision passes the evaluation and does not need intervention; (2) Mild intervention (0.7 ≤ E total (D) < 0.85): Slight adjustment is made to the decision, including modification of expression, optimization of content, etc.; (3) Moderate intervention (0.5 ≤ E total (D) < 0.7): Significant modification is made to the decision, including replacing unsafe content, restructuring decision logic, etc.; (4) Severe intervention (0.3 ≤ E total (D) < 0.5): Reject the current decision and request the situational decision module to regenerate the decision; (5) System intervention (E total (D) < 0.3): Trigger system-level security mechanisms, including temporarily reducing the level of autonomy, starting security mode, etc.

[0419] The intervention operation is performed by the intervention function I(D, E total ), which returns the modified decision D ′ or a rejection signal:

[0420] D ′ = I(D, E total )

[0421] The intervention is implemented in a way that combines automated rules and manual review. Mild and moderate intervention is executed by automatic rules, and severe and system intervention may require manual confirmation.

[0422] The security control module provides a multi-level behavior explanation generation function. Explanation generation aims to improve the transparency and understandability of system behavior and enhance user trust. The explanation levels include:

[0423] (1)Basic explanation: briefly explains the purpose and result of system behavior, suitable for routine interaction; (2)Detailed explanation: provides key steps and considerations of system decision-making process, suitable for complex decision-making; (3)Technical explanation: demonstrates technical details and algorithm logic of decision-making, suitable for professional users; (4)Compliance explanation: explains how system behavior complies with relevant regulations and standards, suitable for compliance audit; (5)Intervention explanation: explains why the system intervenes in the original decision, suitable for intervention cases.

[0424] The explanation generation adopts a combination of template filling and natural language generation. Common decision types use an explanation template library to extract key elements and fill in the templates; non-standard decisions use an extraction- abstraction-based method to extract key information from decision logic and generate coherent explanation texts.

[0425] Through the above technical solutions, the safety control module of the present application establishes a safety guarantee mechanism for system behavior, ensuring that the system is controllable and reliable while maintaining autonomy. The module prevents unsafe behavior through multi-dimensional evaluation and multi-level intervention, while enhancing the transparency and explainability of system behavior through explanation generation, providing safety guarantees for practical applications.

[0426] In combination Figure 2 , the workflow of the system of the present application includes the following steps:

[0427] S1. Initialization: the self-awareness module loads system configuration and initial role attributes, and each functional module completes initialization.

[0428] S2. Environment perception: the real-time perception module processes multi-modal input data, evaluates information reliability, and generates a structured environment state vector.

[0429] S3. Plan generation: the proactive planning module performs goal decomposition and generates a multi-path execution plan containing a main path and alternative paths based on the environment state.

[0430] S4. Decision making: the situational decision module calculates task priorities and generates resource allocation schemes; the safety control module evaluates decision rationality and ensures behavior safety.

[0431] S5. Execution implementation: the dynamic execution module maps decisions into instruction sequences, sets execution checkpoints, monitors execution status, and handles abnormal situations.

[0432] S6. Emotion update: the emotion engine module updates system emotion state according to environmental events and execution results, and adjusts emotion expression parameters.

[0433] S7. Interaction optimization: the adaptive interaction module dynamically adjusts interaction parameters and optimizes interaction strategies according to user characteristics and system state.

[0434] S8. Learning storage: the self-cognition module processes the execution results and interaction data, updates the memory storage and system attributes, and refines the experience patterns.

[0435] In summary, the active real-time interaction system based on LLM provided by the present application builds an intelligent interaction system with autonomy, adaptability and safety through the organic integration of eight core functional modules. The system breaks through the limitations of passive response of traditional AI systems, realizes active planning and decision-making based on self-cognition and environmental perception, can predict environmental changes, generate response plans in advance, actively adjust interaction strategies, provide personalized interaction experience, and at the same time ensure the compliance and controllability of behavior.

[0436] Those skilled in the art should understand that the algorithm implementation, parameter configuration and data structure of each module can be optimized without departing from the basic architecture of the present application, and these changes based on the core technology of the present application are all within the protection scope of the present application.

Claims

1. An active real-time interactive system based on LLM, characterized in that, The system comprises the following modules that work in coordination: a self-cognition module, a real-time perception module, an active planning module, a situational decision-making module, a dynamic execution module, an emotion engine module, an adaptive interaction module, and a safety control module; The self-cognition module is configured to represent the system role attributes through a multi-dimensional feature vector, and record and manage the system interaction experience by using a hierarchical storage structure. The self-cognition module dynamically updates the system cognition state based on deep reinforcement learning. The real-time perception module is configured to perform multi-modal data fusion, and convert different types of inputs into a structured environment vector. The active planning module is configured to generate an execution plan comprising a main path and alternative paths for different types of targets, and dynamically update the execution plan by using a timing and event dual triggering mechanism. The active planning module generates a personalized interaction scheme in combination with the self-cognition state and emotion parameters. The situational decision-making module is configured to calculate the task priority based on multi-dimensional decision-making factors, model the resource allocation as an optimization problem, and solve the optimization problem. The dynamic execution module is configured to map the decision into an executable instruction sequence through hierarchical conversion, and monitor the execution state through preset checkpoints. The emotion engine module is configured to maintain the system emotion state, establish a mapping relationship between events and emotion changes, and an influence mechanism of emotion on system behavior. The emotion parameters output by the emotion engine module affect the decision-making process of the active planning module and the dynamic execution module through a weighted fusion mechanism. The adaptive interaction module is configured to analyze user interaction features to establish a user model, and dynamically optimize the interaction strategy. The safety control module is configured to perform multi-dimensional evaluation on the decision, and implement a hierarchical intervention mechanism according to the evaluation results. The above modules form a closed-loop information exchange network through standardized interfaces, and establish a bidirectional feedback loop between the modules to realize the active real-time interaction capability of the system.

2. The system of claim 1, wherein: The hierarchical storage structure used by the self-cognition module comprises a short-term circular buffer, a medium-term key-value database, and a long-term graph structure. The management of the system interaction experience by the self-cognition module comprises memory diversion based on importance scoring and dynamic adjustment of memory based on time decay and access promotion. The self-cognition module realizes experience pattern extraction through feature extraction, similarity calculation, clustering analysis, and quality evaluation.

3. The system of claim 1, wherein: The multi-modal data fusion performed by the real-time perception module is based on an attention mechanism, including intra-modal feature extraction, inter-modal feature alignment, and cross-modal feature fusion. The structured environment vector generated by the real-time perception module comprises a time state vector, a user state vector, and a system state vector. The real-time perception module calculates an information reliability score based on source attributes, timeliness, and content consistency.

4. The system of claim 1, wherein: The active planning module targets different types of targets, including information targets, state targets, capability targets, and experience targets. The active planning module uses an adjacency matrix to represent task dependency relationships, and triggers plan adjustment or re-planning based on the plan fitness evaluation results. The active planning module generates a multi-path execution plan by using a Monte Carlo tree search algorithm.

5. The system of claim 1, wherein: The multi-dimensional decision factors on which the situational decision module is based include importance score, urgency score, environment matching degree, and dependency influence degree; the situational decision module adopts a hierarchical decision architecture, including a strategy layer, a tactic layer, and an operation layer; the situational decision module applies special resolution strategies for resource conflict, time conflict, and target conflict.

6. The system of claim 1, wherein: The hierarchical conversion adopted by the dynamic execution module includes three levels of abstract decision decomposition into intermediate representation, intermediate representation conversion into specific instructions, and specific instruction translation into executable operation sequence; the preset checkpoints of the dynamic execution module include task critical stage completion point, resource consumption threshold point, execution time exceeding expectation point, environment state change point, and dependency task completion point; the dynamic execution module realizes dynamic adjustment of the execution path through parameter fine-tuning, component replacement, path switching, and re-planning.

7. The system of claim 1, wherein: The system emotion state maintained by the emotion engine module adopts a multi-dimensional vector representation, including six basic emotions of joy, sadness, anger, fear, surprise, and disgust; the emotion engine module realizes the influence of emotion state on decision parameters through an emotion modulation matrix, and realizes the influence of emotion on expression mode through a hybrid method based on templates and rules; the emotion engine module realizes an emotion intensity time decay mechanism based on a differentiated decay coefficient.

8. The system of claim 1, wherein: The user model established by the adaptive interaction module includes eight dimensions of knowledge level, expression preference, reaction mode, interaction rhythm, attention duration, learning style, decision mode, and emotional characteristics; the adaptive interaction module constructs and updates the user model through a hybrid modeling method of rule-based model and machine learning model; the adaptive interaction module optimizes the interaction strategy using a multi-armed bandit algorithm, and generates strategy variation through parameter perturbation and cross combination.

9. The system of claim 1, wherein: The multi-dimensional evaluation performed by the safety control module includes role consistency evaluation, content security evaluation, resource rationality evaluation, safety influence evaluation, and ethical compliance evaluation; the hierarchical intervention mechanism implemented by the safety control module includes five levels of no intervention, light intervention, medium intervention, heavy intervention, and system intervention.

Citation Information

Patent Citations

  • Emotion simulation method of knowledge base question-answering robot, medium and system

    CN118260407A

  • AI behavior optimization and self-management system

    CN118278538A