Fine adjustment instruction construction method and device, equipment and medium

By dividing negative text samples into multi-level labels and constructing initial fine-tuning instruction data for large models, and modifying it when the model cannot follow it, the problem of difficulty in effectively utilizing pre-training knowledge in fine-tuning instruction design is solved, and the performance of the model on specific tasks is improved. performance and comprehension.

CN118734928AActive Publication Date: 2024-10-01NAT COMP NETWORK & INFORMATION SECURITY MANAGEMENT CENT

Patent Information

Application Number
CN202410629625.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-21
Publication Date
2024-10-01
Estimated Expiration
2044-05-21

AI Technical Summary

Technical Problem

In the field of natural language processing, the design of fine-tuning instructions makes it difficult to effectively utilize the knowledge of the pre-trained model, resulting in poor performance of the model on specific tasks, especially when processing unseen professional terms or specific nouns, which may lead to model understanding bias and Performance degrades.

Method used

By dividing the labels of negative text samples into multiple levels of target classification labels, a preset large model is used to construct initial fine-tuning instruction data, which represents the keywords, classification categories and cause analysis of negative text samples, and is used when the target model cannot follow the initial Modify the instruction data to generate target fine-tuning instruction data to better fit the knowledge of the pre-trained model.

Benefits of technology

It improves the usability of fine-tuning instructions and the model's ability to follow instructions, making the text classification task better fit the knowledge of the pre-trained target model, and improving the model's performance and understanding ability on specific tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118734928A_ABST
    Figure CN118734928A_ABST
Patent Text Reader

Abstract

The invention relates to a fine tuning instruction construction method and device, equipment and a medium. The method comprises the following steps: dividing labels of negative text samples into target classification labels of multiple levels; based on the target classification label, using a preset large model to construct initial fine tuning instruction data for the negative text sample; and modifying the initial fine tuning instruction data into the target fine tuning instruction data under the condition that the target model to be finely tuned cannot follow the initial fine tuning instruction data. For the problem that a negative text sample is searched from a knowledge base or a network, a target classification label is firstly divided, initial fine tuning instruction data is constructed on the basis of the target classification label, whether a target model can follow the initial fine tuning instruction data or not can be checked for the problem that the model cannot understand the instruction, and the fine tuning instruction data can be obtained under the condition that the target model cannot follow the initial fine tuning instruction data. And the initial fine tuning instruction data is modified into the target fine tuning instruction data, so that the obtained target fine tuning instruction can enable the text classification task to better fit the knowledge of the pre-training target model, and the availability of the fine tuning instruction is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a construction method, device, equipment and medium for fine-tuning instructions. Background Art

[0002] In the field of Natural Language Processing (NLP), the strategy of pre-training followed by fine-tuning has become a very popular training model in recent years. The pre-training stage is essentially an unsupervised learning method that enables the model to absorb and learn a rich knowledge system through a large amount of text data.

[0003] Subsequently, the model can be optimized for specific downstream tasks through fine-tuning techniques of supervised learning. The core of this method is to continue training for specific tasks based on the language model that has mastered extensive semantic representations in the pre-training stage, rather than retraining a new model from scratch.

[0004] Since the pre-training stage has laid a solid knowledge foundation for the model, this method can effectively transfer the knowledge gained in pre-training to downstream tasks, thereby significantly improving the performance of task execution. In addition, carefully designed fine-tuning instructions can better fit the characteristics of pre-training data and provide the model with an efficient path to the task goal.

[0005] Therefore, in this process, the design of fine-tuning instructions is particularly critical, which is directly related to whether the model can make full use of the knowledge learned in the pre-training stage and whether it can maximize the performance on specific tasks. Summary of the invention

[0006] In order to solve the above technical problems, the present disclosure provides a construction method, device, equipment and medium for fine-tuning instructions.

[0007] According to one aspect of the present disclosure, a method for constructing a fine-tuning instruction is provided, comprising:

[0008] Divide the labels of negative text samples into multiple levels of target classification labels;

[0009] Based on the target classification label, construct initial fine-tuning instruction data for the negative text sample using a preset large model; the initial fine-tuning instruction data is used to represent at least one of the following information of the negative text sample: a keyword associated with the negative text sample, a classification category of the negative text sample, and an analysis of the reasons for the classification of the negative text sample;

[0010] When it is checked that the target model to be fine-tuned cannot comply with the initial fine-tuning instruction data, the initial fine-tuning instruction data is modified into target fine-tuning instruction data.

