Method for desensitizing output data of large language model agent and related equipment

By leveraging the collaborative mechanism of the model context protocol server and the de-identification tool, sensitive fields of large language models are identified and processed in real time, solving the problem of sensitive information leakage in traditional technologies and achieving secure and readable output text generation.

CN122113141APending Publication Date: 2026-05-29CHINA PING AN PROPERTY INSURANCE CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
CHINA PING AN PROPERTY INSURANCE CO LTD
Filing Date
2026-03-09
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

Traditional large language models pose a risk of sensitive information leakage in their output results, especially in multi-turn dialogues or cross-domain retrieval scenarios. Existing technologies struggle to effectively identify and handle the rewriting of sensitive fields, cross-turn references, and multi-position embeddings.

Method used

By introducing a model context protocol server, key-value caching, and desensitization tools, and by building a unified communication channel and knowledge replenishment mechanism, sensitive fields are identified and processed in real time, and desensitized output text is generated in combination with a context alignment strategy.

Benefits of technology

While maintaining the semantic integrity of model inference, it effectively blocks sensitive information from entering the output text, achieving privacy protection, avoiding data leakage, and ensuring the security and readability of the output text.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122113141A_ABST
    Figure CN122113141A_ABST
Patent Text Reader

Abstract

The application relates to the technical field of artificial intelligence, can be applied to the fields of science and technology finance and digital medical treatment, and discloses a large language model intelligent agent output data desensitization processing method and related equipment. The method comprises the following steps: constructing a model context protocol server in a model reasoning process, so that an intelligent agent calls a knowledge base to obtain a search result; the search result is written into a key value cache and a cache sequence is generated in combination with an intermediate state in reasoning; a desensitization tool is called to perform sensitive field identification and desensitization processing on text in the cache sequence to obtain a desensitization intermediate result; the desensitization intermediate result is semantically aligned and spliced with large language model generated content according to a context alignment strategy to form a target output text after desensitization; and finally, the target output text after desensitization is returned to the intelligent agent output. The method realizes sensitive information protection in output data of a large language model, so that external data can be safely referenced and the output semantic is complete.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence technology and can be applied to the fields of fintech / digital healthcare, particularly to a method and related equipment for desensitizing the output data of a large language model intelligent agent. Background Technology

[0002] With the development of Large Language Model (LLM) technology, Intelligent Agents are widely used in enterprise-level artificial intelligence applications for scenarios such as customer service consultation, business processing, risk assessment, and process decision-making. They typically combine Retrieval-Augmented Generation (RAG) mechanisms to retrieve cases, rules, documents, and historical data from the enterprise's internal knowledge base and organize them into natural language output, giving the model high real-time performance and professionalism. However, most current Intelligent Agents adopt the traditional "input-as-task" model, directly retrieving knowledge base information through prompts and then having the model generate the output. During language paraphrasing and semantic assembly, the model directly references knowledge base information. If the knowledge base contains highly sensitive information such as customer names, contact information, ID numbers, medical records, or financial accounts, this information is easily exposed unprocessed in the final generated results. In the fintech field, for example, when intelligent agents are used for loan risk control, credit review assistance, or compliance report writing, they retrieve historical review documents, which contain private data such as borrowers' ID numbers, transaction details, and account statements. Direct output of such data would constitute a serious information leak. In the digital healthcare field, when intelligent agents are used for medical record summaries, treatment suggestions, or medical quality control, they extract patient identity information, examination records, and medical insurance codes from medical record databases, which also poses a risk of leakage. Existing technologies attempt to reduce leakage through sensitive word filtering, prompt word constraints, and keyword replacement, but they cannot cope with semantic rewriting, content expansion, cross-turn dialogue referencing, and multiple knowledge base retrievals. Furthermore, they cannot be linked with the model's internal reasoning process and struggle to cover multi-turn dialogue caching and ultra-long text generation. Therefore, existing intelligent agents pose a risk of sensitive information leakage when outputting data: the model may reference sensitive fields in the search results during reasoning; sensitive information may be rewritten or repeatedly referenced across turns in the reasoning chain, making keyword filtering difficult to fully identify; in multi-turn or cross-domain retrieval scenarios, sensitive information may also be embedded in the generated content in multiple locations and on multiple topics, further expanding the scope of leakage. In summary, existing technologies pose a risk of sensitive information exposure when intelligent agents output text intended for business users. Summary of the Invention

[0003] The main technical problem addressed by the implementation method of this application is the risk of sensitive information leakage in the output results obtained by traditional large language model inference.

[0004] To address the aforementioned technical problems, the first technical solution adopted in this application is: providing a method for de-identifying the output data of a large language model agent, comprising: constructing a model context protocol server, enabling the agent to call a knowledge base through the model context protocol server to obtain knowledge base retrieval results; writing the knowledge base retrieval results to a key-value cache in the model context protocol server, and generating a corresponding cache sequence based on the key-value cache and the intermediate state of model inference; calling a preset de-identification tool, and using the de-identification tool to identify and de-identify sensitive fields in the text content corresponding to the cache sequence to obtain a de-identification intermediate result; based on a preset context alignment strategy, performing semantic alignment and splicing processing on the de-identification intermediate result and the generated content of the large language model to generate a de-identified target output text; returning the de-identified target output text to the agent, and having the agent output the target output text.

[0005] Optionally, the step of using the desensitization tool to identify and desensitize sensitive fields in the text content corresponding to the cache sequence to obtain an intermediate desensitization result includes: based on a preset desensitization rule base, performing rule matching and identification on the field content in the cache sequence to determine the set of sensitive fields that need to be desensitized; calling the corresponding desensitization strategy according to the structural characteristics of different fields in the sensitive field set, performing character replacement, character masking, and / or content pruning on each target field to generate desensitized field content with the same character layout as the original field; and writing the desensitized field content to the position in the cache sequence corresponding to the original field, so that the cache sequence is converted into an intermediate desensitization result that can be processed by the context alignment strategy.

[0006] Optionally, the step of writing the knowledge base retrieval results to the key-value cache in the model context protocol server and generating a corresponding cache sequence based on the key-value cache and the intermediate state of model inference includes: establishing a time-series index based on the model call history stored in the key-value cache; segmenting and numbering the obtained knowledge base retrieval results, wherein the segment number corresponds to the time-series index; semantically associating the content corresponding to the segment number with the intermediate state of model inference, so that segments with different semantic associations are assigned different association identifiers; arranging the content corresponding to the segment number according to the time-series index and the association identifier; and generating the cache sequence based on the arranged content corresponding to the segment number.

