Security fine tuning data synthesis method and system based on iterative model representation spatial expansion
Through the intent-hidden model and iterative model representation space expansion technology, secure fine-tuning data similar to real attack data is generated, which solves the problem of centralization of secure fine-tuning data and improves the security and recognition capabilities of the model.
Patent Information
- Application Number
- CN202510417684.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-03
- Publication Date
- 2025-08-19
AI Technical Summary
In the prior art, the security fine-tuning data set is inconsistent with the distribution of real attack data, resulting in security training failure, and data concentration leads to security fine-tuning inefficiency.
The intention hidden model is used for supervised fine-tuning, combined with iterative model characterization space expansion technology, and the model is optimized by training the loss function to generate secure fine-tuning data similar to the real attack data.
Enhanced the diversity and coverage of the secure fine-tuning dataset, and improves the model's recognition ability and rejection of answers when facing malicious instructions from real users.
Smart Images

Figure CN120509031A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the fields of large model content synthesis control and large model security alignment, and in particular to a secure fine-tuning data synthesis method and system based on iterative model representation space expansion. Background Art
[0002] In recent years, with the advancement of large-model jailbreak attack techniques, model security and ethical issues have attracted increasing attention in commercial models (such as ChatGPT and DeepSeek) and open-source models (such as Llama 3.1 and Vicuna-v1.5). Techniques aimed at improving model security primarily include security fine-tuning and analysis of the model's internal representation. Security fine-tuning relies primarily on manually or semi-manually selected preference datasets to align the model's security preferences. These datasets often ignore the diversity and authenticity of the data within the dataset, resulting in the model's inability to learn malicious input patterns in real-world attack scenarios. Model internal representation state analysis techniques often utilize model gradients and parameter information to detect the harmful tendencies of the model's outputs, but they still face challenges such as insufficient information and difficulty simulating real-world attacks.
[0003] The disadvantages of the prior art are:
[0004] (1) There is a serious disconnect between the model and the real attack scenario. The attack data of the model in the real scenario is inconsistent with the distribution of its security training data, making the security training ineffective.
[0005] (2) When constructing security fine-tuning data, the similarity of data representation within the model is often ignored, resulting in concentrated data distribution and inefficient security fine-tuning.
[0006] Based on the above analysis, there is an urgent need to research and develop a set of technologies that utilize command intent hiding models and introduce iterative model representation space expansion technology to synthesize security training expectations in order to overcome these shortcomings, improve the performance of model security fine-tuning, and enable the model to identify and refuse to answer when faced with malicious commands from real users. Summary of the Invention
[0007] In order to solve the problem that the distribution of the security fine-tuning corpus is too concentrated and differs greatly from the real data, the present invention proposes a security fine-tuning data synthesis method based on iterative model representation expansion technology. By hiding and rewriting the intention of malicious instructions and analyzing the model latent space representation, the quality of security fine-tuning data is improved and the security of the model is improved.
[0008] In a first aspect, an embodiment of the present application provides a method for synthesizing secure fine-tuning data based on iterative model representation space expansion, the method comprising:
[0009] Intent-hiding model training steps: Use supervised fine-tuning to train the intent-hiding model, converting simple malicious commands into intent-hidden commands to improve the similarity between synthetic data and real attack data;
[0010] Iterative model representation space expansion step: Utilize the trained hidden intent model and use iterative model representation space expansion technology to iteratively expand the coverage of the synthetic security fine-tuning corpus in the model representation space and gradually synthesize security fine-tuning data.
[0011] In a specific embodiment of the present invention, the above-mentioned intention hidden model training step includes:
[0012] By adding semantic distance loss to the training loss function of the intent hidden model, training is performed to insert simple malicious instructions into the intent hidden model containing complex scenarios.
[0013] In a specific embodiment of the present invention, the above-mentioned training loss function includes:
[0014]
[0015] in, represents the supervised loss function, represents the semantic distance loss function, cos_sim represents the cosine similarity function, θ is the parameter of the hidden intent model, q', Represent the reference intention hidden instruction and the model output intention hidden instruction respectively, They represent the token of the reference intent hidden instruction and the token of the model output intent instruction, respectively. ' , They represent the model internal representation vectors of the reference intention instruction and the model output intention hidden instruction respectively. α and β are hyperparameters. In the actual system, α = 0.8 and β = 0.2.
[0016] In a specific embodiment of the present invention, the above-mentioned iterative model representation space expansion step includes:
[0017] In each round of iteration, multiple loss functions are used to constrain the content consistency and content diversity of the synthesized security fine-tuning data to generate the current round of synthetic data;
[0018] Constrain the content of the data generated in the current round to be similar to the original malicious instruction and not deviate from the intention of the malicious instruction;
[0019] If the data generated in the current round is not similar to the data already generated, the control iteration is repeated to generate data;
[0020] Constrain the current round of generated data to be far away from safe data in the representation space and close to malicious instructions;
[0021] When the threshold of the number of iterations is reached, the iterative model representation space expansion step ends.
[0022] In a specific embodiment of the present invention, the above-mentioned multiple loss functions include:
[0023] Losses due to malicious themes; is the positive and negative sample comparison loss;
[0024] Characterize distance loss for hazard data.
[0025] In a specific embodiment of the present invention, the loss function for training the above-mentioned intention hiding model is as follows:
[0026]
[0027] in, A set of characterization vectors representing the hazard dataset, Represents the characterization vector corresponding to the i-th data in the hazard dataset, represents the data representation vector set generated in the tth iteration, Indicates the representation vector corresponding to the k-th data in the j-th round of generated data, Represents a set of characterization vectors of a security dataset, represents the representation vector corresponding to the i-th data in the security dataset, d, ε are distance interval hyperparameters, δ, φ, γ are loss balance hyperparameters. In the actual system,
[0028] d = ε = 1E-2;
[0029] δ=0.6,φ=0.2,γ=0.2;
[0030] where Z x The model representation space vector represents the sample in the dataset X, and δ, φ, γ are hyperparameters.
[0031] In a specific embodiment of the present invention, the above-mentioned iterative model representation space expansion step further includes:
[0032] In the k-th iteration, the intention hidden model trained in the first iteration will be used as the basis, and L aug Train a data augmentation model M k , generate a batch of data A k , where k is an integer greater than 0;
[0033] After completing all k rounds of iterations, we get k models {M1, M2, ..., M k}; and the corresponding generated k types of synthetic data samples {A1, A2, ..., A k};
[0034] The k models and k types of synthetic data samples are added as new security fine-tuning data to the security fine-tuning of the model.
[0035] In a second aspect, an embodiment of the present application provides a security fine-tuning data synthesis system based on iterative model representation space expansion, which adopts the security fine-tuning data synthesis method based on iterative model representation space expansion as described above, and the system includes:
[0036] Hidden Intent Model Training Module: This module uses supervised fine-tuning to train the hidden intent model, converting simple malicious commands into hidden intent commands to improve the similarity between synthetic data and real attack data.
[0037] Iterative model representation space expansion module: Utilizing the trained hidden intent model and using iterative model representation space expansion technology, iteratively expands the coverage of the synthetic security fine-tuning corpus in the model representation space and gradually synthesizes security fine-tuning data.
[0038] In a third aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the security fine-tuning data synthesis method based on iterative model representation space expansion.
[0039] In a fourth aspect, an embodiment of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored on the memory and runnable on the processor. When the processor executes the program, the steps of the secure fine-tuning data synthesis method based on iterative model representation space expansion are implemented as described.
[0040] Compared with the related existing technologies, it has the following outstanding beneficial effects:
[0041] 1) The method of the present invention bridges the gap between security fine-tuning data and real attack data. By analyzing the differences between security fine-tuning data and real attack data in the model representation space, it provides guidance for the collection and establishment of security fine-tuning corpus, further enhancing the security fine-tuning dataset.
[0042] 2) Iterative model representation space expansion technology. This method uses iterative analysis of the model's internal representation space and synthetic security fine-tuning data to expand the data distribution in the security fine-tuning corpus and improve the model's security fine-tuning effect. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0044] Figure 1Schematic diagram of the security fine-tuning data synthesis method of the present invention;
[0045] Figure 2 Schematic diagram of the overall process of spatial expansion and a single iterative calculation of the iterative model representation according to an embodiment of the present invention;
[0046] Figure 3 This is a schematic diagram of the security fine-tuning data synthesis system of the present invention;
[0047] Figure 4 Schematic diagram of computer hardware of the present invention. DETAILED DESCRIPTION
[0048] In this disclosure, "at least one" means one or more, and "plurality" means two or more. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, "at least one of a, b, or c" can mean: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or plural.
[0049] It should also be understood that the term "and / or" in this document simply describes an association between related objects, indicating that three possible relationships exist. For example, "A and / or B" can represent: A alone, A and B together, or B alone. A and B can be singular or plural. Furthermore, the character " / " in this document generally indicates an "or" relationship between the related objects, but it may also indicate an "and / or" relationship. For specific understanding, please refer to the context.
[0050] It should also be understood that in various embodiments of the present invention, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0051] In the several embodiments provided by the present invention, it should be understood that the disclosed devices, apparatuses, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interface, indirect coupling or communication connection of the device or unit, which can be electrical, mechanical or other forms.
[0052] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0053] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0054] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0055] To illustrate the above-mentioned features and effects of the present invention more clearly and easily, the following embodiments are specifically described below with reference to the accompanying drawings. This specification discloses one or more embodiments incorporating the features of the present invention. The disclosed embodiments are for illustrative purposes only. The scope of protection of the present invention is not limited to the disclosed embodiments; the present invention is defined by the appended claims.
[0056] The following is a system embodiment corresponding to the above method embodiment. This embodiment can be implemented in conjunction with the above embodiment. The relevant technical details mentioned in the above embodiment are still valid in this embodiment and will not be repeated here to reduce repetition. Accordingly, the relevant technical details mentioned in this embodiment can also be applied to the above embodiment.
[0057] The method of the present invention aims to utilize the instruction intent hiding model and introduce iterative model representation space expansion technology to synthesize security training expectations to overcome these shortcomings, improve the performance of model security fine-tuning, and enable the model to recognize and refuse to answer when faced with malicious instructions from real users. When conducting research on security fine-tuning data synthesis, the present invention found that in the prior art, the concentration of data distribution in security training expectations and the difference from real attack data are one of the main reasons for the failure of security fine-tuning. After many rounds of experiments, the present invention proposes to utilize the intent hiding model and introduce iterative model representation space expansion technology to control the content of the synthesized training data, thereby enhancing the coverage of the security fine-tuning corpus in the model representation space and improving the diversity of the synthesized training data. Further research shows that the use of iterative representation space expansion technology can effectively bridge the model representation space gap between safe instructions and malicious instructions, so that model security fine-tuning can cover more scenarios that are more similar to real scenarios.
[0058] The following describes the method of the embodiment of the present application in detail with reference to specific embodiments:
[0059] Example 1
[0060] like Figure 1 As shown, the embodiment of the present application provides a method for synthesizing secure fine-tuning data based on iterative model representation space expansion, the method comprising:
[0061] Intent-hiding model training step 101: Use supervised fine-tuning to train the intent-hiding model, converting simple malicious commands into intent-hidden commands to improve the similarity between synthetic data and real attack data;
[0062] Iterative model representation space expansion step 102: Utilize the trained hidden intent model and use iterative model representation space expansion technology to iteratively expand the coverage of the synthetic security fine-tuning corpus in the model representation space and gradually synthesize security fine-tuning data.
[0063] Figure 2 This is an overall flow chart of a specific embodiment of the present invention, showing the overall process of iterative model representation space expansion and the process of a single expansion calculation.
[0064] In a specific embodiment of the present invention, the above-mentioned hidden intention model training step 101 includes:
[0065] By adding semantic distance loss to the training loss function of the intent hidden model, training is performed to insert simple malicious instructions into the intent hidden model containing complex scenarios.
[0066] Specifically, step 101 includes: intention hiding model training, training a generative model that inserts simple malicious instructions into complex scenarios: the existing model has been fine-tuned for security on simple malicious instructions, and the attack instructions in real attack scenarios use different scenarios to hide the intentions of malicious instructions to deceive the model. Therefore, the present invention converts simple malicious instructions into intention-hidden instructions by training the intention hiding model to improve the similarity between synthetic data and real attack data. For the training of the intention hiding model, the present invention uses a supervised fine-tuning method to perform fine-tuning on an open source large model. During fine-tuning, taking into account the need for the present invention to allow the model to learn to hide intentions while maintaining the diversity of the virtual scenes it generates, the present invention ensures its intention hiding ability and diversity by adding semantic distance loss to its training loss function. The specific training loss function is as follows:
[0067]
[0068] in, represents the supervised loss function, represents the semantic distance loss function, cos_sim represents the cosine similarity function. θ is the parameter of the hidden intent model, q', Represent the reference intention hidden instruction and the model output intention hidden instruction respectively, They represent the token of the reference intent hidden instruction and the token of the model output intent instruction respectively. ' , They represent the model internal representation vectors of the reference intention instruction and the model output intention hidden instruction respectively. α and β are hyperparameters. In the actual system, α = 0.8 and β = 0.2.
[0069] By optimizing supervision loss and semantic distance loss, the model can learn to hide malicious intentions from simple malicious instructions by synthesizing virtual scenes. At the same time, due to semantic distance loss, the model cannot simply remember the content in the dataset, ensuring the diversity of the virtual scenes synthesized by the model.
[0070] In a specific embodiment of the present invention, the iterative model representation space expansion step 102 includes:
[0071] In each round of iteration, multiple loss functions are used to constrain the content consistency and content diversity of the synthesized security fine-tuning data to generate the current round of synthetic data;
[0072] Constrain the content of the data generated in the current round to be similar to the original malicious instruction and not deviate from the intention of the malicious instruction;
[0073] If the data generated in the current round is not similar to the data already generated, the control iteration is repeated to generate data;
[0074] Constrain the current round of generated data to be far away from safe data in the representation space and close to malicious instructions;
[0075] When the threshold of the number of iterations is reached, the iterative model representation space expansion step ends.
[0076] Specifically, step 102 includes: using the trained intent hiding model and iterative model representation space expansion technology to expand the coverage of the synthetic security fine-tuning corpus in the model representation space and improve the similarity between the security fine-tuning corpus and the real jailbreak data. The number of iterations k is a manually set hyperparameter. In each round of iteration, we use three types of loss functions to constrain the content consistency and content diversity of the synthetic data. Specifically, we focus on the data generated in the current round: (1) The content theme needs to be similar to the original malicious instructions and not deviate from the intention of the malicious instructions; (2) It is dissimilar to the generated data and controls repeated generation; (3) It is far away from the safe data in the representation space and close to the malicious instructions. The training loss function is as follows:
[0077]
[0078] like Figure 2 As shown, A set of characterization vectors representing the hazard dataset, Represents the characterization vector corresponding to the i-th data in the hazard dataset, represents the data representation vector set generated in the tth iteration, Indicates the representation vector corresponding to the k-th data in the j-th round of generated data, Represents a set of characterization vectors of a security dataset, Represents the representation vector corresponding to the i-th data in the security dataset. d, ε are distance interval hyperparameters, δ, φ, γ are loss balance hyperparameters. In the actual system,
[0079] d=ε=1e-2
[0080] δ=0.6,φ=0.2,γ=0.2
[0081] In a specific embodiment of the present invention, the iterative model representation space expansion step 102 further includes:
[0082] In the k-th iteration, the intention hidden model trained in the first iteration will be used as the basis, and L aug Train a data augmentation model M k , generate a batch of data A k , where k is an integer greater than 0;
[0083] After completing all k rounds of iterations, we get k models {M1, M2, ..., M k}; and the corresponding generated k types of synthetic data samples {A1, A2, ..., A k};
[0084] The k models and k types of synthetic data samples are added as new security fine-tuning data to the security fine-tuning of the model.
[0085] Specifically, in iteration round k, based on the intention hidden model trained in step 101, L aug Train a data augmentation model M k , generate a batch of data A k After completing all k rounds of iterations, k models {M1, M2, ..., M k} and the corresponding generated k types of synthetic data samples {A1,A2,…,A k These k models and k types of data samples are added to the security fine-tuning of the model as new security fine-tuning data.
[0086] Compared with the existing technology, the method of the present invention has the following advantages: (1) Improved model security performance: By combining the internal representation distribution of the model with the distribution of real attack data, the effectiveness of model security fine-tuning is enhanced; (2) Targeted expansion of security training expectations: By iteratively expanding the model representation space, the problem of over-concentration of data distribution in existing security fine-tuning expectations is solved, and the difference with real attack data is bridged; (3) Optimized security fine-tuning efficiency: By synthesizing security fine-tuning corpus with diverse distribution, redundant data training on the model is avoided, thereby improving the efficiency of security fine-tuning.
[0087] Example 2
[0088] like Figure 3 As shown, an embodiment of the present application provides a security fine-tuning data synthesis system based on iterative model representation space expansion, which adopts the security fine-tuning data synthesis method based on iterative model representation space expansion as described above. The system includes:
[0089] Intent hiding model training module 201: uses a supervised fine-tuning method to train the intent hiding model, converting simple malicious instructions into intent hiding instructions to improve the similarity between synthetic data and real attack data;
[0090] Iterative model representation space expansion module 202: Utilizes the trained hidden intent model and uses iterative model representation space expansion technology to iteratively expand the coverage of the synthetic security fine-tuning corpus in the model representation space and gradually synthesize security fine-tuning data.
[0091] Example 3
[0092] An embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon. When the program is executed by a processor, the steps of the security fine-tuning data synthesis method based on iterative model representation space expansion are implemented.
[0093] Example 4
[0094] An embodiment of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the steps of the secure fine-tuning data synthesis method based on iterative model representation space expansion are implemented.
[0095] In addition, combined Figure 1 The security fine-tuning data synthesis method based on iterative model representation space expansion described in the embodiment of the present application can be implemented by an electronic device, such as a computer device. Figure 4 Schematic diagram of the hardware structure of a computer device according to an embodiment of the present application.
[0096] In some embodiments, the computer device may further include a communication interface 83 and a bus 80. Figure 4 As shown, the processor 81, the memory 82, and the communication interface 83 are connected via a bus 80 and communicate with each other.
[0097] Specifically, the processor 81 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
[0098] The memory 82 may be used to store or cache various data files required for processing and / or communication, as well as possible computer program instructions executed by the processor 81 .
[0099] The processor 81 reads and executes computer program instructions stored in the memory 82 to implement any one of the security fine-tuning data synthesis methods based on iterative model representation space expansion in the above embodiments.
[0100] The technical features of the above-mentioned embodiments can be combined arbitrarily. In order to make the description concise, not all possible combinations of the technical features in the above-mentioned embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0101] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that a person skilled in the art could make various modifications and improvements without departing from the spirit of the present application, all of which fall within the scope of protection of the present application. Therefore, the scope of protection of the present patent application shall be determined by the appended claims.
Claims
1. A secure fine-tuning data synthesis method based on iterative model representation space expansion, characterized by: The method comprises: Intent-hiding model training steps: Use supervised fine-tuning to train the intent-hiding model, converting simple malicious commands into intent-hidden commands to improve the similarity between synthetic data and real attack data; Iterative model representation space expansion step: Utilizing the trained hidden intent model, using iterative model representation space expansion technology, iteratively expands the coverage of the synthetic security fine-tuning corpus in the model representation space, and gradually synthesizes security fine-tuning data.
2. The method for synthesizing security fine-tuning data based on iterative model representation space expansion according to claim 1, characterized in that: The intention hidden model training steps include: By adding semantic distance loss to the training loss function of the intent hidden model, the intent hidden model is trained to insert simple malicious instructions into complex scenarios.
3. The method for synthesizing security fine-tuning data based on iterative model representation space expansion according to claim 2, characterized in that: The training loss function includes: θ1argmin θ [α* Lsft (q',q^)-β*L sem (q',q^)] Among them, L sft (q',q^) represents the supervision loss function, represents the semantic distance loss function, cos_sim represents the cosine similarity function; θ is the parameter of the hidden intent model, q', Represents the reference intention hidden instruction and the model output intention hidden instruction, y' j , They represent the token of the reference intent hidden instruction and the token of the model output intent instruction, z', They represent the model internal representation vectors of the reference intention instruction and the model output intention hidden instruction respectively, and α and β are hyperparameters.
4. The method for synthesizing security fine-tuning data based on iterative model representation space expansion according to claim 1, characterized in that: The iterative model representation space expansion step includes: In each round of iteration, multiple loss functions are used to constrain the content consistency and content diversity of the synthesized security fine-tuning data to generate the current round of synthesized data; Constrain the subject matter of the content of the data generated in the current round to be similar to the original malicious instruction and not deviate from the intention of the malicious instruction; If the data generated in the current round is not similar to the data already generated, controlling the iterative regeneration of data; Constraining the currently generated data to be far away from the safety data in the representation space and close to the malicious instructions; When the threshold of the number of iterations is reached, the iterative model representation space expansion step ends.
5. The method for synthesizing security fine-tuning data based on iterative model representation space expansion according to claim 4, characterized in that: The multiple loss functions include: Losses due to malicious themes; is the positive and negative sample comparison loss; Characterize distance loss for hazard data.
6. The method for synthesizing security fine-tuning data based on iterative model representation space expansion according to claim 5, characterized in that: The loss function for training the hidden intent model is as follows: in, A set of characterization vectors representing the hazard dataset, Represents the characterization vector corresponding to the i-th data in the hazard dataset, represents the data representation vector set generated in the tth iteration, Indicates the representation vector corresponding to the k-th data in the j-th round of generated data, Represents a set of characterization vectors of a security dataset, represents the representation vector corresponding to the i-th data in the security dataset, d, ε are distance interval hyperparameters, δ, φ, γ are loss balance hyperparameters. In the actual system, d=ε=1e-2 δ=0.6,φ=0.2,γ=0.2 where Z x The model representation space vector represents the sample in the dataset X, and δ, φ, γ are hyperparameters.
7. The method for synthesizing security fine-tuning data based on iterative model representation space expansion according to claim 6, characterized in that: The iterative model representation space expansion step further includes: In the k-th iteration, the intention hidden model trained in the first iteration will be used as the basis, and L aug Train a data augmentation model M k , generate a batch of data A k , wherein k is an integer greater than 0; After completing all k rounds of iterations, we get k models {M1, M2, ..., M k }; and the corresponding generated k types of synthetic data samples {A1, A2, ..., A k }; The k models and k types of synthetic data samples are added as new security fine-tuning data to the security fine-tuning of the model.
8. A security fine-tuning data synthesis system based on iterative model representation space expansion, using the security fine-tuning data synthesis method based on iterative model representation space expansion according to any one of claims 1 to 7, characterized in that: The system comprises: Hidden Intent Model Training Module: This module uses supervised fine-tuning to train the hidden intent model, converting simple malicious commands into hidden intent commands to improve the similarity between synthetic data and real attack data. Iterative model representation space expansion module: Utilizing the trained hidden intent model and using iterative model representation space expansion technology, iteratively expands the coverage of the synthetic security fine-tuning corpus in the model representation space and gradually synthesizes security fine-tuning data.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the security fine-tuning data synthesis method based on iterative model representation space expansion according to any one of claims 1 to 7 are implemented.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the steps of the security fine-tuning data synthesis method based on iterative model representation space expansion are implemented as described in any one of claims 1 to 7.