[0011] According to another aspect of the present disclosure, a device for constructing a fine-tuning instruction is provided, comprising:

[0012] A classification module, which is used to classify the labels of negative text samples into multiple levels of target classification labels;

[0013] An instruction construction module is used to construct initial fine-tuning instruction data for the negative text sample based on the target classification label using a preset large model; the initial fine-tuning instruction data is used to represent at least one of the following information of the negative text sample: a keyword associated with the negative text sample, a classification category of the negative text sample, and an analysis of the reasons for the classification of the negative text sample;

[0014] The instruction modification module is used to modify the initial fine-tuning instruction data into target fine-tuning instruction data when it is checked that the target model to be fine-tuned cannot follow the initial fine-tuning instruction data.

[0015] According to another aspect of the present disclosure, an electronic device is provided, the electronic device comprising:

[0016] processor;

[0017] a memory for storing instructions executable by the processor;

[0018] The processor is used to read the executable instructions from the memory and execute the instructions to implement the above method.

[0019] According to another aspect of the present disclosure, a computer-readable storage medium is provided, wherein the storage medium stores a computer program, and the computer program is used to execute the above method.

[0020] Compared with the prior art, the technical solution provided by the embodiments of the present disclosure has the following advantages:

[0021] The technical solution provided by the present disclosure includes: dividing the labels of negative text samples into multiple levels of target classification labels; based on the target classification labels, using a preset large model to construct initial fine-tuning instruction data for negative text samples; the initial fine-tuning instruction data is used to represent at least one of the following information of the negative text sample: keywords associated with the negative text sample, classification categories of the negative text sample, and analysis of the reasons for the classification of the negative text sample; in the case of checking that the target model to be fine-tuned cannot follow the initial fine-tuning instruction data, the initial fine-tuning instruction data is modified to the target fine-tuning instruction data. This technical solution searches for negative text samples from a knowledge base or a network, first divides the target classification labels, and then constructs the initial fine-tuning instruction data based on this, wherein, for the problem that the model cannot understand the instructions, this embodiment can check whether the target model can follow the initial fine-tuning instruction data, and if it cannot follow, the initial fine-tuning instruction data is modified to the target fine-tuning instruction data, and the target fine-tuning instruction obtained thereby can make the text classification task better fit the knowledge of the pre-trained target model, thereby improving the availability of the fine-tuning instruction. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0023] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0024] Figure 1 A flowchart of a method for constructing a fine-tuning instruction according to an embodiment of the present disclosure;

[0025] Figure 2 A structural block diagram of a construction device for fine-tuning instructions according to an embodiment of the present disclosure;

[0026] Figure 3 It is a schematic diagram of the structure of the electronic device described in the embodiment of the present disclosure. DETAILED DESCRIPTION

[0027] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.

[0028] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.

[0029] Fine-tuning instructions are particularly critical for model optimization, which is directly related to whether the model can make full use of the knowledge learned in the pre-training phase and whether it can maximize performance on specific tasks.

[0030] In this disclosure, some methods have been developed for utilizing large language models for various tasks, and there are also multiple methods for constructing large model training datasets.

[0031] For example, in the existing practice of building a large language model fine-tuning instruction set for cloud computing business, the conventional process includes crawling data from the Internet, manually annotating, annotating using a large model, and finally verifying the annotation results through a scoring model. In this process, knowledge base data, data collected online, and data generated by large models are usually used to build a data set for fine-tuning instructions. However, according to practical experience, there are some professional terms or specific nouns that may never appear in the training data of the model, resulting in the model being unable to understand their meaning, such as instructions such as "high red and low black". This may cause a deviation in the model's understanding, thereby affecting the effect and performance of model training.

[0032] Furthermore, in other text classification methods based on large language models, a fine-tuning instruction dataset for a large model is constructed by combining the text to be classified and the prompt word template, and the label category of the candidate set is determined by calculating the similarity between the texts. However, in the application practice in specific fields, in-depth exploration and fine-tuning operations are still needed to ensure that the pre-trained model can better adapt to specific scenarios and output results that are more in line with user expectations. Specifically, the use of appropriate fine-tuning instructions (prompt) mentioned in the solution to call a large model to obtain data is actually a very critical link. In order to achieve this goal, it is necessary to carefully design and construct fine-tuning instructions, which is a process involving creativity and technicality. Constructing fine-tuning instructions is not just a simple question, but a deep understanding of the nature of the problem and how to guide the model to generate the data required by the user through precise language expressions.