[0007] Optionally, the step of semantically aligning and splicing the desensitized intermediate results and the generated content of the large language model based on a preset context alignment strategy to generate the desensitized target output text includes: performing context position recognition on the desensitized intermediate results to locate the semantic connection position corresponding to the desensitized intermediate results and the generated content of the large language model; performing content trimming and / or content extraction processing on the desensitized intermediate results according to the semantic connection position to obtain an aligned segment that connects with the generated content of the large language model; and splicing the aligned segment and the generated content of the large language model according to the semantic connection position to obtain the desensitized target output text.

[0008] Optionally, the step of calling a preset desensitization tool to perform sensitive field identification and desensitization processing on the text content corresponding to the cache sequence includes: detecting whether the text content corresponding to the cache sequence meets a preset trigger condition for triggering desensitization processing; if the preset trigger condition is met, generating a desensitization trigger signal; receiving the desensitization trigger signal and starting the preset desensitization tool to perform sensitive field identification processing on the text content corresponding to the cache sequence to locate the target field area corresponding to the sensitive field; after the sensitive field identification is completed, performing desensitization processing on the target field area to obtain the desensitized field, and writing the desensitized field to the position corresponding to the cache sequence.

[0009] Optionally, after the step of generating the corresponding cache sequence based on the key-value cache and the intermediate state of model inference, the method further includes: establishing a temporal index for each of the multiple knowledge base retrieval results to identify the generation order of different knowledge base retrieval results; semantically associating the segment numbers corresponding to the knowledge base retrieval results with the intermediate state of model inference, so that different associating different associating identifiers are assigned to segments corresponding to different inference chains; incrementally arranging the segments corresponding to different inference chains according to the temporal index and the semantic associating identifier, so as to perform segmented incremental insertion processing on the original cache sequence to obtain the updated cache sequence.

[0010] Optionally, the step of performing segmented incremental insertion processing on the original cache sequence includes: detecting whether a segment with the same associated identifier already exists at the insertion target position to determine whether a segment conflict has occurred; when a segment conflict is detected, comparing the conflicting segment and the newly added segment in sequence according to the time sequence index to determine the target insertion segment; and writing the target insertion segment to the position corresponding to the original cache sequence to overwrite and update the cache sequence.

[0011] To address the aforementioned technical problems, the second technical solution adopted in this application is: providing an output data desensitization processing device for a large language model agent, comprising: a knowledge base retrieval module for constructing a model context protocol server, enabling the agent to call the knowledge base through the model context protocol server to obtain knowledge base retrieval results; a cache sequence generation module for writing the knowledge base retrieval results to a key-value cache in the model context protocol server, and generating a corresponding cache sequence based on the key-value cache and the intermediate state of model inference; a desensitization intermediate result module for calling a preset desensitization tool, and performing sensitive field identification and desensitization processing on the text content corresponding to the cache sequence through the desensitization tool to obtain a desensitized intermediate result; an output text generation module for performing semantic alignment and splicing processing on the desensitized intermediate result and the generated content of the large language model based on a preset context alignment strategy to generate a desensitized target output text; and an output text feedback module for returning the desensitized target output text to the agent, through which the agent outputs the target output text.

[0012] To solve the above-mentioned technical problems, the third technical solution adopted in the embodiments of this application is: to provide an electronic device, including: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the output data desensitization processing method of the large language model agent as described above.

[0013] To solve the above-mentioned technical problems, the fourth technical solution adopted in the embodiments of this application is: to provide a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by an electronic device, the electronic device executes the output data desensitization processing method of the large language model intelligent agent as described above.

[0014] Unlike related technologies, this application introduces a collaborative mechanism of model context protocol server, key-value caching, desensitization tools, and context alignment strategies during the large language model inference process. This mechanism creates a continuous processing chain from external knowledge retrieval, sensitive field identification, desensitization processing, to final output generation. By maintaining the semantic integrity and readability of the model inference, it effectively prevents sensitive fields from directly entering the model's output text, thus enabling the model's generated results to have privacy protection capabilities. This avoids the risk of sensitive information leakage in the model's output data due to post-processing delays in traditional technologies. Attached Figure Description

[0015] One or more embodiments are illustrated by way of example with reference to the accompanying drawings. These illustrations do not constitute a limitation on the embodiments. Elements having the same reference numerals in the drawings are denoted as similar elements. Unless otherwise stated, the figures in the drawings are not to be limited by scale.

[0016] Figure 1 This is a schematic diagram of the operating environment for the desensitization processing method for the output data of the large language model intelligent agent provided in the embodiments of this application.

[0017] Figure 2 This is a schematic diagram of the execution flow of the desensitization processing method for the output data of the large language model intelligent agent provided in the embodiments of this application.

[0018] Figure 3 This is a schematic diagram of the execution flow of obtaining intermediate desensitization results in the desensitization processing method for the output data of the large language model intelligent agent provided in the embodiments of this application.

[0019] Figure 4 This is a schematic diagram of the execution flow of obtaining the target output text in the output data desensitization processing method of the large language model intelligent agent provided in the embodiments of this application.

[0020] Figure 5 This is an example structural diagram of the intelligent agent calling external tools and resources based on the model context protocol in the output data desensitization processing method of the large language model intelligent agent provided in the embodiments of this application.

[0021] Figure 6 This is a schematic diagram of the system structure of the output data desensitization processing device for the large language model intelligent agent provided in the embodiments of this application.

[0022] Figure 7 This is a schematic diagram of the hardware structure of an electronic device that performs the output data desensitization processing method for a large language model intelligent agent, as provided in an embodiment of this application. Detailed Implementation

[0023] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application. Software tools, components, or servers not belonging to this company that appear in the embodiments of this application are merely illustrative examples and do not represent actual use.

[0024] It should be noted that, unless otherwise specified, the various features in the embodiments of this application can be combined with each other, all of which are within the protection scope of this application. Furthermore, although functional modules are divided in the device schematic diagram and a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device schematic diagram or the order in the flowchart.

[0025] Unless otherwise defined, all technical and scientific terms used in this specification have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the scope of this application. The term "and / or" as used in this specification includes any and all combinations of one or more of the associated listed items.

