Method and device for automatically constructing instruction fine tuning sample set in power field

By constructing a power text knowledge base and screening instruction fine-tuning samples, the problem of lack of diversity in instruction fine-tuning sample data in the power field is solved, and efficient, diverse and professional fine-tuning sample generation is achieved, which improves model effect and reduces labeling costs.

CN120086381APending Publication Date: 2025-06-03GLOBAL ENERGY INTERCONNECTION RES INST CO LTD +4
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202411968733.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-30
Publication Date
2025-06-03

AI Technical Summary

Technical Problem

The instruction fine-tuning sample data in the power field lacks the diversity of task descriptions and is difficult to accurately connect to task requirements in the power field, resulting in limited improvement in model effectiveness.

Method used

By using power text to build an instruction fine-tuning sample knowledge base, combining instruction seed sample examples from different scenarios in the power field, multiple instruction fine-tuning samples in each scenario are generated, and based on the thinking chain verification method and text feature screening method, samples that meet the requirements are screened to construct a fine-tuning sample data set.

Benefits of technology

It realizes efficient and automatic generation of high-quality, diverse and professional power fine-tuning samples that meet task requirements, reducing the workload of manual participation and labeling, and reducing labeling costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120086381A_ABST
    Figure CN120086381A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of natural language processing, and particularly relates to a power field instruction fine tuning sample set automatic construction method and device, and the method comprises the steps: constructing an instruction fine tuning sample knowledge base through a power text; generating a plurality of instruction fine tuning samples in each scene by using the instruction fine tuning sample knowledge base and the instruction seed sample instances of different scenes in the power field; based on a thinking chain verification method and a text feature screening method, screening instruction fine-tuning samples meeting requirements from the multiple instruction fine-tuning samples to construct a fine-tuning sample data set; according to the technical scheme provided by the invention, the electric power fine tuning sample which meets task requirements and has high quality, diversity and specialty is efficiently and automatically generated, so that a data basis is provided for large model fine tuning, meanwhile, the workload of manual participation and labeling is reduced, and the labeling cost is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of natural language processing, and particularly relates to a method and device for automatically constructing an instruction fine-tuning sample set in the power field. Background Art

[0002] In the instruction fine-tuning stage, a large amount of instruction fine-tuning data is used to fine-tune the pre-trained language model, and this process is closely related to supervised fine-tuning and multi-task prompt training. Specifically, an instruction generation mechanism can be used to combine and construct question-and-answer-formatted instruction fine-tuning data. Although a large number of training instances have been formatted by adding instructions, they mainly come from public natural language processing data sets. Such instruction fine-tuning data lacks the diversity of task descriptions and it is difficult to accurately connect to the task requirements in the power field, which is relatively limited in improving the model effect.

[0003] In the professional field, instruction fine-tuning heavily relies on manually written instruction data. Especially in the power field, the knowledge is highly professional and the sample data volume is limited, resulting in the fact that the instruction fine-tuning sample data is usually restricted in terms of quantity, diversity, and professionalism, thus limiting the capabilities of the model. Summary of the Invention

[0004] To overcome the problems existing in the above related technologies, the present application provides a method and device for automatically constructing an instruction fine-tuning sample set in the power field.

[0005] According to the first aspect of the embodiments of the present application, a method for automatically constructing an instruction fine-tuning sample set in the power field is provided, including:

[0006] Using power texts to construct an instruction fine-tuning sample knowledge base;

[0007] Using the instruction fine-tuning sample knowledge base and instruction seed sample instances in different scenarios in the power field to generate multiple instruction fine-tuning samples in each scenario;

[0008] Based on the thought chain verification method and the text feature screening method, screening the qualified instruction fine-tuning samples from the multiple instruction fine-tuning samples to construct a fine-tuning sample data set.

[0009] Preferably, the seed sample instances include: instructions, user questions, and answers;

[0010] The instruction fine-tuning samples include: instructions, user questions, and answers;

[0011] The instructions include: tasks, ontology knowledge, and knowledge background.

[0012] Preferably, the instruction fine-tuning sample knowledge base includes: ontology knowledge and knowledge background; the using power texts to construct an instruction fine-tuning sample knowledge base includes:

[0013] Determine the data type of the power text;

[0014] According to the data type of the power text, determine the ontology knowledge and knowledge background corresponding to the power text;

[0015] Construct the instruction fine-tuning sample knowledge base by using the ontology knowledge and the background knowledge.

[0016] Preferably, the determining the ontology knowledge and knowledge background corresponding to the power text according to the data type of the power text includes:

[0017] When the data type of the power text is semi-structured data, store the power text by using a multi-way tree structure storage method to obtain the instruction fine-tuning sample knowledge base; the multi-way tree includes: multiple child nodes;

[0018] Each child node in the multi-way tree is ontology knowledge, and the parent node and sibling nodes of each child node in the multi-way tree are knowledge background.

[0019] Preferably, the determining the ontology knowledge and knowledge background corresponding to the power text according to the data type of the power text includes:

[0020] When the data type of the power text is unstructured data, slice the power text to obtain multiple text blocks, and the text blocks are ontology knowledge;

[0021] Use the TextRank algorithm to generate a summary of the power text, and the summary is the knowledge background.

[0022] Preferably, the determining the ontology knowledge and knowledge background corresponding to the power text according to the data type of the power text includes:

[0023] When the data type of the power text is structured data, use the attributes of the entities in the power text as ontology knowledge, and use the associated entities of the entities in the power text as background knowledge.

[0024] Preferably, the generating multiple instruction fine-tuning samples in each scenario by using the instruction fine-tuning sample knowledge base and instruction seed sample instances in different scenarios in the power field includes:

[0025] Input the instruction fine-tuning sample knowledge base and the seed sample instances into a large model for reasoning to generate multiple instruction fine-tuning samples in each scenario.

[0026] Preferably, the screening the qualified instruction fine-tuning samples from the multiple instruction fine-tuning samples based on the thought chain verification method and the text feature screening method to construct a fine-tuning sample data set includes:

[0027] Use the chain-of-thought verification method to screen the instruction fine-tuning samples to obtain initial samples;

[0028] Use the text feature screening method to remove stop words from the initial samples to obtain the instruction fine-tuning samples that meet the requirements;

[0029] Use the instruction fine-tuning samples that meet the requirements to construct a fine-tuning sample dataset.

[0030] Preferably, the use of the chain-of-thought verification method to screen the instruction fine-tuning samples to obtain initial samples includes:

[0031] Take the answer in the instruction fine-tuning sample as the reference answer;

[0032] Based on the reference answer, the user question in the instruction fine-tuning sample, the ontology knowledge in the instruction fine-tuning sample, and the knowledge background in the instruction fine-tuning sample, use a large model to generate verification questions;

[0033] Use the large model to generate the answers to the verification questions;

[0034] Use the large model to logically judge whether the answer is consistent with the reference answer. If they are consistent, use the instruction fine-tuning sample corresponding to the reference answer to construct the initial sample; if they are not consistent, remove the instruction fine-tuning sample corresponding to the reference answer.