[0033] In this case, the embodiments of the present disclosure provide a method, device, equipment and medium for constructing fine-tuning instructions. The technology mainly relates to a method for constructing fine-tuning instructions for text classification tasks, that is, classifying information on the network into relevant categories, and providing information such as keywords and classification reasons. The fine-tuning instructions constructed in the present disclosure can make the text classification task better fit the pre-trained model.

[0034] Figure 1 The present invention provides a flowchart of a method for constructing a fine-tuning instruction according to an embodiment of the present invention. The method for constructing a fine-tuning instruction can be executed by a fine-tuning instruction construction device configured in a terminal. The device can be implemented by software and / or hardware. Figure 1 As shown, the construction method of the fine-tuning instruction may include the following steps.

[0035] Step S102: Divide the labels of negative text samples into target classification labels of multiple levels.

[0036] This embodiment is a process of constructing a classification label, which can be implemented through the following two parts: classification label setting and classification label verification.

[0037] Regarding the classification label setting, this embodiment includes: classifying the categories of the labels of the negative text samples according to different levels to obtain initial classification labels of multiple levels.

[0038] Among them, negative text samples are, for example, data searched from a knowledge base and data searched by crawling a specific network. Each negative text sample corresponds to its own label, such as politics, gambling, pornography, etc., and the severity and refinement levels of different labels may be different. Therefore, this embodiment divides the categories of the labels of negative text samples according to different levels. As an example, the above different levels may include the following three levels from high to low: a first-level category including multiple categories such as politics, violence, and pornography, a second-level category including multiple categories such as underage pornography, and a third-level category including multiple categories such as espionage, gambling, and horse racing. Through the above-mentioned level division, an initial classification label with a level can be determined for each negative text sample.

[0039] Taking into account that lower-level categories can be mapped to higher-level categories, such as third-level categories can be mapped to first-level categories and second-level categories, more detailed classification labels can be constructed based on the third-level classification categories and some second-level categories that do not have third-level categories, thereby constructing more detailed, more diverse, more accurate and more comprehensive classification labels.

[0040] Regarding the classification label verification, this embodiment includes: inputting the initial classification label into the target model to be fine-tuned, and determining whether the output semantic information of the target model is the correct semantic information corresponding to the initial classification label.

[0041] Usually, when doing classification tasks based on a large model, the large model must first be able to understand the meaning of the classification label. Only when the large model understands the meaning of the label can it obtain the pre-trained knowledge behind the label. Based on this, this embodiment needs to feed the divided initial classification labels to the target model to be fine-tuned to check whether the target model knows its meaning, that is, input the initial classification label to the target model to be fine-tuned, recognize and output the semantic information of the initial classification label through the target model, and judge whether the output semantic information of the target model is the correct semantic information corresponding to the initial classification label.

[0042] An initial classification label whose output semantic information is not correct semantic information is determined as a first label to be processed.

[0043] It can be understood that for a large number of initial classification labels, the target model generally cannot accurately understand the meaning of a small number of initial classification labels (such as "involving region A", etc.), and the output semantic information of the target model is not correct semantic information for these small number of initial classification labels. Furthermore, this embodiment determines the initial classification label whose output semantic information is not correct semantic information as the first label to be processed, and the first label needs to be changed to a label that is easy for the target model to understand and meets the task.

[0044] Furthermore, the name of the first label is modified, for example, "involving region A" is modified to "involving politics in region A". Alternatively, fine-tuning instruction data for the first label is constructed to obtain a second label that enables the target model to understand the semantics; wherein the fine-tuning instruction data for the first label is in the format of a question-answer pair, and is used to train the target model to output the correct semantic information of the first label. Exemplarily, after the name of the first label is modified, the target model still cannot correctly understand the semantics of the modified label, so fine-tuning instruction data for the first label can be constructed, the fine-tuning instruction data is in the format of a question-answer pair, and the target model is trained with the fine-tuning instruction data so that the target model can correctly understand the meaning of the first label.

[0045] The second label and the initial classification label that the output semantic information is the correct semantic information are determined as the target classification label; wherein the target classification label is a label that is easy for the target model to understand. In this embodiment, the initial classification label that the output semantic information is the correct semantic information is a label that the target model can originally understand the semantics, and the second label is a label that enables the target model to understand the semantics after modification or construction of fine-tuning instruction data. Therefore, the second label and the initial classification label that the output semantic information is the correct semantic information are determined as the final target classification label.