[0026] To facilitate understanding of this embodiment, a detailed description of the method for de-identifying the output data of a large language model intelligent agent disclosed in this application embodiment will be provided first. Please refer to [link to relevant documentation]. Figure 1 , Figure 1 This is a schematic diagram of the operating environment for the output data desensitization processing method of the large language model intelligent agent provided in the embodiments of this application, such as... Figure 1 As shown, the execution subject of the large language model intelligent agent output data anonymization processing method provided in this application embodiment is generally an electronic device with a certain computing power, such as a computer device. In some possible implementations, this large language model intelligent agent output data anonymization processing method can be implemented by the processor calling computer-readable instructions stored in the memory. Figure 1 The computer equipment mentioned can be a server. A server can be a standalone server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms. This can be understood as... Figure 1 The number of computer devices shown is merely illustrative and can be expanded in any number according to actual needs.

[0027] Please continue reading. Figure 2 , Figure 2 This is a schematic diagram of the execution flow of the output data anonymization processing method for a large language model intelligent agent provided in the embodiments of this application, as shown below. Figure 2 As shown, it includes the following steps: S1. Construct a Model Context Protocol (MTP) server so that the agent can call the knowledge base through the MTP server to obtain the knowledge base retrieval results.

[0028] In step S1, the Model Context Protocol (MTP) server acts as an intermediary layer between the agent and external resources. By defining data access interfaces, parameter passing specifications, and context state management mechanisms, it enables the agent to standardize its access to the knowledge base, facilitate cross-round access, and maintain its inference state. During construction, the MTP server encapsulates the knowledge base access capabilities into a standardized API to support query parameter parsing, retrieval triggering, result feedback, and asynchronous execution, ensuring that the agent can obtain external knowledge supplementation and domain information support in real time during the inference process. The MTP server not only acts as a knowledge retrieval channel but also undertakes cross-session semantic carrying and content caching management. By caching, indexing, and semantically annotating retrieval results, it allows the agent to reference external knowledge in subsequent inferences without repeated retrievals, thereby improving response accuracy and context continuity. For example, in a fintech scenario, the agent can generate credit assessments and risk control explanations by calling the loan rule base, industry risk indicator base, and customer credit history base through the MTP server; in a digital healthcare scenario, the agent can call the clinical diagnosis and treatment knowledge base, disease guideline base, and medical insurance rule base to obtain treatment pathways and medication recommendations. Therefore, step S1 establishes a unified communication channel and knowledge replenishment mechanism between the agent and the knowledge base by introducing a model context protocol server, providing basic data sources and semantic support for subsequent sensitive field identification, desensitization processing, and context alignment.

[0029] S2. Write the knowledge base retrieval results to the key-value cache in the model context protocol server, and generate the corresponding cache sequence based on the key-value cache and the intermediate state of model inference.

[0030] In step S2, the core technology lies in standardizing external knowledge retrieval content and incorporating it into the model's inference chain. This allows the large language model to not only rely on its internal parameter knowledge base but also reference external domain knowledge in real time during inference. Key-value caching maintains contextual continuity, achieving traceable and scalable semantic fusion. In fintech scenarios, when an agent performs loan risk control explanations or credit report generation tasks, loan rules, customer historical indicators, and risk markers output by external compliance models are written into the key-value cache as retrieval results. These are then organized into cache sequences as referenceable fragments during inference, supporting accurate risk control analysis and clause interpretation. In digital healthcare scenarios, when an agent generates treatment suggestions or disease progression analysis, retrieved clinical treatment guidelines, past case summaries, and medication guidelines are written into the key-value cache and converted into cache sequences. This allows the model to directly call upon authoritative external medical knowledge rather than relying on parameter memory when generating suggestions, significantly improving the reliability and professionalism of medical content. Therefore, step S2 integrates external knowledge retrieval results with the model's inference structure, providing a foundational semantic layer for subsequent desensitization, context alignment, and content splicing output.

[0031] As an example, a KV Cache mechanism can be built to store and dynamically maintain the context and intermediate results generated during model inference, so as to support the continuation of context and content reorganization in multi-round inference links. Specifically, a KVCache class can be defined to store and manage intermediate results and state information generated by the Token stream. Furthermore, an input conversion function can be provided to convert the Token sequence into a text string for use by the desensitization tool, enabling the generated text fragments to be sent as intermediate input to the desensitization tool for sensitive field processing. Simultaneously, a ContextAlignment class can be defined to perform realignment of the desensitized text, ensuring semantic continuity when the desensitized fragments are integrated with content generated by the large language model. During inference, the system can continuously write multiple rounds of RAG retrieval results or external tool call results to the cache sequence, ensuring that the content generated in each knowledge supplementation and inference stage forms a traceable cache snapshot. After desensitization, the system recombines the desensitized fragments with the model-generated content based on context alignment, pruning, and splicing strategies to obtain the final output text. Through these methods, a stable contextual structure can be maintained throughout the entire model inference process, forming an integrated and continuous processing chain for external knowledge referencing, intermediate state maintenance, and text output generation.

[0032] As an optional implementation, step S2 may further include steps S21 to S23.

[0033] S21. Establish a time-series index based on the model call history stored in the key-value cache, and segment and number the obtained knowledge base retrieval results, with the segment number corresponding to the time-series index.

[0034] The technical purpose of step S21 is to provide semantic clues in the time dimension for subsequent model reasoning, and to realize process-level positioning and tracking of knowledge fragments. The correspondence between segment number and time sequence index can ensure that even if the number of retrieval results is large, the sources are many, and the structure is inconsistent, a deterministic reasoning order can be maintained, providing a structured basis for subsequent semantic association identification and incremental sequence generation.

[0035] S22. Based on the intermediate state of the model inference, semantic association labels are applied to the content corresponding to the segment number so that segments with different semantic association relationships are assigned different association labels.

[0036] In step S22, by identifying the semantic coupling relationship between each knowledge fragment and the current reasoning target, each fragment is mapped to different reasoning chains, thereby binding knowledge with reasoning paths. This enables the model to distinguish between content belonging to the same reasoning topic and content belonging to different reasoning topics, thus ensuring that the subsequent cache sequence arrangement stage maintains logical consistency in the semantic dimension.

[0037] S23. Arrange the content corresponding to the segment number according to the time sequence index and the association identifier, and generate a cache sequence based on the content corresponding to the arranged segment number.

[0038] The technical significance of step S23 lies in recombining cross-source, cross-time period, and semantically heterogeneous knowledge fragments into a data structure that can be used for model reasoning based on timeline and semantic links. This allows the cache sequence to retain both temporal continuity and semantic aggregation, providing a stable and structured semantic input foundation for subsequent desensitization processing and context splicing.