[0035] Preferably, the use of the text feature screening method to remove stop words from the initial samples to obtain the instruction fine-tuning samples that meet the requirements includes:

[0036] Based on a preset stop word dictionary, judge whether the user questions and answers in the initial samples contain stop words;

[0037] If the instructions in the initial samples contain stop words, remove the initial samples containing stop words, and the remaining initial samples are the instruction fine-tuning samples that meet the requirements; if the user questions and answers in the initial samples do not contain stop words, the initial samples are the instruction fine-tuning samples that meet the requirements.

[0038] Preferably, the use of the instruction fine-tuning samples that meet the requirements to construct a fine-tuning sample dataset includes:

[0039] Use the bert model to encode the instruction fine-tuning samples that meet the requirements into sentence vectors;

[0040] Use the k-center algorithm to cluster the sentence vectors to obtain multiple clustering clusters;

[0041] Use the multiple clustering clusters to construct the fine-tuning sample dataset.

[0042] According to the second aspect of the embodiments of the present application, there is provided an apparatus for automatically constructing an instruction fine-tuning sample set in the power field, including:

[0043] A first construction unit, configured to construct an instruction fine-tuning sample knowledge base by using power texts;

[0044] A generation unit, configured to generate a plurality of instruction fine-tuning samples in each scenario by using the instruction fine-tuning sample knowledge base and instruction seed sample instances in different scenarios in the power field;

[0045] A second construction unit, configured to screen out instruction fine-tuning samples that meet the requirements from the plurality of instruction fine-tuning samples based on the chain of thought verification method and the text feature screening method, and construct a fine-tuning sample data set.

[0046] Preferably, the seed sample instances include: instructions, user questions, and answers;

[0047] The instruction fine-tuning samples include: instructions, user questions, and answers;

[0048] The instructions include: tasks, ontology knowledge, and knowledge background.

[0049] Preferably, the instruction fine-tuning sample knowledge base includes: ontology knowledge and knowledge background; the first construction unit includes:

[0050] A first determination module, configured to determine the data type of the power text;

[0051] A second determination module, configured to determine the ontology knowledge and knowledge background corresponding to the power text according to the data type of the power text;

[0052] A first construction module, configured to construct the instruction fine-tuning sample knowledge base by using the ontology knowledge and the background knowledge.

[0053] Preferably, the second determination module is specifically configured to:

[0054] When the data type of the power text is semi-structured data, store the power text by using a multi-way tree structure storage method to obtain the instruction fine-tuning sample knowledge base; the multi-way tree includes: a plurality of child nodes;

[0055] Each child node in the multi-way tree is ontology knowledge, and the parent node and sibling nodes of each child node in the multi-way tree are knowledge background.

[0056] Preferably, the second determination module is further specifically configured to:

[0057] When the data type of the power text is unstructured data, slice the power text to obtain multiple text blocks, and the text blocks are ontology knowledge;

[0058] Use the TextRank algorithm to generate a summary of the power text, and the summary is the knowledge background.

[0059] Preferably, the second determination module is further specifically configured to:

[0060] When the data type of the power text is structured data, use the attributes of the entities in the power text as ontology knowledge, and use the associated entities of the entities in the power text as background knowledge.

[0061] Preferably, the generating unit is specifically configured to:

[0062] Input the instruction fine-tuning sample knowledge base and the seed sample instances into the large model for inference to generate multiple instruction fine-tuning samples in each scenario.

[0063] Preferably, the second construction unit includes:

[0064] The first screening module is used to screen the instruction fine-tuning samples by using the thought chain verification method to obtain initial samples;

[0065] The second screening module is used to remove stop words in the initial samples by using the text feature screening method to obtain the qualified instruction fine-tuning samples;

[0066] The second construction module is used to construct a fine-tuning sample data set by using the qualified instruction fine-tuning samples.

[0067] Preferably, the first screening module is specifically configured to:

[0068] Use the answer in the instruction fine-tuning sample as the reference answer;

[0069] Based on the reference answer, the user question in the instruction fine-tuning sample, the ontology knowledge in the instruction fine-tuning sample, and the knowledge background in the instruction fine-tuning sample, use the large model to generate verification questions;

[0070] Use the large model to generate the reply of the verification question;

[0071] Use the large model to logically judge whether the reply is consistent with the reference answer. If they are consistent, use the instruction fine-tuning sample corresponding to the reference answer to construct the initial sample; if they are inconsistent, remove the instruction fine-tuning sample corresponding to the reference answer.

[0072] Preferably, the second screening module is specifically configured to:

[0073] Judge whether the user questions and answers in the initial sample contain stop words based on a preset stop word dictionary;

[0074] If the instructions in the initial sample contain stop words, remove the initial samples containing stop words, and the remaining initial samples are the instruction fine-tuning samples that meet the requirements; if the user questions and answers in the initial sample do not contain stop words, then the initial sample is the instruction fine-tuning sample that meets the requirements.

[0075] Preferably, the second construction module is specifically used for:

[0076] Use the bert model to encode the instruction fine-tuning samples that meet the requirements into sentence vectors;

[0077] Use the k-center algorithm to cluster the sentence vectors to obtain multiple clusters;

[0078] Use the multiple clusters to construct the fine-tuning sample data set.

[0079] According to the third aspect of the embodiments of the present application, an electronic device is provided, including: at least one processor and a memory; the memory and the processor are connected by a bus;

[0080] The memory is used to store one or more programs;

[0081] When the one or more programs are executed by the at least one processor, the automatic construction method of the instruction fine-tuning sample set in the power field as described above is implemented.

[0082] According to the fourth aspect of the embodiments of the present application, a readable storage medium is provided, on which an execution program is stored, and when the execution program is executed, the automatic construction method of the instruction fine-tuning sample set in the power field as described above is implemented.

[0083] The technical solution provided by the present invention has the following beneficial effects:

[0084] An automatic construction method and device for an instruction fine-tuning sample set in the power field provided by the present invention, by using power texts to construct an instruction fine-tuning sample knowledge base, using the instruction fine-tuning sample knowledge base and instruction seed sample instances in different scenarios in the power field, generating multiple instruction fine-tuning samples in each scenario, and based on the thought chain verification method and the text feature screening method, screening the instruction fine-tuning samples that meet the requirements from multiple instruction fine-tuning samples to construct a fine-tuning sample data set, realizes the efficient automatic generation of power fine-tuning samples that meet the task requirements and have high quality, diversity, and professionalism, thereby providing a data basis for large model fine-tuning, while reducing the workload of manual participation and annotation and lowering the annotation cost. Description of the Drawings

[0085] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the accompanying drawings required for the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other accompanying drawings can be obtained based on these drawings.

[0086] Figure 1 It is a flowchart of a method for automatically constructing an instruction fine-tuning sample set in the field of electric power provided by an embodiment of the present invention;

[0087] Figure 2 It is a schematic diagram of a tree-shaped knowledge instruction fine-tuning sample knowledge base provided by an embodiment of the present invention;

