A prompt word privacy protection method, device, equipment, product and medium
By identifying and encrypting privacy entities in cloud-based LLM interactions using a local large model, and combining symmetric encryption and distributed storage technologies, the problem of privacy information leakage in existing technologies is solved, achieving privacy protection and information restoration in cloud-based LLM interactions.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-14
- Publication Date
- 2026-03-31
AI Technical Summary
Existing technologies struggle to effectively protect specific privacy entities from being leaked when users interact with cloud-based generative large language models (LLMs). Furthermore, existing solutions such as MPC and Presidio suffer from high resource consumption or irreversible anonymization operations that result in information that cannot be restored.
The system uses a local large model with preset thought chain prompts to identify privacy entities. It then uses symmetric encryption and desensitization techniques to encrypt and replace the privacy entities, generating security prompts. After interaction with the cloud LLM, the system is decrypted and restored. Combined with a secret sharing engine and distributed storage technology, the system ensures the security and availability of privacy data.
It effectively protects privacy information during cloud-based LLM interactions, ensuring data is not leaked and can be decrypted and restored when needed, maintaining information integrity and natural language expression, while reducing resource consumption and operating costs.
Smart Images

Figure CN121502824B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, specifically to a method, apparatus, device, product, and medium for protecting privacy of prompt words. Background Technology
[0002] Currently, generative large language models (LLMs) have become a major focus of industry attention due to their powerful understanding of language logic and strong domain scalability. However, compared to accessing traditional search engines, interacting with cloud-based LLM services is more likely to leak personal privacy, trade secrets, and various sensitive information, thus raising information security issues.
[0003] In related technologies, some solutions achieve secure inference through the Secure Multi-Party Computation (MPC) protocol, which is a fully cryptographic solution. MPC uses cryptographic means to ensure that the data involved in the computation is not leaked, and through ciphertext function computation, it ensures that the result is identical to the plaintext computation. However, in many practical applications, the core user requirement is not to protect all information in the entire prompt, but only to ensure that specific privacy entities (such as personally identifiable information) contained within it are not leaked. The "all or nothing" protection granularity provided by MPC solutions appears overly redundant and costly in such scenarios. Summary of the Invention
[0004] This application provides a method, apparatus, device, product, and medium for protecting privacy in prompt words, which can conceal privacy information in user prompt words, protect privacy data from leakage, and decrypt and restore privacy data.
[0005] This application provides a method for protecting the privacy of prompt words, including:
[0006] Obtain the original prompt word from the user's encrypted request information;
[0007] The local large model based on the preset thought chain prompt words performs privacy word recognition on the original prompt words to obtain privacy entities;
[0008] The privacy entity is encrypted to obtain the corresponding encrypted entity;
[0009] Based on the encrypted entity, the privacy entity in the original prompt word is replaced accordingly to obtain the security prompt word;
[0010] Obtain the original answer generated by the cloud-based big data model based on the security prompt words;
[0011] The encrypted entities in the original answer are decrypted to obtain the restored answer, which is then fed back to the user.
[0012] Optionally, the training method for the local large model of the preset thought chain prompts includes:
[0013] Obtain the original task text, which includes at least one privacy entity and the privacy term tag corresponding to the privacy entity;
[0014] A thought chain template is constructed for the original task text, and the original task text is rewritten in format based on the thought chain template to obtain sample data. The sample data includes privacy recognition instructions, thought chains, and privacy recognition results. The privacy recognition results include the privacy entity and the privacy word tags corresponding to the privacy entity.
[0015] The privacy recognition instruction is used as the target input of the pre-trained basic large model, and the thought chain and the privacy recognition result are used as the target output of the pre-trained basic large model. The pre-trained basic large model is fine-tuned so that it learns the privacy recognition reasoning pattern based on the thought chain, thus obtaining the local large model.
[0016] Optionally, the thought chain template includes:
[0017] A privacy word recognition column is used to identify privacy words and one or more privacy entities under the privacy words in the original task text based on a preset privacy word list, wherein the privacy word list includes a variety of privacy word tags;
[0018] The category verification column is used to perform compliance verification on one or more privacy entities under the privacy term based on the verification rules corresponding to the privacy term, and to filter out compliant privacy entities.
[0019] The context analysis section is used to perform security assessments on compliant privacy entities based on the context of the original task text, and to filter out privacy entities that are at risk of leakage.
[0020] The summary section is used to summarize the privacy words present in the original task text and the privacy entities under the privacy words that have the risk of leakage.
[0021] Optionally, the privacy entity is encrypted to obtain a corresponding encrypted entity, including:
[0022] Determine the privacy term tags corresponding to the privacy entity;
[0023] Based on the encryption rules corresponding to the privacy term tags, the privacy entity is symmetrically encrypted using a symmetric key to obtain ciphertext data.
[0024] Based on preset desensitization rules, the ciphertext characters in the ciphertext data are replaced with corresponding Greek characters to obtain an encrypted entity, which carries the privacy term tag.
[0025] Decrypting the encrypted entities in the original response yields the restored response, including:
[0026] Based on preset desensitization rules, the Greek characters in the encrypted entity are replaced with the corresponding ciphertext characters to obtain ciphertext data;
[0027] Based on the decryption rules corresponding to the privacy term tags, the ciphertext data is symmetrically decrypted using the same symmetric key to obtain the privacy entity;
[0028] The encrypted entities in the original answer are replaced with the corresponding private entities to obtain the restored answer.
[0029] Optionally, the privacy entity is encrypted to obtain a corresponding encrypted entity, including:
[0030] The privacy entity is sharded based on the secret sharing engine to obtain N original shards, and the shard metadata of each original shard is recorded. The shard metadata includes the shard number and username corresponding to the original shard. The secret sharing engine is used to restore the privacy entity based on any N-1 original shards, where N is a positive integer.
[0031] Symmetric encryption is performed on each original fragment to obtain N encrypted fragments, wherein the encrypted entity corresponding to the privacy entity is obtained by combining the N encrypted fragments;
[0032] The N encrypted fragments are stored in different database tables respectively;
[0033] Decrypting the encrypted entities in the original response yields the restored response, including:
[0034] Based on the username, a query is initiated to all database tables to obtain N-1 encrypted shards and shard numbers corresponding to the username;
[0035] Symmetrically decrypt the N-1 encrypted fragments to obtain N-1 original fragments;
[0036] Based on the N-1 original fragments and their corresponding fragment numbers, the privacy entity is reconstructed using the secret sharing engine;
[0037] The encrypted entities in the original answer are replaced with the corresponding private entities to obtain the restored answer.
[0038] Optionally, the fragment metadata may also include a decryption count threshold and an expiration timestamp;
[0039] Decrypting the encrypted entities in the original answer to obtain the restored answer also includes:
[0040] Get the historical decryption count and current timestamp;
[0041] If the historical decryption count is less than the decryption count threshold, and the current timestamp is less than the expiration timestamp, then an access token is generated;
[0042] Based on the access token and the username, queries are initiated to all database tables to obtain N-1 encrypted fragments and fragment numbers corresponding to the username.
[0043] This application embodiment also provides a prompt word privacy protection device, including:
[0044] The original prompt word acquisition module is used to acquire the original prompt words in the user's encrypted request information;
[0045] The privacy word recognition module is used to perform privacy word recognition on the original prompt words based on the local large model of preset thought chain prompt words to obtain privacy entities;
[0046] A privacy encryption module is used to encrypt the privacy entity to obtain the corresponding encrypted entity;
[0047] The security prompt word acquisition module is used to replace the privacy entities in the original prompt word with the corresponding encrypted entities to obtain the security prompt word;
[0048] The original answer acquisition module is used to acquire the original answer generated by the cloud-based large model based on the security prompt words;
[0049] The privacy decryption module is used to decrypt the encrypted entities in the original answer to obtain the restored answer, and then feed the restored answer back to the user.
[0050] This application also provides an electronic device, including a memory storing multiple instructions; the processor loads the instructions from the memory to execute the steps in any of the prompt word privacy protection methods provided in this application.
[0051] This application also provides a computer program product, including a computer program / instructions, which, when executed by a processor, implement the steps in any of the prompt word privacy protection methods provided in this application.
[0052] This application also provides a computer-readable storage medium storing a plurality of instructions adapted for loading by a processor to execute steps in any of the prompt word privacy protection methods provided in this application.
[0053] This application embodiment can obtain the original prompt words in the user's encrypted request information; perform privacy word recognition on the original prompt words based on the local large model of preset thought chain prompt words to obtain privacy entities; encrypt the privacy entities to obtain the corresponding encrypted entities; replace the privacy entities in the original prompt words with the corresponding encrypted entities to obtain security prompt words; obtain the original answer generated by the cloud large model based on the security prompt words; decrypt the encrypted entities in the original answer to obtain the restored answer, and feed the restored answer back to the user.
[0054] Therefore, by using a local big model with preset thought chain prompts, the privacy information in the prompts can be identified and hidden, so that the user's privacy data will not be leaked when using the third-party cloud big model normally. Furthermore, if there is hidden information in the original answer returned by the cloud big model, it can be decrypted and restored to provide the user with a complete and readable answer. Attached Figure Description
[0055] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0056] Figure 1 This is a flowchart illustrating a method for protecting privacy of prompt words provided in an embodiment of this application;
[0057] Figure 2 This is a schematic diagram illustrating the application of privacy data encryption and decryption in the embodiments of this application;
[0058] Figure 3 This is a schematic diagram of the structure of a prompt word privacy protection device provided in an embodiment of this application;
[0059] Figure 4 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0060] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0061] In recent years, effectively protecting user privacy while using cloud-based LLM services has become a critical technical issue that urgently needs to be addressed in this field. Currently, there are two main technical approaches to solving this problem:
[0062] One type is secure inference schemes based on the Secure Multi-Party Computation (MPC) protocol. This scheme is essentially a fully encrypted computation framework. Its core idea is that the data of all parties involved in the computation exists in encrypted form, and they collaborate through specific cryptographic protocols to obtain the same result as the plaintext computation, thus theoretically guaranteeing that the original data is not leaked throughout the computation process. However, for computationally intensive applications like LLM with a huge number of model parameters, the additional resource consumption of the MPC scheme makes it difficult to deploy and apply on a large scale in practice. Furthermore, in many practical applications, the core user requirement is not to protect all the information in the entire prompt, but only to ensure that specific privacy entities (such as personally identifiable information) contained within it are not leaked. The "all or nothing" protection granularity provided by the MPC scheme is overly redundant and costly in such scenarios.
[0063] Another type is privacy-preserving entity anonymization technology, exemplified by Microsoft Presidio. This approach combines rule-based matching with a local small named entity recognition (NER) model. First, its analyzer component detects privacy-preserving entities in the text. Then, the anonymizer component performs operations such as replacement, masking, or encryption on the identified entities to de-identify the privacy data. This solution avoids the high overhead of MPC. However, the Presidio solution has significant limitations. First, its anonymization operations (especially full replacement or masking) are usually irreversible, meaning they do not support the restoration of anonymized information in subsequent processing. This greatly limits its usability in scenarios requiring association with the original context or result backtracking. Second, and more critically, simple replacement operations often disrupt the language structure and semantic integrity of the original text, leading to deviations or unnatural expressions in the language of anonymized prompts. These deviations may negatively impact the understanding capabilities of cloud-based LLM, thereby reducing the quality and accuracy of the generated content.
[0064] In view of this, embodiments of this application provide a method for protecting privacy of prompt words, so as to conceal the privacy information in the user prompt words, protect the privacy data from being leaked, and be able to decrypt and restore the privacy data.
[0065] For details, please refer to Figure 1 The specific process for protecting the privacy of this prompt word can be as follows:
[0066] S110. Obtain the original prompt word from the user's encrypted request information.
[0067] In this embodiment, the encrypted request information refers to the complete data packet issued by the user that contains the original instructions or questions. The original prompt is a key part of the encrypted request information and contains explicit personal privacy data.
[0068] For example, a user might enter the following encrypted request: "Hi Xiaomi, please help me conceal the following private information: The customer's mobile number is 12345678912, please contact him today." The extracted original prompt is: "The customer's mobile number is 12345678912, please contact him today."
[0069] S120. Based on the preset thought chain prompt words, the local large model performs privacy word recognition on the original prompt words to obtain privacy entities.
[0070] In this embodiment, the local large model of the preset thought chain prompt words refers to an open-source large language model deployed in a user-controllable local environment (such as an enterprise intranet or trusted edge device). This model has been fine-tuned by thought chain and is specifically used to accurately identify and infer privacy information in the original prompt words in order to encrypt the privacy information and ensure that the privacy data does not leave the local trust domain.
[0071] Privacy terms refer to tags or categories that represent a type of sensitive information, such as "ID number," "mobile phone number," "bank card number," and "address." Privacy entities are actual data fragments that specifically appear in the original prompt and belong to a certain privacy term category. For example, in the original prompt above, "12345678912" is a privacy entity under the privacy term "mobile phone number."
[0072] Furthermore, the training methods for the local large-scale model with preset thought chain prompts include:
[0073] S210. Obtain the original task text, which includes at least one privacy entity and the privacy term tag corresponding to the privacy entity.
[0074] In this embodiment, the sources of the original task text include: public datasets, such as text containing personal privacy information filtered from news comments and social media posts; simulated generation, which involves a large amount of fictional but structurally realistic privacy data automatically generated through templates or rules, such as sentences containing fictional ID numbers and phone numbers; and business log data, which is text that has undergone strict anonymization processing of internal corporate communications, customer service records, etc., in compliance with privacy regulations.
[0075] Then, each privacy entity in the original task text is labeled with a corresponding privacy term tag. For example, in the original task text "Please conceal the privacy information in the following text: Zhang San's address is No. 19, Renmin Road, Haidian District, Xingfu City, and his phone number is 12345678912", the privacy term tag for "Province A, City B, District C, Road D, No. E" needs to be "address", and the privacy term tag for "12345678912" needs to be "phone number".
[0076] S220. Construct a thought chain template for the original task text, and rewrite the format of the original task text based on the thought chain template to obtain sample data. The sample data includes privacy recognition instructions, thought chains, and privacy recognition results. The privacy recognition results include privacy entities and privacy word tags corresponding to the privacy entities.
[0077] Specifically, the mind chain template includes:
[0078] The privacy word recognition column is used to identify privacy words and one or more privacy entities under each privacy word in the original task text based on a preset privacy word list.
[0079] The privacy terminology includes various privacy term tags, such as "name," "ID number," and "phone number." Specifically, the original task text can be scanned based on the privacy terminology to find privacy terms that match these category tags, or numeric strings, strings, or phrases that conform to these category characteristics. For example, suppose the original task text 1 is: "Ms. Wang provided the contact number 138********, but the address she provided—No. E, D Road, C District, B City, Province A—seems problematic. Based on her historical spending records, her address might be No. E, D Road, C District, B City, F Province." Then the following privacy terms and entities might be identified: 1. Name: "Ms. Wang" identified. 2. Contact number: numeric string "138********" identified. 3. Address: strings "No. E, D Road, C District, B City, Province A" and "No. E, D Road, C District, B City, F Province" identified.
[0080] The category verification section is used to perform compliance verification on one or more privacy entities under the privacy term based on the verification rules corresponding to the privacy term, and to filter out compliant privacy entities.
[0081] Each privacy term is associated with a verification rule. For example, for "ID number," the rules include length verification, address code verification, birth date code verification, and verification of the validity of the last check digit. For "address," a geocoding API might be called for verification. Thus, through rules such as format and check digits, the validity of identified privacy entities is verified to filter out genuine and valid privacy information. For example, for the original task text 1 above, its classification verification process might include: 1. Name "Ms. Wang": This is a common title, not a specific name. 2. Contact number "138********": The first three digits '138' belong to a valid number range, and the 11-digit length is correct, so it is determined to be a compliant mobile phone number. 3. Address "No. E, D Road, C District, B City, Province A": After verification, this address is a famous tourist attraction and is usually not used as a residential address; it may be invalid or fake, and in this scenario, it is marked as non-compliant. Address "No. E, D Road, C District, B City, Province F": After verification, this address is a real residential address and is marked as compliant. In other words, the final list of compliant privacy entities includes: contact number "138********" and address "No. E, D Road, C District, B City, F Province".
[0082] The Context Analysis section is used to perform security assessments on compliant privacy entities based on the context of the original task text, and to filter out privacy entities that are at risk of leakage.
[0083] The context analysis section is used to assess the security of real privacy information, analyzing whether disclosing this information poses a risk in a specific context. For example, for the original task text 1 above, the context analysis process might include: 1. Contact number "138********": related to property security, high risk. 2. Address "No. E, D Road, C District, B City, F Province": related to residential security, high risk. That is, the final filtered privacy entities with a risk of disclosure include: contact number "138********" and address "No. E, D Road, C District, B City, F Province".
[0084] The summary section is used to summarize the privacy-related words and privacy entities under those words that pose a risk of leakage in the original task text.
[0085] For example, for the original task text 1 above, the final privacy identification results are: 1. Contact number "138********". 2. Address "No. E, D Road, C District, B City, F Province".
[0086] It should be noted that the asterisk (*) in this article is only used to obscure specific numbers and has no special meaning.
[0087] Furthermore, when constructing sample data, the original task text is rewritten in format based on a thought chain template to obtain standard sample data. The sample data includes privacy identification instructions, thought chains, and privacy identification results. The privacy identification results include privacy entities and their corresponding privacy term tags. For example:
[0088] Q: Please help me identify the privacy information in the following text:
[0089] Plaintiff: Zhang San, male, Han nationality, ID number: 152647************, home address: No. E, D Road, C District, B City, G Province, telephone: 135********.
[0090] Defendant: Li Si, male, Han nationality, ID number: 142546************, home address: No. E, D Road, C District, B City, H Province, telephone: 139********.
[0091] S: Upon inspection, the text contains the privacy term "ID number". However, the privacy entity 152647************ conforms to the general regular expression for ID card numbers, while the privacy entity 142546************ does not conform to the general regular expression for ID card numbers.
[0092] The text contains the privacy term "address", and the two privacy entities under it both conform to the general regular expression for address information;
[0093] The text contains the privacy term "telephone," and both of its privacy entities conform to the regular expression for a possible telephone number.
[0094] C: In summary, this text contains three types of sensitive information: ID number, address, and telephone number. The ID number is 152647************; the address is No. E, D Road, C District, B City, G Province, and No. E, D Road, C District, B City, H Province; and the telephone numbers are 135******** and 139********.
[0095] Where Q represents the privacy recognition instruction, S represents the thought chain, and C represents the privacy recognition result.
[0096] S230. Use the privacy recognition instruction as the target input of the pre-trained basic large model, and use the thought chain and privacy recognition result as the target output of the pre-trained basic large model. Fine-tune the pre-trained basic large model so that it learns the privacy recognition reasoning pattern based on the thought chain, and obtain the local large model.
[0097] The pre-trained base model can utilize open-source models such as LLaMA2 and ChatGLM. During training, the instruction portion of the sample data is used as input to the model. The training goal is to enable the model to generate all content following the instruction, i.e., the complete thought chain and privacy recognition result, thereby teaching the model how to derive thought chains and better perform privacy recognition tasks. Specifically, parameter fine-tuning methods such as LoRA can be used. This method freezes over 99% of the original parameters of the pre-trained base model, training only the additionally injected, lightweight adapter layer. This approach efficiently utilizes the existing language understanding capabilities of the base model, teaches it privacy recognition-specific skills at extremely low computational cost, and avoids catastrophic forgetting.
[0098] In this embodiment, the basic large model is fine-tuned by constructing sample data based on thought chains, enabling the model to learn this fixed pattern of "question-reasoning-answering". The resulting local large model, upon receiving a new privacy recognition instruction, will automatically and step by step generate a reasoning process to accurately identify the privacy information in the text.
[0099] S130. Encrypt the privacy entity to obtain the corresponding encrypted entity.
[0100] In this embodiment, the encrypted entity is a replacement string of the privacy entity after encryption. For example, the encrypted entity corresponding to the privacy entity "12345678912" is "abcdefghiab".
[0101] After identifying the privacy entities in the text through the above steps, each identified privacy entity is encrypted using a predetermined encryption algorithm (such as symmetric encryption AES) to form an encrypted entity in order to protect privacy data.
[0102] S140. Replace the privacy entities in the original prompt with corresponding encrypted entities to obtain the security prompt.
[0103] The security prompt is a new prompt obtained by replacing all privacy entities in the original prompt with corresponding encrypted entities. For example, the original prompt is: "The customer's mobile number is 12345678912, please contact him today." The security prompt obtained after privacy protection is: "The customer's mobile number is abcdefghiab, please contact him today."
[0104] The generated security message retains the semantic structure and intent of the original statement, but the privacy information within it has been turned into unrecognizable gibberish.
[0105] S150: Obtain the original answer generated by the cloud-based large model based on the security prompt words.
[0106] The cloud-based large-scale model is a large-scale language model service provided by third-party service providers (such as OpenAI and Wenxin Yiyan). The original answer is the response generated by the cloud-based large-scale model after receiving a question from a user based on safety prompts.
[0107] After obtaining the security prompt words through the above steps, users can use them to interact with third-party cloud-based big data models, protecting their privacy data from being leaked while using the cloud-based big data models normally.
[0108] Specifically, users can upload security tips to the service provider's cloud environment and post corresponding questions. For example: "Why contact this customer: The customer's phone number is abcdefghiab, please contact him today." Then, the system uses an API to call the cloud-based big data model's semantic generation capabilities to obtain the original answer. For example: "Because this customer has a complaint record, it is necessary to contact him today. The customer's phone number is abcdefghiab."
[0109] S160. Decrypt the encrypted entities in the original answer to obtain the restored answer, and then send the restored answer back to the user.
[0110] The restored answer is the final result obtained by decrypting the encrypted entities in the original answer and replacing them with the original privacy entities. This answer is the complete content that the user finally sees, containing readable information.
[0111] If the original answer obtained from the cloud-based big data model contains encrypted private information, the private data can be decrypted and restored to generate a fully readable and complete answer for the user, i.e., the restored answer, which is then fed back to the customer.
[0112] Furthermore, the process of encrypting the privacy entity to obtain the corresponding encrypted entity includes:
[0113] S310. Determine the privacy term tags corresponding to the privacy entities.
[0114] S320. Based on the encryption rules corresponding to the privacy word tags, use a symmetric key to perform symmetric encryption on the privacy entity to obtain ciphertext data.
[0115] S330. Based on the preset desensitization rules, replace the ciphertext characters in the ciphertext data with the corresponding Greek characters to obtain the encrypted entity, which carries a privacy term tag.
[0116] Specifically, after identification by a local large-scale model using preset thought chain prompts, a structured list is obtained, containing each privacy entity and its corresponding privacy term tag. For each privacy term tag, a corresponding encryption rule is pre-set; for example, privacy term tags such as "name," "ID number," and "address" may have different encryption rules. In practice, an encryption policy mapping table can be constructed to map different privacy term tags to specific encryption rules.
[0117] For example, encryption rules mainly consist of three parts in structure: 1. Encryption algorithm: such as AES-256-GCM (a strong symmetric encryption algorithm). 2. Key: A symmetric key specifically used for encrypting this type of data. In specific implementations, different keys can be used for data of different sensitivity levels (e.g., a general key for encrypting basic personal information, and another higher-level key specifically for encrypting financial data). 3. Mode and parameters: such as encryption mode, initialization vector, etc.
[0118] By using a defined algorithm and key, plaintext private entities are encrypted, converting them into unreadable binary data. For ease of transmission and storage in text systems, this can be encoded (e.g., Base64 encoding) into a plaintext string, thus obtaining ciphertext data.
[0119] Then, the ciphertext data is anonymized by replacing the ciphertext characters with corresponding Greek characters, resulting in an encrypted entity of the same length. This further enhances data security (preventing the ciphertext features from being identified) and maintainability. For example, encrypting the privacy entity "110101************" using the Key_A key and the AES-256-GCM algorithm yields the ciphertext data "qXw9E5lN2+KmZ / abc123==". After anonymization, the resulting encrypted entity is " ".
[0120] The final encrypted entity, in addition to containing the replaced Greek string, will also carry its privacy term tag in a specific way (such as as a prefix, suffix, or a field in a JSON structure) to quickly find the corresponding decryption key and algorithm during decryption.
[0121] Correspondingly, the encrypted entities in the original answer are decrypted to obtain the restored answer, including:
[0122] S410. Based on the preset desensitization rules, replace the Greek characters in the encrypted entity with the corresponding ciphertext characters to obtain the ciphertext data.
[0123] S420. Based on the decryption rules corresponding to the privacy word tags, the same symmetric key is used to symmetrically decrypt the ciphertext data to obtain the privacy entity.
[0124] S430. Replace the encrypted entities in the original answer with the corresponding privacy entities to obtain the restored answer.
[0125] Specifically, the encrypted entity is first located in the original answer, and then the same character mapping relationship as that used during encryption and desensitization, but in the opposite direction, is applied to replace the Greek letters in the encrypted entity with ciphertext characters one by one, thereby obtaining the ciphertext data through reverse desensitization.
[0126] Then, the prefix field is parsed from the ciphertext data to obtain the privacy word tag. Based on this tag, the decryption algorithm corresponding to the encryption algorithm and the same symmetric key Key_A used during encryption are found. Next, the ciphertext data is symmetrically decrypted using the decryption algorithm and the symmetric key Key_A to obtain the original privacy entity. Finally, the encrypted entity in the original answer is replaced with the decrypted privacy entity to obtain the restored answer feedback to the user.
[0127] This embodiment ensures data confidentiality through algorithm encryption, enhances its concealment and debuggability through format desensitization, and achieves precise matching of encryption and decryption rules through privacy term tag association, thereby ensuring that core privacy data is available but not visible, and better protecting the security of user information.
[0128] In another implementation, encrypting the privacy entity to obtain the corresponding encrypted entity may further include:
[0129] S510. The privacy entity is fragmented based on the secret sharing engine to obtain N original fragments, and the fragment metadata of each original fragment is recorded. The fragment metadata includes the fragment number and username corresponding to the original fragment. The secret sharing engine is used to restore the privacy entity based on any N-1 original fragments, where N is a positive integer.
[0130] In this embodiment, when fragmenting the privacy entity: the secret sharing engine can construct a random polynomial, for example... The constant term It is a privacy entity. For random coefficients, such as , , All coefficients are random. Then, this polynomial is calculated in N different... Value (e.g.) Results on (=1, 2, 3, ..., N) , ... Thus, each one obtained This is a single original partition. This indicates the fragment number of the original fragment. This indicates the specific content of the original fragment. Subsequently, when reconstructing the privacy entity from the fragments, it is only necessary to collect any N-1 original fragments to reassemble them (such as using Lagrange interpolation) to obtain the complete privacy entity.
[0131] For example, for the ID number "110101********4032", we set N=4, meaning we generate 4 original fragments, and any 3 of them can be used to reconstruct the original data. First, we construct a random polynomial, for example... Then calculate the 4 partitions:
[0132] Fragment 1 ( ): 110101********4611;
[0133] Fragment 2 ( ): 110101********5654;
[0134] Part 3 ( ): 110101********7169;
[0135] Part 4 ( ): 110101********9156.
[0136] And record the fragment metadata for each raw fragment:
[0137] Shard 1: (Username: Zhang San, Shard ID: 1, Shard Data: 110101********4611).
[0138] Shard 2: (Username: Zhang San, Shard ID: 2, Shard Data: 110101********5654);
[0139] Shard 3: (Username: Zhang San, Shard ID: 3, Shard Data: 110101********7169).
[0140] Shard 4: (Username: Zhang San, Shard ID: 4, Shard Data: 110101********9156).
[0141] S520. Perform symmetric encryption on each original fragment to obtain N encrypted fragments, where the encrypted entity corresponding to the privacy entity is obtained by combining the N encrypted fragments.
[0142] The process of symmetric encryption of the original fragments also includes two stages: encryption and desensitization. Please refer to steps S310-S330 above for details, which will not be repeated here.
[0143] S530. Store the N encrypted fragments into different database tables.
[0144] Specifically, database middleware (such as ShardingSphere-Proxy) can be used to achieve automatic data distribution (distributed storage). This means that N encrypted shards are physically stored across N different database table instances to achieve physical isolation, ensuring that no single database contains the complete secret. Therefore, only by simultaneously obtaining all the data from all the database tables can the data be decrypted based on the inherent interaction logic between the fields.
[0145] Correspondingly, the encrypted entities in the original answer are decrypted to obtain the restored answer, including:
[0146] S610. Based on the username, initiate a query to all database tables to obtain N-1 encrypted shards and shard numbers corresponding to the username.
[0147] S620. Perform symmetric decryption on N-1 encrypted fragments to obtain N-1 original fragments.
[0148] S630: Based on N-1 original fragments and their corresponding fragment numbers, the privacy entity is restored using the secret sharing engine.
[0149] S640. Replace the encrypted entities in the original answer with the corresponding privacy entities to obtain the restored answer.
[0150] Specifically, based on the username, a query is initiated to all N distributed databases via ShardingSphere-Proxy to collect at least N-1 encrypted shards corresponding to that username and their shard numbers. Then, the encrypted shards are independently decrypted using the same key used during encryption to restore the corresponding original shards. The decryption process can be referred to steps S410-S430 above, and will not be repeated here.
[0151] Then, these N-1 original fragments are input into the secret sharing engine according to their fragment numbers. The engine will then use the Lagrange interpolation formula to accurately reconstruct the original polynomial based on these points. and calculate The value of the encrypted entity is used to obtain the original privacy entity. Finally, the encrypted entity in the original answer is replaced with the decrypted privacy entity to obtain the restored answer feedback to the user.
[0152] This embodiment achieves encryption and decryption of sensitive data (ID numbers, phone numbers, email addresses, etc.) through triple protection of symmetric encryption, desensitization, and distributed storage, and has high security and high availability.
[0153] Optionally, the fragment metadata also includes a decryption count threshold and an expiration timestamp. The decryption count threshold defines the maximum number of times this private data can be legally decrypted during its lifetime. For example, a decryption count threshold of 3 means that this data can only be decrypted and restored a maximum of 3 times; after that, it becomes invalid. The expiration timestamp defines the "expiration time" of this private data, which is a future point in time. After this point in time, any decryption request will be rejected.
[0154] The process of decrypting the encrypted entities in the original response to obtain the restored response also includes: obtaining the historical decryption count and the current timestamp; if the historical decryption count is less than the decryption count threshold, or the current timestamp is less than the expiration timestamp, then generating an access token; based on the access token and the username, initiating a query to all database tables to obtain N-1 encrypted fragments and fragment numbers corresponding to the username.
[0155] Specifically, before actually initiating a query to the distributed database to obtain encrypted shards, the validity of the decryption needs to be determined: if the historical decryption count of the privacy entity is less than the decryption count threshold, and the current timestamp is less than the expiration timestamp, it indicates that the decryption request is compliant, and a short-term, single-use access token is generated. This token serves as a "license" to access the distributed database. The database access interface will be configured to require verification of this token's validity. If no token is available or the token is invalid, the query will be rejected.
[0156] Finally, after a successful decryption, the historical decryption count for that privacy entity is updated. If the decryption count reaches a threshold, or the current time exceeds the expiration timestamp, all subsequent decryption requests will be rejected, thereby fundamentally reducing the risk of leakage from long-term storage.
[0157] Please refer to Figure 2 , Figure 2 This is a schematic diagram illustrating the application of privacy data encryption and decryption in the embodiments of this application. For example... Figure 2As shown, a pre-designed thought chain template is used to rewrite the original task text to obtain sample data, which is then used to fine-tune the open-source base model LLaMA 2 to obtain a local large model. Then, multiple concurrently executing Agents are built based on the Langchain framework. By decomposing the task into multiple sub-tasks, each executed by a different Agent, the processing efficiency and accuracy of the task are improved. Next, a dynamic privacy encryption / decryption tool based on a symmetric encryption algorithm is integrated into the Agent's toolkit to support intelligent encryption, desensitization, and data restoration. Simultaneously, a database middleware is connected to achieve distributed storage of privacy data.
[0158] When applied, the privacy encryption process includes: 1. The user sends an encryption request in natural language: "Please help me conceal the privacy information in the following text...". 2. The request triggers Agent intervention, initiating the task processing flow: the Agent performs tool retrieval, calls the tool call interface in the tool module, and prepares to use the tool to complete the task. 3. Based on the local large model, planning and scheduling are performed to identify the privacy data in the text and formulate a plan to coordinate resources (such as Agent clusters) to allocate tasks. 4. The Agent executes the interface call, using the corresponding encryption tool to perform symmetric encryption, desensitization, and distributed storage on the privacy data in the text, obtaining the encrypted entity. 5. The Agent returns the task result to the local large model. 6. The local large model, based on context memory, organizes and replaces the encrypted content, and returns the text with the privacy words concealed to the user. 7. The user interacts with the third-party cloud large model based on the concealed text. 8. If the original response returned by the cloud large model contains the encrypted entity, a decryption request is generated: "Please help me recover the concealed information in the following text...". The subsequent decryption process is similar to the encryption process and will not be described in detail here.
[0159] This embodiment employs the MindChain technology to construct a sample dataset for fine-tuning an open-source large model. Based on the fine-tuned local large model, multiple parallel agents are built. A dynamic privacy encryption / decryption tool based on a symmetric encryption algorithm is integrated into the agent's toolkit, supporting intelligent encryption, desensitization, and restoration to achieve encrypted protection of privacy information and prevent the leakage of sensitive information. Thus, while users are using the cloud-based large model normally, they can hide privacy information in prompts, protecting their privacy data from leakage. If the hidden information appears in the returned results, the privacy data can be decrypted and restored.
[0160] To better implement the above methods, this application also provides a prompt word privacy protection device, which can be integrated into an electronic device, such as a terminal or server. The terminal can be a mobile phone, tablet computer, smart Bluetooth device, laptop computer, or personal computer; the server can be a single server or a server cluster composed of multiple servers.
[0161] For example, in this embodiment, the method of this application embodiment will be described in detail by taking the integration of the prompt word privacy protection device into the server as an example.
[0162] For example, such as Figure 3 As shown, the prompt word privacy protection device may include an original prompt word acquisition module 310, a privacy word recognition module 320, a privacy encryption module 330, a security prompt word acquisition module 340, an original answer acquisition module 350, and a privacy decryption module 360, as follows:
[0163] The original prompt word acquisition module 310 is used to acquire the original prompt word in the user's encrypted request information;
[0164] The privacy word recognition module 320 is used to perform privacy word recognition on the original prompt words based on the local large model with preset thought chain prompt words to obtain privacy entities;
[0165] The privacy encryption module 330 is used to encrypt the privacy entity to obtain the corresponding encrypted entity;
[0166] The security prompt word acquisition module 340 is used to replace the privacy entities in the original prompt word with corresponding encrypted entities to obtain the security prompt word;
[0167] The original answer acquisition module 350 is used to acquire the original answers generated by the cloud-based large model based on security prompt words;
[0168] The privacy decryption module 360 is used to decrypt encrypted entities in the original answer, obtain the restored answer, and then return the restored answer to the user.
[0169] Optionally, the device further includes:
[0170] The raw data acquisition module is used to acquire the raw task text, which includes at least one privacy entity and the privacy term tag corresponding to the privacy entity.
[0171] The sample data construction module is used to build a thought chain template for the original task text and rewrite the format of the original task text based on the thought chain template to obtain sample data. The sample data includes privacy recognition instructions, thought chains, and privacy recognition results. The privacy recognition results include privacy entities and privacy word tags corresponding to the privacy entities.
[0172] The local large model training module is used to take privacy recognition instructions as the target input of the pre-trained basic large model, and take the thought chain and privacy recognition results as the target output of the pre-trained basic large model. It fine-tunes the pre-trained basic large model so that the pre-trained basic large model learns the privacy recognition reasoning pattern based on the thought chain, thus obtaining the local large model.
[0173] Optionally, the mind chain template includes:
[0174] The privacy word recognition column is used to identify privacy words and one or more privacy entities under the privacy words in the original task text based on a preset privacy word list. The privacy word list includes various privacy word tags.
[0175] The category verification section is used to perform compliance verification on one or more privacy entities under the privacy term based on the verification rules corresponding to the privacy term, and to filter out compliant privacy entities.
[0176] The context analysis section is used to perform security assessments on compliant privacy entities based on the context of the original task text, and to filter out privacy entities that are at risk of leakage.
[0177] The summary section is used to summarize the privacy-related words and privacy entities under those words that pose a risk of leakage in the original task text.
[0178] Optionally, the privacy encryption module 330 includes:
[0179] The privacy tag determination submodule is used to determine the privacy term tags corresponding to privacy entities;
[0180] The encryption submodule is used to perform symmetric encryption on privacy entities using a symmetric key based on the encryption rules corresponding to privacy word tags, so as to obtain ciphertext data.
[0181] The desensitization submodule is used to replace the ciphertext characters in the ciphertext data with the corresponding Greek characters based on the preset desensitization rules, so as to obtain the encrypted entity, which carries privacy word tags.
[0182] 360's privacy decryption module includes:
[0183] The restoration submodule is used to replace Greek characters in the encrypted entity with corresponding ciphertext characters based on preset de-identification rules, so as to obtain ciphertext data;
[0184] The decryption submodule is used to symmetrically decrypt the ciphertext data based on the decryption rules corresponding to the privacy word tags, using the same symmetric key to obtain the privacy entity;
[0185] The restored answer acquisition submodule is used to replace the encrypted entities in the original answer with corresponding privacy entities to obtain the restored answer.
[0186] Optionally, the privacy encryption module 330 includes:
[0187] The sharding submodule is used to shard the privacy entity based on the secret sharing engine to obtain N original shards and record the shard metadata of each original shard. The shard metadata includes the shard number and username corresponding to the original shard. The secret sharing engine is used to restore the privacy entity based on any N-1 original shards, where N is a positive integer.
[0188] The fragment encryption submodule is used to perform symmetric encryption on each original fragment to obtain N encrypted fragments. The encrypted entity corresponding to the privacy entity is obtained by combining the N encrypted fragments.
[0189] The sharded storage submodule is used to store N encrypted shards into different database tables;
[0190] 360's privacy decryption module includes:
[0191] The shard query submodule is used to initiate a query to all database tables based on the username and obtain N-1 encrypted shards and shard numbers corresponding to the username.
[0192] The fragment decryption submodule is used to perform symmetric decryption on N-1 encrypted fragments to obtain N-1 original fragments;
[0193] The privacy entity restoration submodule is used to restore the privacy entity based on N-1 original fragments and their corresponding fragment numbers using the secret sharing engine.
[0194] The restored answer acquisition submodule is used to replace the encrypted entities in the original answer with corresponding privacy entities to obtain the restored answer.
[0195] Optionally, the fragment metadata also includes a decryption count threshold and an expiration timestamp;
[0196] The privacy decryption module 360 also includes:
[0197] The condition retrieval submodule is used to retrieve the historical decryption count and the current timestamp;
[0198] The access token generation submodule is used to generate an access token if the historical decryption count is less than the decryption count threshold and the current timestamp is less than the expiration timestamp.
[0199] The database access submodule is used to initiate queries to all database tables based on the access token and username, and obtain N-1 encrypted fragments and fragment numbers corresponding to the username.
[0200] In practice, each of the above units can be implemented as an independent entity or can be arbitrarily combined to be implemented as the same or several entities. For the specific implementation of each of the above units, please refer to the previous method embodiments, which will not be repeated here.
[0201] In the embodiments of this application, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.
[0202] This application also provides an electronic device, which can be a terminal, a server, or other similar device. The terminal can be a mobile phone, tablet computer, smart Bluetooth device, laptop computer, personal computer, etc.; the server can be a single server or a server cluster composed of multiple servers, etc.
[0203] In some embodiments, the prompt word privacy protection device can also be integrated into multiple electronic devices. For example, the prompt word privacy protection device can be integrated into multiple servers, and the prompt word privacy protection method of this application can be implemented by multiple servers.
[0204] In this embodiment, as Figure 4 As shown, it illustrates a structural schematic diagram of the electronic device involved in the embodiments of this application, specifically:
[0205] The electronic device may include components such as a processor 410 with one or more processing cores, a memory 420 with one or more computer-readable storage media, a power supply 430, an input module 440, and a communication module 450. Those skilled in the art will understand that... Figure 4 The electronic device structure shown does not constitute a limitation on the electronic device and may include more or fewer components than shown, or combine certain components, or have different component arrangements. Wherein:
[0206] The processor 410 is the control center of the electronic device. It connects various parts of the electronic device via various interfaces and lines. By running or executing software programs and / or modules stored in the memory 420, and by calling data stored in the memory 420, it performs various functions and processes data, thereby performing overall detection of the electronic device. In some embodiments, the processor 410 may include one or more processing cores; in some embodiments, the processor 410 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may also not be integrated into the processor 410.
[0207] The memory 420 can be used to store software programs and modules. The processor 410 executes various functional applications and data processing by running the software programs and modules stored in the memory 420. The memory 420 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, application programs required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 420 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 volatile solid-state storage device. Accordingly, the memory 420 may also include a memory controller to provide the processor 410 with access to the memory 420.
[0208] The electronic device also includes a power supply 430 that supplies power to the various components. In some embodiments, the power supply 430 can be logically connected to the processor 410 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. The power supply 430 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0209] The electronic device may also include an input module 440, which can be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
[0210] The electronic device may also include a communication module 450. In some embodiments, the communication module 450 may include a wireless module, through which the electronic device can perform short-range wireless transmission, thereby providing users with wireless broadband internet access. For example, the communication module 450 can be used to help users send and receive emails, browse web pages, and access streaming media.
[0211] Although not shown, the electronic device may also include a display unit, etc., which will not be described in detail here. Specifically, in this embodiment, the processor 410 in the electronic device loads the executable files corresponding to the processes of one or more applications into the memory 420 according to the following instructions, and the processor 410 runs the applications stored in the memory 420, thereby realizing the various functions in the above-mentioned privacy protection method for prompt words.
[0212] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.
[0213] Therefore, embodiments of this application provide a computer-readable storage medium storing a plurality of instructions that can be loaded by a processor to execute steps in any of the prompt word privacy protection methods provided in embodiments of this application.
[0214] The storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0215] According to one aspect of this application, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the electronic device to perform the prompt word privacy protection method provided in the above embodiments.
[0216] Since the instructions stored in the storage medium can execute the steps of any of the prompt word privacy protection methods provided in the embodiments of this application, the beneficial effects that any of the prompt word privacy protection methods provided in the embodiments of this application can achieve can be realized. For details, please refer to the previous embodiments, which will not be repeated here.
[0217] The foregoing has provided a detailed description of a method, apparatus, device, product, and medium for protecting privacy of prompt words according to embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A method for prompt word privacy protection, characterized in that, The method comprises: obtaining the original prompt word in the user's encrypted request information; based on the local large model of the preset thinking chain prompt word, the privacy word recognition of the original prompt word is carried out, and the privacy entity is obtained; encrypting the privacy entity to obtain the corresponding encrypted entity; based on the encrypted entity, the privacy entity in the original prompt word is replaced to obtain a safe prompt word; obtaining the original answer generated by the cloud large model based on the safe prompt word; decrypting the encrypted entity in the original answer to obtain a restored answer, and feeding back the restored answer to the user; wherein the training method of the local large model of the preset thinking chain prompt word comprises: obtaining an original task text, the original task text comprising at least one privacy entity and a privacy word label corresponding to the privacy entity; constructing a thinking chain template for the original task text, and rewriting the format of the original task text based on the thinking chain template to obtain sample data, the sample data comprising a privacy recognition instruction, a thinking chain and a privacy recognition result, the privacy recognition result comprising the privacy entity and the privacy word label corresponding to the privacy entity; the privacy recognition instruction is taken as the target input of the pre-trained basic large model, and the thinking chain and the privacy recognition result are taken as the target output of the pre-trained basic large model, the pre-trained basic large model is fine-tuned, the pre-trained basic large model learns the privacy recognition reasoning mode based on the thinking chain, and a local large model is obtained; the thinking chain template comprises: a privacy word recognition column for determining the privacy word and one or more privacy entities under the privacy word existing in the original task text based on a preset privacy word table, wherein the privacy word table comprises a plurality of privacy word labels; a classification verification column for verifying the compliance of one or more privacy entities under the privacy word based on the verification rules corresponding to the privacy word, and screening out compliant privacy entities; a context analysis column for security evaluation of the compliant privacy entities based on the context of the original task text, and screening out privacy entities with leakage risk; a summary column for summarizing the privacy word existing in the original task text and the privacy entities with leakage risk under the privacy word.
2. The prompt word privacy protection method of claim 1, wherein, encrypting the privacy entity to obtain the corresponding encrypted entity, comprising: determining the privacy word label corresponding to the privacy entity; based on the encryption rule corresponding to the privacy word label, the privacy entity is symmetrically encrypted by using the symmetric key to obtain ciphertext data; based on a preset desensitization rule, the ciphertext characters in the ciphertext data are replaced with corresponding Greek characters to obtain an encrypted entity, the encrypted entity carrying the privacy word label; decrypting the encrypted entity in the original answer to obtain a restored answer, comprising: based on a preset desensitization rule, the Greek characters in the encrypted entity are replaced with corresponding ciphertext characters to obtain ciphertext data; based on the decryption rule corresponding to the privacy word label, the ciphertext data is symmetrically decrypted by using the same symmetric key to obtain the privacy entity; The privacy entity is decrypted to obtain a corresponding encrypted entity, including:
3. The prompt word privacy protection method of claim 1, wherein, The privacy entity is fragmented based on a secret sharing engine to obtain N original fragments, and the fragmentation metadata of each original fragment is recorded, the fragmentation metadata including a fragmentation number and a username corresponding to the original fragment, where the secret sharing engine is used to restore the privacy entity based on any N-1 original fragments, and N is a positive integer; Each original fragment is symmetrically encrypted to obtain N encrypted fragments, where the encrypted entity corresponding to the privacy entity is obtained by combining the N encrypted fragments; The N encrypted fragments are respectively stored in different database tables; The encrypted entity in the original answer is decrypted to obtain a restored answer, including: Based on the username, query is initiated to all database tables to obtain N-1 encrypted fragments and fragmentation numbers corresponding to the username; The N-1 encrypted fragments are symmetrically decrypted to obtain N-1 original fragments; The privacy entity is restored based on the N-1 original fragments and the fragmentation numbers corresponding thereto by using the secret sharing engine; The encrypted entity in the original answer is decrypted to obtain a restored answer, including: The fragmentation metadata further includes a decryption frequency threshold and an invalid timestamp; 4. The prompt word privacy protection method of claim 3, wherein, The encrypted entity in the original answer is decrypted to obtain a restored answer, further including: The historical decryption frequency and the current timestamp are obtained; If the historical decryption frequency is less than the decryption frequency threshold, and the current timestamp is less than the invalid timestamp, an access token is generated; Based on the access token and the username, query is initiated to all database tables to obtain N-1 encrypted fragments and fragmentation numbers corresponding to the username. The device includes:
5. A prompt word privacy protection apparatus characterized by comprising: An original prompt word acquisition module configured to acquire an original prompt word in encrypted request information of a user; A privacy word identification module configured to identify a privacy entity from the original prompt word based on a local large model of a preset thought chain prompt word; A privacy encryption module configured to encrypt the privacy entity to obtain a corresponding encrypted entity; A secure prompt word acquisition module configured to replace the privacy entity in the original prompt word with the encrypted entity to obtain a secure prompt word; An original answer acquisition module configured to acquire an original answer generated by a cloud large model based on the secure prompt word; A privacy decryption module configured to decrypt the encrypted entity in the original answer to obtain a restored answer, and feed back the restored answer to the user; The device further includes an original data acquisition module configured to acquire an original task text, the original task text including at least one privacy entity and a privacy word label corresponding to the privacy entity; A sample data construction module is configured to construct a thinking chain template for the original task text, and perform format rewriting on the original task text based on the thinking chain template to obtain sample data, the sample data including a privacy identification instruction, a thinking chain, and a privacy identification result, the privacy identification result including a privacy entity and a privacy word label corresponding to the privacy entity; A local large model training module is configured to take the privacy identification instruction as a target input of a pre-trained basic large model, take the thinking chain and the privacy identification result as a target output of the pre-trained basic large model, fine-tune the pre-trained basic large model, make the pre-trained basic large model learn a thinking chain-based privacy identification reasoning mode, and obtain a local large model; The thinking chain template includes: A privacy word identification column is configured to determine, based on a preset privacy word table, a privacy word existing in the original task text and one or more privacy entities under the privacy word, where the privacy word table includes a plurality of privacy word labels; A classification verification column is configured to perform compliance verification on the one or more privacy entities under the privacy word based on a verification rule corresponding to the privacy word, and screen out compliant privacy entities; A context analysis column is configured to perform security evaluation on the compliant privacy entities based on a context of the original task text, and screen out privacy entities with a risk of leakage; A summary column is configured to aggregate the privacy word existing in the original task text and the privacy entities with the risk of leakage under the privacy word.
6. An electronic device, comprising: A processor and a memory are included, and the memory stores a plurality of instructions; the processor loads the instructions from the memory to perform the steps in the prompt word privacy protection method according to any one of claims 1-4.
7. A computer program product, characterised in that, A computer program / instruction is included, and the computer program / instruction is executed by a processor to implement the steps in the prompt word privacy protection method according to any one of claims 1-4.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a plurality of instructions, and the instructions are adapted to be loaded by a processor to perform the steps in the prompt word privacy protection method according to any one of claims 1-4.
Citation Information
Patent Citations
Privacy protection proxy method for third-party large language model
CN117725610A
Private data protection method and device, storage medium and computer program product
CN119323051A