[0039] As an example, in a fintech scenario, when an agent generates a credit risk control analysis report, the model context protocol server repeatedly retrieves loan rules, customer historical risk indicators, and industry regulatory requirements from the knowledge base. First, a temporal index is created for the knowledge content retrieved for each retrieval based on the model's call history, ensuring that data generated at different retrieval times has a distinguishable temporal location. Then, semantic association is performed on each risk indicator and regulatory rule based on the model's current inference task. Content belonging to the credit scoring calculation link is marked as belonging to one association group, while content belonging to the anti-fraud verification link is marked as belonging to another association group, thus isolating content from different risk perspectives. Finally, the knowledge content is incrementally arranged based on the temporal index and semantic association, inserting the latest regulatory requirements into the corresponding positions in the credit scoring link without affecting the order of existing content in the anti-fraud link. This constructs a structurally correct and semantically coherent cache sequence, supporting the agent in generating rigorous risk control explanations and interpretations.

[0040] As another example, in digital healthcare scenarios, when an agent generates treatment recommendations or disease progression analysis, the Model Context Protocol (MTP) server typically retrieves medical data such as clinical guidelines, case follow-up summaries, and medication guidelines from the knowledge base multiple times. First, a temporal index is established based on the chronological order of different retrievals, allowing guideline updates, case conclusions, and drug contraindications to be assigned locatable segment numbers. Then, semantic association tags are applied to the segmented content based on the current treatment reasoning path, grouping content related to "post-relapse treatment pathways" into the same semantic group and content related to "medication safety matters" into different semantic groups, thus semantically distinguishing treatment strategies from safe medication content. Finally, incremental sorting of the medical content is performed based on the temporal index and semantic association tags, automatically inserting newly added medication contraindications into the corresponding "medication safety matters" position without altering the semantic order of the "post-relapse treatment pathway" link. This forms a logically stable cache sequence, providing structured knowledge support for the agent to generate reliable treatment recommendations.

[0041] In a preferred embodiment, after step S2, the obtained cache sequence can be optimized, specifically including steps S24 to S26.

[0042] S24. Establish time-series indexes for the knowledge base retrieval results obtained multiple times to identify the generation order of the retrieval results from different knowledge bases; S25. Based on the intermediate state of the model reasoning, semantic association labels are applied to the segment numbers corresponding to the knowledge base retrieval results so that different association labels are assigned to segments corresponding to different reasoning chains. S26. According to the temporal index and semantic association identifier, the segments corresponding to different inference chains are incrementally arranged to perform segmented incremental insertion processing on the original cache sequence, so as to obtain the updated cache sequence.

[0043] Through steps S24 to S26, the knowledge base retrieval results obtained multiple times are jointly reconstructed based on temporal indexing and semantic association identifiers, enabling cross-round retrieval content to have a distinguishable generation order and semantic affiliation before integration. Therefore, segmented content from different inference chains can be located and arranged simultaneously according to the time and semantic dimensions when inserted into the original cache sequence, completing incremental content insertion without destroying the existing semantic structure. Furthermore, by generating an updated cache sequence, the model can stably acquire knowledge content that matches the current inference target during subsequent inference references, avoiding deviations in inference logic due to stacked retrieval content, overlapping topics, or disordered order, and improving the organization and reference certainty of external knowledge in the inference chain.

[0044] As a preferred embodiment, the segmented incremental insertion process in step S26 above may specifically include the following steps S261 to S263.

[0045] S261. Check whether a segment with the same associated identifier already exists at the insertion target position to determine whether a segment conflict has occurred.

[0046] S262. When a segment conflict is detected, the conflicting segment and the newly added segment are judged sequentially according to the time sequence index to determine the target insertion segment.

[0047] S263. Write the target insertion segment to the position corresponding to the original cache sequence to overwrite and update the cache sequence.

[0048] Through steps S261 to S263, an insertion control mechanism based on association identifier conflict detection and temporal index comparison is introduced into the segmented incremental insertion process. This mechanism can identify and handle semantic conflicts or overwriting relationships with existing segments when inserting a target segment. Therefore, the addition of a segment will not disrupt the original semantic chain or cause inference order disorder when written to the cache sequence, achieving local updates of the cache sequence while maintaining structural integrity. Furthermore, by overwriting the target inserted segment, the updated cache sequence maintains the continuity of field reference order and semantic association relationships, thereby providing a deterministic and stable knowledge reference structure for the model in subsequent inference stages.

[0049] S3. Call the preset desensitization tool to identify and desensitize sensitive fields in the text content corresponding to the cache sequence, and obtain the intermediate desensitization result.

[0050] The core technology of step S3 lies in real-time sensitive information filtering of external knowledge base content during the model inference stage, rather than post-processing after model output. This places the privacy protection mechanism at the forefront of the inference chain, achieving process-level sensitive information control. The sensitive field identification process analyzes the fields in the cache sequence segment by segment based on the desensitization rule base, and matches the corresponding desensitization strategy according to the field structure and semantic features, replacing, masking, or trimming the original fields into desensitized fields that meet security requirements. In fintech scenarios, borrower names, ID numbers, bank card numbers, customer related party information, risk tags, etc., are converted into desensitized identifiers through desensitization strategies before being referenced by the intelligent agent, thereby ensuring that risk control analysis text and credit description content do not leak customer privacy. In digital healthcare scenarios, sensitive information involving personally identifiable information in patient names, medical record numbers, hospitalization numbers, contact information, and past medical history has been desensitized and replaced before being added to the inference sequence, so that treatment suggestions, disease analysis, or health consultation texts still maintain the integrity of medical content but do not contain personally identifiable information. Therefore, step S3 achieves the structured cleaning of sensitive information in the model inference chain, enabling external knowledge to safely participate in the inference and generation process.

[0051] As an example, a text masking tool can be built to automatically identify and mask sensitive fields involved in model inference, thereby transforming traditional text masking methods into a programmable tool that can be called by large language models. This tool can perform pattern matching detection and masking replacement of sensitive fields based on a pre-defined masking rule base, such as masking the middle four digits of a phone number or adding a mask to the middle numerical portion of an ID number. It can also automatically match the corresponding rules based on the input content to generate masked field replacements. Furthermore, the tool can be encapsulated into a callable tool interface according to the MCP protocol framework, allowing large language models to dynamically input text content into the tool for sensitive field identification and masking replacement during the inference process, and receive the masked text as input for subsequent inference and context alignment, thus forming a seamless automated processing chain between sensitive field processing and model inference.