[0046] Through the above embodiments, target classification labels of multiple levels that are easy for the target model to understand can be constructed for a large number of negative text samples.

[0047] Step S104: Based on the target classification label, use the preset large model to construct initial fine-tuning instruction data for the negative text sample; the initial fine-tuning instruction data is used to represent at least one of the following information of the negative text sample: keywords associated with the negative text sample, the classification category of the negative text sample, and the reason analysis of the classification of the negative text sample; wherein the classification category of the negative text sample is determined from the target classification label.

[0048] In practical applications, since the data set needs to construct information such as keywords and reasons for classification, the manual labeling workload is large and the task is cumbersome. The labeling personnel have limited knowledge reserves and may label keywords and reasons that the large model does not understand, and the labeling diversity may be limited. To improve the above problems, this embodiment uses a large model to generate fine-tuning instruction data, so that the fine-tuning instruction data generated by the large model can be better understood by the model.

[0049] In this embodiment, a preset large model is used to annotate initial instruction information on negative text samples, and the initial instruction information is constructed as initial fine-tuning instruction data; wherein the initial instruction information includes, for example, role information, background information, requirement statement information, and output format.

[0050] Role information is used to indicate the bad information reviewer, such as a bad information review expert with extensive experience.

[0051] Background information is used to determine whether the text contains harmful information. It is specifically responsible for reviewing articles submitted by users to determine whether they contain harmful content.

[0052] This embodiment can review whether a text contains bad content or not by constructing character information and background information, which is equivalent to constructing a review thinking chain for harmful information and harmless information, making the initial fine-tuning instruction data containing character information and background information more practical and logical.

[0053] The requirement statement information is used to indicate the keywords associated with the negative text sample, the classification category of the negative text sample, and the reason analysis of the classification of the negative text sample. The specific requirements of the requirement statement information are as follows: If bad content is found in the article, please find one or more keywords that are closely related to it and conduct a detailed analysis and explanation. At the same time, you need to select the most suitable category from the provided classification directory, which is used to record the target classification label. If no bad content is found in the article, you also need to list the keywords and provide a reason analysis to explain the judgment basis for not finding bad content. The classification category can be left blank.