[0088] Figure 3 It is a flowchart of a method for verifying the chain of thought provided by an embodiment of the present invention;

[0089] Figure 4 It is a flowchart of the k-center algorithm provided by an embodiment of the present invention;

[0090] Figure 5 It is a flowchart of a method for automatically constructing an instruction fine-tuning sample set in the field of electric power provided by an embodiment of the present invention;

[0091] Figure 6 It is a structural block diagram of a device for automatically constructing an instruction fine-tuning sample set in the field of electric power provided by an embodiment of the present invention;

[0092] Figure 7 It is a structural block diagram of an electronic device provided by an embodiment of the present invention. Detailed implementation manners

[0093] To make the objectives, technical solutions, and advantages of the present invention clearer, the following will clearly and completely describe the technical solutions of the present invention in conjunction with the accompanying drawings. Obviously, the following embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts fall within the scope of protection of the present invention.

[0094] Embodiment 1

[0095] The present invention provides a method for automatically constructing an instruction fine-tuning sample set in the field of electric power, as Figure 1 shown, including the following steps:

[0096] Step 11: Use electric power texts to construct an instruction fine-tuning sample knowledge base;

[0097] Step 12: Use the instruction fine-tuning sample knowledge base and the instruction seed sample instances in different scenarios in the power field to generate multiple instruction fine-tuning samples for each scenario;

[0098] Step 13: Based on the thought chain verification method and the text feature screening method, screen out the instruction fine-tuning samples that meet the requirements from multiple instruction fine-tuning samples to construct a fine-tuning sample data set.

[0099] Further, the seed sample instances include: instructions, user questions, and answers;

[0100] The instruction fine-tuning samples include: instructions, user questions, and answers;

[0101] Instructions include: tasks, ontology knowledge, and knowledge background.

[0102] For example, the following instruction fine-tuning sample:

[0103] # Task instruction: Please answer the user's question based on the given ontology knowledge and knowledge background.

[0104] Ontology knowledge:

[0105] 3.1 Preventive maintenance

[0106] Preventive maintenance of the power system is a key link to ensure the stable operation of the power system and reduce the occurrence of faults.

[0107] Knowledge background:

[0108] Document name: "Power Equipment Basics"

[0109] Document summary: "Power Equipment Basics" outlines the structure and functions of the power system, introduces the main power equipment, and discusses maintenance and fault handling, providing a basic guide for readers in the power field.

[0110] Chapter 3 Maintenance and Fault Handling of the Power System

[0111] Discuss the maintenance strategies and common fault handling methods of the power system.

[0112] 3.1 Preventive maintenance

[0113] Preventive maintenance of the power system is a key link to ensure the stable operation of the power system and reduce the occurrence of faults.

[0114] 3.2 Fault handling

[0115] Details of the diagnosis and repair process of power system faults are described.

[0116] # User question: What is the role of preventive maintenance of the power system?

[0117] #Output answer: Preventive maintenance of power systems is a crucial link to ensure the stable operation of power systems and reduce the occurrence of faults.

[0118] Seed sample examples are as follows:

[0119] (1) Instruction: Please answer the user's question based on the given ontology knowledge and knowledge background.

[0120] Ontology knowledge: High pressure water mist extinguishing system is a water mist extinguishing system in which the pressure of the flowing medium in the distribution pipe network is greater than or equal to 3.50 MPa;

[0121] Background knowledge: High pressure water mist extinguishing system (High Pressure Water Mist Extinguishing System) refers to a water mist extinguishing system in which the pressure of the flowing medium in the distribution pipe network is greater than or equal to 3.50 MPa. This system atomizes water into extremely small water droplets through the use of high-pressure pump groups or bottle group water supply methods and sprays them at high speeds to form fine water mist. These fine water mists can quickly absorb heat and displace oxygen, effectively controlling and extinguishing fires. The fire extinguishing mechanism of the high pressure water mist extinguishing system includes efficient cooling and rapid asphyxiation. The formed water mist is between liquid and gas, and the water consumption is much less than that of traditional fire extinguishing systems, reducing damage to the environment and protected objects.

[0122] User's question: What is the minimum pressure of the flowing medium in the distribution pipe network of the high pressure water mist extinguishing system?

[0123] Answer: 3.5 MPa;

[0124] (2) Instruction: Please answer the user's question based on the given ontology knowledge and knowledge background.

[0125] Ontology knowledge: Structures should adopt effective anti-corrosion measures. Steel structures should adopt hot-dip galvanizing, zinc spraying or other reliable measures; it is not advisable to increase the material specifications due to anti-corrosion requirements.

[0126] Background knowledge: "Code for Design of 35kV - 110kV Substations", structures should adopt effective anti-corrosion measures, and steel structures should be anti-corroded by hot-dip galvanizing, zinc spraying or other reliable measures.

[0127] User's question: Generate a question: How should the steel structure of a 35kV - 100kV substation be anti-corroded?

[0128] Answer: Adopt hot-dip galvanizing, zinc spraying or other reliable measures;

[0129] (3) Instruction: Please answer the user's question based on the given ontology knowledge and knowledge background.

[0130] Ontological knowledge: The sampling locations for acceptance inspection should be comprehensively determined according to the following requirements: 1. The sampling points should be randomly, evenly, and representatively distributed; 2. The important parts considered by the designers; 3. The parts with complex local geotechnical characteristics that may affect the construction quality; 4. The parts where abnormal construction conditions occur.

[0131] Background knowledge: For the acceptance inspection in the Technical Code for Building Foundation Treatment, the sampling locations should be comprehensively considered to ensure that the acceptance inspection can fully cover the key areas and pay sufficient attention to the places where problems may occur, so as to ensure the quality and safety of the foundation treatment project.

[0132] User's question: According to what requirements should the sampling locations for acceptance inspection of the foundation treatment project be comprehensively determined?

[0133] Answer: 1. The sampling points should be randomly, evenly, and representatively distributed; 2. The important parts considered by the designers; 3. The parts with complex local geotechnical characteristics that may affect the construction quality; 4. The parts where abnormal construction conditions occur.

[0134] Furthermore, the instruction fine-tuning sample knowledge base includes: ontological knowledge and knowledge background;

[0135] In some embodiments, as shown in Table 1, the instruction fine-tuning sample knowledge base further includes: the file name, label, and knowledge title of the power text;

[0136] Among them, the label is the field to which the power text belongs. For example, the business field (such as the fields of equipment, dispatching, and safety monitoring, etc.).

[0137] Table 1 Storage Definition Table of Instruction Fine-tuning Sample Knowledge Base Fields

[0138] Field Description Type filename File name of the knowledge source string tag Label string knowledge title Knowledge title string knowledge Ontology knowledge string context knowledge Background knowledge string source type Data source type string

[0139] Furthermore, step 11 includes:

[0140] Step 111: Determine the data type of the power text;

[0141] Step 112: According to the data type of the power text, determine the corresponding ontological knowledge and knowledge background of the power text;

[0142] Step 113: Use the ontological knowledge and background knowledge to construct the instruction fine-tuning sample knowledge base.

