An interaction method, device and storage medium of a large language model
Patent Information
- Application Number
- CN202611037729.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-13
- Publication Date
- 2026-10-16
AI Technical Summary
[0004]本申请实施例提供一种大语言模型的交互方法、设备及存储介质,能够解决大语言模型交互过程中响应速度慢的技术问题,通过同时启动第一任务和第二任务,实现初始提示信息生成与候选记忆和候选技能打分筛选的并发执行,并以预设超时阈值对第二任务进行竞态比较,使第二任务先于预设超时阈值完成时目标记忆和目标技能得以及时注入,第二任务晚于预设超时阈值完成时不阻塞主推理流程而延迟至下一回合注入,从而将记忆调取延迟与首字延迟解耦,显著提升了大语言模型交互的响应速度
[0014] In a third aspect, embodiments of this application provide a storage medium for storing computer-executable instructions, which, when executed by a computer processor, are used to perform the interaction method of the large language model as described in the first aspect.
Smart Images

Figure CN122925545A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of intelligent interaction technology, and in particular to an interaction method, device and storage medium for a large language model. Background Technology
[0002] In recent years, Large Language Models (LLMs) have made groundbreaking progress in the field of natural language understanding and generation. Intelligent interactive systems based on LLMs have been widely used in complex scenarios such as multi-turn dialogues, knowledge-based question answering, and task execution, becoming an important technological entry point connecting users and digital services. As application scenarios continue to deepen, users are placing higher demands on the real-time responsiveness and cross-session continuity of interactive systems. How to efficiently utilize external memory within a limited context window to support personalized and long-term interactions has become a key technical challenge in this field.
[0003] Existing large language model interactive systems typically employ a serial processing approach. This involves retrieving and filtering external memory before the main inference process begins. The filtered memory content is then concatenated with basic prompts to generate prompts containing the memory content, which are then submitted to the large language model for inference. This serial processing mechanism directly adds the memory retrieval delay to the user's perceived first-word delay. When external storage fluctuates, the main inference process is forced to block and wait, leading to timeouts or stuttering in the interactive response. Summary of the Invention
[0004] This application provides an interaction method, device, and storage medium for a large language model, which can solve the technical problem of slow response speed during the interaction of a large language model. By simultaneously starting the first task and the second task, the generation of initial prompt information and the scoring and screening of candidate memories and candidate skills are executed concurrently. The second task is compared in a race condition with a preset timeout threshold, so that when the second task is completed before the preset timeout threshold, the target memory and target skill can be injected in time. When the second task is completed after the preset timeout threshold, the main inference process is not blocked and the injection is delayed until the next round. This decouples the memory retrieval delay from the first character delay, and significantly improves the response speed of the interaction of the large language model.
[0005] In a first aspect, embodiments of this application provide an interaction method for a large language model, comprising: Upon receiving user input in the current round, both the first and second tasks are initiated simultaneously. The first task generates initial prompts based on the user input, basic system commands, dialogue-level preferences, externally visible dialogue history, and an internal event queue. The externally visible dialogue history is obtained by removing entries marked as internally visible only from the internal dialogue history. The internal event queue includes system event blocks from the previous round if the second task in the previous round was completed later than a preset timeout threshold. The second task scores and filters candidate memories and candidate skills based on the user input and the internal dialogue history. The second task is compared with the preset timeout threshold in a competitive manner. If the second task is completed before the preset timeout threshold, the target memory and target skill obtained by scoring and filtering are injected into the initial prompt information in the form of system event blocks to obtain the target prompt information. If the second task is completed later than the preset timeout threshold, the initial prompt message will be used as the target prompt message, and the system event block obtained after the completion of the second task will be stored in the internal event queue for injection in the next round. The interactive response is obtained by parsing the target prompt information using a large language model.
[0006] Furthermore, the first task generates initial prompt information based on user input messages, basic system commands, dialogue-level preferences, externally visible dialogue history, and internal event queues, including: It retrieves user input messages for the current round, basic system commands, conversational preferences, and publicly visible conversation history, and checks whether there are system event blocks in the internal event queue; When there is no system event block in the internal event queue, the initial prompt information for this round is obtained by combining the basic system instructions, dialogue-level preferences, externally visible dialogue history and user input messages in a fixed assembly order. When a system event block exists in the internal event queue, it is combined according to the fixed assembly order of basic system instructions, dialogue-level preferences, externally visible dialogue history, system event blocks in the internal event queue, and user input messages to obtain the initial prompt information for this round, and then the system event block is removed from the internal event queue.
[0007] Furthermore, the second task involves scoring and filtering candidate memories and skills based on user input and internal dialogue history, including: Obtain a set of candidate entries, which includes candidate memories in the memory bank and candidate skills in the skill bank; The comprehensive score of each candidate item is calculated based on the semantic relevance between the user input message and each candidate item, the semantic overlap between each candidate item and the set of recently successful tool names, the normalized duration of each candidate item since its last appearance, and the fixed weighting of each candidate item by the operation and maintenance end. The set of recently successful tool names is obtained by extracting recently successful tool names from the tool call records according to the preset backtracking window and removing duplicates. The memories are sorted in descending order based on their overall scores, and then hard-filtered using the set of emerging memory names obtained from the internal dialogue history through reverse parsing to exclude injected entries, thus obtaining the target memory and target skill. The set of emerging memory names is obtained by reverse parsing from the internal dialogue history according to preset reminder block anchors.
[0008] Furthermore, after obtaining the interactive response through large language model parsing based on the target prompts, the process also includes: In response to the round end event, the first shadow agent extracts candidate memories from the internal dialogue history within the most recent preset number of rounds. The round end event is the event generated after the large language model is parsed and the interactive response is output. The first shadow agent is a memory extraction shadow agent. In response to the call achievement event, the tool call sequence within the most recent preset number of rounds is reviewed through the second shadow agent to obtain candidate skills. The call achievement event is the event generated when the cumulative number of tool calls exceeds a preset threshold. The second shadow agent is a skill review shadow agent. The alternative memories and alternative skills undergo security review, and the alternative memories that pass the review are designated as candidate memories, and the alternative skills that pass the review are designated as candidate skills. Save candidate memories to the memory bank, and save candidate skills to the skill bank.
[0009] Furthermore, in response to the end-of-round event, candidate memories are extracted from the internal dialogue history within the most recent preset number of rounds via the first shadow agent, including: In response to the round end event, query the occupancy status of the first mutex. If the first mutex is not occupied, trigger the start of the first shadow agent. The first mutex is a memory extraction mutex. The first shadow agent obtains the most recent internal dialogue history within a preset number of rounds. The internal dialogue history includes user input messages, interactive responses generated by the large language model, tool call requests, and tool call return results. The first shadow agent performs semantic extraction on the acquired internal dialogue history to obtain candidate memories. Semantic extraction includes extracting key information, user preferences, factual content, and relational content from the internal dialogue history.
[0010] Furthermore, in response to a call completion event, a second shadow agent reviews the tool call sequence within a recent preset number of rounds to obtain alternative skills, including: In response to the call completion event, query the occupancy status of the second mutex. If the second mutex is not occupied, trigger the start of the second shadow agent. The second mutex is a skill replay type mutex. The tool call sequence within a preset number of rounds is obtained through the second shadow proxy. The tool call sequence includes the tool call request, input parameter configuration, return result, retry record, error message and call time data. The second shadow proxy is used to review and extract the obtained tool call sequence to obtain candidate skills. The review and extraction includes tool call patterns, parameter optimization rules, call chain combinations and exception handling strategies.
[0011] Furthermore, security reviews are conducted on alternative memories and skills, including: The candidate memory is subjected to a first security review to obtain a first review result. The first review process is to detect whether the candidate memory contains first sensitive information. The candidate memory that does not contain first sensitive information passes the review. The first sensitive information includes instruction trigger words, invisible control characters, abnormal coded segments, high-entropy strings, key password token prefixes and assignment content of key synonyms co-occurring. The alternative skills undergo a second security review to obtain a second review result. The second review process involves detecting whether the alternative skills contain second sensitive information. Alternative skills that do not contain second sensitive information pass the review. The second sensitive information includes directory traversal symbols, out-of-bounds absolute paths, special system paths, and command families that have irreversible destructive effects on file systems, services, and network configurations.
[0012] Furthermore, after injecting the target memories and target skills obtained through scoring and filtering into the initial prompt information in the form of system event blocks, and obtaining the target prompt information, the following is also included: The system event block is copied into two copies. One copy is added with a timestamp prefix and an internally visible only flag and then stored as a persistent readable copy. The other copy is added with a system role flag and an internally visible only flag and then stored as a persistent internally visible copy. When rendering the externally visible dialogue history on the front end, filter out entries marked as "only visible internally" from the readable copy, and then render and display the filtered entries to show the externally visible dialogue history.
[0013] In a second aspect, embodiments of this application provide an interactive device for a large language model, comprising: Memory and one or more processors; Memory, used to store one or more programs; When one or more programs are executed by one or more processors, the one or more processors implement the interactive methods of the large language model as described in the first aspect.
[0014] In a third aspect, embodiments of this application provide a storage medium for storing computer-executable instructions, which, when executed by a computer processor, are used to perform the interaction method of the large language model as described in the first aspect.
[0015] This application embodiment, during interaction using a large language model, simultaneously initiates a first task and a second task upon receiving user input information for the current round. The first task generates prompt information based on user input, basic system instructions, dialogue-level preferences, externally visible dialogue history, and an internal event queue. The internal event queue contains system event blocks from the previous round if the second task was completed later than a preset timeout threshold. The second task scores and filters candidate memories and skills based on user input and internal dialogue history. A race condition comparison is performed between the second task and the preset timeout threshold. If the second task completes before the preset timeout threshold, the scored and filtered target memories and target skills are injected into the initial prompt information as system event blocks to obtain target prompt information. If the second task completes later than the preset timeout threshold, the initial prompt information is used as the target prompt information, and the system event blocks from the completed second task are stored in the internal event queue for injection in the next round. The large language model parses the target prompt information to obtain an interactive response. By employing the aforementioned technical means, the simultaneous activation of the first and second tasks enables the concurrent execution of initial prompt information generation and candidate memory and candidate skill scoring and selection. A race condition comparison is performed on the second task using a preset timeout threshold. If the second task completes before the preset timeout threshold, the target memory and target skill are injected promptly. If the second task completes after the preset timeout threshold, the main inference process is not blocked, and the injection is delayed until the next round. This ensures that target prompt information is obtained within the time limit corresponding to the preset timeout threshold, and an interactive response from the large language model is obtained based on the target prompt information. This avoids the technical problem of slow response speed during large language model interaction. This embodiment decouples memory retrieval delay from first-character delay, significantly reducing first-character delay and thus significantly improving the response speed of large language model interaction.
[0016] The beneficial effects of the interactive devices and storage media of the large language model provided above can be referenced in relation to the beneficial effects of the interactive methods of the large language model. Attached Figure Description
[0017] Figure 1 This is a flowchart of an interaction method for a large language model provided in an embodiment of this application; Figure 2 This is a flowchart of another interaction method for a large language model provided in an embodiment of this application; Figure 3 This is a flowchart of another interaction method for a large language model provided in the embodiments of this application; Figure 4 This is a flowchart of another interaction method for a large language model provided in an embodiment of this application; Figure 5 This is a flowchart of another interaction method for a large language model provided in the embodiments of this application; Figure 6 This is a flowchart of another interaction method for a large language model provided in an embodiment of this application; Figure 7 This is a flowchart illustrating another interaction method for a large language model provided in an embodiment of this application; Figure 8 This is a schematic diagram of the structure of an interactive device for a large language model provided in an embodiment of this application. Detailed Implementation
[0018] To make the objectives, technical solutions, and advantages of this application clearer, specific embodiments of this application will be described in further detail below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are merely for explaining this application and not for limiting it. It should also be noted that, for ease of description, only the parts relevant to this application are shown in the drawings, not all of them. Before discussing exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although the flowcharts describe operations (or steps) as sequential processes, many of these operations can be performed in parallel, concurrently, or simultaneously. Furthermore, the order of the operations can be rearranged. The process can be terminated when its operation is completed, but may also have additional steps not included in the drawings. The process can correspond to a method, function, procedure, subroutine, subprogram, etc.
[0019] With the development of large language model technology, the limitation of context window length in multi-turn dialogues and long conversations has become increasingly prominent. This typically requires the use of external memory systems to recall personalized or long-term information before user messages enter inference, and to store new knowledge generated during the dialogue back into the memory bank to support cross-conversation coherence and personalized experiences. Currently available large language model memory-related technologies can be categorized into hierarchical context management, relevance scoring retrieval, memory recurrent networks, knowledge extraction, proactive retrieval, proactive extraction, and learnable memory skills, each with its own limitations.
[0020] In hierarchical context management technologies, the finite context window of a large language model is typically analogized to main memory, and external storage to a disk. Interruptions are triggered by function calls initiated by the large language model, performing paging operations between the main and external contexts to achieve long-term memory capabilities across sessions. This approach can be applied to scenarios such as cross-session dialogue proxies, long document analysis, and multi-session personalized assistants. However, in this scheme, memory reading and writing are entirely driven by the large language model through synchronous function calls. Memory retrieval and dialogue inference are performed sequentially. If external memory needs to be accessed within a given round, the main inference flow of the large language model will be forcibly blocked, leading to increased response latency.
[0021] In relevance-based retrieval techniques, user input is typically transformed into a contextualized list of memories, organized chronologically. A reflection tree for abstract thinking and an associative network for related retrieval are constructed. A six-dimensional relevance scoring model is employed, incorporating time relevance, content relevance, contextual relevance, emotional resonance, connection strength, and insight relevance. Each dimension is normalized from minimum to maximum and then weighted and summed. Memory content suitable for the context window is selected based on score and filtered. A forgetting mechanism is introduced to prevent memory bloat, thereby achieving long-term memory retention and consistency maintenance in multi-turn dialogues. However, this method involves simultaneous scoring and sorting of memories, requiring the relevance calculation and sorting to complete before entering the main inference stage of the large language model. This introduces uncontrollable synchronization delays, impacting the user experience.
[0022] In techniques using recurrent memory networks (RNNs), large language models are typically enhanced for human-computer interaction. For example, task requests are encoded into queryable one-dimensional or multi-dimensional objects, context information is generated by querying and filtering from a memory repository, the output of the large language model is obtained and evaluated, and the task process is then converted into memory items and stored in the memory repository, forming a closed loop from input to processing, output, and backfeeding. This strengthens the model's context-based learning ability in long-context human-computer interactions. However, this method executes the entire processing pipeline synchronously within the main dialogue thread. The sequential design of input encoding, memory query, context generation, result evaluation, and memory write-back lengthens the main inference chain. Furthermore, memory generation is synchronously evaluated and written by the main model at the end of each round, relying on the main agent process, which is equivalent to adding a serial writing step to the main inference path, further increasing response latency.
[0023] In knowledge extraction technologies, task objectives are typically defined and broken down into sub-objectives using the SMART principle (Specificity, Measurability, Achievability, Relevance, and Timeliness). Natural language processing (NLP) techniques are then used to extract key information from each sub-objective. This key information is integrated to generate an initial knowledge set, which is then validated and finalized based on the SMART principle. This allows for the extraction of structured knowledge from user task text to aid in automated decision-making. However, this method extracts single task text rather than historical dialogue context, making it incompatible with the cumulative memory extraction application scenario in multi-turn dialogues. Furthermore, the extraction process is executed within the main agent process, consuming computational resources of the main dialogue and thus affecting the speed of interactive feedback.
[0024] In proactive recall technologies, the typical approach involves acquiring multimodal dialogue information from the user, followed by the decision center generating four-dimensional tags encompassing intent, safety, emotion, and context. Following three steps—conditional filtering, similarity retrieval, and time sorting—relevant memory fragments are proactively retrieved from a memory bank. These fragments are then combined with the dialogue context to generate a response. This approach is suitable for emotionally charged dialogues and contextualized recall scenarios across conversations. However, the generation of multi-dimensional tags is a synchronous pre-processing step, requiring sequential completion before the main inference of the large language model. This introduces additional waiting overhead and increases the perceived first-word delay for the user.
[0025] In proactive extraction techniques, memory extraction is typically viewed as an iterative cognitive process, introducing a question-and-answer feedback loop that allows the agent to actively explore the dialogue history to fill in missing information or correct errors. This approach can be applied to proactive information completion scenarios in complex dialogues. However, the feedback loop in this method still runs synchronously and iteratively within the main agent process, consuming the main dialogue's computational resources and increasing inference time.
[0026] In learnable memory skills technologies, memory operations are typically reshaped into learnable and evolvable memory skills. A controller learns and selects relevant skills, an executor based on a large language model executes the memory operations, and the designer periodically reviews challenging cases to evolve the skill set, supporting memory management for self-evolving agents in long-term task execution. However, this method involves synchronous collaboration between the controller, executor, and designer at the memory decision-making level, making it difficult to balance latency and recall. Furthermore, response latency is constrained by the memory decision-making process. Additionally, the designer's review of the evolution of the overall skill set differs from the application objective of retrieval of memories after truncating dialogue history by a preset number of rounds.
[0027] In summary, existing large language model memory-related technologies generally suffer from deep coupling between memory retrieval and the main inference process, and the serial operation causes memory retrieval delays to be directly superimposed on the user's perceived first-word delay. When external storage fluctuates, the main inference process is forced to block and wait, resulting in interactive response timeouts or stuttering.
[0028] Based on this, this application provides an interaction method, device, and storage medium for a large language model, which aims to simultaneously initiate a first task and a second task when receiving user input information in the current round during interaction with the large language model. The first task generates prompt information based on user input information, basic system instructions, dialogue-level preferences, externally visible dialogue history, and an internal event queue. The internal event queue contains system event blocks from the previous round if the second task was completed later than a preset timeout threshold in the previous round. The second task scores and filters candidate memories and candidate skills based on user input information and internal dialogue history. A race condition comparison is performed between the second task and the preset timeout threshold. If the second task completes before the preset timeout threshold, the target memories and target skills obtained from the scoring and filtering are injected into the initial prompt information as system event blocks to obtain target prompt information. If the second task completes later than the preset timeout threshold, the initial prompt information is used as the target prompt information, and the system event blocks from the completed second task are stored in the internal event queue for injection in the next round. The large language model is then parsed based on the target prompt information to obtain an interactive response. By employing the aforementioned technical means, the simultaneous activation of the first and second tasks enables the concurrent execution of initial prompt information generation and the scoring and screening of candidate memories and skills. A race condition comparison is performed on the second task using a preset timeout threshold. If the second task completes before the preset timeout threshold, the target memory and target skill are injected in a timely manner. If the second task completes after the preset timeout threshold, the main inference process is not blocked, and the injection is delayed until the next round. This allows the target prompt information to be obtained within the time limit corresponding to the preset timeout threshold, and the interactive response of the large language model to be obtained based on the target prompt information. Compared to existing methods that deeply couple memory retrieval with the main inference process and operate serially, this embodiment decouples memory retrieval delay from first-character delay, significantly reducing first-character delay and thus significantly improving the response speed of the large language model interaction.
[0029] Figure 1 A flowchart of an interaction method for a large language model provided in this application embodiment is given. The interaction method for the large language model provided in this embodiment can be executed by an interaction device for the large language model. The interaction device for the large language model can be implemented by software and / or hardware. The interaction device for the large language model can consist of two or more physical entities, or it can consist of a single physical entity. Generally speaking, the interaction device for the large language model can be an electronic device, such as a PC (personal computer), interactive flat panel, tablet computer, cloud server, or smartphone.
[0030] The following description uses a PC as the primary example to illustrate the interaction method for implementing a large language model. (Refer to...) Figure 1 The interaction methods of this large language model specifically include: S11. Upon receiving user input message for the current round, simultaneously initiate the first task and the second task. The first task generates initial prompt information based on the user input message, basic system instructions, dialogue-level preferences, externally visible dialogue history, and internal event queue. The externally visible dialogue history is obtained by removing entries marked as internally visible only from the internal dialogue history. The internal event queue contains the system event block from the previous round if the second task in the previous round was completed later than a preset timeout threshold. The second task scores and filters candidate memories and candidate skills based on the user input message and the internal dialogue history.
[0031] In one embodiment, during the interaction with the Large Language Model (LLM), upon receiving the user input message for the current round, both a first task and a second task are initiated simultaneously. A round refers to a dialogue unit consisting of a single message sent by the user to the LLM and a completed response. The first task is the effective prompt assembly task, responsible for assembling a complete prompt sequence submitted to the LLM for inference. The second task is the prefetch selection task, responsible for retrieving and filtering candidate items related to the current user message from the memory bank and skill base.
[0032] For example, the first task generates initial prompts based on user input, basic system commands, dialogue-level preferences, externally visible dialogue history, and an internal event queue. The basic system commands are pre-configured, fixed prompts defining the basic behavioral rules of the large language model; dialogue-level preferences are personalized configuration information for the current dialogue; and the externally visible dialogue history is a sequence of information available for front-end rendering after removing entries marked as internally visible only from the internal dialogue history. The internal event queue is a buffer queue that holds system event blocks that were not injected in time in the previous round due to timeout. Specifically, the internal event queue contains system event blocks from the previous round if the second task in the previous round completes later than a preset timeout threshold. A system event block is a code snippet with a specific anchor header and timestamp prefix, used to inject additional memory or skill context into the large language model.
[0033] For example, the second task scores and filters candidate memories and candidate skills based on user input messages and internal dialogue history. Candidate memories are entries stored in a memory bank that describe user preferences or historical facts; candidate skills are entries stored in a skill bank that describe tool usage methods or task execution strategies.
[0034] In one embodiment, after a user submits an input message in the current round, the round start scheduler immediately and logically concurrently initiates two processing paths: a first task and a second task. The first task first reads basic system instructions and dialogue-level preferences as prompt prefixes, then removes all entries marked as internally visible only from the internal dialogue history to obtain the externally visible dialogue history. Simultaneously, it checks the internal event queue for system event blocks left over from the previous round due to the second task's timeout; if present, these are included in the assembly process. Finally, the above content is combined according to a fixed assembly order to generate the initial prompt information. Meanwhile, the second task, based on the current user input message and the complete internal dialogue history, retrieves candidate entries from the memory bank and skill bank. It scores and ranks candidate memories and skills based on multiple dimensions, including semantic relevance, recent tool call overlap, entry timeliness, and fixed weighting by the operations and maintenance side, thereby selecting the target memory and target skill.
[0035] As described above, by executing prompt assembly and memory prefetching concurrently, the serial blocking problem in traditional synchronous retrieval schemes, which require waiting for memory retrieval to complete before prompt assembly can begin, is avoided. This achieves parallelization of prompt preparation and memory recall at the start of the round, laying the temporal foundation for subsequent race condition comparison mechanisms. Simultaneously, by removing internally visible entries from the internal dialogue history to construct an externally visible dialogue history, the purity of the dialogue bubble during front-end rendering is ensured, preventing historically injected content from polluting the user-visible interface. Furthermore, the introduction of an internal event queue allows system event blocks that timed out in the previous round to be reconsumed in the current round, ensuring that memory recall opportunities are not permanently lost due to a single timeout.
[0036] S12. Compare the second task with the preset timeout threshold. If the second task is completed before the preset timeout threshold, inject the target memory and target skill obtained by scoring and filtering into the initial prompt information in the form of system event block to obtain the target prompt information.
[0037] After simultaneously starting the first and second tasks in S11, a race condition comparison is performed between the second task and a preset timeout threshold. If the second task completes before the preset timeout threshold, the target memory and target skill, selected through scoring, are injected into the initial prompt information as a system event block, thus obtaining the target prompt information. Here, the preset timeout threshold refers to the maximum waiting time allowed to block the main inference pipeline during a single prefetch, configured in milliseconds and denoted as T_pf. The race condition comparison refers to a temporal competition between the completion time of the second task and the arrival time of the preset timeout threshold, with the first occurrence used as the decision criterion. The target memory and target skill are the highest-scoring candidate memories and candidate skills after the second task has been scored and selected. Injection refers to appending the system event block to a specific position in the initial prompt information to form the complete target prompt information.
[0038] For example, at the start of a round, the race controller simultaneously holds a completion wait handle for the second task and a timer with a preset timeout threshold, and continuously monitors the state changes of both. If the second task completes the scoring and filtering of candidate items and returns the target memory and target skill before the preset timeout threshold is reached, the race controller determines that the second task wins. At this time, the filtered target memory and target skill are immediately formatted into a system event block by the inline injector, and the system event block is appended to the end of the initial prompt information to obtain the target prompt information. At the same time, the system event block is synchronously written into a dual-track persistence structure. One copy is stored in the historical message persistence as a readable copy with the System:[ts] prefix and marked as internally visible only, and the other copy is stored in the historical message persistence as an internally visible copy with the role of system and also marked as internally visible only, for use in the derived state parsing and model replay restoration of subsequent rounds.
[0039] As described above, the competitive comparison mechanism enables the immediate injection of prompts for the current round when memory prefetching is completed within a controllable time budget. This maximizes the memory recall rate and personalized response quality for the current round while ensuring that the first character delay does not exceed the preset timeout threshold. Meanwhile, the dual-track persistent synchronous writing ensures the traceability and auditability of the injected content, while the internally visible markers ensure the purity of the front-end dialogue rendering, achieving dual-channel isolation that is visible to the model and invisible to the user.
[0040] S13. If the second task is completed later than the preset timeout threshold, the initial prompt information is used as the target prompt information, and the system event block obtained after the completion of the second task is stored in the internal event queue for injection in the next round.
[0041] After simultaneously initiating the first and second tasks in S11, a race condition comparison is performed between the second task and a preset timeout threshold. If the second task completes later than the preset timeout threshold, the initial prompt information is used as the target prompt information, and the system event block obtained after the completion of the second task is stored in the internal event queue for injection in the next round. Completion later than the preset timeout threshold means that the execution time of the second task exceeds the maximum waiting time allowed by the race condition controller; in this case, the second task loses the race condition comparison. Using the initial prompt information as the target prompt information means that, without attaching any prefetch memory or skills, the initial prompt information generated by the first task is directly submitted to the large language model for inference, thereby avoiding blocking the main inference pipeline.
[0042] For example, if the timer with the preset timeout threshold is triggered before the completion of the second task, the race controller determines that the second task has failed. At this time, the initial prompt information is immediately released to the large language model inference engine as the target prompt information to ensure that the main inference pipeline is not blocked. At the same time, the race controller delivers the still running second task and its context state to the internal event queue for background management. When the second task finally completes the scoring and filtering in the background, the system event block it produces is encapsulated as an internal event and queued for storage. This internal event will be consumed first by the round start scheduler when the next round starts, and injected into the valid prompt of the next round in the same format as the inline injection in S12. At the same time, the dual-track persistent write operation is also performed.
[0043] The above-mentioned scheduling strategy of non-blocking due to timeout and no loss due to delay effectively solves the dilemma of either blocking and waiting leading to a surge in first-word delay or completely abandoning recall leading to the loss of memory support in the current round in traditional synchronous retrieval schemes. This ensures that even if a single prefetch is slowed down due to fluctuations in the external memory system (such as vector index reconstruction or network jitter), it will not negatively affect the user experience of the current round. At the same time, it ensures that the memory recall opportunity is only delayed for one round rather than being permanently lost, thus achieving a good trade-off between delay controllability and memory recall rate at the system level.
[0044] S14. Based on the target prompt information, perform large language model parsing to obtain interactive responses.
[0045] After obtaining the target prompt information in S12 or S13, the interactive response is generated by parsing the target prompt information using a large language model. Large language model parsing refers to submitting the target prompt information to the large language model inference engine for forward computation and text generation to produce an interactive response corresponding to the current user input. The interactive response is a text response generated by the large language model based on system instructions, dialogue history, user messages, and optional system event blocks in the target prompt information, and may include direct answers or tool call requests.
[0046] For example, the target prompt information determined in S12 or S13 is submitted to the large language model inference engine in a fixed assembly order through an effective prompt assembler. The large language model inference engine encodes the target prompt information, calculates attention, and performs autoregressive decoding to generate interactive response text.
[0047] In one embodiment, if the interactive response contains a tool call request, the tool execution engine executes the corresponding external tool call and accumulates the tool count. When the tool call count reaches a preset threshold, a tool execution count reaching threshold event is triggered. Finally, the main agent issues a round end event after the round is completed. The above two types of events will be used as trigger signals for the shadow agent to enter the subsequent self-learning process.
[0048] As mentioned above, since the assembly order of the target prompt information remains fixed and the prefix bytes are stable, the key-value cache on the model supply side has good byte stability, thus maintaining a high cache hit rate in multi-round dialogues and reducing the overhead of repeated computation and inference costs. At the same time, through the competitive prefetching and dual-track injection mechanism in steps S11 to S13, the large language model can obtain memory and skill support that are highly relevant to the current user message during parsing, and will not increase the first character delay due to synchronous waiting for retrieval. Therefore, the final output interactive response has the characteristics of personalization, coherence and low latency response.
[0049] The above describes a method for interactive large language model communication. Upon receiving user input in the current round, both a first task and a second task are initiated simultaneously. The first task generates prompt information based on user input, basic system commands, dialogue-level preferences, publicly visible dialogue history, and an internal event queue. The internal event queue contains system event blocks from the previous round if the second task was completed later than a preset timeout threshold. The second task scores and filters candidate memories and skills based on user input and internal dialogue history. A race condition comparison is performed between the second task and the preset timeout threshold. If the second task completes before the preset timeout threshold, the target memory and target skill obtained from the scoring and filtering are injected into the initial prompt information as system event blocks to obtain target prompt information. If the second task completes later than the preset timeout threshold, the initial prompt information is used as the target prompt information, and the system event block of the completed second task is stored in the internal event queue for injection in the next round. The large language model parses the target prompt information to obtain an interactive response. By employing the aforementioned technical means, the simultaneous activation of the first and second tasks enables the concurrent execution of initial prompt information generation and the scoring and screening of candidate memories and skills. A race condition comparison is performed on the second task using a preset timeout threshold. If the second task completes before the preset timeout threshold, the target memory and target skill are injected in a timely manner. If the second task completes after the preset timeout threshold, the main inference process is not blocked, and the injection is delayed until the next round. This allows the target prompt information to be obtained within the time limit corresponding to the preset timeout threshold, and the interactive response of the large language model to be obtained based on the target prompt information. Compared to existing methods that deeply couple memory retrieval with the main inference process and operate serially, this embodiment decouples memory retrieval delay from first-character delay, significantly reducing first-character delay and thus significantly improving the response speed of the large language model interaction.
[0050] In one embodiment, after injecting the target memories and target skills obtained from scoring and filtering into the initial prompt information in the form of system event blocks, and obtaining the target prompt information, the method further includes: copying the system event block into two copies; adding a timestamp prefix and an internally visible-only marker to one copy and storing it as a persistent readable copy; and adding a system role marker and an internally visible-only marker to the other copy and storing it as a persistent internally visible copy. Here, a system event block refers to a structured data fragment with a specific anchor header and a timestamp marker, used to inject memory or skill context into a large language model. A timestamp prefix is a text marker appended to the message content in the form of a system identifier plus time information, used to identify the time of the entry's creation during auditing. An internally visible-only marker is an internal flag appended to the message metadata, used to identify that the entry should not be rendered and displayed by the front end. A readable copy refers to a message record stored in a human-readable text format for auditing, debugging, and front-end filtering. An internally visible copy refers to a structured message record stored in a system role format for restoring system prompts during model playback. Persistence refers to the operation of writing data to a non-volatile storage medium to ensure long-term preservation. For example, after receiving a system event block delivered by the inline injector or internal event queue via the dual-track persistence logger, the system event block is first copied into two identical copies. Then, a timestamp prefix and an internally visible-only flag are added to the first copy, and it is stored in the historical message persistence as a readable copy. The content of this readable copy begins with a human-readable system time prefix, making it easy for operations and maintenance personnel to read and understand directly. Simultaneously, a system role flag and an internally visible-only flag are added to the second copy, and it is stored in the historical message persistence as an internally visible copy. This internally visible copy is stored in a structured form based on roles within the system, facilitating the restoration of the complete semantics of system prompts in chronological order during model playback. Thus, the system event block simultaneously falls into two tracks in two forms, completing the dual-track persistence writing process. In this embodiment, by simultaneously persisting the same system event block as a readable copy and an internally visible copy, a flexible storage strategy is achieved where the same content in two forms has independent uses. The readable copy supports operations and maintenance auditing and front-end filtering, while the internally visible copy supports model playback and semantic restoration; the two do not interfere with each other and can be maintained independently. Meanwhile, the introduction of the "visible only to internal content" tag ensures that all entries in both tracks are uniformly marked as internal content. The front-end renderer only needs to filter based on this single tag to achieve dialog bubble cleanup, eliminating the need to identify multiple different tag types. This simplifies the filtering logic and reduces the complexity of front-end processing. Furthermore, the dual-track persistence design allows the system to flexibly choose which track to retain or retain both tracks simultaneously when performing historical message pruning, archiving, or migration, significantly improving the flexibility and scalability of data management.
[0051] In one embodiment, when rendering the externally visible dialogue history on the front end, entries marked as "visible only to internal users" are filtered out from a readable copy, and the filtered entries are then rendered and displayed to show the externally visible dialogue history. Here, front-end rendering refers to the process of converting persistent dialogue history data into visual interface elements and displaying them on the user's terminal screen. The externally visible dialogue history refers to the message sequence that can be directly viewed by the user after removing entries marked as "visible only to internal users" from the complete internal dialogue history. Filtering refers to the operation of selecting a subset of data that meets specific conditions and excluding elements that do not meet the requirements from the dataset. Rendering and display refers to the process of converting the filtered message entries into visual components such as chat bubbles, avatars, or timestamps in the chat interface and presenting them to the user. For example, when loading the history messages of the current conversation, the conversation renderer first reads a readable copy of the history messages in the persistence repository. Then, it iterates through all message entries in the copy, identifying whether each message carries an internally visible only flag. If a message carries this flag, it is directly removed from the rendering queue; if a message does not carry this flag, it is retained in the rendering queue. Subsequently, the conversation renderer renders the filtered retained entries into conversation bubbles in the front-end interface in chronological order. Real user messages are rendered as the right-hand user bubble, and assistant-generated interactive replies are rendered as the left-hand assistant bubble. All filtered system event blocks and their corresponding content will not appear in the user-visible interface, thus ultimately presenting an externally visible conversation history containing only the interaction content between the real user and the assistant. In this embodiment, by filtering readable copies based on an internally visible tag, the system-injected memory and skill content is effectively isolated. This ensures the front-end dialogue interface remains clean and pure, allowing users to see only their actual conversations with the assistant without being disturbed or confused by system-injected prompts, thus significantly improving user experience and interface friendliness. Furthermore, since the filtering operation is performed during the rendering phase after reading persistent data, rather than during the data writing phase, the complete content of the system event block remains in persistent storage. This supports both front-end cleansing and the preservation of complete data required for back-end auditing and model playback, achieving a dual-channel isolation effect of front-end invisibility and back-end traceability. In addition, this filtering mechanism relies on only a single tag field for judgment, eliminating the need for complex content parsing or pattern matching. It boasts high execution efficiency and clear logic, maintaining stable rendering performance even with massive historical message scenarios. Moreover, when business requirements change, the visibility of different types of content can be flexibly controlled simply by adjusting the filtering conditions, demonstrating good maintainability and scalability.
[0052] Figure 2 This is a flowchart of another interaction method for a large language model provided in an embodiment of this application, see below. Figure 2When performing the first task, the interaction methods of this large language model specifically include: S111: Obtain the user input messages, basic system commands, dialogue-level preferences, and externally visible dialogue history for the current round, and check if there are system event blocks in the internal event queue.
[0053] After simultaneously initiating the first and second tasks in S11, when executing the first task, the system first acquires the user input message, basic system commands, dialogue-level preferences, and externally visible dialogue history for the current round, and checks whether system event blocks exist in the internal event queue. The user input message for the current round refers to the most recently submitted text content by the user in this dialogue interaction. Basic system commands are pre-configured system-level prompts used to define the basic behavioral guidelines and role positioning of the large language model. Dialogue-level preferences are personalized configuration parameters set for the current specific dialogue session; the externally visible dialogue history is a message sequence that can be rendered and displayed on the front-end interface after filtering out entries marked as internally visible only from the complete internal dialogue history. The internal event queue is a first-in-first-out queue used to buffer and store system event blocks that could not be injected in time in the previous round due to prefetch timeout. System event blocks are structured data fragments with specific anchor headers and timestamps used to inject memory or skill context into the large language model. For example, after the round initiation scheduler receives the user input message, the first task effectively prompts the assembly task to begin execution. It first reads the user input message of the current round as the final content of the assembly, and simultaneously loads basic system instructions and dialogue-level preferences as the prefix content of the assembly. Then, it removes all entries marked as internally visible only from the internal dialogue history to construct an externally visible dialogue history. Furthermore, the first task checks the status of the internal event queue to determine if there are any system event blocks to be consumed, thereby determining the appropriate assembly strategy for the initial prompt message of this round.
[0054] As described above, by centrally acquiring and checking the basic elements required for prompt assembly, complete data preparation is provided for the subsequent combination operations of the first task. At the same time, by distinguishing between externally visible dialogue history and internal dialogue history, it is ensured that complete contextual information can be obtained for model reasoning during the prompt assembly process, while preventing internally injected content from mixing into the user-visible dialogue records. This lays a data foundation for subsequent dual-track persistence and front-end rendering purification.
[0055] S112. When there is no system event block in the internal event queue, the initial prompt information for this round is obtained by combining the basic system instructions, dialogue-level preferences, externally visible dialogue history and user input messages in a fixed assembly order.
[0056] After checking in S111 whether a system event block exists in the internal event queue, if no system event block exists in the internal event queue, the initial prompt information for this round is obtained by combining the basic system instructions, dialogue-level preferences, externally visible dialogue history, and user input messages in a fixed assembly order. The fixed assembly order refers to the pre-set, fixed arrangement of each prompt component in the prompt sequence to optimize the hit rate of the model's supply-side key-value cache. The initial prompt information refers to the prompt text that has not yet been attached with the real-time prefetched memory and skills for this round, but already possesses basic reasoning conditions. For example, when the check result in S111 shows that no system event block exists in the internal event queue, the effective prompt assembler, according to the pre-set fixed assembly order, places the basic system instructions at the beginning of the prompt sequence, then adds dialogue-level preferences, then inserts the externally visible dialogue history, and finally places the user input message for the current round at the end of the sequence. This combination generates the initial prompt information for this round, which at this time only contains basic reasoning elements and does not contain any historical delayed memory carried by the internal event queue.
[0057] As mentioned above, due to the use of a fixed assembly order, the prefix part of the prompt sequence remains highly consistent across different rounds, enabling the key-value cache on the model supply side to effectively reuse the calculated prefix attention state, thereby significantly reducing redundant computation overhead and improving inference efficiency. At the same time, when the internal event queue is empty, the combination of basic elements is used directly, avoiding unnecessary queue consumption operations and ensuring the simplicity and execution efficiency of the prompt assembly path.
[0058] S113. When a system event block exists in the internal event queue, it is combined according to the fixed assembly order of basic system instructions, dialogue-level preferences, externally visible dialogue history, system event blocks in the internal event queue, and user input messages to obtain the initial prompt information for this round, and the system event block is removed from the internal event queue.
[0059] After S111 checks whether a system event block exists in the internal event queue, if a system event block exists in the internal event queue, it is combined according to the fixed assembly order of basic system instructions, dialogue-level preferences, externally visible dialogue history, system event blocks in the internal event queue, and user input messages to obtain the initial prompt information for this round, and then the system event block is removed from the internal event queue. The removal operation refers to the cleanup action of deleting the system event block from the internal event queue after it has been successfully injected into the prompt sequence to prevent duplicate consumption in the next round. For example, when the check result in S111 shows that there is a system event block in the internal event queue, the effective prompt assembler also combines them according to the pre-set fixed assembly order, placing the basic system instructions at the front, followed by adding the dialogue-level preferences, then inserting the externally visible dialogue history, then adding the system event block in the internal event queue to the prompt sequence before the user input message, and finally placing the user input message of the current round at the end of the sequence to obtain the initial prompt information of the current round. After the combination is completed, the consumed system event block is immediately removed from the internal event queue to ensure that the delayed memory is not repeatedly injected when the next round starts.
[0060] As described above, by inlining system event blocks in the internal event queue into the initial prompt information according to a fixed assembly order, memories or skills delayed in the previous round due to prefetch timeout can be promptly perceived by the large language model in the current round, thereby compensating for memory loss in delayed rounds and restoring cross-round coherence. At the same time, by removing system event blocks from the queue immediately after injection, the repeated injection of the same memory content is effectively prevented, avoiding model attention distraction and prompt redundancy caused by repeated reminders. Furthermore, maintaining the fixed assembly order ensures the byte stability of the key-value cache, enabling a high cache reuse rate even for prompt sequences containing delayed events.
[0061] Figure 3 This is a flowchart of another interaction method for a large language model provided in the embodiments of this application, referred to... Figure 3 When performing the second task, the interaction methods of this large language model specifically include: S114. Obtain a set of candidate entries, wherein the candidate entries include candidate memories in the memory bank and candidate skills in the skill bank.
[0062] After simultaneously initiating the first and second tasks in S11, when executing the second task, firstly, a set of candidate entries is obtained. These candidate entries include candidate memories from the memory bank and candidate skills from the skill bank. The set of candidate entries is the collective term for all candidate entries retrieved from the memory bank and skill bank that may be related to the user's input information in the current round. The memory bank is a dedicated database used for persistently storing user preferences, historical events, and personalized information; the skill bank is a dedicated database used for persistently storing tool usage methods, task execution strategies, and operational experience. Candidate memories refer to memory entries in the memory bank that have not yet been scored and filtered and possess potential relevance; candidate skills refer to skill entries in the skill bank that have not yet been scored and filtered and possess potential relevance. For example, after the second task, namely the prefetching selection task, is started, it first sends retrieval requests to the memory bank and the skill bank at the same time. It extracts candidate memories from the memory bank that have a certain degree of semantic proximity to the user input message, and extracts candidate skills from the skill bank that have a certain degree of semantic proximity to the user input message or the current dialogue context. Then, it merges the above two types of candidate items to form a candidate item set, which serves as the input data source for subsequent scoring and filtering.
[0063] As described above, by simultaneously covering two data sources, the memory bank and the skill bank, the prefetching selection task can take into account both the retrieval of users' personalized information and the retrieval of tool operation experience, thereby providing more comprehensive contextual support for subsequent reasoning of the large language model. At the same time, the parallel retrieval of the two banks also reserves sufficient execution time window for the competitive comparison mechanism.
[0064] S115. Calculate the comprehensive score of each candidate item based on the semantic relevance of the user input message and each candidate item, the semantic overlap between each candidate item and the set of recently successful tool names, the normalized duration of each candidate item since its last appearance, and the fixed weighting of each candidate item by the operation and maintenance end. The set of recently successful tool names is obtained by extracting recently successful tool names from the tool call records according to the preset backtracking window and removing duplicates.
[0065] After obtaining the candidate item set in S114, the comprehensive score of each candidate item is calculated based on the semantic relevance between the user input message and each candidate item, the semantic overlap between each candidate item and the recently successful tool name set, the normalized duration of each candidate item since its last appearance, and the fixed weighting factor applied by the operations and maintenance department. The recently successful tool name set is obtained by extracting recently successful tool names from the tool call records according to a preset backtracking window and then deduplicating them. Semantic relevance refers to the cosine similarity or semantic distance between the candidate item and the user input information in the vector embedding space, with a value ranging from 0 to 1; a higher value indicates a stronger relevance. The recently successful tool name set is the set of tool names successfully called within the window period, extracted from the tool call records according to a preset backtracking window and deduplicated. This set reflects the tool capabilities recently used or mastered in the current dialogue. Semantic overlap refers to the degree of overlap between the text description of the candidate item and the tool names in the recently successful tool name set in the semantic space, with a value ranging from 0 to 1; a higher value indicates a greater overlap. Normalized duration refers to the length of time that has elapsed since a candidate item was last prompted and participated in inference. It is linearly normalized to a value between 0 and 1 after being set to a preset maximum duration limit; values exceeding the limit are assigned a value of 1. Fixed weighting refers to additional weight values manually set by users (such as operations personnel) for specific candidate items. These can be used to increase the priority of important items or decrease the priority of less important items. The overall score is a numerical result calculated by combining the above four dimensions to measure the current priority of a candidate item.
[0066] For example, a prefetch selector sequentially calculates the sub-scores for each of the four dimensions in the candidate item set. First, the semantic relevance score between the candidate item and the user input message is calculated; second, the semantic overlap score between the candidate item and the set of recently used tool names is calculated; third, the normalized duration score since the candidate item last appeared is calculated; finally, the fixed weighted item for the candidate item from the operations and maintenance end is read. Subsequently, the semantic relevance score is multiplied by the corresponding weight coefficient, the semantic overlap score is multiplied by the corresponding negative weight coefficient to reduce the weight of recently used tool-related items, the normalized duration score is multiplied by the corresponding weight coefficient to adjust for timeliness, and the fixed weighted item is directly included in the summation. Finally, the comprehensive score of the candidate item is obtained by weighted summation. The above calculation process is repeated for each item in the candidate item set until all are completed.
[0067] For example, the overall score is calculated using the following formula: ;in, A candidate entry refers to a specific candidate memory or candidate skill retrieved from a memory bank or skill bank. The user input information for the current round serves as anchor text for semantic relevance comparison. Candidate entries The overall score ranges from [ [1,1], the higher the value, the better for the candidate entry. The more worthwhile it is to be injected in the current round. Candidate entries With user input information The semantic relevance score between them ranges from [0,1], with higher values indicating a stronger semantic relevance. is the weighting coefficient for semantic relevance, and is a constant greater than or equal to zero, used to adjust the contribution ratio of semantic relevance to the overall score. This is a set of recently successful tool names, formed by deduplicating the tool call records in the preset backtracking window. Candidate entries Collection of recently successful tool names The semantic overlap score between them ranges from [0,1], with higher values indicating greater overlap. is the weighting coefficient corresponding to the semantic overlap score, which is a constant greater than or equal to zero. It is used to adjust the contribution ratio of semantic overlap in the overall score. Here, a negative sign is used to reduce the weight. Candidate entries The normalized duration since the last appearance, with a value range of [0,1], and using a preset maximum duration upper limit. Perform linear normalization, and set the value to 1 when the value exceeds the upper limit. Candidate entries The weighting coefficient corresponding to the normalized duration since the last appearance is a constant greater than or equal to zero, used to adjust the contribution ratio of the normalized duration in the overall score. Here, a negative sign is used to achieve timeliness adjustment. For the operations and maintenance side to select candidate entries A manually set fixed weighting value, which can be positive, negative, or zero, is used to manually increase or decrease the priority of a specific item. The weighting coefficient for the fixed weighting item on the operations and maintenance side is a constant greater than or equal to zero, used to adjust the contribution ratio of the fixed weighting to the overall score. This formula integrates four dimensions—semantic relevance, tool overlap, timeliness, and fixed weighting on the operations and maintenance side—into a comprehensive score through weighted summation. Semantic relevance and fixed weighting on the operations and maintenance side are positive bonuses, while tool overlap and normalized duration are negative deductions. This achieves a multi-dimensional balanced selection strategy: higher priority is given to items more relevant to the user's current needs; lower priority is given to items more overlapping with recently used tools; higher priority is given to items that have not been activated for a long time; and higher priority is given to items specified by operations and maintenance.
[0068] The above-mentioned approach, by introducing semantic relevance as a positive scoring factor, ensures that memories and skills highly relevant to the user's current needs are prioritized for retrieval; by introducing semantic overlap with the set of recently successful tool names as a negative scoring factor, it effectively avoids excessive repetitive recommendations of tool-related items that have been frequently used or mastered recently, thereby improving the diversity and information gain of the candidate set; by introducing normalized duration as a moderating factor, it allows dormant memories that have not been activated for a long time to receive appropriate priority increases, while items that have just been used are given lower priority, achieving a time balance in memory activation; by introducing fixed weighting items from the operations and maintenance side, it empowers system administrators with the ability to manually adjust specific important items, enhancing the system's maintainability and flexibility; the comprehensive scoring mechanism of the above four dimensions makes the candidate item selection process more refined and intelligent, significantly improving the accuracy and personalization of memory retrieval.
[0069] S116. Sort the results in descending order according to the overall score, and perform hard filtering using the set of emerging memory names obtained by reverse parsing from the internal dialogue history to exclude injected entries, thereby obtaining the target memory and target skill. The set of emerging memory names is obtained by reverse parsing from the internal dialogue history according to the preset reminder block anchor point.
[0070] After obtaining the comprehensive score of each candidate item in S115, they are sorted in descending order according to the comprehensive score. A hard filter is then applied using the set of emerging memory names obtained from the internal dialogue history through reverse parsing to exclude injected items, resulting in the target memory and target skill. The set of emerging memory names is obtained by reverse parsing from the internal dialogue history according to preset reminder block anchors. Descending order refers to sorting the candidate items in descending order of comprehensive score. The set of emerging memory names refers to the set of memory item names extracted from the internal dialogue history through reverse parsing of specific reminder block anchors, which have been injected and participated in reasoning in previous rounds. This set serves as a derived state for cross-round deduplication. Reminder block anchors are fixed plain text markers pre-set in system event blocks, such as semantic anchors like "Memory Reminder - Start," used to locate and parse injected memory items from historical messages in subsequent rounds. Hard filtering refers to a filtering mechanism that strictly excludes candidate entries based on the set of emerging memory names. That is, as long as the name of a candidate entry appears in the set of emerging memory names, it is discarded regardless of its overall score. Target memory refers to the memory entries to be injected in this round, determined after descending sorting and hard filtering. Target skill refers to the skill entries to be injected in this round, determined after descending sorting and hard filtering. For example, the prefetch selector first sorts all candidate entries with the calculated comprehensive score in S115 from high to low, forming an ordered candidate sequence. Then, the effective prompt assembler scans all message entries in the internal dialogue history, and reverse-parses the names of memory entries that have been injected in previous rounds from the history marked as internally visible only, according to the preset reminder block anchor format. This constructs a set of emerging memory names as a derived state. The prefetch selector then uses this set of emerging memory names as a filtering condition to check the ordered candidate sequence one by one, directly excluding entries whose names exist in the set of emerging memory names, and only retaining candidate entries that have not been injected in previous rounds. Finally, the top-ranked entries are selected from the filtered candidate entries as target memories and target skills, thus completing the output of the prefetch selection task for this round.
[0071] As described above, by sorting the overall scores in descending order, the system ensures that the most relevant and information-rich memory and skill items are prioritized for injection within the limited prompt space. The hard filtering mechanism of the already surfaced memory name set effectively avoids the problem of the same memory item being repeatedly injected in multiple consecutive rounds, effectively preventing model attention distraction, prompt redundancy, and decreased dialogue coherence caused by repeated reminders. Furthermore, the already surfaced memory name set, as a derived state, is obtained by reverse parsing from the reminder block anchors in historical messages, without introducing any new persistent fields or independent injected record data structures. This achieves cross-round deduplication with zero additional storage cost. Moreover, when historical messages decay due to pruning, archiving, or cleanup, the already surfaced memory name set also decays naturally, allowing distant historical memory items to be reinjected at appropriate times. This aligns with users' expectations of avoiding repetition of recently reminded content and timely review of distant historical content. Simultaneously, this derived state mechanism also possesses good scalability and maintainability, significantly reducing the complexity of system implementation and storage overhead.
[0072] Figure 4 This is a flowchart of another interaction method for a large language model provided in an embodiment of this application, see below. Figure 4 After receiving the interaction response for the current round, the interaction methods of this large language model specifically include: S21. In response to the round end event, the first shadow agent extracts candidate memories from the internal dialogue history within the most recent preset number of rounds. The round end event is the event generated after the large language model of the current round is parsed and the interactive response is output. The first shadow agent is a memory extraction shadow agent.
[0073] In one embodiment, upon detecting a round-end event, in response to the round-end event, a first shadow agent extracts candidate memories from the most recent internal dialogue history within a preset round-number range. The round-end event is generated after the large language model parsing of the current round is completed and the interactive response is output. The first shadow agent is a memory-extraction shadow agent. The round-end event is an asynchronous event signal issued by the main agent after completing the large language model parsing and outputting the interactive response for the current round, and after all tool calls have been executed. The round-end event marks the formal termination of the current dialogue round in the main dialogue thread. The first shadow agent, i.e., the memory-extraction shadow agent, is a sub-agent derived from the main agent and running independently of the main dialogue process, specifically responsible for extracting historical dialogue content from a retrospective perspective. The preset round-number range refers to the maximum dialogue round budget configured for the first shadow agent, denoted as maxTurns_M, used to limit the length of dialogue history that the shadow agent can backtrack and process during the extraction process. Candidate memories refer to candidate memory entries extracted by the first shadow agent from the dialogue history that have not yet undergone security review. For example, after the main agent completes the large language model parsing and outputs the interactive response in the current round, the trigger router receives the round end event and then queries the status of the memory-extractable mutex. If the lock is already occupied, the trigger is skipped directly; if the lock is in a released state, the lock is acquired immediately and the derivation process of the first shadow agent is started. The first shadow agent generates an independent agent identifier according to a preset naming rule, for example, the naming rule is "${parentId}__fork_${K}_${ts}", where parentId is the main agent identifier, K is the agent type identifier, and ts is the timestamp. This naming rule is also used by the trigger router as a criterion for blocking recursive forks. That is, if the current agent identifier already contains the "fork" substring, it will refuse to fork again, thereby preventing recursive calls. Subsequently, within its maxTurns_M runtime budget, the first shadow agent reads the complete internal dialogue history within the most recent preset number of rounds. Utilizing the text understanding and information extraction capabilities of the large language model, it identifies and extracts personalized information with long-term value, such as user preferences, important facts, and key decisions, from the dialogue history, and then organizes this information into structured alternative memory entries.
[0074] As described above, by decoupling the memory extraction task from the main dialogue thread and entrusting it to an independent first shadow agent for asynchronous execution, the latency accumulation problem caused by superimposing serial write steps on the main inference path in traditional solutions is avoided. This ensures that the main dialogue process is not blocked due to memory extraction, thus guaranteeing smooth user interaction and low-latency response. Simultaneously, a mutex mechanism ensures that at most one memory extraction shadow agent is running at any given time, effectively preventing duplicate extractions and resource contention caused by concurrent triggering. Furthermore, recursive forking is blocked through naming rules, preventing infinite recursive chains formed by shadow agents accidentally triggering new forks during extraction. In addition, a budget constraint with a preset round range provides a clear resource boundary for the first shadow agent, preventing it from exhausting computing resources due to processing excessively long histories, thereby achieving controllability and stability in the memory extraction process.
[0075] S22. In response to the call completion event, the tool call sequence within the most recent preset number of rounds is reviewed by the second shadow agent to obtain candidate skills. The call completion event is an event generated when the cumulative number of tool calls exceeds a preset threshold. The second shadow agent is a skill review shadow agent.
[0076] In one embodiment, upon detecting a call completion event, in response to the event, a second shadow agent reviews the tool call sequence within a recent preset number of rounds to obtain candidate skills. The call completion event is an event generated when the cumulative number of tool calls exceeds a preset threshold. The second shadow agent is a skill review-type shadow agent. Specifically, the call completion event is an asynchronous event signal issued by the tool execution engine when the cumulative number of tool calls reaches a preset threshold N_th. The call completion event signifies that the tool usage frequency in the current dialogue has reached the trigger condition for skill review and summary. The second shadow agent, i.e., the skill review-type shadow agent, is a sub-agent derived from the main agent and runs independently of the main dialogue process. It is specifically responsible for reviewing and analyzing recent tool call sequences to extract operational skills. The preset number of rounds refers to the maximum dialogue round budget configured for the second shadow agent, denoted as maxTurns_S, used to limit the length of the tool call sequence that the shadow agent can backtrack and process during the review process. Candidate skills refer to candidate skill entries obtained by the second shadow agent from the tool call sequence that have not yet undergone security review. For example, the tool execution engine counts each tool call after execution. When the accumulated count reaches a preset threshold N_th, it sends a call completion event to the trigger router. The trigger router then queries the status of the skill replay mutex. If the lock is already held, the trigger is skipped. If the lock is released, the trigger is acquired immediately, and the derivation process of the second shadow proxy is started. The second shadow proxy also generates an independent proxy identifier according to a preset naming rule, for example, "${parentId}__fork_${K}_${ts}", where parentId is the main proxy identifier, K is the proxy type identifier, and ts is the timestamp. This naming rule is subject to the same recursive fork blocking mechanism. Subsequently, within its maxTurns_S runtime budget, the second shadow agent reads the tool call sequence records within the most recent preset number of rounds. Utilizing the reasoning and inductive capabilities of the large language model, it systematically reviews the triggering conditions, parameter configurations, execution order, and reasons for success or failure of the tool calls. From this, it extracts structured knowledge such as reusable operation patterns, parameter optimization strategies, and error avoidance methods, and then organizes this knowledge into candidate skill items.
[0077] As described above, by introducing a call achievement event that differs from the round-end event as a trigger for skill review, the separation and specialization of two self-learning tasks—memory extraction and skill review—are achieved. Memory extraction focuses on the personalized information accumulation within the dialogue content, while skill review focuses on the methodological summary of tool usage experience. Each performs its own function without interfering with the other. Simultaneously, the two types of shadow agents have independent triggering conditions, independent budget configurations, and independent mutex locks, allowing users to flexibly adjust their respective triggering frequencies and resource quotas according to actual scenario needs. For example, in high-frequency tool call scenarios, the N_th threshold can be lowered to accelerate skill accumulation, or in long dialogue scenarios, maxTurns_M can be increased to improve memory extraction depth, thus significantly enhancing the system's configurability and scenario adaptability. Furthermore, the independent asynchronous execution of the skill review shadow agent also ensures that the main dialogue process is not affected by the review computation overhead, maintaining the real-time nature of user interaction.
[0078] S23. Conduct security review of alternative memories and alternative skills, and determine the alternative memories that pass the review as candidate memories and the alternative skills that pass the review as candidate skills.
[0079] After candidate memories are extracted through the first shadow proxy in S21, and candidate skills are extracted through the second shadow proxy in S22, security reviews are conducted on the candidate memories and candidate skills. Candidate memories that pass the review are designated as candidate memories, and candidate skills that pass the review are designated as candidate skills. The security review process refers to a multi-dimensional semantic-level security scan and risk assessment procedure performed on the content to be written to disk produced by the shadow proxy. This security review can be performed by the pre-write security gating module. Candidate memories are memory entries that, after security review, are deemed risk-free and can be formally written to the memory bank. Candidate skills are skill entries that, after security review, are deemed risk-free and can be formally written to the skill bank. For example, after completing their respective extraction or review tasks, the first and second shadow proxies submit the generated candidate memories and candidate skills to the pre-write security gating. The pre-write security gating performs parallel scanning and security review of each candidate entry from four dimensions: injection prompts, sensitive credentials, path traversal, and destructive commands. If any candidate entry hits any risk pattern in the above four dimensions, it is rejected, isolated to the review directory, or requires manual confirmation according to the preset strategy. Only when a candidate entry does not hit any risk pattern in all four dimensions is it judged as passing the review. Then, the candidate memory that passes the review is determined as the candidate memory, and the candidate skill that passes the review is determined as the candidate skill. The rejected or isolated entries follow the soft deletion plus time-to-live path. They are first renamed to a preset directory (such as .trash / {ts} / ) and then truly deleted by an independent cleaner after a preset number of days. Manual recovery is supported during this period.
[0080] As described above, by performing a multi-dimensional semantic-level security scan on all candidate entries generated by the shadow proxy before disk write-to-disk, the system effectively intercepts potential security risks such as hidden prompt injection commands, sensitive credential leakage, path traversal attacks, and destructive commands in the content automatically generated by the large language model. This prevents such problematic content from directly entering the memory or skill library and causing damage to user privacy, system security, and dialogue quality. Furthermore, by embedding security review as an independent gating step into the disk write-to-disk process, the review strategy can be iteratively upgraded independently of the extraction logic. For example, adding detection dimensions or adjusting the hit threshold does not require modifying the shadow proxy implementation, thereby improving system maintainability and security response speed. In addition, the soft deletion plus lifetime disaster recovery mechanism provides a recovery channel for mistakenly blocked legitimate entries, avoiding the permanent loss of useful information due to overly strict review strategies, ensuring both security and data availability and recoverability.
[0081] S24. Save candidate memories to the memory bank and candidate skills to the skill bank.
[0082] After obtaining candidate memories and candidate skills through the security review process in S23, the candidate memories are saved to the memory bank, and the candidate skills are saved to the skill bank. The memory bank is a dedicated database for persistently storing memory entries that have undergone security review. It can be implemented using a vector database or key-value storage to support efficient semantic retrieval. The skill bank is a dedicated database for persistently storing skill entries that have undergone security review, and it also supports semantic retrieval and structured queries. For example, for candidate memories that have passed the review in S23, their main content can be written to the main storage file of the memory bank, and a corresponding metadata companion file can be generated. This companion file records auxiliary information such as the candidate memory's reference count, most recent usage time, and source round identifier, so that complete metadata can be reconstructed based on the companion file if the main content file is corrupted or migrated. Subsequently, the candidate memory officially becomes a persistent entry in the memory bank, available for retrieval and scoring by the prefetch selector in subsequent rounds. For the candidate skills that pass the review in S23 above, the same persistence process can be performed to write their main content into the skill library and generate corresponding metadata companion files. Subsequently, the candidate skills officially become persistent entries in the skill library, which can also be retrieved and scored by the prefetch selector in subsequent rounds. Thus, the complete closed loop from the triggering of the round end event or the call achievement event to the asynchronous extraction or review of the shadow agent, the security review before writing, and the final disk storage is completed. These newly added candidate memories and candidate skills will be included in the candidate entry set by the prefetch selector when the next round starts to participate in the scoring and screening, thereby realizing the continuous accumulation and dynamic evolution of memories and skills.
[0083] As described above, by storing approved memories and skills in the memory bank and skill bank respectively, the system achieves persistent accumulation of personalized information and operational experience. This allows the content to be retained and reused across multiple dialogue sessions, supporting cross-session coherence and personalized experiences. Furthermore, the independent storage of accompanying metadata files enables the main content files to be migrated, backed up, or rebuilt without losing key metadata, significantly improving the system's maintainability and disaster recovery capabilities. Simultaneously, newly added entries immediately become visible candidates for the prefetch selector, allowing the accumulated effects of memories and skills to be fed back into subsequent dialogue rounds with minimal delay. This forms a complete self-learning closed loop from extraction to review, disk storage, recall, and re-extraction, driving the dialogue agent system to continuously self-optimize and evolve its knowledge during long-term operation, ultimately realizing the continuous self-learning capability of the large language model personalized memory system.
[0084] Figure 5 This is a flowchart of another interaction method for a large language model provided in the embodiments of this application, referred to... Figure 5 When performing alternative memory extraction through the first shadow agent, the interaction method of this large language model specifically includes: S211. In response to the end-of-round event, query the occupancy status of the first mutex. If the first mutex is not occupied, trigger the start of the first shadow agent, wherein the first mutex is a memory-removal mutex.
[0085] In the aforementioned S21, when performing alternative memory extraction via the first shadow proxy, upon detecting a round-end event, the occupancy status of the first mutex is queried. If the first mutex is not occupied, the first shadow proxy is triggered to start. The first mutex is a memory extraction type mutex. The first mutex is a concurrency control mechanism based on the shadow proxy type, used to ensure that at most one shadow proxy instance of the same type is running at any given time. Occupancy status refers to whether the mutex is currently acquired and held by a shadow proxy instance. Unoccupied status means the mutex is in a released state, available for acquisition by a new shadow proxy instance. Triggering startup refers to the process by which the trigger router formally derives the first shadow proxy instance after determining that the startup conditions are met. The first shadow proxy, i.e., the memory extraction type shadow proxy, is a sub-proxy derived from the main proxy, running independently of the main dialogue process, specifically responsible for extracting historical dialogue content from a hindsight perspective. For example, after the main agent completes the parsing of the large language model and outputs the interactive response in the current round, the trigger router receives the round end event and then queries the current holding status of the first mutex lock. If the lock is already held, the trigger is skipped to avoid resource contention and state disorder caused by concurrent extraction. If the lock is in an unheld and released state, the trigger router immediately acquires the lock and starts the derivation process of the first shadow agent. The first shadow agent generates an independent agent identifier using the naming rule "${parentId}__fork_${K}_${ts}", where parentId is the main agent identifier, K is the agent type identifier, and ts is the timestamp. This naming rule is also used by the trigger router as a criterion for blocking recursive forks. That is, if the current agent identifier already contains the "fork" substring, it directly refuses to fork again, thereby preventing the shadow agent from accidentally triggering a new fork during the extraction process and forming an infinite recursive chain. At the same time, the release time of the first mutex lock is set to when the first shadow agent terminates normally, terminates abnormally, or runs out of budget, to ensure that the lock resources can be reclaimed in a timely manner.
[0086] As described above, by introducing a query and acquisition mechanism using a first mutex lock, the problem of duplicate extraction caused by multiple concurrent triggers of the same type of shadow agent within a short period of time is effectively avoided. This ensures strict serialization control of the memory extraction process at the concurrency level, thereby guaranteeing the consistency and accuracy of the extraction results. Simultaneously, through the discard semantics of "occupy and skip," the system can effectively degrade handling when faced with high-frequency event triggers, preventing the main dialogue thread from being blocked or exceptions from propagating due to lock contention, significantly improving the overall stability of the system. Furthermore, by implementing recursive forking blocking through naming rules, the risk of shadow agent self-replication or cascading derivation is fundamentally eliminated, ensuring the isolation and controllability of the shadow agent execution environment. This allows the memory extraction task to be completed independently within a safe sandbox boundary, and even if an exception occurs, it will not be propagated back to affect the main dialogue process.
[0087] S212. Obtain the most recent internal dialogue history within a preset number of rounds through the first shadow agent, wherein the internal dialogue history includes user input messages, interactive responses generated by the large language model, tool call requests, and tool call return results.
[0088] After the first shadow agent is started in S212, the internal dialogue history within the most recent preset number of rounds is obtained through the first shadow agent. This internal dialogue history includes user input messages, interactive responses generated by the large language model, tool call requests, and tool call return results. The preset number of rounds refers to the maximum dialogue round budget configured for the first shadow agent, denoted as `maxTurns_M`, which limits the length of dialogue history that the shadow agent can backtrack and process during the extraction process. Internal dialogue history refers to the complete sequence of dialogue messages recorded by the system during operation, containing all externally visible and internally visible entries; its content is more complete than the externally visible dialogue history. User input messages refer to the raw text content submitted by the user to the system in each round. Interactive responses refer to the text responses generated by the large language model in response to user input messages. Tool call requests refer to the structured call instructions issued by the large language model when it determines that an external tool needs to be called during inference. Tool call return results refer to the structured output data returned to the large language model by the tool execution engine after executing the tool call request. For example, after successful startup, the first shadow agent first reads the preset `maxTurns_M` parameter in its own runtime budget. Then, it retrieves the complete dialogue record within the most recent `maxTurns_M` rounds from the system's persistent historical message storage. This complete dialogue record includes not only the actual dialogue between the user and the assistant but also entries marked as internally visible only, such as system event blocks, tool call requests, and tool call return results, thus forming a complete internal dialogue history. The first shadow agent uses this internal dialogue history as the input data source for subsequent semantic extraction, ensuring that the extraction process can extract information based on the most comprehensive and original dialogue context, rather than relying solely on filtered, externally visible fragments.
[0089] As described above, by limiting the preset number of rounds, a clear boundary is set for the data reading operation of the first shadow agent, preventing it from exhausting computing resources or incurring excessive time overhead due to processing too long a history. This ensures the controllable execution and resource isolation of the memory extraction task. Simultaneously, by acquiring the complete internal dialogue history rather than just the externally visible portion, the first shadow agent can access the complete trajectory of tool calls, the injected content of system prompts, and the intermediate decision-making basis of model inference. This information is crucial for accurately understanding user intent, reconstructing the dialogue context, and extracting deep personalized preferences, thus significantly improving the comprehensiveness and depth of subsequent semantic extraction and avoiding extraction bias or omissions caused by missing information.
[0090] S213. Semantic extraction is performed on the obtained internal dialogue history through the first shadow agent to obtain candidate memories. Semantic extraction includes extracting key information, user preferences, factual content and relational content from the internal dialogue history.
[0091] After obtaining the most recent internal dialogue history within a preset number of rounds through the first shadow agent in S212, the first shadow agent performs semantic extraction on the obtained internal dialogue history to obtain candidate memories. Semantic extraction includes extracting key information, user preferences, factual content, and relational content from the internal dialogue history. Semantic extraction refers to the process of identifying and extracting structured information with long-term preservation value from unstructured dialogue text using the text understanding, information extraction, and knowledge induction capabilities of a large language model. Candidate memories are candidate memory entries extracted from the dialogue history by the first shadow agent that have not yet undergone security review. Key information refers to content fragments with high information entropy, such as important events, decisions, agreements, or conclusions involved in the dialogue. User preferences refer to the personal preferences, habits, value judgments, or priority rankings explicitly or implicitly expressed by users in the dialogue. Factual content refers to verifiable declarative information such as objective facts, entity attributes, time, location, and numerical data involved in the dialogue. Relational content refers to the relationships and causal chains between users and entities, between entities, or between events involved in the dialogue. For example, after acquiring the complete internal dialogue history, the first shadow agent utilizes the reasoning capabilities of a large language model to analyze this history layer by layer. First, it locates and extracts key information from the dialogue text formed by user input and interactive responses, identifying important matters explicitly mentioned or repeatedly emphasized by the user. Second, it infers the user's personalized preferences from their expression style, choice tendencies, and feedback attitudes. Third, it extracts factual content from entity descriptions, attribute statements, and scene portrayals involved in the dialogue. Finally, it gleans causal relationships between events and semantic relationships between entities from the contextual evolution of multiple rounds of dialogue to form relational content. Subsequently, the first shadow agent organizes the above four types of extraction results into candidate memory entries according to a preset structured template. Each candidate memory entry contains meta-information such as memory name, memory type, memory content, source round identifier, and confidence score, thus completing the transformation process from the original dialogue to structured memory.
[0092] As described above, by subdividing the semantic extraction task into four dimensions—key information, user preferences, factual content, and relational content—the output of candidate memories becomes more structured and multi-dimensional. It not only records "what the user said" but also deeply understands "what the user prefers," "what the objective facts are," and "how things are related," thus significantly improving the information density of memory entries and the accuracy of subsequent retrieval. Simultaneously, because the semantic extraction process is executed asynchronously by a first shadow agent independent of the main dialogue process, the main dialogue thread can continue processing the next round of user requests without waiting for extraction to complete. This achieves complete decoupling of memory production and dialogue reasoning, enabling the system to continuously accumulate personalized knowledge without sacrificing the real-time nature of user interaction. Ultimately, this drives the dialogue agent to form increasingly accurate user profiles and richer knowledge reserves over long-term use, providing users with a more coherent, considerate, and efficient personalized service experience.
[0093] Figure 6 This is a flowchart of another interaction method for a large language model provided in an embodiment of this application, see below. Figure 6 When extracting alternative skills through a second shadow proxy, the interaction method of this large language model specifically includes: S221. In response to the call completion event, query the occupancy status of the second mutex. If the second mutex is not occupied, trigger the start of the second shadow agent. The second mutex is a skill replay type mutex.
[0094] In the aforementioned S22 process of extracting alternative skills via the second shadow proxy, upon detecting a call completion event, the occupancy status of the second mutex is queried. If the second mutex is not occupied, the second shadow proxy is initiated. This second mutex is a skill review-type mutex. The call completion event is an asynchronous event signal automatically emitted by the tool execution engine when the accumulated number of tool calls reaches a preset threshold. This event signifies that the tool usage frequency in the current dialogue has reached the trigger condition for skill review and summary. The second mutex, i.e., the skill review-type mutex, is a concurrency control mechanism with shadow proxy type granularity, specifically used for the startup management of skill review-type shadow proxies. Occupancy status refers to whether the mutex is currently acquired and held by a shadow proxy instance. Unoccupied means the mutex is in a released state, available for acquisition by new shadow proxy instances. The second shadow proxy, also known as the skill review shadow proxy, is a sub-proxy derived from the main proxy and running independently of the main dialogue process. It is specifically responsible for reviewing and analyzing recent tool call sequences to extract operational skills. For example, the tool execution engine counts each tool call after execution. When the accumulated count reaches a preset threshold, it sends a call completion event to the trigger router. Upon receiving this event, the trigger router immediately checks the current holding status of the second mutex lock. If the lock is already held, it skips the current trigger to avoid resource contention and duplicate processing caused by concurrent reviews. If the lock is in an unheld, released state, it immediately acquires the lock and initiates the second shadow proxy's derivation process. The second shadow proxy generates an independent proxy identifier using the naming rule "${parentId}__fork_${K}_${ts}", where parentId is the primary proxy identifier, K is the proxy type identifier, and ts is the timestamp. This naming rule is also used by the trigger router as a criterion for blocking recursive forks. That is, if the current proxy identifier already contains the "fork" substring, it will directly refuse to fork again, thereby preventing the shadow proxy from accidentally triggering a new fork during the review process and forming an infinite recursive chain. At the same time, the release time of the second mutex lock is set to when the second shadow proxy terminates normally, terminates abnormally, or runs out of budget, to ensure that the lock resources can be reclaimed in a timely manner.
[0095] As described above, by introducing a second mutex lock query and acquisition mechanism, the problem of repeated reviews caused by multiple concurrent triggers of the skill review shadow agent in a short period of time is effectively avoided. This ensures strict serialization control of the skill review process at the concurrency level, thereby guaranteeing the consistency and accuracy of the review results. Simultaneously, since the second mutex lock is independent of the first mutex lock, the two self-learning tasks of skill review and memory extraction are completely decoupled. Users (such as system administrators) can adjust the triggering frequency and resource quotas of both for different business scenarios. For example, in high-frequency tool call scenarios, the trigger threshold can be lowered to accelerate skill accumulation, or skill review can be shut down separately while memory extraction continues to run normally when resources are scarce, thus significantly improving the system's flexibility and maintainability. Furthermore, recursive forking blocking is implemented through naming rules, effectively eliminating the risk of shadow agent self-replication or cascading derivation, ensuring that the skill review task can be completed independently within a safe isolation boundary, and even if an anomaly occurs, it will not affect the main dialogue process.
[0096] S222. Obtain the tool call sequence within the most recent preset number of rounds through the second shadow proxy, wherein the tool call sequence includes tool call request, input parameter configuration, return result, retry record, error message and call time data.
[0097] After the second shadow agent is triggered and started in S221, the tool call sequence within the most recent preset number of rounds is obtained through the second shadow agent. This tool call sequence includes tool call requests, input parameter configurations, return results, retry records, error messages, and call time data. In this embodiment, the preset number of rounds refers to the maximum dialogue round budget configured for the second shadow agent, denoted as maxTurns_S, which limits the length of the tool call sequence that the shadow agent can backtrack and process during the review process. A tool call sequence refers to the collection of all tool call-related data recorded chronologically by the tool execution engine within a certain time or round range. A tool call request is a structured call instruction issued by the large language model when it determines that an external tool needs to be called during inference; it typically includes the tool name and call parameters. Input parameter configuration refers to the specific parameter settings and numerical configurations carried in each tool call request. Return results refer to the structured output data returned to the large language model by the tool execution engine after executing the tool call request. Retry records refer to the repeated attempt information recorded by the system when a tool call fails or times out for the first time, and is subsequently called again according to the retry strategy. Error messages refer to diagnostic data such as error codes, error descriptions, and exception stacks returned when a tool call fails or encounters an exception. Call duration data refers to the time interval between issuing a tool call request and receiving a return result, used to evaluate tool performance and response latency. For example, after successful startup, the second shadow agent first reads the preset `maxTurns_S` parameter in its own runtime budget; then, it backtracks from the tool execution engine's call log or persistent records to read all tool call records within the most recent `maxTurns_S` rounds. These records are organized chronologically into a complete tool call sequence, where each record contains the original tool call request text, specific input parameter configurations, the return result returned by the tool execution engine, retry records when the call fails, error messages generated during the call, and call duration data from request initiation to response reception. The second shadow agent uses this multi-dimensional tool call sequence as the input data source for subsequent post-processing, ensuring that the post-processing can be based on the most comprehensive and original tool execution trajectory for in-depth analysis.
[0098] As described above, by limiting the preset number of rounds, a clear boundary is set for the data reading operations of the second shadow agent, preventing it from exhausting computing resources or incurring excessive time overhead due to processing excessively long sequences. This ensures the controllable execution and resource isolation of the skill review task. Simultaneously, by acquiring a complete tool call sequence, including tool call requests, input parameter configurations, return results, retry records, error messages, and call time data, the second shadow agent can not only understand which tools were called but also deeply analyze how parameters were configured, what results were obtained, how to retry in the face of failure, what errors were encountered, and how much time each call took. This multi-dimensional data provides a solid factual foundation for subsequent extraction of high-quality operational skills, significantly improving the depth and practicality of the review extraction and avoiding biases or omissions in skill summarization due to incomplete information.
[0099] S223. The obtained tool call sequence is reviewed and extracted through the second shadow agent to obtain candidate skills. The review and extraction includes tool call patterns, parameter optimization rules, call chain combinations and exception handling strategies.
[0100] After obtaining the tool call sequence within the recent preset number of rounds through the second shadow agent in S222, the second shadow agent performs a post-mortem analysis on the obtained tool call sequence to extract candidate skills. This post-mortem analysis includes tool call patterns, parameter optimization rules, call chain combinations, and exception handling strategies. Post-mortem analysis refers to the process of systematically reviewing, analyzing, and summarizing historical tool call sequences using the reasoning and inductive capabilities of a large language model, extracting reusable structured knowledge. Candidate skills refer to candidate skill items obtained by the second shadow agent from the tool call sequence that have not yet undergone security review. Tool call patterns refer to the decision-making rules and triggering conditions for which tools should be called under different business scenarios or user intentions. Parameter optimization rules refer to configuration strategies and rules of thumb for adjusting input parameter configurations to obtain better return results for specific tools or scenarios. Call chain combinations refer to a multi-tool collaborative execution scheme that links multiple single tool calls in a specific order and logical relationship to complete complex tasks. An exception handling strategy refers to the response measures and decision-making process, such as retries, degradation, substitution, or error reporting, that should be taken when faced with situations such as tool call failures, timeouts, or return exceptions. For example, after obtaining the complete tool call sequence, the second shadow agent uses the reasoning capabilities of a large language model to analyze this sequence layer by layer. First, it identifies the tool call pattern from the association between tool call requests and corresponding user inputs, summarizing the conditional characteristics and decision logic that trigger specific tool calls in different scenarios. Second, it summarizes parameter optimization rules from the correspondence between input parameter configurations and return results, extracting parameter setting experience that can obtain higher quality return results. Third, it sorts out the call chain combination from the temporal relationship of continuous multi-tool calls, identifying the optimal tool chaining order and data transmission path required to complete complex tasks. Finally, it summarizes exception handling strategies from the analysis of retry records and error messages, concluding the most effective recovery methods and alternative solutions for various common errors. Subsequently, the second shadow agent organizes the above four types of review results into candidate skill items according to a preset structured template. Each candidate skill item contains meta-information such as skill name, skill type, applicable scenario, specific strategy, source round identifier, and confidence score, thereby completing the transformation process from the original tool call trajectory to structured operation skills.
[0101] As described above, by subdividing the debriefing extraction into four dimensions—tool invocation patterns, parameter optimization rules, invocation chain combinations, and exception handling strategies—the output of candidate skills not only encompasses decision-making knowledge on "when to use," but also configuration knowledge on "how to use," orchestration knowledge on "how to chain," and fault-tolerant knowledge on "how to deal with failure." This forms a complete and reusable tool operation methodology, significantly improving the information density of skill items and the practicality of subsequent applications. Furthermore, because the debriefing extraction process is executed asynchronously by a second shadow agent independent of the main dialogue process, the main dialogue thread can continue processing the next round of user requests without waiting for the debriefing to complete. This decouples skill production from dialogue reasoning, allowing the system to continuously accumulate tool usage experience without sacrificing the real-time nature of user interaction. Furthermore, these structured and refined alternative skills can be identified by the prefetch selector and injected into effective prompts in subsequent rounds. This guides the large language model to make more accurate, efficient, and robust tool invocation decisions in similar scenarios, ultimately driving the dialogue agent system to continuously optimize its tool usage capabilities during long-term operation, reducing tool invocation failure rates and retry overhead, and providing users with a smoother and more reliable interactive service experience.
[0102] Figure 7 This is a flowchart of another interaction method for a large language model provided in the embodiments of this application, referred to... Figure 7 During security review, the interaction methods of this large language model specifically include: S231. Perform a first security review on the candidate memory to obtain a first review result. The first review process is to detect whether the candidate memory contains first sensitive information. The candidate memory that does not contain first sensitive information passes the review. The first sensitive information includes instruction trigger words, invisible control characters, abnormal coded segments, high-entropy strings, key password token prefixes, and assignment content of key synonyms co-occurring.
[0103] During the security review process in S23 mentioned above, a first security review can be performed on the candidate memory to obtain a first review result. This first review involves detecting whether the candidate memory contains first sensitive information. Candidate memories that do not contain first sensitive information pass the review. First sensitive information includes instructional trigger words, invisible control characters, abnormal encoded segments, high-entropy strings, key / password token prefixes, and assignments containing co-occurring key synonyms. The first security review refers to a multi-dimensional semantic scanning process performed by the pre-write security gating module on the candidate memory, aimed at detecting the risks of prompt injection and sensitive credential leakage. The first review result refers to the risk assessment conclusion made on the candidate memory after the first security review, including two states: review passed and review failed. First sensitive information refers to a specific set of information categories that may cause security risks and need to be detected and identified. Instructional trigger words refer to semantic expressions that attempt to override or tamper with system instructions, such as word combinations containing "ignore the above rules" or "override system prompts," which have the intent to hijack instructions. Invisible control characters refer to special characters that cannot be directly displayed in the text but may affect parsing behavior, such as abnormal combinations of zero-width spaces, backspaces, or newlines. Abnormal encoded segments refer to abnormal Unicode character ranges that exceed the normal text encoding range and may be used to bypass content filtering. High-entropy strings refer to string sequences with extremely high character randomness and length and pattern conforming to the characteristics of keys or tokens. Key / password / token prefixes refer to fixed-format prefixes commonly found in API Keys (Application Programming Interface Keys), Access Tokens, or cryptographic credentials. Assignment content with co-occurrence of key synonyms refers to content fragments in the text consisting of semantically similar words such as "key," "password," "token," and "password," along with their assignment expressions. For example, after the first shadow agent completes semantic extraction and generates candidate memories, the pre-write security gating module immediately initiates the first security review process for each candidate memory. First, pattern matching and semantic analysis are used to detect whether the candidate memory contains instructional trigger words to identify potential hint injection attacks. Second, character-level scanning is used to detect whether there are invisible control characters and abnormal encoded segments to identify hidden content that may be used to bypass security mechanisms or disrupt text parsing. Third, entropy calculation and regular expression matching are used to detect whether there are high-entropy strings and key / password token prefixes to identify potential sensitive credential leaks. Finally, natural language processing techniques are used to detect whether there are assignments containing co-occurring key synonyms to identify user privacy credentials or system keys that may be memorized. If the candidate memory does not contain any primary sensitive information in any of the above detection dimensions, the first review result is passed, and the candidate memory is identified as a candidate memory and enters the subsequent disk write process.If a candidate memory hits the first sensitive information in any detection dimension, the first review result is that the review fails. The system will then perform write rejection, isolate the candidate memory to the pending review directory, or require manual confirmation according to the preset strategy. At the same time, the processed entry will be temporarily stored in the recycle area via soft deletion plus TTL (Time To Live) path for subsequent cleanup or recovery.
[0104] The above-mentioned multi-dimensional detection system, which covers command trigger words, invisible control characters, abnormal encoded segments, high-entropy strings, key password token prefixes, and key synonym co-occurrence assignment content, effectively intercepts potentially hidden prompt injection commands and sensitive credential information in the content automatically generated by the large language model before the memory is written to disk. This prevents these problematic memories from directly entering the memory bank and causing damage to user privacy, system security, and dialogue quality. Furthermore, because the detection process covers both visible text and invisible characters, the comprehensiveness and robustness of the security review are significantly improved. In addition, by embedding the first security review process as an independent gating step into the memory writing process, the review strategy can be iteratively upgraded independently of the memory extraction logic. For example, adding detection dimensions or adjusting the hit threshold does not require modifying the implementation of the first shadow proxy, thereby improving the system's maintainability and security response speed. The soft deletion plus time-to-live disaster recovery mechanism provides a recovery channel for mistakenly intercepted legitimate memory entries, ensuring both security and data availability and recoverability.
[0105] S232. A second security review is performed on the candidate skills to obtain a second review result. The second review process involves detecting whether the candidate skills contain second sensitive information. Candidate skills that do not contain second sensitive information pass the review. The second sensitive information includes directory traversal symbols, out-of-bounds absolute paths, special system paths, and command families that have irreversible destructive effects on file systems, services, and network configurations.
[0106] During the security review process in S23 mentioned above, a second security review can be performed on the candidate skills to obtain a second review result. This second review involves detecting whether the candidate skills contain second sensitive information. Candidate skills that do not contain second sensitive information pass the review. Second sensitive information includes directory traversal symbols, out-of-bounds absolute paths, special system paths, and command families that have irreversible destructive effects on the file system, services, and network configuration. The second security review refers to a multi-dimensional semantic scanning process performed by the pre-write security gating module on the candidate skills, targeting the detection of path traversal and destructive command risks. The second review result refers to the risk assessment conclusion made on the candidate skills after the second security review, including two states: passed and failed. Second sensitive information refers to a specific set of information categories that may pose system security threats and need to be detected and identified. Directory traversal symbols refer to character combinations used to bypass directory access restrictions and access parent directories or illegal paths, such as path jump expressions composed of consecutive periods and forward slashes. Out-of-bounds absolute paths refer to absolute path references that exceed the application's legal workspace and point to the system core directory or user private directory. Special system paths refer to critical system directories and configuration file paths in the operating system or runtime environment, such as the system boot directory, registry path, or storage location of core configuration files. Command families with irreversible destructive effects refer to sets of operation instructions that may cause permanent damage or loss of function to the file system, service processes, or network configuration, such as formatting commands, recursive deletion commands, or service deactivation commands. For example, after the second shadow agent completes the replay extraction and generates candidate skills, the pre-write security gating module immediately initiates a second security review process for each candidate skill. First, it uses regular expressions and path parsing algorithms to detect whether the candidate skills contain directory traversal symbols to identify potential path traversal attack vectors; second, it uses path validity checks to detect whether they contain out-of-bounds absolute paths to identify illegal path references attempting to access sensitive areas of the system; third, it uses system path library comparison to detect whether they contain special system paths to identify access attempts targeting core operating system components; finally, it uses command pattern matching and semantic analysis to detect whether they contain command families with irreversible destructive effects on the file system, services, and network configuration to identify dangerous operation instructions that may lead to system paralysis or data loss. If the candidate skill does not contain any second sensitive information in any of the above detection dimensions, the second review result is passed, and the candidate skill is identified as a candidate skill and enters the subsequent disk write process. If the candidate skill contains second sensitive information in any detection dimension, the second review result is failed. The system will perform write rejection, isolation to the pending review directory, or require manual confirmation for the candidate skill according to the preset strategy. At the same time, the processed entry will also be temporarily stored in the recycle area through soft deletion plus time-to-live path for later cleanup or recovery.
[0107] The above-mentioned multi-dimensional detection system, encompassing directory traversal symbols, absolute out-of-bounds paths, special system paths, and command families with irreversible destructive effects, effectively intercepts potential path traversal attack vectors and destructive commands hidden in content automatically generated by the large language model before skills are written to disk. This prevents problematic skills from being directly executed in subsequent tool calls after entering the skill library, thus avoiding serious security incidents such as file system corruption, service interruption, or network configuration corruption. Furthermore, because the second security review process is independent and runs in parallel with the first, memory security and skill security are managed and optimized separately. This allows system administrators to configure review strategies and sensitivity thresholds based on the different risk characteristics of the memory and skill libraries, significantly improving the flexibility and accuracy of security gating. In addition, by embedding the second security review process as an independent gating step into the skill writing process, a clear boundary of responsibility is established between skill review and security assurance. This ensures both the automation and efficiency of skill production and that every skill entering the library undergoes rigorous security verification, ultimately achieving dual security and reliability assurance for the dialogue agent system during continuous self-learning.
[0108] This application provides an interactive device for a large language model, referring to... Figure 8 The interactive device of this large language model includes: a processor 31, a memory 32, a communication module 33, an input device 34, and an output device 35. The interactive device of this large language model can have one or more processors, and the interactive device of this large language model can have one or more memories. The processor, memory, communication module, input device, and output device of the interactive device of this large language model can be connected via a bus or other means.
[0109] The memory 32, as a computer-readable storage medium, can be used to store software programs, computer-executable programs, and modules, such as program instructions / modules corresponding to the interaction method of the large language model in any embodiment of this application. The memory may primarily include a program storage area and a data storage area, wherein the program storage area may store the operating system and at least one application program required for a function; the data storage area may store data created based on the use of the device, etc. Furthermore, the memory may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device. In some instances, the memory may further include memory remotely located relative to the processor, and these remote memories can be connected to the device via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0110] The communication module 33 is used for data transmission.
[0111] The processor 31 executes various functional applications and data processing of the device by running software programs, instructions and modules stored in the memory, thereby realizing the interactive method of the large language model mentioned above.
[0112] Input device 34 can be used to receive input digital or character information, and to generate key signal inputs related to user settings and function control of the device. Output device 35 may include display devices such as a display screen.
[0113] The interactive device for the large language model provided above can be used to execute the interactive method for the large language model provided in the above embodiments, and has corresponding functions and beneficial effects.
[0114] This application embodiment also provides a storage medium for storing computer-executable instructions. When executed by a computer processor, the computer-executable instructions are used to execute an interaction method for a large language model. This interaction method includes: upon receiving user input messages in the current round, simultaneously initiating a first task and a second task; wherein the first task generates initial prompt information based on the user input message, basic system instructions, dialogue-level preferences, externally visible dialogue history, and an internal event queue; wherein the externally visible dialogue history is obtained by removing entries marked as internally visible only from the internal dialogue history; and the internal event queue is generated when the second task in the previous round completes later than a preset timeout threshold. The system includes the system event block from the previous round. The second task scores and filters candidate memories and skills based on user input and internal dialogue history. A race condition comparison is performed between the second task and a preset timeout threshold. If the second task completes before the preset timeout threshold, the scored and filtered target memories and skills are injected into the initial prompt information as a system event block, resulting in the target prompt information. If the second task completes after the preset timeout threshold, the initial prompt information is used as the target prompt information, and the system event block obtained after the second task is completed is stored in the internal event queue for injection in the next round. The interactive response is obtained through large language model parsing based on the target prompt information.
[0115] Storage medium – any type of memory device or storage device. The term “storage medium” is intended to include: mounting media, such as CD-ROM, floppy disk, or magnetic tape devices; computer system memory or random access memory, such as DRAM, DDR RAM, SRAM, EDO RAM, Rambus RAM, etc.; non-volatile memory, such as flash memory, magnetic media (e.g., hard disk or optical storage); registers or other similar types of memory elements, etc. Storage medium may also include other types of memory or combinations thereof. Furthermore, storage medium may reside in a first computer system in which the program is executed, or it may reside in a different second computer system connected to the first computer system via a network (such as the Internet). The second computer system can provide program instructions to the first computer for execution. The term “storage medium” can include two or more storage media residing in different locations (e.g., in different computer systems connected via a network). Storage medium may store program instructions (e.g., specifically implemented as a computer program) executable by one or more processors.
[0116] Of course, the computer-executable instructions provided in the embodiments of this application are not limited to the interaction method of the large language model as described above, but can also execute related operations in the interaction method of the large language model provided in any embodiment of this application.
[0117] The interactive device, storage medium, and interactive equipment of the large language model provided in the above embodiments can execute the interactive method of the large language model provided in any embodiment of this application. For technical details not described in detail in the above embodiments, please refer to the interactive method of the large language model provided in any embodiment of this application.
[0118] The above description is merely a preferred embodiment and the technical principles employed in this application. This application is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions that can be made by those skilled in the art will not depart from the scope of protection of this application. Therefore, although this application has been described in detail through the above embodiments, this application is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of this application, the scope of which is determined by the scope of the claims.
Claims
1. An interactive method for a large language model, characterized in that, include: Upon receiving user input for the current round, both the first and second tasks are started simultaneously. The first task generates initial prompt information based on the user input message, basic system instructions, dialogue-level preferences, externally visible dialogue history, and internal event queue. The externally visible dialogue history is obtained by removing entries marked as internally visible only from the internal dialogue history. The internal event queue includes system event blocks from the previous round if the second task in the previous round was completed later than a preset timeout threshold. The second task scores and filters candidate memories and candidate skills based on the user input message and internal dialogue history. The second task is compared with a preset timeout threshold in a competitive manner. If the second task is completed before the preset timeout threshold, the target memory and target skill obtained by scoring and filtering are injected into the initial prompt information in the form of a system event block to obtain the target prompt information. If the second task is completed later than the preset timeout threshold, the initial prompt information is used as the target prompt information, and the system event block obtained after the completion of the second task is stored in the internal event queue for injection in the next round. The interactive response is obtained by parsing the target prompt information using a large language model.
2. The method according to claim 1, characterized in that, The first task generates initial prompt information based on the user input message, basic system commands, dialogue-level preferences, externally visible dialogue history, and internal event queue, including: The system acquires the user input message of the current round, the basic system instructions, the dialogue-level preferences, and the externally visible dialogue history, and checks whether there are system event blocks in the internal event queue. When there is no system event block in the internal event queue, the initial prompt information for this round is obtained by combining the basic system instructions, the dialogue-level preferences, the externally visible dialogue history, and the user input messages in a fixed assembly order. When a system event block exists in the internal event queue, it is combined according to the fixed assembly order of the basic system instructions, the dialogue-level preferences, the externally visible dialogue history, the system event block in the internal event queue, and the user input message to obtain the initial prompt information for this round, and then the system event block is removed from the internal event queue.
3. The method according to claim 1, characterized in that, The second task involves scoring and filtering candidate memories and candidate skills based on the user input messages and internal dialogue history, including: Obtain a set of candidate entries, which includes candidate memories in a memory bank and candidate skills in a skill bank; Based on the semantic relevance of the user input message to each candidate item, the semantic overlap between each candidate item and the set of recently successful tool names, the normalized duration of each candidate item since its last appearance, and the fixed weighting of each candidate item by the operation and maintenance end, the comprehensive score of each candidate item is calculated. The set of recently successful tool names is obtained by extracting recently successful tool names from the tool call records according to a preset backtracking window and then removing duplicates. The results are sorted in descending order according to the comprehensive score, and then hard-filtered using the set of emerging memory names obtained by reverse parsing from the internal dialogue history to exclude injected entries, thereby obtaining the target memory and target skill. The set of emerging memory names is obtained by reverse parsing from the internal dialogue history according to preset reminder block anchor points.
4. The method according to claim 1, characterized in that, After obtaining the interactive response through large language model parsing based on the target prompt information, the method further includes: In response to the round end event, the first shadow agent extracts candidate memories from the internal dialogue history within the most recent preset number of rounds. The round end event is the event generated after the large language model parsing of the current round is completed and the interactive response is output. The first shadow agent is a memory extraction shadow agent. In response to a call completion event, a second shadow agent is used to review the tool call sequence within a preset number of rounds to obtain candidate skills. The call completion event is an event that occurs when the cumulative number of tool calls exceeds a preset threshold. The second shadow agent is a skill review type shadow agent. The alternative memories and alternative skills are subject to security review, and the alternative memories that pass the review are determined as candidate memories, and the alternative skills that pass the review are determined as candidate skills. The candidate memories are saved to the memory bank, and the candidate skills are saved to the skill bank.
5. The method according to claim 4, characterized in that, In response to the round-end event, the first shadow agent extracts candidate memories from the internal dialogue history within the most recent preset number of rounds, including: In response to the round end event, the occupancy status of the first mutex is queried. If the first mutex is not occupied, the first shadow agent is triggered to start. The first mutex is a memory extraction mutex. The first shadow agent obtains the most recent internal dialogue history within a preset number of rounds. The internal dialogue history includes user input messages, interactive responses generated by the large language model, tool call requests, and tool call return results. The candidate memory is obtained by semantically extracting the acquired internal dialogue history through the first shadow agent. The semantic extraction includes extracting key information, user preferences, factual content and relational content from the internal dialogue history.
6. The method according to claim 4, characterized in that, In response to the call completion event, the second shadow agent reviews the tool call sequence within a recent preset number of rounds to obtain candidate skills, including: In response to the call completion event, the occupancy status of the second mutex is queried. If the second mutex is not occupied, the second shadow agent is triggered to start. The second mutex is a skill replay type mutex. The second shadow proxy obtains the tool call sequence within the most recent preset number of rounds. The tool call sequence includes the tool call request, input parameter configuration, return result, retry record, error message and call time data. The second shadow agent performs a post-mortem analysis on the obtained tool call sequence to obtain the candidate skills. The post-mortem analysis includes tool call patterns, parameter optimization rules, call chain combinations, and exception handling strategies.
7. The method according to claim 4, characterized in that, The security review process for the alternative memories and the alternative skills includes: The candidate memory is subjected to a first security review process to obtain a first review result. The first review process is to detect whether the candidate memory contains first sensitive information. The candidate memory that does not contain the first sensitive information passes the review. The first sensitive information includes instruction trigger words, invisible control characters, abnormal coded segments, high-entropy strings, key password token prefixes and assignment content of key synonym co-occurrence. The candidate skills are subjected to a second security review to obtain a second review result. The second review process is to detect whether the candidate skills contain second sensitive information. Candidate skills that do not contain the second sensitive information pass the review. The second sensitive information includes directory traversal symbols, out-of-bounds absolute paths, special system paths, and command families that have irreversible destructive effects on file systems, services, and network configurations.
8. The method according to claim 1, characterized in that, After injecting the target memories and target skills obtained through scoring and filtering into the initial prompt information in the form of system event blocks to obtain the target prompt information, the method further includes: The system event block is copied into two copies. One copy is added with a timestamp prefix and an internally visible only flag and then stored as a persistent readable copy. The other copy is added with a system role flag and an internally visible only flag and then stored as a persistent internally visible copy. When rendering the externally visible dialogue history on the front end, the entries marked as "only visible internally" are filtered out from the readable copy, and the filtered entries are rendered and displayed to show the externally visible dialogue history.
9. An interactive device for a large language model, characterized in that, include: Memory and one or more processors; The memory is used to store one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of claims 1-8.
10. A storage medium for storing computer-executable instructions, characterized in that, The computer-executable instructions, when executed by a processor, are used to perform the method as described in any one of claims 1-8.