Method and device for simplifying cue word set and storage medium
By using a large language model to iteratively process the initial prompt word collection and scene constraint optimization in the field of information security, the problem of low quality of prompt words is solved, and the quality of prompt words and synthetic data is significantly improved, which is suitable for application scenarios in the field of information security.
Patent Information
- Application Number
- CN202411542679.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-31
- Publication Date
- 2025-03-28
- Estimated Expiration
- 2044-10-31
AI Technical Summary
The prompt words used in the information security field are not of high quality, the field where the data belongs is poorly correlated with the security field, and the data does not comply with the grammatical rules, resulting in poor quality of synthetic data.
By inputting the preset set of initial prompt words into a large language model for learning, the initial input data is processed in an iterative manner. Each iteration determines whether the number of initial input data has changed based on the first score value and/or the second score value, and stops the iteration process when there is no longer any change. The synthetic data is scored using a preset algorithm, the number of initial input data is determined, and the prompt words are optimized through scene constraints.
It effectively improves the quality of prompt words, makes them more in line with the current application scenarios, and thus improves the quality of generated synthetic data.
Smart Images

Figure CN119721013A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of data processing, and provides a method, device and storage medium for concise prompt word set. Background Art
[0002] With its powerful language understanding and knowledge emergence capabilities, large language models have begun to empower many fields, and the information security field has also begun to study the help that large language models can bring. Taking network operations as an example, the current mainstream method is to filter out a large amount of log information through various rule engines and threat intelligence libraries. For those log alarms that cannot be filtered out, they will be formed into alarm tickets through aggregation, association and other rules, and then judged by operators, which is time-consuming and laborious.
[0003] Moreover, the quality of the prompt words used in the field of information security is not high. For example, the field to which the data in the prompt words belong has a poor correlation with the security field, the data itself does not conform to grammatical rules, has poor quality, etc., which results in the poor quality of the synthesized data of the above prompt words after being processed by a large language model. Summary of the invention
[0004] The embodiments of the present application provide a method, device and storage medium for simplifying a prompt word set, so as to improve the quality of each initial input data in the prompt word, so that the prompt word is more suitable for the current application scenario.
[0005] The specific technical solutions provided by this application are as follows:
[0006] In a first aspect, an embodiment of the present application provides a method for simplifying a prompt word set, which is applied to a server, and the method includes:
[0007] Inputting a preset initial prompt word set into a large language model for learning, and processing a plurality of initial input data included in the initial prompt word set in an iterative manner;
[0008] In each round of iteration, whether the number of initial input data has changed is determined according to the first score value and / or the second score value of this round, and the iteration process is stopped when the number no longer changes; wherein each round of iteration process is as follows:
[0009] Using a preset first algorithm to score each first synthesized data to obtain a first score value, wherein the first synthesized data is obtained after the large language model learns each initial input data included in the initial prompt word set; and / or
[0010] A preset second algorithm is used to score each second synthesized data to obtain a second score value, wherein the second synthesized data is obtained by learning each initial input data included in the initial prompt word set using a large language model after adding scene constraints.
[0011] Optionally, the first synthetic data is determined by:
[0012] Inputting a preset initial prompt word set into a large language model for learning to obtain a plurality of first output data, wherein one initial input data included in the initial prompt word set corresponds to at least one first output data;
[0013] Based on the initial input data and at least one corresponding first output data, first synthesis data are determined.
[0014] Optionally, the second synthetic data is determined by:
[0015] Add scenario constraints to the large language model, where different rounds of iterations correspond to different scenario constraints;
[0016] Inputting each initial input data included in the initial prompt word set into the large language model after adding the scene constraint condition for learning, and obtaining a plurality of second output data, wherein one initial input data included in the initial prompt word set corresponds to at least one second output data;
[0017] Based on the initial input data and at least one corresponding second output data, second synthesis data are determined.
[0018] Optionally, the first algorithm includes a first professionalism sub-algorithm, a first grammar sub-algorithm and a first anomaly detection sub-algorithm, and each first synthetic data is scored respectively using the preset first algorithm to obtain a first score value, including:
[0019] Using a preset first professionalism sub-algorithm to score each first synthetic data to obtain a professionalism score;
[0020] Using a preset first grammar sub-algorithm to score each first synthetic data to obtain a grammar score;
[0021] Using a preset first anomaly detection sub-algorithm to score each first synthetic data to obtain an anomaly detection score;
[0022] The professionalism score, the grammar score, and the anomaly detection score are added together to obtain a first score value.
[0023] Optionally, using a preset second algorithm to score each second synthetic data to obtain a second score value includes:
[0024] The quality of each second synthetic data is scored respectively using a preset second algorithm to obtain a second score value.
[0025] Optionally, before using the preset second algorithm to score each second synthetic data, the method further includes:
[0026] Determine the correlation value between each initial input data included in the initial prompt word set and the scene constraint condition;
[0027] Initial input data with a correlation value less than a preset correlation threshold is deleted from the initial prompt word set.
[0028] Optionally, determining whether the number of initial input data has changed according to the first score value and / or the second score value of the current round includes:
[0029] Compare the first score value of this round with the first standard score value preset in this round;
[0030] If the first score value is less than the first standard score value, the initial input data below the first threshold value is deleted from the initial prompt word set;
[0031] Compare the second score value of this round with the second standard score value preset in this round;
[0032] If the second score value is less than the second standard score value, the initial input data below the second threshold value is deleted from the initial prompt word set;
[0033] If the first score value is not less than the first standard score value and / or the second score value is not less than the second standard score value, it is determined that the number of initial input data in the initial prompt word set corresponding to this round does not change any more.
[0034] In a second aspect, the embodiment of the present application further provides a device for simplifying a prompt word set, including:
[0035] An input unit, used for inputting a preset initial prompt word set into the large language model for learning, and iteratively processing a plurality of initial input data included in the initial prompt word set;
[0036] The iteration unit is used to determine whether the number of initial input data has changed according to the first score value and / or the second score value of this round in each iteration process, and stop the iteration process when the number no longer changes; wherein each iteration process is as follows:
[0037] a first processing unit, configured to score each first synthesized data by using a preset first algorithm to obtain a first score value, wherein the first synthesized data is obtained after the large language model learns each initial input data included in the initial prompt word set; and / or
[0038] The second processing unit is used to score each second synthetic data respectively using a preset second algorithm to obtain a second score value, wherein the second synthetic data is obtained by learning each initial input data included in the initial prompt word set using a large language model after adding scene constraints.
[0039] Optionally, the first synthetic data is determined by:
[0040] Inputting a preset initial prompt word set into a large language model for learning to obtain a plurality of first output data, wherein one initial input data included in the initial prompt word set corresponds to at least one first output data;
[0041] Based on the initial input data and at least one corresponding first output data, first synthesis data are determined.
[0042] Optionally, the second synthetic data is determined by:
[0043] Add scenario constraints to the large language model, where different rounds of iterations correspond to different scenario constraints;
[0044] Inputting each initial input data included in the initial prompt word set into the large language model after adding the scene constraint condition for learning, and obtaining a plurality of second output data, wherein one initial input data included in the initial prompt word set corresponds to at least one second output data;
[0045] Based on the initial input data and at least one corresponding second output data, second synthesis data are determined.
[0046] Optionally, the first algorithm includes a first professionalism sub-algorithm, a first grammar sub-algorithm and a first anomaly detection sub-algorithm, and each first synthetic data is scored respectively using the preset first algorithm to obtain a first score value, and the first processing unit is used to:
[0047] Using a preset first professionalism sub-algorithm to score each first synthetic data to obtain a professionalism score;
[0048] Using a preset first grammar sub-algorithm to score each first synthetic data to obtain a grammar score;
[0049] Using a preset first anomaly detection sub-algorithm to score each first synthetic data to obtain an anomaly detection score;
[0050] The professionalism score, the grammar score, and the anomaly detection score are added together to obtain a first score value.
[0051] Optionally, each second synthetic data is scored respectively by using a preset second algorithm to obtain a second score value, and the second processing unit is used to:
[0052] The quality of each second synthetic data is scored respectively using a preset second algorithm to obtain a second score value.
[0053] Optionally, before using the preset second algorithm to score each second synthetic data, the method further includes:
[0054] Determine the correlation value between each initial input data included in the initial prompt word set and the scene constraint condition;
[0055] Initial input data with a correlation value less than a preset correlation threshold is deleted from the initial prompt word set.
[0056] Optionally, determining whether the number of initial input data has changed according to the first score value and / or the second score value of this round, the iteration unit is used to:
[0057] Compare the first score value of this round with the first standard score value preset in this round;
[0058] If the first score value is less than the first standard score value, the initial input data below the first threshold value is deleted from the initial prompt word set;
[0059] Compare the second score value of this round with the second standard score value preset in this round;
[0060] If the second score value is less than the second standard score value, the initial input data below the second threshold value is deleted from the initial prompt word set;
[0061] If the first score value is not less than the first standard score value and / or the second score value is not less than the second standard score value, it is determined that the number of initial input data in the initial prompt word set corresponding to this round does not change any more.
[0062] In a third aspect, a server includes:
[0063] A memory for storing executable instructions;
[0064] A processor is used to read and execute executable instructions stored in a memory to implement any method as described in the first aspect.
[0065] In a fourth aspect, a computer-readable storage medium is provided. When instructions in the storage medium are executed by a processor, the processor is enabled to execute any method described in the first aspect.
[0066] The beneficial effects of this application are as follows:
[0067] In summary, in the embodiments of the present application, a method, device and storage medium for simplifying a prompt word set are provided. The method is applied to a server, and the method comprises: inputting a preset initial prompt word set into a large language model for learning, and processing a plurality of initial input data included in the initial prompt word set in an iterative manner. During each round of iteration, determining whether the number of initial input data has changed according to the first score value and / or the second score value of this round, and stopping the iteration process when the number no longer changes, wherein each round of iteration process is as follows: using a preset first algorithm to score each first synthetic data respectively to obtain a first score value, wherein the first synthetic data is a large language model. The model is obtained after learning each initial input data included in the initial prompt word set; and / or, a preset second algorithm is used to score each second synthetic data respectively to obtain a second score value, wherein the second synthetic data is obtained after using the large language model with the scene constraint added to learn each initial input data included in the initial prompt word set. The above-mentioned method of simplifying each initial input data by the first score value and / or the second score value, and using the large language model with the scene constraint added to learn each initial input data, effectively improves the quality of the prompt word, makes the prompt word more in line with the current application scenario, and thereby improves the quality of the generated synthetic data.
[0068] Other features and advantages of the present application will be described in the following description, and partly become apparent from the description, or be understood by practicing the present application. The purpose and other advantages of the present application can be realized and obtained by the structures specifically pointed out in the written description, claims, and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0069] 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:
[0070] Figure 1 A schematic diagram of a system architecture for simplifying prompt words in an embodiment of the present application;
[0071] Figure 2 This is a schematic diagram of a process for simplifying prompt words in an embodiment of the present application;
[0072] Figure 3 This is a schematic diagram of a process for determining first synthetic data in an embodiment of the present application;
[0073] Figure 4 This is a schematic diagram of a process for determining second synthetic data in an embodiment of the present application;
[0074] Figure 5This is a schematic diagram of a process of using a first algorithm to obtain a first score value in an embodiment of the present application;
[0075] Figure 6 This is a schematic diagram of a process for simplifying a prompt word set in an embodiment of the present application;
[0076] Figure 7 A schematic diagram of the logical architecture of a device for simplifying prompt words in an embodiment of the present application;
[0077] Figure 8 This is a schematic diagram of the physical architecture of a server in an embodiment of the present application. DETAILED DESCRIPTION
[0078] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the technical solution of the present application, rather than all of the embodiments. Based on the embodiments recorded in the application documents, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the technical solution of the present application.
[0079] The terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented using sequences other than those illustrated or described herein.
[0080] The following is an explanation of the professional terms involved in this application.
[0081] Large Language Model (LLM): is an AI model designed to understand and generate human language. They are trained on large amounts of text data and can perform a wide range of tasks, including text summarization, translation, sentiment analysis, and more. LLMs are characterized by their large size and contain billions of parameters, which help them learn complex patterns in language data.
[0082] Synthetic Data: Synthetic data is non-artificially created data that imitates real-world data. It is created by computational algorithms and simulations based on generative artificial intelligence technology. Synthetic prompts have the same mathematical properties as the actual data they are based on, but do not contain the same information. In the field of machine learning and artificial intelligence, synthetic data can provide training materials for models to help them learn, understand and predict.
[0083] The preferred implementation modes of the present application are described in detail below with reference to the accompanying drawings.
[0084] See also Figure 1 As shown, in the embodiment of the present application, the system includes at least one server. Figure 1 In the embodiment, the initial prompt word set 1, the initial prompt word set 2 and the initial prompt word set n can be input into the server for streamlining, so as to obtain the streamlined initial prompt word set 1, the initial prompt word set 2 and the initial prompt word set n accordingly. The above-mentioned initial prompt word sets usually include multiple prompt texts input into the large language model, but the correlation between the prompt texts and the large language model is uncertain. After the above-mentioned initial prompt word sets are streamlined, prompt texts that are more adapted to the large language model are finally obtained.
[0085] In the embodiment of the present application, a method for simplifying a prompt word set is implemented mainly on the server side, and the following is a specific introduction to the process of simplifying an initial prompt word set.
[0086] See also Figure 2 As shown, in the embodiment of the present application, a specific process of simplifying the prompt word set is as follows:
[0087] Step 201: input a preset initial prompt word set into a large language model for learning, and process a plurality of initial input data included in the initial prompt word set in an iterative manner.
[0088] First of all, it should be noted that the initial prompt word set includes multiple initial input data, which are usually preset manually, but the correlation between each of the initial input data and the application scenario used by the large language model is uncertain. Based on this, in the embodiment of the present application, the large language model is used to simplify the initial input data included in the initial prompt word set, so that the quality of the synthesized data obtained after the simplified initial input data passes through the large language model is higher.
[0089] During the implementation, an iterative method is used to streamline the multiple initial input data included in the initial prompt word set.
[0090] Step 202: During each round of iteration, determine whether the number of initial input data has changed according to the first score value and / or the second score value of this round, and stop the iteration process when the number no longer changes; wherein each round of iteration process is as follows:
[0091] Considering that the number of initial input data included in the initial prompt word set is uncertain, and the correlation between each initial input data and the application scenario used by the large language model is uncertain. Therefore, in the process of executing each round of iteration, after calculating the first score value and / or the second score value, it is determined whether to delete each initial input data in the initial prompt word set according to the first score value, or according to the second score value, or according to the first score value and the second score value, that is, it is determined whether the number of initial input data in the initial prompt word set changes, and the above iteration process is stopped when the number of initial input data no longer changes, that is, a streamlined initial prompt word set is obtained. The execution steps in each round of iteration are described in detail below through steps 203 and 204.
[0092] Step 203: using a preset first algorithm to score each first synthesized data to obtain a first score value, wherein the first synthesized data is obtained after the large language model learns each initial input data included in the initial prompt word set; and / or
[0093] First of all, it should be noted that Figure 3 As shown, the first synthetic data is determined in the following manner:
[0094] Step 101: input a preset initial prompt word set into a large language model for learning to obtain a plurality of first output data, wherein an initial input data included in the initial prompt word set corresponds to at least one first output data.
[0095] During the implementation, each initial input data included in the preset initial prompt word set is input into the large language model for learning, and at least one first output data can be obtained for each initial input data through the large language model. In this way, multiple first output data can be obtained for each initial input data included in the initial prompt word set, and one initial input data corresponds to at least one first output data.
[0096] Step 102: Determine first synthesized data based on initial input data and at least one corresponding first output data.
[0097] After obtaining multiple first output data, each initial input data is combined with at least one corresponding first output data to determine a first synthetic data. It should be noted that when an initial input data and multiple first output data constitute a synthetic data, the initial input data and multiple first output data can be combined in a set manner.
[0098] It should be noted that, see Figure 4 As shown, the second synthetic data is determined by:
[0099] Step 101 ′: adding scene constraints to the large language model, wherein different rounds of iterations correspond to different scene constraints.
[0100] In order to achieve targeted optimization and rewriting of the initial prompt word set, different scenario constraints can be added to the large language model in different rounds of iterations during implementation, so that each initial input data is more inclined to the preset usage scenario. In order to achieve gradual optimization of the initial prompt word set, relatively broad scenario constraints can be added to the large language model during implementation, and more stringent scenario constraints can be gradually added in subsequent iterations.
[0101] Step 102 ′: input each initial input data included in the initial prompt word set into the large language model after adding scene constraints for learning, and obtain multiple second output data, wherein one initial input data included in the initial prompt word set corresponds to at least one second output data.
[0102] After adding the scene constraint to the large language model, each initial input data included in the initial prompt word set is input into the large language model after adding the scene constraint for learning, and at least one second output data can be obtained for one initial input data through the large language model. In this way, multiple second output data can be obtained for each initial input data included in the initial prompt word set, and one initial input data corresponds to at least one second output data.
[0103] It should be noted that the initial prompt word set input into the large language model after adding the scene constraint condition may be a preset initial prompt word set, or an initial prompt word set after each initial input data is simplified by the first score value, or an initial prompt word set after each initial input data is iteratively simplified by the second score value, or the first score value and the second score value. That is, in one embodiment, the second synthetic data can be directly obtained according to the preset initial prompt word set, and each initial input data is simplified according to the second score value; in another embodiment, the first synthetic data is first obtained according to the preset initial prompt word set, and each initial input data is preliminarily simplified according to the first score value obtained by scoring the first synthetic data, and on this basis, the preliminarily simplified initial prompt word set is input into the large language model after adding the scene constraint condition; in a third embodiment, the initial prompt word set after each initial input data is simplified at least once according to the second score value, or the initial prompt word set after each initial input data is iteratively simplified by the first score value and the second score value is input into the large language model after adding the scene constraint condition.
[0104] Step 103 ′: Determine second synthesized data based on the initial input data and at least one corresponding second output data.
[0105] After obtaining multiple second output data, each initial input data is combined with at least one corresponding second output data to determine a second synthetic data. It should be noted that when an initial input data and multiple second output data constitute a synthetic data, the initial input data and multiple second output data can be combined in a set manner.
[0106] During the implementation, after obtaining a plurality of first synthetic data, the first algorithm is used to score each first synthetic data, the first algorithm includes a first professional degree sub-algorithm, a first grammar sub-algorithm and a first anomaly detection sub-algorithm. The first algorithm is used to score each first synthetic data to obtain a first score value. Figure 5 As shown, including:
[0107] Step 2031: Use the preset first professionalism sub-algorithm to score each first synthetic data to obtain a professionalism score.
[0108] It should be noted that the above-mentioned first professional degree sub-algorithm can be pre-set and integrated into the large language model. During the implementation process, the above-mentioned first professional degree sub-algorithm can be implemented by scoring the historical first synthetic data according to the prior professional knowledge. The implementation method includes but is not limited to scoring the historical first synthetic data according to the prior professional knowledge to obtain scores of different levels, and combining the weights corresponding to each level to determine the first professional degree sub-algorithm. For example, when the historical first synthetic data is scored according to the prior professional knowledge to obtain three levels of scores, and the weights of the scores from high to low are set to 100%, 50% and 0 respectively, the total score corresponding to the first professional degree sub-algorithm can be expressed by the formula: Among them, N1 represents the number of initial input data corresponding to the level with high score, N2 represents the number of initial input data corresponding to the level with medium score, and N3 represents the number of initial input data corresponding to the level with low score.
[0109] During the implementation process, after the first professionalism sub-algorithm is determined, each first synthetic data is scored using the first professionalism sub-algorithm, and the scored data are weighted or weighted averaged to obtain a professionalism score.
[0110] Step 2032: Use the preset first grammar sub-algorithm to score each first synthetic data to obtain a grammar score.
[0111] It should be noted that the above-mentioned first grammar sub-algorithm can be pre-set and integrated into the large language model. During the implementation process, it can be achieved by scoring the historical first synthetic data according to the grammatical knowledge. The above-mentioned grammar can be the rules set in various fields or application scenarios. For example, when the large language model is applied to the field of information security, the above-mentioned grammar is the regulation related to the field of information security, and the first grammar sub-algorithm is constructed according to this regulation.
[0112] After the first grammar sub-algorithm is determined, each first synthetic data is scored using the first grammar sub-algorithm, and then the scored data are weighted or weighted averaged to obtain a grammar score.
[0113] Step 2033: Use the preset first anomaly detection sub-algorithm to score each first synthetic data to obtain anomaly detection scores.
[0114] It should be noted that the above-mentioned first anomaly detection sub-algorithm can also be pre-set and integrated into the large language model. During the implementation process, it is inevitable that the first synthetic data with data anomalies will appear. Common anomalies include: long-tail generation, empty replies, abnormal characters, whether the instructions are followed, etc. The industry usually refers to the above-mentioned first synthetic data with anomalies as abnormal samples, and the first synthetic data without anomalies as normal samples. In this way, the larger the ratio of the number of normal samples to the total number of samples, the fewer abnormal samples there are in this group of first synthetic data, and the lower the corresponding anomaly detection score.
[0115] After the first anomaly detection sub-algorithm is determined, each first synthetic data is scored using the first anomaly detection sub-algorithm, and then the scored data are weighted or weighted averaged to obtain an anomaly detection score.
[0116] Step 2034: Add the professionalism score, grammar score and anomaly detection score to obtain a first score value.
[0117] In order to comprehensively measure the quality of the first synthetic data obtained, during the implementation process, the professional score, grammar score and anomaly detection score obtained above are added together, and the total score obtained is the first score value. It should be noted that the total score can also be averaged to obtain the first score value. The above first score value corresponds to a first synthetic data one by one, and multiple first score values can be obtained after scoring each first synthetic data separately. In addition, multiple first score values can be obtained in one round of iteration.
[0118] The following is an introduction to the process of determining the second score value. First of all, it should be supplemented that before using the preset second algorithm to score each second synthetic data, the following process is also included:
[0119] (1) Determine the correlation values between each initial input data included in the initial prompt word set and the scene constraint conditions.
[0120] Considering that scenario constraints are used to limit the correlation between the input and output of the large language model, if the initial input data has a poor correlation with the scenario constraints, for example, when the scenario constraints are information security-related fields, and the initial input data are vegetable planting, the correlation between information security-related fields and vegetable planting is poor. Even if the initial input data is input into the large language model, no results related to information security can be obtained.
[0121] Based on this, during the implementation process, after adding scene constraints to the large language model, the correlation values between each initial input data included in the initial prompt word set and the scene constraints are calculated respectively.
[0122] (2) Initial input data with correlation values less than a preset correlation threshold is deleted from the initial prompt word set.
[0123] After obtaining multiple correlation values, the size of each correlation value is compared with the preset correlation threshold, which represents the minimum value of correlation with the added scene constraint. When the comparison finds that the correlation value is less than the preset correlation threshold, it means that the initial input data corresponding to the correlation value has a poor correlation with the scene constraint, and the initial input data corresponding to the correlation value is deleted from the initial prompt word set, thereby achieving the simplification of the initial prompt word set.
[0124] Step 204: Use a preset second algorithm to score each second synthesized data to obtain a second score value, wherein the second synthesized data is obtained by learning each initial input data included in the initial prompt word set using a large language model after adding scene constraints.
[0125] During the implementation process, after each initial input data included in the initial prompt word set is input into the large language model after adding the scene constraint condition for learning, a plurality of second synthetic data are obtained, and each second synthetic data is scored respectively using a preset second algorithm to obtain a second score value, including:
[0126] The quality of each second synthetic data is scored respectively using a preset second algorithm to obtain a second score value.
[0127] It should be noted that the above second algorithm can be pre-set and integrated into the large language model. During the implementation process, the second algorithm is used to score the quality of each second synthetic data. The limitation of the quality of the second synthetic data here can be specifically set according to the scene constraint. Exemplarily, the second algorithm can include scoring the quality of the grammar, scene relevance, etc. of the second synthetic data, so that a corresponding second score value can be obtained for each second synthetic data, that is, multiple second score values are obtained.
[0128] The above-mentioned determining whether the number of initial input data has changed according to the first score value and / or the second score value of the current round includes:
[0129] First of all, it should be explained that in the embodiment of the present application, each round of iteration process can be divided into three cases: in the first case, only the first synthetic data is scored to obtain the first score value; in the second case, only the second synthetic data is scored to obtain the second score value; in the third case, after the first synthetic data is scored to obtain the first score value, the second synthetic data is scored to obtain the second score value. Accordingly, during the iteration process, only the first score value can be referred to determine whether the number of initial input data has changed; only the second score value can be referred to determine whether the number of initial input data has changed; and both the first score value and the second score value can be referred to determine whether the number of initial input data has changed.
[0130] Preferably, during the implementation, the first score value and the second score value are simultaneously referred to determine whether the number of initial input data has changed. Figure 6 As shown:
[0131] Step 2041: Compare the first score value of this round with the first standard score value preset for this round.
[0132] During implementation, after scoring the first synthetic data and obtaining the first score value, the first score value can be used to determine whether the number of initial input data has changed. Specifically, the first score value can be compared with a preset first standard score value. It should be noted that the above-mentioned first standard score value is usually the minimum score value that the initial input data meets the requirements according to the pre-set professional score, grammar score and anomaly detection score, that is, only the initial input data higher than or equal to the first standard score value can be retained in the initial prompt word set, and the initial input data lower than the first standard score value will be deleted from the initial prompt word set.
[0133] Step 2042: If the first score value is less than the first standard score value, the initial input data below the first threshold value is deleted from the initial prompt word set.
[0134] During the implementation process, if the first score value of this round is less than the first standard score value preset for this round, it means that the initial input data corresponding to the first score value does not meet the requirements. In this case, the initial input data is deleted from the initial prompt word set, thereby streamlining the initial input data in the initial prompt word set.
[0135] Step 2043: Compare the second score value of this round with the second standard score value preset for this round.
[0136] During implementation, after scoring the second synthetic data and obtaining the second score value in this round of iteration, the second score value can be used to determine whether the number of initial input data has changed. Specifically, the second score value can be compared with the preset second standard score value. It should be noted that the above-mentioned second standard score value is usually the lowest score value that meets the requirements of the initial input data set after the quality score of the second synthetic data is performed, that is, only the initial input data higher than or equal to the second standard score value can be retained in the initial prompt word set, and the initial input data lower than the second standard score value will be deleted from the initial prompt word set.
[0137] Step 2044: If the second score value is less than the second standard score value, the initial input data below the second threshold value is deleted from the initial prompt word set.
[0138] During the implementation process, if the second score value of this round is less than the second standard score value preset for this round, it means that the initial input data corresponding to the second score value does not meet the requirements. In this case, the initial input data is deleted from the initial prompt word set, so that the initial input data in the initial prompt word set is more correlated with the added scene constraint conditions.
[0139] Step 2045: If the first score value is not less than the first standard score value and / or the second score value is not less than the second standard score value, it is determined that the number of initial input data in the initial prompt word set corresponding to this round does not change any more.
[0140] In one embodiment, when it is determined after comparison that the first score value is not less than the first standard score value, then the initial input data corresponding to the first score value does not need to be deleted from the initial prompt word set, that is, it is determined that the number of initial input data in the initial prompt word set corresponding to this round no longer changes.
[0141] In another embodiment, when it is determined after comparison that the second score value is not less than the second standard score value, then the initial input data corresponding to the second score value does not need to be deleted from the initial prompt word set, that is, it is determined that the number of initial input data in the initial prompt word set corresponding to this round no longer changes.
[0142] In the third embodiment, when it is determined after comparison that the first score value is not less than the first standard score value, then the initial input data corresponding to the first score value does not need to be deleted from the initial prompt word set. On this basis, when it is determined after comparison that the second score value is not less than the second standard score value, the initial input data corresponding to the second score value does not need to be deleted from the initial prompt word set, that is, it is determined that the number of initial input data in the initial prompt word set corresponding to this round will no longer change.
[0143] Based on the same inventive concept, see Figure 7 As shown, in an embodiment of the present application, a device for simplifying a prompt word set is provided, comprising:
[0144] An input unit 701 is used to input a preset initial prompt word set into a large language model for learning, and iteratively processes a plurality of initial input data included in the initial prompt word set;
[0145] The iteration unit 702 is used to determine whether the number of initial input data has changed according to the first score value and / or the second score value of this round in each iteration process, and stop the iteration process when the number no longer changes; wherein each iteration process is as follows:
[0146] The first processing unit 703 is used to score each first synthesized data by using a preset first algorithm to obtain a first score value, wherein the first synthesized data is obtained after the large language model learns each initial input data included in the initial prompt word set; and / or
[0147] The second processing unit 704 is used to score each second synthesized data using a preset second algorithm to obtain a second score value, wherein the second synthesized data is obtained by learning each initial input data included in the initial prompt word set using a large language model after adding scene constraints.
[0148] Optionally, the first synthetic data is determined by:
[0149] Inputting a preset initial prompt word set into a large language model for learning to obtain a plurality of first output data, wherein one initial input data included in the initial prompt word set corresponds to at least one first output data;
[0150] Based on the initial input data and at least one corresponding first output data, first synthesis data are determined.
[0151] Optionally, the second synthetic data is determined by:
[0152] Add scenario constraints to the large language model, where different rounds of iterations correspond to different scenario constraints;
[0153] Inputting each initial input data included in the initial prompt word set into the large language model after adding the scene constraint condition for learning, and obtaining a plurality of second output data, wherein one initial input data included in the initial prompt word set corresponds to at least one second output data;
[0154] Based on the initial input data and at least one corresponding second output data, second synthesis data are determined.
[0155] Optionally, the first algorithm includes a first professionalism sub-algorithm, a first grammar sub-algorithm and a first anomaly detection sub-algorithm, and each first synthetic data is scored respectively using the preset first algorithm to obtain a first score value. The first processing unit 703 is used to:
[0156] Using a preset first professionalism sub-algorithm to score each first synthetic data to obtain a professionalism score;
[0157] Using a preset first grammar sub-algorithm to score each first synthetic data to obtain a grammar score;
[0158] Using a preset first anomaly detection sub-algorithm to score each first synthetic data to obtain an anomaly detection score;
[0159] The professionalism score, the grammar score, and the anomaly detection score are added together to obtain a first score value.
[0160] Optionally, each second synthetic data is scored respectively by using a preset second algorithm to obtain a second score value, and the second processing unit 704 is used to:
[0161] The quality of each second synthetic data is scored respectively using a preset second algorithm to obtain a second score value.
[0162] Optionally, before using the preset second algorithm to score each second synthetic data, the method further includes:
[0163] Determine the correlation value between each initial input data included in the initial prompt word set and the scene constraint condition;
[0164] Initial input data with a correlation value less than a preset correlation threshold is deleted from the initial prompt word set.
[0165] Optionally, determining whether the number of initial input data has changed according to the first score value and / or the second score value of this round, the iteration unit 702 is configured to:
[0166] Compare the first score value of this round with the first standard score value preset in this round;
[0167] If the first score value is less than the first standard score value, the initial input data below the first threshold value is deleted from the initial prompt word set;
[0168] Compare the second score value of this round with the second standard score value preset in this round;
[0169] If the second score value is less than the second standard score value, the initial input data below the second threshold value is deleted from the initial prompt word set;
[0170] If the first score value is not less than the first standard score value and / or the second score value is not less than the second standard score value, it is determined that the number of initial input data in the initial prompt word set corresponding to this round does not change any more.
[0171] Based on the same inventive concept, see Figure 8 As shown, an embodiment of the present application provides a server, including: a memory 801, used to store executable instructions; a processor 802, used to read and execute the executable instructions stored in the memory, and execute any one of the methods of the first aspect above.
[0172] Based on the same inventive concept, an embodiment of the present application provides a computer-readable storage medium. When instructions in the storage medium are executed by a processor, the processor is enabled to execute the method described in any one of the first aspects above.
[0173] In summary, in the embodiments of the present application, a method, device and storage medium for simplifying a prompt word set are provided. The method is applied to a server, and the method comprises: inputting a preset initial prompt word set into a large language model for learning, and processing a plurality of initial input data included in the initial prompt word set in an iterative manner. During each round of iteration, determining whether the number of initial input data has changed according to the first score value and / or the second score value of this round, and stopping the iteration process when the number no longer changes, wherein each round of iteration process is as follows: using a preset first algorithm to score each first synthetic data respectively to obtain a first score value, wherein the first synthetic data is a large language model. The model is obtained after learning each initial input data included in the initial prompt word set; and / or, a preset second algorithm is used to score each second synthetic data respectively to obtain a second score value, wherein the second synthetic data is obtained after using the large language model with the scene constraint added to learn each initial input data included in the initial prompt word set. The above-mentioned method of simplifying each initial input data by the first score value and / or the second score value, and using the large language model with the scene constraint added to learn each initial input data, effectively improves the quality of the prompt word, makes the prompt word more in line with the current application scenario, and thereby improves the quality of the generated synthetic data.
[0174] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program product systems. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product system implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0175] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program product systems according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0176] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0177] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0178] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A method for simplifying a prompt word set, characterized in that: Applied to a server, the method comprises: Inputting a preset initial prompt word set into a large language model for learning, and processing a plurality of initial input data included in the initial prompt word set in an iterative manner; In each round of iteration, it is determined whether the number of the initial input data has changed according to the first score value and / or the second score value of this round, and the iteration process is stopped when the number no longer changes; wherein each round of iteration process is as follows: Using a preset first algorithm to score each first synthesized data respectively to obtain the first score value, wherein the first synthesized data is obtained after the large language model learns each of the initial input data included in the initial prompt word set; and / or A preset second algorithm is used to score each second synthesized data to obtain a second score value, wherein the second synthesized data is obtained by learning each of the initial input data included in the initial prompt word set using a large language model after adding scene constraints.
2. The method according to claim 1, characterized in that The first synthetic data is determined by: Inputting a preset initial prompt word set into a large language model for learning to obtain a plurality of first output data, wherein one of the initial input data included in the initial prompt word set corresponds to at least one of the first output data; Based on the initial input data and at least one corresponding first output data, the first synthesized data is determined.
3. The method according to claim 1, characterized in that The second synthetic data is determined by: Adding scenario constraints to the large language model, wherein the scenario constraints corresponding to different rounds of iteration processes are different; Inputting each of the initial input data included in the initial prompt word set into the large language model after adding the scene constraint condition for learning, to obtain a plurality of second output data, wherein one of the initial input data included in the initial prompt word set corresponds to at least one of the second output data; Based on the initial input data and at least one corresponding second output data, the second synthesized data are determined.
4. The method according to claim 1, characterized in that The first algorithm includes a first professionalism sub-algorithm, a first grammar sub-algorithm and a first anomaly detection sub-algorithm. The first algorithm is used to score each first synthetic data to obtain the first score value, including: Using a preset first professionalism sub-algorithm to score each first synthetic data to obtain a professionalism score; Using a preset first grammar sub-algorithm to score each first synthetic data to obtain a grammar score; Using a preset first anomaly detection sub-algorithm to score each first synthetic data to obtain an anomaly detection score; The professionalism score, the grammar score, and the anomaly detection score are added together to obtain the first score value.
5. The method according to claim 1, characterized in that The step of using a preset second algorithm to score each second synthetic data to obtain a second score value includes: A preset second algorithm is used to score the quality of each of the second synthetic data to obtain the second score value.
6. The method according to claim 1, characterized in that Before using the preset second algorithm to score each second synthetic data, the method further includes: Determine the correlation value between each of the initial input data included in the initial prompt word set and the scene constraint condition; The initial input data whose correlation value is less than a preset correlation threshold is deleted from the initial prompt word set.
7. The method according to any one of claims 1 to 6, characterized in that: The determining whether the number of the initial input data has changed according to the first score value and / or the second score value of the current round includes: Comparing the first score value of this round with the first standard score value preset for this round; If the first score value is less than the first standard score value, the initial input data below the first threshold value is deleted from the initial prompt word set; Comparing the second score value of this round with the second standard score value preset in this round; If the second score value is less than the second standard score value, the initial input data below the second threshold value is deleted from the initial prompt word set; If the first score value is not less than the first standard score value and / or the second score value is not less than the second standard score value, it is determined that the number of the initial input data in the initial prompt word set corresponding to this round does not change any more.
8. A device for simplifying a prompt word set, characterized in that: include: An input unit, used for inputting a preset initial prompt word set into a large language model for learning, and iteratively processing a plurality of initial input data included in the initial prompt word set; The iteration unit is used to determine whether the number of the initial input data has changed according to the first score value and / or the second score value of the current round in each iteration process, and stop the iteration process when the number no longer changes; wherein each iteration process is as follows: a first processing unit, configured to score each first synthesized data by using a preset first algorithm to obtain the first score value, wherein the first synthesized data is obtained after the large language model learns each of the initial input data included in the initial prompt word set; and / or The second processing unit is used to score each second synthesized data respectively using a preset second algorithm to obtain a second score value, wherein the second synthesized data is obtained after learning each initial input data included in the initial prompt word set using a large language model after adding scene constraints.
9. A server, characterized in that: include: A memory for storing executable instructions; A processor, configured to read and execute the executable instructions stored in the memory to implement the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: When the instructions in the storage medium are executed by a processor, the processor is enabled to execute the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Generation method and device of thinking chain expansion data based on large language model
CN117217202A
Method and device for recommending articles based on large language model and search engine
CN117391824A
Automatic optimization method and device for cue word, equipment and storage medium
CN117520507A
Generation method and device of cue word information of large language model, equipment and medium
CN117539975A
Large language model task processing method and device, equipment and medium
CN117744754A
Cited By
Performance test method and device of accelerator system, program product and medium
CN120547099A
Text data synthesis method and system for helicobacter pylori special disease model
CN120745808A