[0143] In some embodiments, the power text may include, but is not limited to: power-related articles and literature, etc.

[0144] It can be understood that the instruction fine-tuning sample knowledge base constructed by the present invention can be used as the knowledge basis for generating instruction fine-tuning samples.

[0145] Traditional instruction fine-tuning sample generation methods often rely only on the reference knowledge of a single node or a single text block, resulting in the lack of context information and increasing the risk of logical errors or hallucinations when generating samples. To address this, the present invention enhances the context based on a multi-way tree structure to improve the accuracy and diversity of instruction fine-tuning samples. Further, step 112 includes:

[0146] Step 1121: When the data type of the power text is semi-structured data, a multi-way tree structure storage method is used to store the power text to obtain an instruction fine-tuning sample knowledge base; the multi-way tree includes: multiple child nodes;

[0147] Step 1122: Each child node in the multi-way tree is ontological knowledge, and the parent node and sibling nodes of each child node in the multi-way tree are knowledge backgrounds.

[0148] The present invention constructs a comprehensive knowledge background for each child node by splicing the parent node and sibling nodes of the child node. This method provides richer and more accurate reference knowledge for instruction fine-tuning sample generation, effectively reducing the risk of hallucinations when generating samples.

[0149] Further, the multi-way tree also includes: a root node; the root node is the file name of the power text, and the node name of the child node is the knowledge title.

[0150] In some embodiments, in addition to splicing the parent node and sibling nodes of the child node, the abstract content of the parent node can also be spliced.

[0151] For semi-structured data, if the selection of power knowledge is limited to a specific chapter to generate samples, it is very likely to result in the lack of context information of the reference knowledge. To solve this problem, the present invention constructs a sample storage structure based on a multi-way tree structure. By integrating the content of the parent chapter and sibling chapters of the target chapter (i.e., the content of the parent node and sibling nodes) as the knowledge background of the instruction fine-tuning sample knowledge base, it is ensured that the generated fine-tuning samples are comprehensive and detailed at the knowledge level. This strategy not only considers directly relevant knowledge nodes but also incorporates information from other chapters that are logically related to them, thereby constructing a semi-structured fine-tuning sample knowledge system with complete information and coherent context.

[0152] For example, the content of the power text is as follows:

[0153] Chapter 1 Overview of Power System: Introduce the basic concepts, components, and functions of the power system;

[0154] 1.1 Composition of Power System: Describe in detail each component of the power system, including: power generation, power transmission, power distribution, and power consumption;

[0155] 1.2 Functions of the power system: Explain how the power system generates, transmits, and distributes electrical energy;

[0156] Chapter 2 Power Equipment: Introduce the main equipment used in the power system, including transformers, circuit breakers, and cables;

[0157] 2.1 Transformers: Discuss the working principle, types, and role of transformers in the power system;

[0158] 2.2 Circuit Breakers: Explain the functions, operating principles, and importance of circuit breakers in the power system;

[0159] 2.3 Cables: Describe the types, uses, and role of cables in power transmission;

[0160] Chapter 3 Maintenance and Fault Handling of the Power System: Discuss the maintenance strategies and common fault handling methods of the power system;

[0161] 3.1 Preventive Maintenance: Introduce the importance and implementation steps of preventive maintenance;

[0162] 3.2 Fault Handling: Elaborate on the diagnosis and repair process of power system faults.

[0163] Using the multi-way tree structure storage method to store the above power text, the tree-like instruction fine-tuning sample knowledge base as shown in Figure 2 the tree-like knowledge instruction fine-tuning sample knowledge base shown in Table 2, and the storage definition table of the tree-like knowledge instruction fine-tuning sample knowledge base as shown in Table 2.

[0164] Table 2 Storage Definition Table of the Tree-like Knowledge Instruction Fine-tuning Sample Knowledge Base

[0165]

[0166]

[0167] Specifically, the tree-like knowledge storage structure is as follows:

[0168]

[0169]

[0170]

[0171] When generating samples, if the reference knowledge is generated only based on the reference knowledge of this node, it is easy to have the situation of missing reference knowledge context. Therefore, it is necessary to splice the content of its parent node and sibling nodes based on the multi-way tree knowledge base to obtain complete knowledge.

[0172] For example: For node 3.1, if the knowledge base does not adopt the multi-way tree storage, the node reference knowledge is only:

[0173] "″"

[0174] #Reference Knowledge

[0175] 3.1 Preventive Maintenance

[0176] Introduce the importance and implementation steps of preventive maintenance.

[0177] "″"

[0178] Due to the lack of context for this node, the "preventive maintenance" lacks the main content. Inputting it as reference knowledge into the model will cause hallucinations in the generated samples. If the nodes are stored based on a multi-way tree, the knowledge background introduced by the spliced reference knowledge is more comprehensive and complete. As shown below, it can be known that the main content is about "preventive maintenance of the power system", which can reduce the risk of hallucinations in the model generation.

[0179] "″"

[0180] #Knowledge Background:

[0181] Document Name: "Fundamentals of Power Equipment"

[0182] Document Abstract: "Fundamentals of Power Equipment" outlines the structure and functions of the power system, introduces the main power equipment, and explores maintenance and fault handling, providing a basic guide for readers in the power field.

[0183] Chapter 3 Maintenance and Fault Handling of Power System

[0184] Discuss the maintenance strategies and common fault handling methods of the power system.

[0185] 3.1 Preventive Maintenance

[0186] Introduce the importance and implementation steps of preventive maintenance.

[0187] 3.2 Fault Handling

[0188] Detail the diagnosis and repair process of power system faults.

[0189] #Reference Knowledge:

[0190] 3.1 Preventive Maintenance

[0191] Introduce the importance and implementation steps of preventive maintenance.

[0192] "″"

[0193] When the content of unstructured power text is too long or complex, it will exceed the maximum word limit for input to large language models (i.e., large models). Therefore, it is necessary to solve this problem based on text paragraph slicing. However, slicing at the non-semantic level is prone to losing key information. Therefore, strategies such as keyword extraction and summary generation should be adopted to refine key information as background knowledge for the instruction fine-tuning sample knowledge base, so as to construct a complete and information-rich unstructured fine-tuning sample knowledge. Further, step 112 also includes:

[0194] Step 1123: When the data type of the power text is unstructured data, slice the power text to obtain multiple text blocks, and the text blocks are ontology knowledge;

[0195] Step 1124: Use the TextRank algorithm to generate a summary of the power text, and the summary is the knowledge background.

[0196] In some embodiments, the TextRank algorithm can also be used to extract keywords from the text blocks, and the keywords are the knowledge titles of the text blocks.

[0197] For example, the instruction fine-tuning sample knowledge base generated from a certain unstructured power text is shown in Table 3.

[0198] Table 3 Storage Definition Table of Instruction Fine-Tuning Sample Knowledge Base

[0199]