[0054] Output format, used to indicate the field format of outputting the initial fine-tuning instruction data, for example: \n\nˋˋˋjson\n{\n\"Keyword\":[\"xxx\",\"xxx\"],\n\"Cause Analysis\":\"xxx\",\n\"Classification Category\":[\"xxx\"]\n}\nˋˋˋ.

[0055] After constructing initial fine-tuning instruction data for negative text samples using a preset large model, this embodiment may further include: adjusting at least one of the role information, background information, requirement statement information, and output format included in the initial fine-tuning instruction data.

[0056] Specifically, role information and background information need to be more diverse. Taking role information as an example, multiple words with the same semantics can be generated based on the big model to describe different words. These words are spliced ​​together to obtain a variety of role information. Similarly, background information can be processed in the same way.

[0057] The requirement statement information needs to fully explain the task requirements that the big model needs to do, while avoiding the use of words that may easily confuse the big model. For example, in the same article, if the subject used in the previous content is "article", then the subject in the following content should still be "article", instead of being replaced by other words such as "content", "composition", or "work".

[0058] For the classification catalog, it is also necessary to randomly combine all categories to increase the diversity of model instructions.

[0059] For the output format, you need to know in advance whether the large model can stably output the desired format, and avoid confusing the model in the output fields. At the same time, you also need to prepare for subsequent tasks and output a format that is easy to parse.

[0060] The above embodiments add the structure of initial instruction information to the initial fine-tuning instruction data, that is, add the structure of multiple information such as role information, background information, keywords and reasons in the demand statement information, so that the target model fine-tuned based on the initial fine-tuning instruction data can be reasoned step by step to obtain the conclusion requirement, so that the target model is more accurate and the result is obtained by more logical reasoning.

[0061] In addition, in some embodiments, a large amount of knowledge learned in advance by a large model is used to annotate text data. Experiments have found that the manual annotation has large errors, the marking reasons are time-consuming and laborious, and there are also problems such as low annotation diversity, poor logic, and the thinking chain format marking does not meet the specifications. Therefore, large models such as Qwen72b, GPT4, and YaYi30B are selected for annotation. It should be noted that considering that the classification task in a specific field requires a model for a special scenario, it is necessary to select an appropriate large model according to the usage scenario, and the initial fine-tuning instruction data annotated by the large model can be manually inspected to avoid data deviations.

[0062] Step S106: When it is found that the target model to be fine-tuned cannot comply with the initial fine-tuning instruction data, the initial fine-tuning instruction data is modified into the target fine-tuning instruction data.

[0063] After the initial fine-tuning instruction data is constructed according to the above embodiment, it is necessary to test the initial fine-tuning instruction data in the target model to be fine-tuned to check whether the target model can well follow the initial fine-tuning instruction data. Based on this, this embodiment may include the following steps (1)-(4):

[0064] (1) Inputting the initial fine-tuning instruction data into the target model to be fine-tuned to check whether the target model complies with the initial fine-tuning instruction data.

[0065] (2) When the target model cannot follow the initial fine-tuning instruction data, the initial fine-tuning instruction data is modified in text.

[0066] In a specific embodiment, the initial fine-tuning instruction data is split into a plurality of initial instruction information; the initial instruction information is modified into target instruction information with the same semantics but different description texts; and the plurality of target instruction information are constructed into the modified fine-tuning instruction data.

[0067] The initial fine-tuning instruction data is split, and the problem of each instruction is checked step by step. The initial instruction information is modified into the target instruction information with the same semantics but different description text; the following modification examples can be referred to:

[0068] Construct a thinking chain for reviewing harmful and harmless information. Add role construction, output keywords, reasons, and let the target model reason step by step to reach a conclusion, so that the target model can be more accurate and the reasoning can be more logical to reach the result.

[0069] By finding the target model through prompt engineering testing, you can better learn the wording of the knowledge-based fine-tuning instructions, and by splitting the instructions and viewing the results, you can find out whether the instruction structure is good or bad.

[0070] Strengthen the ability of the target model to recognize concepts, and find out the classification labels that are difficult for the target model to understand through mutual verification of the target model and the manual annotation results. At the same time, rewrite or expand the explanation of the labels that are difficult to understand.

[0071] (3) Input the modified fine-tuning instruction data into the target model again, that is, return to step (1) and recheck whether the target model complies with the modified fine-tuning instruction data.

[0072] (4) until the target model follows the modified fine-tuning instruction data, the modified fine-tuning instruction data is determined as the target fine-tuning instruction data; the target fine-tuning instruction data is data that is targeted at the target model and fits the characteristics of the pre-training data of the target model.

[0073] The above steps (1)-(3) are performed once or multiple times until the target model can follow the modified fine-tuning instruction data, then the above repetitive process is stopped, and the current modified fine-tuning instruction data is determined as the final target fine-tuning instruction data.

[0074] The target fine-tuning instruction data obtained according to the above embodiments is highly targeted to the target model to be fine-tuned, is more in line with the characteristics of the target model pre-training data, indicates an efficient path to the task goal for the target model, and enables the text classification task to better fit the knowledge of the pre-trained target model.

[0075] After obtaining the target fine-tuning instruction data for fine-tuning the target model according to the above embodiment, the present embodiment may further include: using a fine-tuning data set composed of a plurality of target fine-tuning instruction data to train the target model for N epochs.

[0076] It can be understood that each negative text sample corresponds to its own target fine-tuning instruction data, so in response, a large number of target fine-tuning instruction data can be used to form a fine-tuning data set, and the target model can be fine-tuned using the fine-tuning data set. Exemplarily, the fine-tuning data set can be used to perform full-parameter fine-tuning on the YaYi13b model and train 2 epochs. An actual training result shows that the accuracy and recall rates can reach more than 80% in m (such as m is 80) target classification labels, and information such as reasons and keywords can be well output. It can be seen that the target fine-tuning instruction data constructed by this embodiment can effectively improve the fine-tuning effect of the target model and can be used in classification tasks with many labels.

[0077] In summary, the construction method of fine-tuning instructions provided by the present disclosure includes: dividing the labels of negative text samples into multiple levels of target classification labels; based on the target classification labels, using a preset large model to construct initial fine-tuning instruction data for negative text samples; the initial fine-tuning instruction data is used to represent at least one of the following information of the negative text sample: keywords associated with the negative text sample, classification categories of the negative text sample, and analysis of the reasons for the classification of the negative text sample; in the case of checking that the target model to be fine-tuned cannot follow the initial fine-tuning instruction data, the initial fine-tuning instruction data is modified to the target fine-tuning instruction data. This technical solution searches for negative text samples from a knowledge base or a network, first divides the target classification labels, and then constructs the initial fine-tuning instruction data based on this, wherein, for the problem that the model cannot understand the instructions, this embodiment can check whether the target model can follow the initial fine-tuning instruction data, and if it cannot follow, the initial fine-tuning instruction data is modified to the target fine-tuning instruction data, and the target fine-tuning instruction obtained thereby can make the text classification task better fit the knowledge of the pre-trained target model, thereby improving the availability of the fine-tuning instruction.

[0078] Furthermore, the method for constructing fine-tuning instructions based on dividing target classification labels disclosed above can better train large language models, improve the model's ability to follow instructions, and better fit the knowledge of pre-trained models. By dividing the target classification labels, the categories that the model does not understand can be found. By transforming the target classification labels and constructing fine-tuning instruction data for the categories that are not understood for training together, the problem of the model not understanding the classification categories can be better solved.

[0079] Furthermore, the present disclosure constructs a thought chain for labeling harmful information and harmless information, adds role construction and thought chain, and requires the model to reason step by step to reach a conclusion.

[0080] The disclosure can enhance the model's conceptual cognition ability, find out the classification labels that are difficult for the model to understand through mutual verification of the model and the manual annotation results, and rewrite or expand the explanation of the labels. At the same time, the prompt engineering test inspection method proposed in the disclosure can improve the availability of fine-tuning instruction data, thereby better fitting the model.

[0081] Of course, the fine-tuning instructions for different tasks can be constructed using the disclosed solution according to actual task requirements, and the output content can be diverse, and is not limited here.

[0082] Figure 2 This is a structural block diagram of a fine-tuning instruction construction device provided in an embodiment of the present disclosure, and the fine-tuning instruction construction device is used to implement the fine-tuning instruction construction method provided in the above embodiment. Figure 2 The construction device of the fine-tuning instruction includes the following modules:

[0083] A classification module 210, used to classify the labels of negative text samples into multiple levels of target classification labels;

[0084] The instruction construction module 220 is used to construct initial fine-tuning instruction data for the negative text sample based on the target classification label using a preset large model; the initial fine-tuning instruction data is used to represent at least one of the following information of the negative text sample: a keyword associated with the negative text sample, a classification category of the negative text sample, and an analysis of the reasons for the classification of the negative text sample;

[0085] The instruction modification module 230 is used to modify the initial fine-tuning instruction data into target fine-tuning instruction data when it is checked that the target model to be fine-tuned cannot comply with the initial fine-tuning instruction data.

[0086] In one embodiment, the classification module 210 is specifically used for:

[0087] The labels of negative text samples are divided into different levels to obtain multiple levels of initial classification labels;

[0088] Inputting the initial classification label into the target model to be fine-tuned, and determining whether the output semantic information of the target model is the correct semantic information corresponding to the initial classification label;

[0089] Determining the initial classification label in which the output semantic information is not the correct semantic information as a first label to be processed;

[0090] Modify the name of the first label, or construct fine-tuning instruction data of the first label to obtain a second label that enables the target model to understand the semantics; wherein the fine-tuning instruction data of the first label is in the format of a question-answer pair, and is used to train the target model to output the correct semantic information of the first label;

[0091] The second label and the initial classification label in which the output semantic information is the correct semantic information are determined as target classification labels; wherein the target classification label is a label that is easy for the target model to understand.

[0092] In one embodiment, the instruction construction module 220 is specifically used to:

[0093] Based on the target classification label, the negative text sample is labeled with initial instruction information using a preset large model, and the initial instruction information is constructed as initial fine-tuning instruction data; wherein the initial instruction information includes:

[0094] Role information, used to indicate the reviewer of bad information;

[0095] Background information, used to check whether the text contains harmful information;

[0096] Demand statement information, used to indicate keywords associated with the negative text sample, classification categories of the negative text sample, and reason analysis of classification of the negative text sample;

[0097] An output format, used to indicate a field format for outputting the initial fine-tuning instruction data;

[0098] By adding the initial instruction information to the initial fine-tuning instruction data, the requirement for obtaining a conclusion based on the target model fine-tuned by the initial fine-tuning instruction data can be achieved through more accurate and more logical reasoning.

[0099] In one embodiment, the device further comprises an adjustment module, which is used to:

[0100] At least one of the role information, the background information, the requirement statement information and the output format included in the initial fine-tuning instruction data is adjusted.

[0101] In one embodiment, the instruction modification module 230 is specifically used to:

[0102] inputting the initial fine-tuning instruction data into the target model to be fine-tuned to check whether the target model complies with the initial fine-tuning instruction data;

[0103] In the case where the target model cannot follow the initial fine-tuning instruction data, modifying the text of the initial fine-tuning instruction data;

[0104] inputting the modified fine-tuning instruction data into the target model again;

[0105] Until the target model follows the modified fine-tuning instruction data, the modified fine-tuning instruction data is determined to be the target fine-tuning instruction data; the target fine-tuning instruction data is data that is targeted at the target model and fits the characteristics of the pre-training data of the target model.

[0106] In one embodiment, the instruction modification module 230 is specifically used to:

[0107] Splitting the initial fine-tuning instruction data into a plurality of initial instruction information;

[0108] Modifying the initial instruction information into target instruction information with the same semantics but different description text;

[0109] The plurality of target instruction information are constructed into modified fine-tuning instruction data.

[0110] In one embodiment, the apparatus further comprises a training module, which is used to:

[0111] The target model is trained for N epochs using a fine-tuning data set consisting of a plurality of the target fine-tuning instruction data.

[0112] The implementation principle and technical effects of the device provided in this embodiment are the same as those of the aforementioned method embodiment. For the sake of brief description, for matters not mentioned in the device embodiment, reference may be made to the corresponding contents in the aforementioned method embodiment.

[0113] Figure 3 The structure diagram of an electronic device provided by the embodiment of the present disclosure is shown in FIG. Figure 3 As shown, the electronic device 300 includes one or more processors 301 and a memory 302 .

[0114] The processor 301 may be a central processing unit (CPU) or other forms of processing units having data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device 300 to perform desired functions.

[0115] The memory 302 may include one or more computer program products, and the computer program product may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, a random access memory (RAM) and / or a cache memory (cache), etc. The non-volatile memory may include, for example, a read-only memory (ROM), a hard disk, a flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor 301 may run the program instructions to implement the construction method of the fine-tuning instruction of the embodiment of the present disclosure described above and / or other desired functions. Various contents such as input signals, signal components, noise components, etc. may also be stored in the computer-readable storage medium.

[0116] In one example, the electronic device 300 may further include: an input device 303 and an output device 304 , and these components are interconnected via a bus system and / or other forms of connection mechanisms (not shown).

[0117] In addition, the input device 303 may also include, for example, a keyboard, a mouse, and the like.

[0118] The output device 304 can output various information to the outside, including the determined distance information, direction information, etc. The output device 304 can include, for example, a display, a speaker, a printer, a communication network and a remote output device connected thereto, and the like.

[0119] Of course, to simplify, Figure 3Only some of the components related to the present disclosure in the electronic device 300 are shown, and components such as a bus, an input / output interface, etc. are omitted. In addition, according to specific application situations, the electronic device 300 may also include any other appropriate components.

[0120] Furthermore, this embodiment also provides a computer-readable storage medium, wherein the storage medium stores a computer program, and the computer program is used to execute the construction method of the above-mentioned fine-tuning instruction.

[0121] The embodiments of the present disclosure provide a method, device, electronic device, and medium for constructing fine-tuning instructions, including a computer program product, which includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the previous method embodiments. The specific implementation can be found in the method embodiments, which will not be repeated here.

[0122] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0123] The above description is only a specific embodiment of the present disclosure, so that those skilled in the art can understand or implement the present disclosure. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure will not be limited to the embodiments described herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for constructing fine-tuning instructions, It is characterized in that include: Divide the labels of negative text samples into multiple levels of target classification labels; Based on the target classification label, construct initial fine-tuning instruction data for the negative text sample using a preset large model; the initial fine-tuning instruction data is used to represent at least one of the following information of the negative text sample: a keyword associated with the negative text sample, a classification category of the negative text sample, and an analysis of the reasons for the classification of the negative text sample; When it is checked that the target model to be fine-tuned cannot comply with the initial fine-tuning instruction data, the initial fine-tuning instruction data is modified into target fine-tuning instruction data.