[0052] As an optional implementation, please refer to Figure 3 , Figure 3 This is a schematic diagram of the execution flow of obtaining intermediate desensitization results in the desensitization processing method for the output data of the large language model intelligent agent provided in the embodiments of this application, as shown in the figure. Figure 3 As shown, the process may specifically include the following steps S31 to S33.

[0053] S31. Establish a time-series index based on the model call history stored in the key-value cache, and segment and number the obtained knowledge base retrieval results, with the segment number corresponding to the time-series index.

[0054] In step S31, the content in the cache sequence is assigned a specific time sequence number, making the reference order of knowledge fragments and the reasoning history of the model traceable, providing a strict temporal positioning basis for subsequent semantic association identification and content arrangement.

[0055] S32. Based on the intermediate state of the model inference, semantic association labels are applied to the content corresponding to the segment number so that segments with different semantic association relationships are assigned different association labels.

[0056] In particular, step S32 can distinguish at the reasoning level whether the content belongs to the same reasoning logic chain or different reasoning topics, thereby ensuring that the subsequent content arrangement stage forms a semantic closed loop and avoiding multiple topics being confused or cross-referenced during the reasoning process.

[0057] S33. Arrange the content corresponding to the segment number according to the time sequence index and the association identifier, and generate a cache sequence based on the content corresponding to the arranged segment number.

[0058] In step S33, by incorporating both temporal order and semantic relationship into the content sorting mechanism, the content of different reasoning topics can remain continuous in their respective positions, while new content is inserted without disrupting the original semantic structure, thereby constructing a desensitized cache sequence that can be stably referenced by the model.

[0059] As an example, in fintech, when an agent generates a corporate credit assessment document, the Model Context Protocol (MTP) server retrieves historical credit records, industry risk warnings, and contract performance information at different stages. First, it establishes a time-series index for financial records from different sources based on the retrieval time, ensuring that credit history, risk indicators, and performance tracking results each correspond to a specific time sequence. Then, it semantically identifies segments of content based on the current credit analysis theme, marking content belonging to "Credit Stability Assessment" as one semantic group and content belonging to "Debt Repayment Ability and Cash Flow Analysis" as another. Finally, it incrementally arranges the content based on the time-series index and semantic association identifiers, inserting the latest performance tracking results into the corresponding position in "Debt Repayment Ability and Cash Flow Analysis" without disrupting the logical order of the "Credit Stability Assessment" chain. This generates a structurally stable and thematically clear content sequence, providing accurate knowledge structure support for the generation of the credit analysis document.

[0060] As another example, in digital healthcare applications, when an agent is used to generate analysis of tumor recurrence treatment plans, it repeatedly retrieves information such as updated guidelines, case follow-up statistics, and medication contraindications from the medical knowledge base. First, a temporal index is established for various types of medical content based on the retrieval time sequence, allowing for distinguishable temporal positioning of the latest guideline updates, latest follow-up conclusions, and previous drug contraindication records. Then, semantic association tags are applied to the content based on the reasoning theme, grouping content related to "treatment pathways after recurrence" into one semantic group and content related to "anti-cancer drug safety" into another. Finally, incremental sorting is performed based on the temporal index and semantic association tags, inserting newly emerging anti-cancer drug contraindications into the corresponding position within the "anti-cancer drug safety" theme without disrupting the integrity of the "treatment pathways after recurrence." This results in a content sequence with clinical logical continuity, providing structured medical evidence for the agent to generate reliable treatment recommendations.

[0061] As another optional implementation, the process of calling a preset desensitization tool in step S3 above to identify and desensitize sensitive fields of the text content corresponding to the cache sequence through the desensitization tool may specifically include the following steps S34 to S36.

[0062] S34. Detect whether the text content corresponding to the cache sequence meets the preset triggering conditions for triggering desensitization processing. If the preset triggering conditions are met, generate a desensitization trigger signal.

[0063] S35. Receive the desensitization trigger signal and start the preset desensitization tool to perform sensitive field identification processing on the text content corresponding to the cache sequence in order to locate the target field area corresponding to the sensitive field.

[0064] S36. After the sensitive field identification is completed, the target field area is desensitized to obtain the desensitized field, and the desensitized field is written to the corresponding position in the cache sequence.

[0065] Through steps S34 to S36, sensitive field identification and on-demand desensitization processing based on trigger conditions are implemented for the text content corresponding to the cache sequence. This links the execution of the desensitization tool with the actual occurrence of sensitive information, thereby avoiding meaningless processing of non-sensitive content. Specifically, by locating and limiting the sensitive field region, the desensitization operation only applies to the target word field region, without affecting the semantic structure and text layout of non-sensitive content in the cache sequence. Furthermore, by writing the desensitized fields back to their original positions to form an updated cache sequence, the cache sequence maintains the same field arrangement and reference path as the original content even after the sensitive information is replaced. This ensures semantic integrity while achieving controllable cleanup of sensitive information in the inference chain, improving the security and usability of the model output content.

[0066] S4. Based on the preset context alignment strategy, the desensitized intermediate results and the generated content of the large language model are semantically aligned and spliced ​​to generate the desensitized target output text.

[0067] The core technical mechanism of step S4 lies in introducing contextual semantic anchors during the model output stage. This ensures that the anonymized content retains its contextual meaning after being inserted into the inference chain, without disrupting the generated semantic logic. The context alignment strategy consists of semantic connection location, fragment pruning / extraction rules, and splicing strategies, used to ensure a smooth semantic connection between the anonymized content and the original model output. In fintech scenarios, this mechanism allows descriptions in risk control analysis documents that originally contained customer fields to maintain logical coherence even after being replaced with anonymized content. For example, "Risk rating adjustment due to X past overdue records of the customer" becomes a complete, readable statement without the original sensitive fields. In digital healthcare scenarios, this mechanism allows anonymized case descriptions to be naturally embedded in treatment recommendation text. For example, "The treatment plan was changed because the patient experienced a serious adverse reaction to a certain drug during previous treatment," where the patient's identity information has been anonymized, but the medical semantics remain unaffected. Therefore, step S4 achieves semantic-level fusion between the anonymized content and the model-generated content, ensuring that the output text maintains readability and professionalism while ensuring security and compliance.