[0200] For structured data such as knowledge graphs, the information of a single entity is too single, and the generation effect for cold power entity samples is not good. Therefore, using the associated knowledge of entities as the background knowledge of the instruction fine-tuning sample knowledge base can supplement the information of cold power entities, and the generated sample information is more abundant, accurate, and professional. Further, step 112 also includes:

[0201] Step 1124: When the data type of the power text is structured data, use the attributes of the entities in the power text as ontology knowledge, and use the associated entities of the entities in the power text as background knowledge.

[0202] It can be understood that a knowledge graph includes: entities, attributes, and relationships.

[0203] For example, the instruction fine-tuning sample knowledge base generated from a certain structured power text is shown in Table 4.

[0204] Table 4 Storage Definition Table of Instruction Fine-Tuning Sample Knowledge Base

[0205]

[0206] The present invention adopts different processing methods for structured power texts, unstructured power texts, and semi-structured power texts to generate a uniformly stored instruction fine-tuning sample knowledge base, providing a unified context-enhanced knowledge basis for subsequent sample generation, and improving the accuracy and diversity of instruction fine-tuning samples. At the same time, the entire framework integrates three different types of data sources to ensure that various data sources can generate high-quality samples under a unified framework.

[0207] Further, step 12 includes:

[0208] Input the instruction fine-tuning sample knowledge base and seed sample instances into the large model for inference to generate multiple instruction fine-tuning samples in each scenario.

[0209] For example: # Your current task is to generate question-and-answer instruction fine-tuning samples based on power technical documents. Importantly:

[0210] 1. The generated question description is complete. Try to combine the file name and the original text context information, retain the background description of the original text main body, and do not lack constraint conditions. Ensure the independence of the question. Just looking at the question can contain all the main body information (such as substation equipment, substation, etc.) without lacking the theme.

[0211] 2. The question and answer should be as general knowledge as possible and not be too restrictive. Do not include charts.

[0212] 3. It should be ensured that the generated answer can answer the user's question by combining ontology knowledge and background knowledge.

[0213] # The following are some reference examples

[0214] Seed sample instance one

[0215] {Input ontology knowledge 1}

[0216] {Input knowledge background 1}

[0217] {User question 1}

[0218] {Output answer 1}

[0219] Seed sample instance two

[0220] {Input ontology knowledge 2}

[0221] {Input knowledge background 2}

[0222] {User question 2}

[0223] {Output answer 2}

[0224] Seed sample instance three

[0225] {Input ontology knowledge 3}

[0226] {Input knowledge background 3}

[0227] {User question 3}

[0228] {Output answer 3}

[0229] ……

[0230] # Generate 5 instruction fine-tuning samples based on the following reference knowledge in the instruction fine-tuning sample knowledge base:

[0231] {Ontology knowledge in the instruction fine-tuning sample knowledge base}

[0232] {Knowledge background in the instruction fine-tuning sample knowledge base}

[0233] # Output: Instruction fine-tuning sample 1, Instruction fine-tuning sample 2, Instruction fine-tuning sample 3, Instruction fine-tuning sample 4, and Instruction fine-tuning sample 5.

[0234] It should be noted that the "large model" involved in the embodiments of the present invention is well-known to those skilled in the art. Therefore, its specific implementation manner will not be described in detail.

[0235] Further, step 13 includes:

[0236] Step 131: Use the thought chain verification method to screen the instruction fine-tuning samples to obtain initial samples;

[0237] Step 132: Use the text feature screening method to remove the stop words in the initial samples to obtain the instruction fine-tuning samples that meet the requirements;

[0238] Step 133: Use the instruction fine-tuning samples that meet the requirements to construct a fine-tuning sample dataset.

[0239] Further, as Figure 3 shown, step 131 includes:

[0240] Step 1311: Use the answer in the instruction fine-tuning sample as the reference answer;

[0241] Step 1312: Based on the reference answer, the user question in the instruction fine-tuning sample, the ontology knowledge in the instruction fine-tuning sample, and the knowledge background in the instruction fine-tuning sample, use the large model to generate verification questions;

[0242] Step 1313: Use the large model to generate the replies to the verification questions;

[0243] Step 1314: Use the large model to logically judge whether the reply is consistent with the reference answer. If it is consistent, use the instruction fine-tuning sample corresponding to the reference answer to construct the initial sample; if it is inconsistent, remove the instruction fine-tuning sample corresponding to the reference answer.

[0244] It should be noted that the verification question is different from the user's question. The verification question is derived from the reference answer and the user's question in the instruction fine-tuning samples. For example, the ontology knowledge and knowledge background in the instruction fine-tuning samples are as follows:

[0245] Common casing failures include explosion, flashover, and oil leakage. The reasons are as follows: ① Poor sealing, insulation dampness and deterioration, or oil leakage; ② Improper configuration of the breather or failure to handle the inhaled moisture in time; ③ For the high-voltage side of the transformer (110 kV and above), capacitive bushings are generally used, and due to poor porcelain quality, there are sand holes or cracks; ④ There are defects in the manufacture of the capacitive core, and there is free discharge inside; ⑤ The casing is seriously fouled.

[0246] The user's question is: What are the reasons for casing failure?

[0247] The reference answer is: Poor sealing, insulation dampness and deterioration, or oil leakage; Improper configuration of the breather or failure to handle the inhaled moisture in time; For the high-voltage side of the transformer (110 kV and above), capacitive bushings are generally used, and due to poor porcelain quality, there are sand holes or cracks; There are defects in the manufacture of the capacitive core, and there is free discharge inside; The casing is seriously fouled.

[0248] The verification question is: What will happen inside when there are defects in the manufacture of the capacitive core?

[0249] The reply to the verification question is: Free discharge.

[0250] As can be seen from the above example, logically, it can be judged that the reply is consistent with the reference answer.

[0251] Since the power field has high requirements for the professionalism and reliability of the reply, the present invention uses the thought chain verification method to improve the reliability of the knowledge Q&A of the large model, allowing the large model to automatically check the answer, thereby improving the accuracy and reliability of the Q&A.

[0252] Further, step 132 includes:

[0253] Step 1321: Judge whether the user's question and answer in the initial sample contain stop words based on a preset stop word dictionary;

[0254] Step 1322: If the instruction in the initial sample contains stop words, remove the initial sample containing stop words, and the remaining initial sample is the instruction fine-tuning sample that meets the requirements; if the user's question and answer in the initial sample do not contain stop words, the initial sample is the instruction fine-tuning sample that meets the requirements.

[0255] The present invention screens the initial samples by using stop words, constructs a pattern recognition rule for dirty data, and accurately identifies and eliminates the data that does not meet the requirements. In some embodiments, if it is matched that the user questions and answers contain meaningless content such as table of contents, cover, etc., or contain stop words such as "figure", "icon" and "video" that cannot be processed by the language model, it is considered that it is difficult to generate answers by the framework and the output reliability decreases, and the user questions and answers are removed.