2. The method according to claim 1, It is characterized in that The labels of negative text samples are divided into multiple levels of target classification labels, including: The labels of negative text samples are divided into different levels to obtain multiple levels of initial classification labels; Inputting the initial classification label into the target model to be fine-tuned, and determining whether the output semantic information of the target model is the correct semantic information corresponding to the initial classification label; Determining the initial classification label in which the output semantic information is not the correct semantic information as a first label to be processed; Modify the name of the first label, or construct fine-tuning instruction data of the first label to obtain a second label that enables the target model to understand the semantics; wherein the fine-tuning instruction data of the first label is in the format of a question-answer pair, and is used to train the target model to output the correct semantic information of the first label; The second label and the initial classification label in which the output semantic information is the correct semantic information are determined as target classification labels; wherein the target classification label is a label that is easy for the target model to understand.

3. The method according to claim 1, It is characterized in that The step of constructing initial fine-tuning instruction data for the negative text sample based on the target classification label using a preset large model includes: Based on the target classification label, the negative text sample is labeled with initial instruction information using a preset large model, and the initial instruction information is constructed as initial fine-tuning instruction data; wherein the initial instruction information includes: Role information, used to indicate the reviewer of bad information; Background information, used to check whether the text contains harmful information; Demand statement information, used to indicate keywords associated with the negative text sample, classification categories of the negative text sample, and reason analysis of classification of the negative text sample; An output format, used to indicate a field format for outputting the initial fine-tuning instruction data; By adding the initial instruction information to the initial fine-tuning instruction data, the requirement for obtaining a conclusion based on the target model fine-tuned by the initial fine-tuning instruction data can be achieved through more accurate and more logical reasoning.