[0068] As an example, a context alignment mechanism can be built to achieve semantic integration between desensitized fragments and content generated by a large language model, ensuring the coherence and integrity of the final output text. This mechanism can merge historical token caches from the model's inference process with the current token stream content, and trim, extract, and splice the desensitized text fragments according to their contextual positions, so that the desensitized content maintains a coherent narrative structure and stable textual logic after replacing sensitive fields. In specific implementation, the ContextAlignment class, which implements alignment functionality, can be used to integrate and align the desensitized field fragments with the token stream context based on their semantic connection positions, generating the final output text without sensitive fields after replacement. This ensures that the output of the large language model neither exposes sensitive information nor compromises the complete expressive effect.

[0069] As an optional implementation, please refer to Figure 4 , Figure 4 This is a schematic diagram illustrating the execution flow of obtaining the target output text in the output data desensitization processing method of the large language model intelligent agent provided in the embodiments of this application, as shown below. Figure 4 As shown, the process can specifically include the following steps S41 to S43.

[0070] S41. Perform context position identification on the desensitized intermediate results to locate the semantic connection position between the desensitized intermediate results and the generated content of the large language model.

[0071] The key technical point of step S41 is to locate the insertion point based on the model reasoning context, semantic breakpoints, topic continuation points, etc., so that the desensitized fragments can be embedded into the generated sequence with minimal semantic perturbation, providing a precise anchor for subsequent fragment splicing.

[0072] S42. Based on the semantic connection position, perform content trimming and / or content extraction processing on the desensitized intermediate results to obtain aligned segments that connect with the generated content of the large language model.

[0073] In step S42, redundant descriptions are trimmed, core content is extracted, or field lengths are standardized to give the desensitized fragments a form that is compatible with the semantic dimension and syntactic structure of the context, thereby reducing the risk of semantic breaks or syntactic incoherence caused by splicing.

[0074] S43. The aligned fragments and the generated content of the large language model are concatenated according to their semantic connection positions to obtain the desensitized target output text.

[0075] The splicing mechanism in step S43 ensures that the desensitized fragments form a continuous semantic chain after insertion, so that the final output text simultaneously meets the requirements of complete expression and privacy protection standards, providing a final processing step for transforming the desensitized intermediate results into externally usable output.

[0076] As an example, in a fintech scenario, when an agent generates a loan risk control statement, the anonymized risk fields need to be semantically fused with the original risk control text generated by the model. First, semantic connection points in the risk control statement text are located, such as "reasons for risk adjustment," "factors affecting score changes," and "overdue pattern analysis," to determine the insertion points for the anonymized content. Then, based on these connection points, the anonymized segments are trimmed or extracted, removing irrelevant background information and retaining only core fields directly related to credit risk logic, such as the analysis segment "credit rating decline due to increased overdue payments." Finally, this aligned segment is inserted into the corresponding position in the risk control statement, making the final output a natural, continuous text, such as "the main reason for this period's risk level adjustment is the increase in the cumulative number of anonymized risk events," thus displaying key risk control indicators without exposing the original sensitive information.

[0077] As another example, in digital healthcare scenarios, when an agent outputs analysis text of tumor treatment plans, the desensitized medical history fragments need to seamlessly integrate with the treatment recommendations. First, semantic connection points are located in the model-generated treatment text, such as semantic nodes like "previous medication reactions," "treatment tolerance," and "relapse triggers," to determine the insertion position of the desensitized medical history. Then, based on this position, the desensitized fragments are trimmed or extracted, removing background descriptions less relevant to the treatment topic and retaining only core content directly related to the treatment plan logic, such as "previously experienced severe adverse reactions to a certain drug." Finally, this aligned fragment is semantically concatenated with the treatment recommendations, resulting in an output format similar to "Due to the desensitized record of previous adverse reactions, this treatment plan recommends adjusting the drug combination," maintaining medical professional logic while avoiding the exposure of personal privacy or identifiable information.

[0078] S5. Return the desensitized target output text to the agent, and output the target output text through the agent.

[0079] As an example, please continue reading Figure 5 , Figure 5 This is an example structural diagram of the intelligent agent calling external tools and resources based on the model context protocol in the large language model intelligent agent output data desensitization processing method provided in the embodiments of this application, as shown in the following example. Figure 5As shown, the agent establishes a bidirectional interactive relationship with the Model Context Protocol (MCP Server) through the Model Context Protocol. The MCP Server, as an intermediate communication layer, connects to external web services and a knowledge base (RAG) based on retrieval enhancement through API interfaces. This enables the agent to call external web services or knowledge bases through the MCP Server to obtain domain knowledge, business data, or real-time information when performing inference tasks, thereby providing referenceable external knowledge support for subsequent model inference and content generation.

[0080] The data anonymization method for the output of a large language model agent provided in this application integrates external knowledge retrieval, inference state maintenance, sensitive field identification, and anonymization replacement into a closed-loop processing mechanism by introducing a model context protocol server, key-value cache, anonymization tools, and context alignment strategies into the inference chain. This ensures that sensitive information is identified and cleaned before output, maintaining semantic continuity and expressive integrity before external output. On the one hand, this allows the model to securely call external knowledge bases and tools during inference while preventing original sensitive fields from entering the model's generated results. On the other hand, context alignment and splicing strategies ensure that the anonymized content remains logically coherent, professionally readable, and business-effective after replacement, thereby enabling secure and usable output of large language models in highly sensitive privacy scenarios such as finance and healthcare.

[0081] Please continue reading. Figure 6 , Figure 6 This is a schematic diagram of the system structure of the output data desensitization processing device for the large language model intelligent agent provided in the embodiments of this application, as shown below. Figure 6 As shown, the output data desensitization processing device 50 of the large language model intelligent agent includes: a knowledge base retrieval module 61, a cache sequence generation module 62, a desensitization intermediate result module 63, an output text generation module 64, and an output text feedback module 65.

[0082] The knowledge base retrieval module 61 is specifically used to construct a model context protocol server, enabling the agent to call the knowledge base through the model context protocol server to obtain the knowledge base retrieval results.

[0083] The cache sequence generation module 62 is specifically used to write the knowledge base retrieval results to the key-value cache in the model context protocol server, and generate a corresponding cache sequence based on the key-value cache and the intermediate state of model inference.

[0084] The desensitization intermediate result module 63 is specifically used to call a preset desensitization tool, and to perform sensitive field identification and desensitization processing on the text content corresponding to the cache sequence through the desensitization tool to obtain the desensitization intermediate result.