[0256] By screening high-quality samples in the instruction fine-tuning samples, the present invention can identify and filter out the noise and hallucinations in the sample generation process, thereby greatly improving the quality of the generated samples, further constructing a more reliable and representative fine-tuning sample data set. At the same time, it solves the problem that in the power field, due to its high professionalism and high requirements for the correctness and reliability of samples, the heuristic sample generation method is prone to generate noise or incorrect data due to the lack of effective supervision.

[0257] Further, step 133 includes:

[0258] Step 1331: Use the bert model to encode the qualified instruction fine-tuning samples into sentence vectors;

[0259] Step 1332: Use the k-center algorithm to cluster the sentence vectors to obtain multiple clusters;

[0260] Step 1333: Use multiple clusters to construct a fine-tuning sample data set.

[0261] It can be understood that the present invention encodes high-quality samples into sentence vectors, and then selects sample diversity based on the k-center algorithm. The algorithm iteratively selects the points that are farthest from the current center point set, which can ensure that the selected data is as scattered as possible, covering various types of instructions, and ensuring the diversity and coverage of the selected instruction data.

[0262] It should be noted that the method of "using the k-center algorithm to cluster the sentence vectors to obtain multiple clusters" involved in the embodiments of the present invention is well known to those skilled in the art. Therefore, its specific implementation method will not be described in detail. In some embodiments, as Figure 4 shown, step 1332 includes:

[0263] Step 1332a: Randomly select K data points as the initial center points, where K is a positive integer, and the data points are the sentence vectors;

[0264] Step 1332b: Assign each remaining object to the cluster represented by the initial center point closest to it;

[0265] Step 1332c: Randomly select a non-center point object y;

[0266] Step 1332d: Calculate the total cost s of replacing the center point X with y;

[0267] Step 1332e: If s is less than 0, replace x with y to form a new center point, and return to Step 1332b; if it is greater than or equal to 0, stop and output K clustering clusters.

[0268] It can be understood that due to the strong professionalism of the power field, large language models tend to generate high-frequency power-related words during sample generation, which restricts the diversity of the generated sample distribution. Especially when dealing with long-tail data, this bias is particularly obvious, thus affecting the generalization performance of the fine-tuned model. The samples of the present invention are based on a diversity sampling algorithm (i.e., the k-center algorithm) to effectively solve the problem of unbalanced data distribution, improve the diversity of sample generation, and thus enhance the generalization ability of the model.

[0269] It should be noted that instruction fine-tuning has demonstrated remarkable generalization ability in various tasks. However, their performance heavily depends on manually written instruction data, which are usually limited in terms of quantity, diversity, and creativity, thus restricting the generality of the model. To solve this problem, the present invention proposes a heuristic method for automatically generating instruction fine-tuning samples, which can efficiently generate high-quality fine-tuning instruction samples on a large scale. Finally, through this framework, a large-scale, highly diverse, high-quality, and efficient instruction fine-tuning dataset is generated, providing a data basis for large model fine-tuning.

[0270] To further illustrate the above method for automatically constructing an instruction fine-tuning sample set in the power field, the present invention also provides a specific example, such as Figure 5 shown, including the following steps:

[0271] Step 21: Use power texts to construct an instruction fine-tuning sample knowledge base;

[0272] Step 22: Input the seed sample instances and the instruction fine-tuning sample knowledge base into the large model LLM for inference to generate instruction fine-tuning samples;

[0273] Step 23: Chain of thought verification Q&A: Use the chain of thought verification method to screen the instruction fine-tuning samples to obtain initial samples;

[0274] Step 24: Text feature screening: Use the text feature screening method to screen the initial samples to obtain high-quality samples;

[0275] Step 25: Sample diversity sampling: Use the bert model to encode the high-quality samples into sentence vectors; use the k-center algorithm to cluster the sentence vectors to obtain multiple clustering clusters; use the multiple clustering clusters to construct a fine-tuning sample dataset.

[0276] In order to reduce the annotation cost of manually writing fine-tuning samples, the present invention designs a heuristic sample automatic generation method, that is, a method for automatically constructing an instruction fine-tuning sample set in the power field. This method can automatically generate samples that meet the task requirements, thereby significantly reducing the workload of manual participation and annotation, that is, automatically generating high-quality, diverse, and professional power fine-tuning samples with the least amount of manually labeled data.

[0277] Embodiment 2

[0278] The present invention also provides an apparatus for automatically constructing an instruction fine-tuning sample set in the power field, as Figure 6 shown, including:

[0279] A first construction unit for constructing an instruction fine-tuning sample knowledge base using power texts;

[0280] A generation unit for generating a plurality of instruction fine-tuning samples in each scenario using the instruction fine-tuning sample knowledge base and instruction seed sample instances in different scenarios in the power field;

[0281] A second construction unit for screening eligible instruction fine-tuning samples from the plurality of instruction fine-tuning samples based on the thought chain verification method and the text feature screening method to construct a fine-tuning sample data set.

[0282] Furthermore, the seed sample instances include: instructions, user questions, and answers;

[0283] The instruction fine-tuning samples include: instructions, user questions, and answers;

[0284] The instructions include: tasks, ontology knowledge, and knowledge background.

[0285] Furthermore, the instruction fine-tuning sample knowledge base includes: ontology knowledge and knowledge background; the first construction unit includes:

[0286] A first determination module for determining the data type of the power text;

[0287] A second determination module for determining the ontology knowledge and knowledge background corresponding to the power text according to the data type of the power text;

[0288] A first construction module for constructing the instruction fine-tuning sample knowledge base using the ontology knowledge and the background knowledge.

[0289] Furthermore, the second determination module is specifically used for:

[0290] When the data type of the power text is semi-structured data, a multi-way tree structure storage method is used to store the power text, and the instruction fine-tuning sample knowledge base is obtained; the multi-way tree includes: multiple child nodes;

[0291] Each child node in the multi-way tree is ontological knowledge, and the parent node and sibling nodes of each child node in the multi-way tree are knowledge backgrounds.

[0292] Further, the second determination module is further specifically configured to:

[0293] When the data type of the power text is unstructured data, slice the power text to obtain multiple text blocks, and the text blocks are ontological knowledge;

[0294] Use the TextRank algorithm to generate an abstract of the power text, and the abstract is the knowledge background.

[0295] Further, the second determination module is further specifically configured to:

[0296] When the data type of the power text is structured data, use the attributes of the entities in the power text as ontological knowledge, and use the associated entities of the entities in the power text as background knowledge.

[0297] Further, the generation unit is specifically configured to:

[0298] Input the instruction fine-tuning sample knowledge base and the seed sample instances into a large model for inference to generate multiple instruction fine-tuning samples in each scenario.

[0299] Further, the second construction unit includes:

[0300] The first screening module is used to screen the instruction fine-tuning samples by using the thought chain verification method to obtain initial samples;

[0301] The second screening module is used to remove stop words in the initial samples by using the text feature screening method to obtain the qualified instruction fine-tuning samples;

[0302] The second construction module is used to construct a fine-tuning sample data set by using the qualified instruction fine-tuning samples.

[0303] Further, the first screening module is specifically configured to:

[0304] Use the answers in the instruction fine-tuning samples as the benchmark answers;