4. The method according to claim 3, It is characterized in that After constructing initial fine-tuning instruction data for the negative text sample using the preset large model, the method further includes: At least one of the role information, the background information, the requirement statement information and the output format included in the initial fine-tuning instruction data is adjusted.

5. The method according to claim 1, It is characterized in that The step of modifying the initial fine-tuning instruction data into target fine-tuning instruction data when checking that the target model to be fine-tuned cannot comply with the initial fine-tuning instruction data comprises: inputting the initial fine-tuning instruction data into the target model to be fine-tuned to check whether the target model complies with the initial fine-tuning instruction data; In the case where the target model cannot follow the initial fine-tuning instruction data, modifying the text of the initial fine-tuning instruction data; inputting the modified fine-tuning instruction data into the target model again; Until the target model follows the modified fine-tuning instruction data, the modified fine-tuning instruction data is determined to be the target fine-tuning instruction data; the target fine-tuning instruction data is data that is targeted at the target model and fits the characteristics of the pre-training data of the target model.

6. The method according to claim 5, It is characterized in that The text modification of the initial fine-tuning instruction data includes: Splitting the initial fine-tuning instruction data into a plurality of initial instruction information; Modifying the initial instruction information into target instruction information with the same semantics but different description text; The plurality of target instruction information are constructed into modified fine-tuning instruction data.