[0085] The output text generation module 64 is specifically used to perform semantic alignment and splicing processing on the desensitized intermediate results and the generated content of the large language model based on a preset context alignment strategy, so as to generate the desensitized target output text.

[0086] The output text feedback module 65 is used to return the desensitized target output text to the intelligent agent, and the intelligent agent outputs the target output text.

[0087] As an optional implementation, the desensitization intermediate result module 63 is further specifically used to perform rule matching and identification on the field content in the cache sequence based on a preset desensitization rule base to determine the set of sensitive fields that need to be desensitized; to call the corresponding desensitization strategy according to the structural characteristics of different fields in the sensitive field set, and to perform character replacement, character masking and / or content pruning on each target field to generate desensitized field content with the same field character layout as the original field; and to write the desensitized field content to the position in the cache sequence corresponding to the original field, so that the cache sequence is converted into a desensitization intermediate result that can be processed by the context alignment strategy.

[0088] As an optional implementation, the cache sequence generation module 62 is further configured to establish a time-series index based on the model call history stored in the key-value cache, segment and number the obtained knowledge base retrieval results, wherein the segment number corresponds to the time-series index; semantically associate the content corresponding to the segment number according to the intermediate state of the model inference, so that segments with different semantic relationships are assigned different association identifiers; arrange the content corresponding to the segment number according to the time-series index and the association identifier, and generate the cache sequence based on the arranged content corresponding to the segment number.

[0089] As an optional implementation, the output text generation module 64 is further specifically used to perform context position recognition on the desensitized intermediate result to locate the semantic connection position between the desensitized intermediate result and the generated content of the large language model; perform content trimming and / or content extraction processing on the desensitized intermediate result according to the semantic connection position to obtain an aligned segment that connects with the generated content of the large language model; and concatenate the aligned segment with the generated content of the large language model according to the semantic connection position to obtain the desensitized target output text.

[0090] As an optional implementation, the desensitization intermediate result module 63 is further configured to detect whether the text content corresponding to the cache sequence meets the preset triggering conditions for triggering desensitization processing. If the preset triggering conditions are met, a desensitization trigger signal is generated; the desensitization trigger signal is received, and a preset desensitization tool is activated to perform sensitive field identification processing on the text content corresponding to the cache sequence to locate the target field area corresponding to the sensitive field; after the sensitive field identification is completed, the target field area is desensitized to obtain the desensitized field, and the desensitized field is written to the position corresponding to the cache sequence.

[0091] As an optional implementation, the cache sequence generation module 62 is further configured to establish temporal indexes for the multiple knowledge base retrieval results to identify the generation order of different knowledge base retrieval results; based on the intermediate state of the model inference, semantically associate the segment numbers corresponding to the knowledge base retrieval results so that different association identifiers are assigned to segments corresponding to different inference chains; incrementally arrange the segments corresponding to different inference chains according to the temporal index and the semantic association identifier to perform segmented incremental insertion processing on the original cache sequence to obtain the updated cache sequence.

[0092] As an optional implementation, the cache sequence generation module 62 is further configured to detect whether a segment with the same associated identifier already exists at the insertion target position to determine whether a segment conflict has occurred; when a segment conflict is detected, the conflicting segment and the newly added segment are compared sequentially according to the time sequence index to determine the target insertion segment; the target insertion segment is written to the position corresponding to the original cache sequence to overwrite and update the cache sequence.

[0093] It should be noted that the above-mentioned large language model intelligent agent output data desensitization processing device can execute the large language model intelligent agent output data desensitization processing method provided in the embodiments of this application, and has the corresponding functional modules and beneficial effects of the method. Technical details not described in detail in the embodiments of the large language model intelligent agent output data desensitization processing device can be found in the large language model intelligent agent output data desensitization processing method provided in the embodiments of this application.

[0094] Figure 7 This is a schematic diagram of the hardware structure of the electronic device for performing the output data desensitization processing method of the large language model intelligent agent provided in the embodiments of this application, as shown below. Figure 7 As shown, the electronic device 700 includes: One or more processors 710 and memory 720, Figure 7 Take the 710 processor as an example.

[0095] The processor 710 and memory 720 can be connected via a bus or other means. Figure 7 Taking the example of a connection between China and Israel via a bus.

[0096] The memory 720, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules, such as the program instructions / modules corresponding to the output data desensitization processing method of the large language model intelligent agent in the embodiments of this application. The processor 710 executes various functional applications and data processing of the server by running the non-volatile software programs, instructions, and modules stored in the memory 720, thereby implementing the output data desensitization processing method of the large language model intelligent agent in the above-described method embodiments.

[0097] The memory 720 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created based on the use of the large language model agent's output data desensitization processing device. Furthermore, the memory 720 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 embodiments, the memory 720 may optionally include memory remotely located relative to the processor 710, and these remote memories can be connected to the large language model agent's output data desensitization processing 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.

[0098] The one or more modules are stored in the memory 720. When executed by the one or more processors 710, they perform the output data desensitization processing method of the large language model agent in any of the above method embodiments. For example, they perform the above-described... Figure 2 Method steps S1 to S5, Figure 3 Method steps S31 to S33, Figure 4 Method steps S41 to S43 are implemented. Figure 6 The functions of modules 61-65 in the document.

[0099] The above-described product can perform the methods provided in the embodiments of this application, and has the corresponding functional modules and beneficial effects for performing the methods. Technical details not described in detail in this embodiment can be found in the methods provided in the embodiments of this application.

[0100] This application provides a non-volatile computer-readable storage medium storing computer-executable instructions that are executed by one or more processors, for example... Figure 7One of the processors 710 can enable one or more of the processors to execute the output data desensitization processing method of the large language model agent in any of the above method embodiments, for example, to execute the above-described... Figure 2 Method steps S1 to S5, Figure 3 Method steps S31 to S33, Figure 4 Method steps S41 to S43 are implemented. Figure 6 The functions of modules 61-65 in the document.

[0101] This application provides a computer program product, which includes a computer program stored on a non-volatile computer-readable storage medium. The computer program includes program instructions, which, when executed by an electronic device, enable the electronic device to perform the output data desensitization processing method of the large language model intelligent agent in any of the above method embodiments. For example, it can perform the above-described... Figure 2 Method steps S1 to S5, Figure 3 Method steps S31 to S33, Figure 4 Method steps S41 to S43 are implemented. Figure 6 The functions of modules 61-65 in the document.