[0305] Generate verification questions using a large model based on the reference answer, the user questions in the instruction fine-tuning samples, the ontology knowledge in the instruction fine-tuning samples, and the knowledge background in the instruction fine-tuning samples;

[0306] Generate responses to the verification questions using a large model;

[0307] Use the large model to logically determine whether the response is consistent with the reference answer. If they are consistent, construct an initial sample using the instruction fine-tuning sample corresponding to the reference answer; if not, remove the instruction fine-tuning sample corresponding to the reference answer.

[0308] Further, the second screening module is specifically configured to:

[0309] Judge whether the user questions and answers in the initial sample contain stop words based on a preset stop word dictionary;

[0310] If the instructions in the initial sample contain stop words, remove the initial samples containing stop words, and the remaining initial samples are the instruction fine-tuning samples that meet the requirements; if the user questions and answers in the initial sample do not contain stop words, the initial sample is the instruction fine-tuning sample that meets the requirements.

[0311] Further, the second construction module is specifically configured to:

[0312] Encode the instruction fine-tuning samples that meet the requirements into sentence vectors using a bert model;

[0313] Cluster the sentence vectors using the k-center algorithm to obtain multiple clusters;

[0314] Construct the fine-tuning sample dataset using the multiple clusters.

[0315] It can be understood that the device embodiments provided above correspond to the method embodiments above, and the corresponding specific content can be referred to each other, and will not be elaborated here.

[0316] It can be understood that the same or similar parts in the above embodiments can be referred to each other, and the content not detailed in some embodiments can be seen in the same or similar content in other embodiments.

[0317] Embodiment III

[0318] As Figure 7As shown, the present invention also provides an electronic device, which may be a computer device, a single-chip microcomputer device, a smart mobile device, etc. The electronic device in this embodiment may include a processor, a memory, a transceiver component, etc. The memory, the processor, and the transceiver component are connected through a bus; the memory can be used to store an execution program, and an exemplary execution program may include instructions; the processor is used to execute the instructions stored in the memory. The memory can also be used to store data, and this data can be called and / or modified when the instructions are executed.

[0319] The processor may be a Central Processing Unit (CPU), or may also be other general-purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field-Programmable Gate Arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. It is the computing core and control core of the terminal, and is suitable for implementing one or more instructions. Specifically, it is suitable for loading and executing one or more instructions in the storage medium to implement the corresponding method flow or corresponding function, so as to implement the steps of a method for automatically constructing an instruction fine-tuning sample set in the power field in the above embodiment.

[0320] Embodiment 4

[0321] Based on the same inventive concept, the present invention also provides a readable storage medium, specifically an electronic device-readable storage medium (Memory). The electronic device-readable storage medium is a memory device in the electronic device, used to store programs and data. It can be understood that the storage medium here can include both the built-in storage medium in the electronic device and, of course, the extended storage medium supported by the electronic device. The storage medium provides a storage space, and the operating system of the terminal is stored in this storage space. And, one or more instructions suitable for being loaded and executed by the processor are also stored in this storage space. These instructions can be one or more execution programs (including program codes). It should be noted that the storage medium here can be a high-speed RAM memory or a non-volatile memory, such as at least one disk memory. By the processor loading and executing one or more instructions stored in the storage medium, the steps of a method for automatically constructing an instruction fine-tuning sample set in the power field in the above embodiment can be implemented.

[0322] Those skilled in the art should understand that the embodiments of the present invention can be provided as a method, a system, or a computer program product. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.

[0323] The present invention is described with reference to the flowcharts and / or block diagrams of methods, apparatuses (systems), and computer program products according to embodiments of the present invention. It should be understood that each flow and / or block in the flowchart and / or block diagram, as well as the combination of flows and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, such that the instructions executed by the processor of the computer or other programmable data processing devices generate means for implementing the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.

[0324] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, such that the instructions stored in the computer-readable memory generate a manufactured article including instruction means that implement the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.

[0325] These computer program instructions can also be loaded onto a computer or other programmable data processing device, such that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process, and thus the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.

[0326] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to the above embodiments, those of ordinary skill in the art should understand that: still, the specific implementation manners of the present invention can be modified or equivalently replaced, and any modification or equivalent replacement that does not depart from the spirit and scope of the present invention shall be covered by the protection scope of the claims of the present invention.

Claims

1. A method for automatically constructing a sample set of fine-tuning instructions in the power field, characterized in that: include: Use power text to build a knowledge base of instruction fine-tuning samples; Using the instruction fine-tuning sample knowledge base and instruction seed sample instances of different scenarios in the power field, multiple instruction fine-tuning samples in each scenario are generated; Based on the thought chain verification method and the text feature screening method, instruction fine-tuning samples that meet the requirements are screened from the multiple instruction fine-tuning samples to construct a fine-tuning sample data set.

2. The method according to claim 1, characterized in that The seed sample examples include: instructions, user questions and answers; The instruction fine-tuning sample includes: instructions, user questions and answers; The instructions include: tasks, ontology knowledge and knowledge background.

3. The method according to claim 1, characterized in that: The instruction fine-tuning sample knowledge base includes: ontology knowledge and knowledge background; the instruction fine-tuning sample knowledge base constructed by using power text includes: Determining the data type of the power text; Determining the ontology knowledge and knowledge background corresponding to the electric power text according to the data type of the electric power text; The instruction fine-tuning sample knowledge base is constructed by utilizing the ontology knowledge and the background knowledge.

4. The method according to claim 3, characterized in that The determining, according to the data type of the electric power text, the ontology knowledge and knowledge background corresponding to the electric power text includes: When the data type of the power text is semi-structured data, a multi-tree structure storage method is used to store the power text to obtain the instruction fine-tuning sample knowledge base; the multi-tree includes: a plurality of child nodes; Each child node in the multi-branch tree is ontology knowledge, and the parent node and sibling nodes of each child node in the multi-branch tree are knowledge background.

5. The method according to claim 3, characterized in that: The determining, according to the data type of the electric power text, the ontology knowledge and knowledge background corresponding to the electric power text includes: When the data type of the power text is unstructured data, the power text is sliced ​​to obtain a plurality of text blocks, where the text blocks are ontology knowledge; The TextRank algorithm is used to generate a summary of the power text, where the summary is the knowledge background.

6. The method according to claim 3, characterized in that: The determining, according to the data type of the electric power text, the ontology knowledge and knowledge background corresponding to the electric power text includes: When the data type of the power text is structured data, the attributes of the entities of the power text are used as ontology knowledge, and the associated entities of the entities of the power text are used as background knowledge.

7. The method according to claim 1, characterized in that The method of using the instruction fine-tuning sample knowledge base and instruction seed sample instances of different scenarios in the electric power field to generate multiple instruction fine-tuning samples in each scenario includes: The instruction fine-tuning sample knowledge base and the seed sample instance are input into the large model for reasoning to generate multiple instruction fine-tuning samples for each scenario.

