Data desensitization method, data desensitization device, electronic equipment and readable storage medium
The data desensitization method uses a personalized large language model to replace sensitive fields with contextually accurate content, addressing readability issues in existing methods by ensuring semantic integrity and user comprehension.
Patent Information
- Application Number
- CN202411284928.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-13
- Publication Date
- 2024-12-06
AI Technical Summary
Existing data desensitization methods result in poor readability due to complete concealment of sensitive information, making it difficult for users to understand the context of the text.
A data desensitization method using a desensitizing large language model trained on personalized user information to generate personalized and contextually accurate replacements for sensitive fields, ensuring semantic integrity and readability.
Ensures that users of different confidentiality levels can understand the meaning of desensitized text without leaking sensitive information, while maintaining semantic completeness and avoiding obscure or incomplete text.
Smart Images

Figure CN119089504A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of computer technology, and in particular, relates to a data desensitization method, a data desensitization device, an electronic device, and a readable storage medium. Background Art
[0002] In the related art, the method for processing sensitive data is usually to perform desensitization based on desensitization rules, but the sensitive information after desensitization is directly blocked or replaced by irrelevant characters. Although this completely conceals the sensitive data, it makes the sensitive data after desensitization difficult to read, affecting the readability of the entire text. Summary of the invention
[0003] The embodiments of the present application provide a data desensitization method, a data desensitization device, an electronic device and a readable storage medium, which can solve the problem of poor reading after desensitization processing in the related art.
[0004] In a first aspect, an embodiment of the present application provides a data desensitization method, the method comprising: in response to a judgment that a preset sensitive field is included in a target text, based on the user confidentiality level and sensitive word confidentiality level corresponding to the user to be consulted, determining a target sensitive field from the target text; based on the text to be desensitized and the user information corresponding to the user to be consulted, generating a first prompt instruction using a first input template, and providing the first prompt instruction to a desensitizing large language model to obtain a first reply, wherein the text to be desensitized includes the target sensitive field and its corresponding context, the first reply includes the desensitized field corresponding to the target sensitive field and the context, and the desensitized large language model is trained based on personalized user information; in response to a judgment that the first reply meets the preset expression requirements, desensitizing the text to be desensitized based on the first reply.
[0005] In a second aspect, an embodiment of the present application provides a data desensitization device, which includes: a determination module, which is used to determine a target sensitive field from the target text in response to a judgment that a preset sensitive field is included in the target text, based on the user confidentiality level and sensitive word confidentiality level corresponding to the user to be consulted; a processing module, which is used to generate a first prompt instruction using a first input template based on the text to be desensitized and the user information corresponding to the user to be consulted, and provide the first prompt instruction to a desensitizing large language model to obtain a first reply, wherein the text to be desensitized includes the target sensitive field and its corresponding context, the first reply includes the desensitized field corresponding to the target sensitive field and the context, and the desensitized large language model is trained based on personalized user information; a desensitization module, which is used to perform desensitization processing on the text to be desensitized based on the first reply in response to a judgment that the first reply meets the preset expression requirements.
[0006] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the method described in the first aspect.
[0007] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.
[0008] In a fifth aspect, an embodiment of the present application provides a chip, comprising a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run a program or instruction to implement the method described in the first aspect.
[0009] In a sixth aspect, a computer program product is provided, the computer program product comprising at least one computer program, and when the computer program is loaded and executed by a processor, the method as described in the first aspect is implemented.
[0010] In an embodiment of the present application, in response to the judgment that the target text includes a preset sensitive field, based on the user confidentiality level and sensitive word confidentiality level corresponding to the user to be consulted, the target sensitive field is determined from the target text, and then based on the text to be desensitized and the user information corresponding to the user to be consulted, a first prompt instruction is generated using a first input template, and the first prompt instruction is provided to the desensitized large language model to obtain a first reply, wherein the text to be desensitized includes the target sensitive field and its corresponding context, the first reply includes the desensitized field corresponding to the target sensitive field and the context, and the desensitized large language model is trained based on personalized user information In response to the judgment that the first reply meets the preset expression requirements, the text to be desensitized is desensitized based on the first reply, and personalized replacement based on the context of the desensitized field is achieved, so as to replace the target sensitive field while maintaining the semantic completeness of the target text. In this way, on the basis of the original target text, each user can easily understand the meaning of the target text without leaking any secrets, that is, easy-to-understand personalized desensitized texts are generated for users of different confidentiality levels without leaking sensitive information. At the same time, while ensuring desensitization, the problem of poor reading caused by the lack of semantic integrity of the target text due to the desensitization process is avoided. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] Figure 1 A schematic diagram of a process of a data desensitization method provided by an exemplary embodiment of the present application is shown;
[0012] Figure 2A schematic diagram showing a first input instruction provided by an exemplary embodiment of the present application is shown;
[0013] Figure 3 A schematic diagram showing a second input instruction provided by an exemplary embodiment of the present application is shown;
[0014] Figure 4 A schematic diagram of a model structure provided by an exemplary embodiment of the present application is shown;
[0015] Figure 5 Another schematic diagram of a data desensitization method provided by an exemplary embodiment of the present application is shown;
[0016] Figure 6 A schematic diagram of the structure of a data desensitization device provided by an exemplary embodiment of the present application is shown;
[0017] Figure 7 A schematic structural diagram of an electronic device provided by an exemplary embodiment of the present application is shown. DETAILED DESCRIPTION
[0018] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0019] In the following, in combination with the accompanying drawings, a data desensitization method, a data desensitization device, an electronic device and a readable storage medium provided in an embodiment of the present application are described in detail through specific embodiments and their application scenarios.
[0020] Figure 1 A data desensitization method provided by an embodiment of the present application is shown, and the method can be performed by an electronic device, and the electronic device may include: a server and / or a terminal device. In other words, the method can be performed by software or hardware installed in the electronic device, and the method includes the following steps:
[0021] S110: In response to determining that the target text includes a preset sensitive field, based on the user confidentiality level and sensitive word confidentiality level corresponding to the user to be consulted, determine a target sensitive field from the target text.
[0022] It can be understood that when it is determined that the target text includes preset sensitive fields, it means that the target text needs to be desensitized, and then based on the user confidentiality level and sensitive word confidentiality level corresponding to the user to be consulted, the target sensitive field is determined from the target text, and then the target sensitive field is desensitized, wherein the target sensitive field can be one or more.
[0023] In an embodiment of the present application, users with different confidentiality levels can access sensitive fields with different confidentiality levels. For example, an ordinary employee may only be able to see the basic information in the target text, middle managers can see part of the sensitive data, and senior managers can see the complete version containing sensitive data. Therefore, before desensitizing, it is necessary to obtain the user confidentiality level and sensitive word confidentiality level of the user to be consulted. The user confidentiality level is used to indicate the user's access rights to sensitive data, and the sensitive word confidentiality level is used to indicate that when the user has access rights to sensitive data, the sensitive data of the corresponding confidentiality level can be accessed. For example, as shown in Table 1, users with different confidentiality levels can access different sensitive word confidentiality levels, so that different content can be displayed for different users according to the user confidentiality level and sensitive word confidentiality level. That is to say, in the actual reading process, the sensitive fields in the target text will be partially or completely replaced according to the user confidentiality level and sensitive word confidentiality level corresponding to the user.
[0024]
[0025]
[0026] Exemplarily, the sensitive fields that may be included in the sensitive word level I include at least one of the following: telephone number, address, etc.; the sensitive fields that may be included in the sensitive word level II include at least one of the following: transaction records, tax information, etc.; the sensitive fields that may be included in the sensitive word level III include at least one of the following: contract information, financial statements, etc.; the sensitive fields that may be included in the sensitive word level IV include at least one of the following: R&D data, customer list, etc.; the sensitive fields that may be included in the sensitive word level V include at least one of the following: account password, token, etc.
[0027] In S110, different target sensitive fields are determined according to different user confidentiality levels, thereby generating different desensitization replacement results.
[0028] S120: Based on the text to be desensitized and the user information corresponding to the user to be consulted, a first prompt instruction is generated using a first input template, and the first prompt instruction is provided to the desensitizing large language model to obtain a first reply.
[0029] Among them, the text to be desensitized includes the target sensitive field and its corresponding context, the first reply includes the desensitized field corresponding to the target sensitive field and the context, and the desensitized large language model is trained based on personalized user information.
[0030] Optionally, the user information is relevant personalized information corresponding to the user to be consulted, and may include at least one of the following: gender, age, hobbies, and the user's geographical location.
[0031] It is understandable that after determining the target sensitive field, the context sentence corresponding to the target sensitive field is extracted from the target text, and then the first prompt instruction is constructed in combination with the user information and the first input template, wherein the first prompt instruction is the prompt instruction of the large language model. Then the first prompt instruction is input into the desensitized large language model to obtain a first reply, which corresponds to the text to be desensitized, so that the large model completes the personalized replacement of the sensitive field.
[0032] In S120, corresponding replacement content is generated according to user information, which avoids the target text after desensitization from being obscure or containing content beyond the user's cognition, making it easier for the user to understand.
[0033] Among them, in one implementation, the first input template includes a text input part for desensitizing text, a desensitizing task description part and a personalized information input part; based on the text to be desensitized and the user information corresponding to the user to be consulted, the first prompt instruction is generated using the first input template, including: filling the text to be desensitized into the text input part for desensitizing text; generating a desensitizing task description corresponding to the text to be desensitized, and filling the desensitizing task description into the desensitizing task description part; filling the user information into the personalized information input part. Among them, the desensitizing task description can be pre-set, or a corresponding task description can be generated based on the text to be desensitized. For example, Figure 2 Shown is a schematic diagram of the first input template.
[0034] S130: In response to the judgment that the first reply meets the preset expression requirements, desensitizing the text to be desensitized based on the first reply.
[0035] Among them, the preset expression requirements include at least one of the following: the text is complete, the semantics are smooth, and it is consistent with the theme of the original text.
[0036] It is understandable that in order to ensure the semantic integrity of the first reply, i.e. the desensitized data, it is necessary to determine whether the first reply meets the preset expression requirements. If it meets the preset expression requirements, the desensitized text to be desensitized is desensitized based on the first reply. Desensitizing the text to be desensitized based on the first reply may include: replacing the corresponding target sensitive field in the text to be desensitized with the desensitized field in the first reply, thereby converting the target text into desensitized data.
[0037] In an embodiment of the present application, in response to a determination that a preset sensitive field is included in the target text, a target sensitive field is determined from the target text based on the user confidentiality level and sensitive word confidentiality level corresponding to the user to be consulted; based on the text to be desensitized and the user information corresponding to the user to be consulted, a first prompt instruction is generated using a first input template, and the first prompt instruction is provided to a desensitizing large language model to obtain a first reply, wherein the text to be desensitized includes the target sensitive field and its corresponding context, the first reply includes the desensitized field corresponding to the target sensitive field and the context, and the desensitized large language model is trained based on personalized user information. In response to the judgment that the first reply meets the preset expression requirements, the text to be desensitized is desensitized based on the first reply, and personalized replacement based on the context of the desensitized field is realized to replace the target sensitive field while maintaining the semantic completeness of the target text. In this way, on the basis of the original target text, each user can easily understand the meaning of the target text without leaking any secrets, that is, easy-to-understand personalized desensitized texts are generated for users of different confidentiality levels without leaking sensitive information. At the same time, while ensuring desensitization, the problem of poor reading caused by the lack of semantic integrity of the target text due to the desensitization process is avoided.
[0038] In one implementation, in response to the judgment that the first reply meets the preset expression requirements, before desensitizing the text to be desensitized based on the first reply, the method also includes: based on the first reply and the user information, generating a second prompt instruction using a second input template, and providing the second prompt instruction to the desensitizing large language model to obtain a second reply, wherein the second prompt instruction is composed of the first reply, the verification task description corresponding to the first reply, and the user information; in response to the judgment that the second reply includes affirmative feature words, determining that the first reply meets the preset expression requirements.
[0039] It is understandable that the desensitized large language model includes a generation module and a verification module, wherein the generation module is used to generate a desensitized text, i.e., a first reply, and the verification module is used to verify whether the generated desensitized text is accurate and complete. That is to say, after generating the first reply, the desensitized large language model uses its general understanding ability to make a secondary judgment on the identified sensitive fields to determine whether the first reply meets the preset expression requirements. Optionally, the affirmative feature words may include at least one of the following: yes, right, affirmative, correct, Yes, sure, Sure, Certainly, Exactly, etc.
[0040] Among them, in one implementation, the second input template includes a desensitized text input part, a verification task description part and a personalized information input part; the second prompt instruction is generated by using the second input template based on the first reply and the user information, including: filling the desensitized text into the desensitized text input part; generating a verification task description corresponding to the desensitized text, and filling the target task description into the verification task description part; filling the user information into the personalized information input part. For example, Figure 3 As shown, it is a schematic diagram of the second prompt instruction provided in the embodiment of the present application. Among them, the verification task description part is used to indicate the verification task, and the verification task description can be pre-set, or a corresponding task description can be generated based on the desensitized text. The desensitized text input part lists the desensitized data in the form of a whole text for word-by-word judgment.
[0041] In this implementation, verification can be used to determine whether the first reply is complete, semantically fluent, and consistent with the original topic, thereby ensuring the accuracy, coherence, and comprehensibility of the final output desensitized text.
[0042] In one implementation, providing the second prompt instruction to the desensitized large language model to obtain a second reply includes: obtaining the semantic similarity between the first reply and the text to be desensitized; in response to the semantic similarity being greater than a first threshold, generating the second reply, wherein the second reply includes the affirmative feature words; or, in response to the semantic similarity being less than the first threshold, generating the second reply, wherein the second reply includes a negative feature word and a field to be desensitized, wherein the field to be desensitized is the target sensitive field whose corresponding desensitized field does not meet the preset expression requirement.
[0043] It can be understood that analysis based on semantic similarity can identify the implicit meaning and context in the text, rather than just superficial vocabulary matching. At the same time, the desensitized text uses different words or expressions for sensitive fields to convey the same meaning, and semantic similarity can be effectively compared by identifying synonyms, phrase variants, etc., so that the corresponding second reply is generated through the comparison result of semantic similarity. If the semantic similarity is greater than the first threshold, it means that the first reply meets the preset expression requirements, and the generated second reply includes affirmative feature words. If the semantic similarity is less than the first threshold, it means that the first reply does not meet the preset expression requirements, and the generated second reply includes negative feature words and target sensitive fields that do not meet the preset expression requirements. In this way, expressions that do not conform to the contextual semantics can be screened out.
[0044] Furthermore, in another implementation, the method also includes: in response to the judgment that the second reply includes the negative feature word, obtaining the field to be desensitized in the first reply; based on the desensitized large language model, regenerating the desensitized field corresponding to the field to be desensitized until the desensitized field corresponding to the field to be desensitized meets the preset expression requirements.
[0045] In other words, the desensitized fields corresponding to the fields to be desensitized are regenerated, and then verification is continued until they meet the preset expression requirements, which can effectively improve the overall effect of the desensitization processing.
[0046] The negative feature word may include at least one of the following: not, no, not, no, etc.
[0047] In one implementation, before providing the first prompt instruction to the desensitized large language model to obtain a first reply, the method also includes: obtaining the personalized user information, multiple training samples, and at least one desensitized sample corresponding to each of the training samples, wherein each of the training samples includes at least one sensitive field sample; constructing a training data set and a verification data set based on the personalized user information, the multiple training samples, and the multiple desensitized samples; and performing supervised training on an initial large language model based on the training data set and the verification data set to obtain the desensitized large language model.
[0048] The initial large prediction model is obtained by extracting language knowledge from massive text data through unsupervised learning, and using the self-attention mechanism to capture the language information in sensitive texts and the contextual relationship of long texts. In the supervised training process, training is performed on the training data set and the validation data set, and the performance of the sensitive information in the desensitization task is optimized by adjusting the model parameters. After fine-tuning, a desensitized large language model can be obtained.
[0049] In addition, in the supervised training process, since words can have different semantics in different contexts, it is difficult for the static word vector similarity index to capture such changes. Therefore, the embodiment of the present application uses the context-related word vector calculation similarity evaluation method as a constraint on the semantic consistency between the desensitized text and the pre-desensitized text, so that the model generates text content that is consistent with the semantics before desensitization. ’ The recall rate R is calculated by matching each word in the text, and the precision rate P is calculated in turn, and then the semantic distance score F between the text before and after desensitization is calculated.
[0050]
[0051] Among them, cos_sim calculates the cosine similarity between two word vectors, and R is X i The recall rate of the word, P is X j The recall rate of a word. The recall rate is the ratio of the number of relevant documents retrieved to the number of all relevant documents in the document library, which measures the recall rate of the retrieval system.
[0052] In the embodiment of the present application, the semantic distance between the generated desensitized text and the reference text is calculated by design F. The semantic distance can be the cosine distance of the text feature vector.
[0053] Optionally, the desensitized large language model is constructed based on the transfer architecture combined with the self-attention mechanism, such as Figure 4 As shown, it is a schematic diagram of a model structure provided in an embodiment of the present application.
[0054] In the embodiment of the present application, based on the training of sensitive data, desensitized data and user personalized information, it is enabled to have the ability to personalize the replacement of sensitive data and the ability to understand and distinguish the context of long texts.
[0055] Based on the above embodiments, the present application also provides another flow chart of the data desensitization method, such as Figure 5 As shown, the following steps may be included:
[0056] S501: Obtain the text to be desensitized.
[0057] S502: Obtain the user's confidentiality level, the sensitive information words corresponding to the confidentiality level in the text, and the context corresponding to the sensitive information in the text.
[0058] S503: Obtain user personalized information.
[0059] S504: Obtain a first input template.
[0060] S505: Build a large model instruction.
[0061] S506: Train a lightweight sensitive data large language model.
[0062] S507: Obtain a personalized replacement word for the corresponding sensitive information word.
[0063] S508: Verify the text to be desensitized after personalized replacement.
[0064] S509: Output the final desensitized text.
[0065] In an embodiment of the present application, when it is detected that there are preset sensitive words in the text to be desensitized, the sensitive word data that needs to be desensitized is screened out by checking the user's user confidentiality level and the confidentiality level of sensitive information words, and the context sentences corresponding to the sensitive words are extracted from the original text, and then the prompt instruction of the large language model is constructed in combination with the user's personalized information and the first input template, so that the large model can complete the personalized replacement of sensitive words. At the same time, in order to improve the accuracy of the replacement and the naturalness of the text, the desensitized data is verified twice to verify whether the desensitized text expression is complete, whether the semantics are smooth, and whether it is consistent with the original theme, and then the final desensitized text output is obtained.
[0066] Figure 6 A schematic diagram of the structure of a data desensitization device provided by an embodiment of the present application is shown as follows: Figure 6 As shown, the data desensitization device 600 may include: a determination module 610, a processing module 620 and a desensitization module 630.
[0067] In this embodiment, a determination module 610 is used to determine a target sensitive field from the target text based on the user confidentiality level and sensitive word confidentiality level corresponding to the user to be consulted in response to a judgment that the target text includes a preset sensitive field; a processing module 620 is used to generate a first prompt instruction using a first input template based on the text to be desensitized and the user information corresponding to the user to be consulted, and provide the first prompt instruction to a desensitizing large language model to obtain a first reply, wherein the text to be desensitized includes the target sensitive field and its corresponding context, the first reply includes the desensitized field corresponding to the target sensitive field and the context, and the desensitized large language model is obtained by training based on personalized user information; a desensitization module 630 is used to perform desensitization processing on the text to be desensitized based on the first reply in response to a judgment that the first reply meets the preset expression requirements.
[0068] In one implementation, the data desensitizing device 600 may also include a verification module, which is used to: generate a second prompt instruction based on the first reply and the user information using a second input template, and provide the second prompt instruction to the desensitizing large language model to obtain a second reply, wherein the second prompt instruction is composed of the first reply, the verification task description corresponding to the first reply, and the user information; in response to the judgment that the second reply includes affirmative feature words, determine that the first reply meets the preset expression requirements.
[0069] In one implementation, the verification module is specifically used to: obtain the semantic similarity between the first reply and the text to be desensitized; in response to the semantic similarity being greater than a first threshold, generate the second reply, wherein the second reply includes the affirmative feature word; or, in response to the semantic similarity being less than the first threshold, generate the second reply, wherein the second reply includes a negative feature word and a field to be desensitized, wherein the field to be desensitized is the target sensitive field whose corresponding desensitized field does not meet the preset expression requirement.
[0070] In one implementation, the data desensitizing device 600 may also include a generation module for obtaining the field to be desensitized in the first reply in response to a judgment that the second reply includes the negative feature word; and regenerating the desensitized field corresponding to the field to be desensitized based on the desensitized large language model until the desensitized field corresponding to the field to be desensitized meets the preset expression requirements.
[0071] In one implementation, the data desensitization device 600 may also include a training module, which is used to: obtain the personalized user information, multiple training samples and at least one desensitized sample corresponding to each of the training samples, wherein each of the training samples includes at least one sensitive field sample; construct a training data set and a verification data set based on the personalized user information, the multiple training samples and the multiple desensitized samples; perform supervised training on the initial large language model based on the training data set and the verification data set to obtain the desensitized large language model.
[0072] In one implementation, the first input template includes a text input part for desensitizing text, a desensitizing task description part, and a personalized information input part; the processing module 620 is specifically used to: fill the text to be desensitized into the text input part for desensitizing text; generate a desensitization task description corresponding to the text to be desensitized, and fill the desensitization task description into the task description part; fill the user information into the personalized information input part.
[0073] A data desensitization device provided in an embodiment of the present application can implement each process implemented in the data desensitization method embodiment. To avoid repetition, it will not be described here.
[0074] The data desensitization device in the embodiment of the present application may be a device, or a component, an integrated circuit, or a chip in an electronic device. The embodiment of the present application is not specifically limited.
[0075] The data desensitization device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.
[0076] Optional, such as Figure 7 As shown, an embodiment of the present application also provides an electronic device 700, including a processor 710, a memory 720, and a program or instruction stored in the memory 720 and executable on the processor 710. When the program or instruction is executed by the processor 710, each process of the above-mentioned data desensitization method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0077] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, each process of the above-mentioned data desensitization method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0078] The processor is a processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0079] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned data desensitization method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0080] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0081] An embodiment of the present application also provides a computer program product, which includes at least one computer program. When the computer program is loaded and executed by a processor, it implements the various processes of the above-mentioned data desensitization method embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0082] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0083] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0084] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A data desensitization method, characterized in that: The method comprises: In response to a determination that a preset sensitive field is included in the target text, based on a user security level and a sensitive word security level corresponding to the user to be consulted, a target sensitive field is determined from the target text; Based on the text to be desensitized and the user information corresponding to the user to be consulted, a first prompt instruction is generated using a first input template, and the first prompt instruction is provided to a desensitized large language model to obtain a first reply, wherein the text to be desensitized includes the target sensitive field and its corresponding context, the first reply includes a desensitized field corresponding to the target sensitive field and the context, and the desensitized large language model is trained based on personalized user information; In response to a determination that the first reply meets preset expression requirements, the text to be desensitized is desensitized based on the first reply.
2. The method according to claim 1, characterized in that In response to the judgment that the first reply meets the preset expression requirement, before performing desensitization processing on the to-be-desensitized text based on the first reply, the method further includes: Based on the first reply and the user information, a second prompt instruction is generated using a second input template, and the second prompt instruction is provided to the desensitized large language model to obtain a second reply, wherein the second prompt instruction is composed of the first reply, the verification task description corresponding to the first reply, and the user information; In response to the determination that the second reply includes the affirmative feature word, it is determined that the first reply meets the preset expression requirement.
3. The method according to claim 2, characterized in that Providing the second prompt instruction to the desensitized large language model to obtain a second reply includes: Obtaining the semantic similarity between the first reply and the text to be desensitized; In response to the semantic similarity being greater than a first threshold, generating the second reply, wherein the second reply includes the positive feature word; or, In response to the semantic similarity being less than the first threshold, the second reply is generated, wherein the second reply includes a negative feature word and a field to be desensitized, wherein the field to be desensitized is the target sensitive field whose corresponding desensitized field does not meet the preset expression requirement.
4. The method according to claim 3, characterized in that The method further comprises: In response to the determination that the second reply includes the negative feature word, obtaining the field to be desensitized in the first reply; Based on the desensitized large language model, the desensitized field corresponding to the field to be desensitized is regenerated until the desensitized field corresponding to the field to be desensitized meets the preset expression requirement.
5. The method according to claim 1, characterized in that Before providing the first prompt instruction to the desensitized large language model to obtain a first reply, the method further includes: Acquire the personalized user information, a plurality of training samples, and at least one desensitized sample corresponding to each of the training samples, wherein each of the training samples includes at least one sensitive field sample; Constructing a training data set and a verification data set based on the personalized user information, the multiple training samples and the multiple desensitized samples; The initial large language model is supervisedly trained based on the training data set and the verification data set to obtain the desensitized large language model.
6. The method according to claim 1, characterized in that The first input template includes a to-be-desensitized text input part, a desensitization task description part, and a personalized information input part; The step of generating a first prompt instruction by using a first input template based on the text to be desensitized and the user information corresponding to the user to be consulted includes: Fill the text to be desensitized into the text to be desensitized input part; Generate a desensitization task description corresponding to the text to be desensitized, and fill the desensitization task description into the task description part; Fill the user information into the personalized information input part.
7. A data desensitization device, characterized in that: include: A determination module, configured to determine a target sensitive field from the target text in response to a determination that the target text includes a preset sensitive field, based on a user security level and a sensitive word security level corresponding to the user to be consulted; a processing module, configured to generate a first prompt instruction using a first input template based on the text to be desensitized and the user information corresponding to the user to be consulted, and provide the first prompt instruction to a desensitized large language model to obtain a first reply, wherein the text to be desensitized includes the target sensitive field and its corresponding context, the first reply includes a desensitized field corresponding to the target sensitive field and the context, and the desensitized large language model is trained based on personalized user information; A desensitization module is used to perform desensitization processing on the text to be desensitized based on the first reply in response to a judgment that the first reply meets the preset expression requirements.
8. An electronic device, characterized in that: include: A processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the data desensitization method as described in any one of claims 1 to 6.
9. A readable storage medium, characterized in that: The readable storage medium stores programs or instructions, and when the programs or instructions are executed by the processor, the steps of the data desensitization method according to any one of claims 1 to 6 are implemented.
10. A computer program product, characterized in that The computer program product includes at least one computer program, which, when loaded and executed by a processor, implements the steps of the data desensitization method according to any one of claims 1 to 6.
Citation Information
Cited By
Data desensitization processing method and system based on large model
CN119670157A
Data desensitization processing method and system based on large model
CN119670157B
Content security identification method based on integration of multiple large language models
CN120012776A
Content generation method, device and equipment based on retrieval enhancement generation
CN121117187A