[0102] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.

[0103] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented using software and a general-purpose hardware platform, or of course, using hardware. Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.

[0104] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and not to limit them; under the concept of this application, the technical features of the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other variations of different aspects of this application as described above, which are not provided in detail for the sake of brevity; although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.

Claims

1. A method for desensitizing the output data of a large language model intelligent agent, characterized in that, include: A model context protocol server is constructed, enabling the agent to invoke the knowledge base through the model context protocol server to obtain knowledge base retrieval results; The retrieval results of the knowledge base are written to the key-value cache in the model context protocol server, and a corresponding cache sequence is generated based on the key-value cache and the intermediate state of model inference. A preset desensitization tool is invoked to identify and desensitize sensitive fields in the text content corresponding to the cache sequence, thereby obtaining an intermediate desensitization result. Based on a preset context alignment strategy, the desensitized intermediate results and the generated content of the large language model are semantically aligned and spliced ​​to generate the desensitized target output text. The de-identified target output text is returned to the agent, and the target output text is output through the agent.

2. The method for desensitizing the output data of a large language model agent according to claim 1, characterized in that, The step of using the desensitization tool to identify and desensitize sensitive fields in the text content corresponding to the cache sequence to obtain intermediate desensitization results includes: Based on a preset desensitization rule base, the field content in the cache sequence is matched and identified by rules to determine the set of sensitive fields that need to be desensitized. Based on the structural characteristics of different fields in the sensitive field set, the corresponding desensitization strategies are invoked to perform character replacement, character masking and / or content pruning on each target field to generate desensitized field content with the same character layout as the original field. Write the content of the de-identified field into the position in the cache sequence corresponding to the original field, so that the cache sequence is converted into a de-identified intermediate result that can be processed by the context alignment strategy.

3. The method for desensitizing the output data of a large language model agent according to claim 1, characterized in that, The step of writing the knowledge base retrieval results to the key-value cache in the model context protocol server, and generating a corresponding cache sequence based on the key-value cache and the intermediate state of model inference, includes: A time-series index is established based on the model call history stored in the key-value cache, and the obtained knowledge base retrieval results are segmented and numbered, with the segment number corresponding to the time-series index. Based on the intermediate state of the model inference, the content corresponding to the segment number is semantically associated, so that segments with different semantic relationships are assigned different association identifiers; Arrange the content corresponding to the segment number according to the time sequence index and the association identifier, and generate the cache sequence according to the arranged content corresponding to the segment number.

4. The method for desensitizing the output data of a large language model agent according to claim 1, characterized in that, The step of semantically aligning and concatenating the desensitized intermediate results and the generated content of the large language model based on a preset context alignment strategy to generate the desensitized target output text includes: Context position identification is performed on the de-identified intermediate results to locate the semantic connection position between the de-identified intermediate results and the generated content of the large language model; Based on the semantic connection position, the desensitized intermediate result is processed by content trimming and / or content extraction to obtain an aligned segment that connects with the generated content of the large language model; The aligned fragments and the generated content of the large language model are concatenated according to the semantic connection positions to obtain the desensitized target output text.

5. The method for desensitizing the output data of a large language model intelligent agent according to claim 1, characterized in that, The step of calling a preset desensitization tool and using the desensitization tool to identify and desensitize sensitive fields in the text content corresponding to the cache sequence includes: The system detects whether the text content corresponding to the cached sequence meets the preset triggering conditions for triggering de-identification processing. If the preset triggering conditions are met, a de-identification trigger signal is generated. The desensitization trigger signal is received, and a preset desensitization tool is started to perform sensitive field identification processing on the text content corresponding to the cache sequence in order to locate the target field area corresponding to the sensitive field. After the sensitive field identification is completed, the target field area is desensitized to obtain the desensitized field, and the desensitized field is written to the position corresponding to the cache sequence.

6. The method for desensitizing the output data of a large language model agent according to claim 1, characterized in that, After the step of generating the corresponding cache sequence based on the key-value cache and the intermediate state of model inference, the method further includes: A time-series index is established for each of the multiple knowledge base retrieval results to identify the generation order of the retrieval results from different knowledge bases; Based on the intermediate state of the model inference, the segment numbers corresponding to the knowledge base retrieval results are semantically associated with each segment, so that different association identifiers are assigned to segments corresponding to different inference chains. The segments corresponding to different inference chains are incrementally arranged according to the temporal index and the semantic association identifier, so as to perform segmented incremental insertion processing on the original cache sequence and obtain the updated cache sequence.

7. The method for desensitizing the output data of a large language model agent according to claim 6, characterized in that, The step of performing segmented incremental insertion processing on the original cache sequence includes: Check if a segment with the same associated identifier already exists at the insertion target location to determine if a segment conflict has occurred; When a segmentation conflict is detected, the conflicting segment and the newly added segment are compared sequentially according to the time sequence index to determine the target insertion segment; The target insertion segment is written to the position corresponding to the original cache sequence to overwrite and update the cache sequence.

8. A device for desensitizing the output data of a large language model intelligent agent, characterized in that, include: The knowledge base retrieval module is used to construct a model context protocol server, enabling the agent to call the knowledge base through the model context protocol server to obtain knowledge base retrieval results; The cache sequence generation module is used to write the knowledge base retrieval results to the key-value cache in the model context protocol server, and generate a corresponding cache sequence based on the key-value cache and the intermediate state of model inference. The desensitization intermediate result module is used to call a preset desensitization tool, and use the desensitization tool to identify and desensitize sensitive fields in the text content corresponding to the cache sequence to obtain the desensitization intermediate result; The output text generation module is used to perform semantic alignment and splicing processing on the desensitized intermediate results and the generated content of the large language model based on a preset context alignment strategy, so as to generate the desensitized target output text. The output text feedback module is used to return the de-identified target output text to the intelligent agent, and the intelligent agent outputs the target output text.

9. An electronic device, characterized in that, include: At least one processor; as well as, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, which, when executed by the at least one processor, enables the at least one processor to perform the output data desensitization processing method for a large language model agent as described in any one of claims 1-7.

10. A non-volatile computer-readable storage medium, characterized in that, The non-volatile computer-readable storage medium stores computer-executable instructions, which, when executed by an electronic device, cause the electronic device to perform the output data desensitization processing method of the large language model intelligent agent according to any one of claims 1-7.