7. The method according to claim 1, It is characterized in that The method further comprises: The target model is trained for N epochs using a fine-tuning data set consisting of a plurality of the target fine-tuning instruction data.

8. A construction device for fine-tuning instructions, It is characterized in that include: A classification module, which is used to classify the labels of negative text samples into multiple levels of target classification labels; An instruction construction module is used to construct initial fine-tuning instruction data for the negative text sample based on the target classification label using a preset large model; the initial fine-tuning instruction data is used to represent at least one of the following information of the negative text sample: a keyword associated with the negative text sample, a classification category of the negative text sample, and an analysis of the reasons for the classification of the negative text sample; The instruction modification module is used to modify the initial fine-tuning instruction data into target fine-tuning instruction data when it is checked that the target model to be fine-tuned cannot follow the initial fine-tuning instruction data.

9. An electronic device, It is characterized in that The electronic device comprises: processor; a memory for storing instructions executable by the processor; The processor is used to read the executable instructions from the memory and execute the instructions to implement the method described in any one of claims 1 to 7.

10. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores instructions, and when the instructions are executed on a terminal device, the terminal device implements the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Text classification method, device and equipment and computer readable storage medium

    CN117390192A

  • Label classification method and device, electronic equipment and storage medium

    CN117688174A

  • Method for constructing information review classification model, and information review method

    WO2022134588A1

Cited By

  • Content security auditing method and related device

    CN119441495A