8. The method according to claim 1, characterized in that The method based on the thought chain verification method and the text feature screening method, screening the instruction fine-tuning samples that meet the requirements from the multiple instruction fine-tuning samples to build a fine-tuning sample data set, includes: Using the thought chain verification method to screen the instruction fine-tuning samples to obtain an initial sample; Using a text feature screening method to remove stop words in the initial sample, to obtain the instruction fine-tuning sample that meets the requirements; A fine-tuning sample data set is constructed using the instruction fine-tuning samples that meet the requirements.

9. The method according to claim 8, characterized in that The method of using the thought chain verification method to screen the instruction fine-tuning sample to obtain the initial sample includes: Using the answers in the instruction fine-tuning sample as the benchmark answer; Generate verification questions using a large model based on the benchmark answer, the user question in the instruction fine-tuning sample, the ontology knowledge in the instruction fine-tuning sample, and the knowledge background in the instruction fine-tuning sample; Use the large model to generate responses to validation questions; The large model is used to logically determine whether the reply is consistent with the benchmark answer. If they are consistent, the initial sample is constructed using the instruction fine-tuning sample corresponding to the benchmark answer; if they are inconsistent, the instruction fine-tuning sample corresponding to the benchmark answer is removed.

10. The method according to claim 8, characterized in that The method of using a text feature screening method to remove stop words in the initial sample to obtain the instruction fine-tuning sample that meets the requirements includes: Determining whether the user questions and answers in the initial sample contain stop words based on a preset stop word dictionary; If the instructions in the initial sample contain stop words, the initial samples containing the stop words are removed, and the remaining initial samples are the instruction fine-tuning samples that meet the requirements; if the user questions and answers in the initial sample do not contain stop words, the initial sample is the instruction fine-tuning sample that meets the requirements.

11. The method according to claim 1, characterized in that: The step of constructing a fine-tuning sample data set using the instruction fine-tuning samples that meet the requirements includes: Encode the instruction fine-tuning sample that meets the requirements into a sentence vector using the BERT model; Clustering the sentence vectors using a k-center algorithm to obtain multiple clusters; The fine-tuning sample dataset is constructed using the multiple clustering clusters.

12. An automatic construction device for fine-tuning sample sets of electric power field instructions, characterized in that: include: A first construction unit is used to construct an instruction fine-tuning sample knowledge base using the power text; A generating unit, configured to generate a plurality of instruction fine-tuning samples in each scenario by using the instruction fine-tuning sample knowledge base and instruction seed sample instances in different scenarios in the electric power field; The second construction unit is used to select instruction fine-tuning samples that meet the requirements from the multiple instruction fine-tuning samples based on the thought chain verification method and the text feature screening method to construct a fine-tuning sample data set.

13. The device according to claim 12, characterized in that The seed sample examples include: instructions, user questions and answers; The instruction fine-tuning sample includes: instructions, user questions and answers; The instructions include: tasks, ontology knowledge and knowledge background.

14. The device according to claim 12, characterized in that The instruction fine-tuning sample knowledge base includes: ontology knowledge and knowledge background; the first construction unit includes: A first determination module, used to determine the data type of the power text; A second determination module is used to determine the ontology knowledge and knowledge background corresponding to the power text according to the data type of the power text; The first building module is used to build the instruction fine-tuning sample knowledge base by using the ontology knowledge and the background knowledge.

15. The device according to claim 14, characterized in that The second determining module is specifically used to: When the data type of the power text is semi-structured data, a multi-tree structure storage method is used to store the power text to obtain the instruction fine-tuning sample knowledge base; the multi-tree includes: a plurality of child nodes; Each child node in the multi-branch tree is ontology knowledge, and the parent node and sibling nodes of each child node in the multi-branch tree are knowledge background.

16. The device according to claim 14, characterized in that The second determining module is further specifically configured to: When the data type of the power text is unstructured data, the power text is sliced ​​to obtain a plurality of text blocks, where the text blocks are ontology knowledge; The TextRank algorithm is used to generate a summary of the power text, where the summary is the knowledge background.

17. The device according to claim 14, characterized in that The second determining module is further specifically configured to: When the data type of the power text is structured data, the attributes of the entities of the power text are used as ontology knowledge, and the associated entities of the entities of the power text are used as background knowledge.

18. The device according to claim 12, characterized in that The generating unit is specifically used for: The instruction fine-tuning sample knowledge base and the seed sample instance are input into the large model for reasoning to generate multiple instruction fine-tuning samples for each scenario.

19. The device according to claim 12, characterized in that The second building unit comprises: A first screening module is used to screen the instruction fine-tuning samples using a thought chain verification method to obtain an initial sample; A second screening module is used to remove stop words in the initial sample by using a text feature screening method to obtain the instruction fine-tuning sample that meets the requirements; The second construction module is used to construct a fine-tuning sample data set using the instruction fine-tuning samples that meet the requirements.

20. The device according to claim 19, characterized in that The first screening module is specifically used for: Using the answers in the instruction fine-tuning sample as the benchmark answer; Generate verification questions using a large model based on the benchmark answer, the user question in the instruction fine-tuning sample, the ontology knowledge in the instruction fine-tuning sample, and the knowledge background in the instruction fine-tuning sample; Use the large model to generate responses to validation questions; Using the big model to logically determine whether the reply is consistent with the benchmark answer, if consistent, using the instruction fine-tuning sample corresponding to the benchmark answer to construct an initial sample; If they are inconsistent, the instruction fine-tuning sample corresponding to the benchmark answer is removed.

21. The device according to claim 19, characterized in that The second screening module is specifically used for: Determining whether the user questions and answers in the initial sample contain stop words based on a preset stop word dictionary; If the instructions in the initial sample contain stop words, the initial samples containing the stop words are removed, and the remaining initial samples are the instruction fine-tuning samples that meet the requirements; if the user questions and answers in the initial sample do not contain stop words, the initial sample is the instruction fine-tuning sample that meets the requirements.

22. The device according to claim 12, characterized in that The second building block is specifically used for: Encode the instruction fine-tuning sample that meets the requirements into a sentence vector using the BERT model; Clustering the sentence vectors using a k-center algorithm to obtain multiple clusters; The fine-tuning sample dataset is constructed using the multiple clustering clusters.

23. An electronic device, characterized in that: include: at least one processor and memory; The memory and the processor are connected via a bus; The memory is used to store one or more programs; When the one or more programs are executed by the at least one processor, the method for automatically constructing a sample set of fine-tuning instructions in the electric power field as claimed in any one of claims 1 to 11 is implemented.

24. A readable storage medium, characterized in that: An execution program is stored thereon, and when the execution program is executed, the method for automatically constructing a sample set of fine-tuning instructions in the power field as described in any one of claims 1 to 11 is implemented.

Citation Information

Cited By

  • Large language model data set protection method and device based on pollution lexical elements, electronic equipment, readable storage medium and computer program product

    CN120523965A

  • Power dispatching scene-oriented thinking chain question and answer data synthesis method and device

    CN121303370A

  • A thinking chain question and answer data synthesis method and device for a power dispatching scene

    CN121303370B