Supervised fine-tuning data generation method, device, medium and product
Patent Information
- Application Number
- CN202610840721.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-11
- Publication Date
- 2026-09-08
- Estimated Expiration
- 2046-06-11
AI Technical Summary
但现有技术中,缺少一种专门面向消防领域Markdown文档、能够结合切分、题型判断、分产线生成和上下文扩展机制进行监督微调数据构造的系统化方案
[0011]与相关技术相比,本申请通过基于格式化文本文档的监督微调数据生成方案来实现消防领域文档向监督微调样本的自动化转换,提高训练语料的来源可追溯性、答案严谨性、场景适配性及整体可用性,适用于消防法规、标准、制度、指南、应急预案及相关知识性文档的数据构建。
Smart Images

Figure CN122388570B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of supervised fine-tuning technology for large language models, and in particular to methods, devices, media and products for generating supervised fine-tuning data. Background Technology
[0002] With the continued application of large language models in vertical industries, the demand for high-quality supervisory fine-tuning corpora in the fire protection field is constantly increasing. Fire protection documents typically include policies and regulations, national standards, local standards, industry standards, management systems, operational guidelines, emergency plans, and accident handling procedures. These documents vary significantly in their expression, structural hierarchy, and knowledge density. Directly using general question-and-answer construction methods can easily lead to problems such as mixed question types, incomplete question subjects, unclear answer boundaries, and ambiguous citation sources.
[0003] For policy, regulation, and standard documents, answers often need to strictly correspond to specific clauses, and cannot be arbitrarily generalized or subjectively expanded. For guidelines, regulations, and contingency plans, however, samples with inductive, analytical, and practical orientations need to be generated, provided the source is clearly identified. Existing solutions typically rely on manual compilation or semi-automatic processing, which is not only inefficient but also makes it difficult to standardize sample criteria and hinders large-scale implementation.
[0004] Meanwhile, Markdown format, due to its clear hierarchy, well-defined structure, and ease of program processing, has become an important intermediate form for document parsing and training corpus construction. However, existing technologies lack a systematic solution specifically designed for Markdown documents in the fire protection field, capable of supervising and fine-tuning data construction by combining segmentation, question type judgment, production line generation, and context expansion mechanisms.
[0005] Therefore, how to provide methods, equipment, media, and products for supervising fine-tuning data generation to address the obvious deficiencies in existing technologies has become a technical problem that urgently needs to be solved by those skilled in the art. Summary of the Invention
[0006] To achieve the above objectives, some embodiments of this application provide the following aspects:
[0007] In a first aspect, some embodiments of this application provide a supervised fine-tuning data generation method, including: acquiring a formatted text document; segmenting the formatted text document to form multiple content units; performing question type judgment on each content unit to determine the judgment result of the question type that matches the content unit; assigning each content unit to a corresponding production line according to the question type judgment result to generate candidate questions; the production line is a question-answering generation model pre-built for different question types; filtering candidate questions and generating answers that match the candidate questions; generating question-answering content from the candidate questions and their matching answers, and then outputting the relevant question-answering content as a supervised fine-tuning training sample.
[0008] Secondly, some embodiments of this application also provide an electronic device, the electronic device comprising: one or more processors; and a memory storing computer program instructions, which, when executed, cause the processor to perform the steps of the supervised fine-tuning data generation method as described above.
[0009] Thirdly, some embodiments of this application also provide a computer-readable medium having computer program instructions stored thereon, which can be executed by a processor to implement the supervised fine-tuning data generation method as described above.
[0010] Fourthly, some embodiments of this application also provide a computer program product, including a computer program / instructions that, when executed by a processor, implement the steps of the supervised fine-tuning data generation method as described above.
[0011] Compared with related technologies, this application realizes the automatic conversion of fire protection documents into supervised fine-tuning samples through a supervised fine-tuning data generation scheme based on formatted text documents. This improves the traceability of training data sources, the rigor of answers, the adaptability of scenarios, and the overall usability. It is applicable to the data construction of fire protection regulations, standards, systems, guidelines, emergency plans, and related knowledge documents. Attached Figure Description
[0012] One or more embodiments are illustrated by way of example with reference numerals in the accompanying drawings. These illustrations do not constitute a limitation on the embodiments. Elements with the same reference numerals in the drawings are denoted as similar elements. Unless otherwise stated, the figures in the drawings are not to be limited by scale.
[0013] Figure 1 An exemplary flowchart of a supervised fine-tuning data generation method provided in Embodiment 1;
[0014] Figure 2 An exemplary flowchart of another supervised fine-tuning data generation method provided in Embodiment 2;
[0015] Figure 3 This is an exemplary structural diagram of the electronic device provided in Embodiment 3.
[0016] Detailed Implementation
[0017] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0018] In this embodiment of the disclosure, the collection, storage, use, processing, transmission, provision, and disclosure of user personal information comply with relevant laws and regulations and do not violate public order and good morals.
[0019] Example 1
[0020] This embodiment relates to a method for generating supervised fine-tuning data. For example... Figure 1 As shown, the supervised fine-tuning data generation method may include the following steps:
[0021] S11, retrieve the formatted text document;
[0022] S12, the formatted text document is segmented to form multiple content units;
[0023] S13, perform question type judgment on each of the content units to determine the judgment result of the question type that matches the content unit;
[0024] S14. Based on the judgment result of the question type, each of the content units is assigned to the corresponding production line to generate candidate questions; the production line is a question-answering generation model pre-built for different question types.
[0025] S15, filter candidate questions and generate answers that match the candidate questions;
[0026] S16, generate question-and-answer content from the candidate questions and their matching answers, and output the relevant question-and-answer content as a supervised fine-tuning training sample.
[0027] The core of this embodiment lies in acquiring a formatted text document; segmenting the formatted text document to form multiple content units; judging the question type of each content unit to determine the judgment result of the question type that matches the content unit; assigning each content unit to the corresponding production line according to the judgment result to generate candidate questions; the production line is a question-answer generation model pre-built for different question types; filtering candidate questions and generating answers that match the candidate questions; generating question-answer content from the candidate questions and their matching answers, and then outputting the relevant question-answer content as a supervised fine-tuning training sample. This supervised fine-tuning data generation scheme based on formatted text documents achieves the automated conversion of fire protection documents into supervised fine-tuning samples, improving the traceability of training data sources, the rigor of answers, scenario adaptability, and overall usability. It is applicable to the data construction of fire protection regulations, standards, systems, guidelines, emergency plans, and related knowledge documents.
[0028] Example 2
[0029] This embodiment relates to another method for generating supervised fine-tuning data. Embodiment two is an improvement upon embodiment one; please refer to the detailed implementation below for specific improvements. Figure 2 This is shown as an exemplary flowchart of another supervised fine-tuning data generation method. Figure 2 As shown, the supervised fine-tuning data generation method includes:
[0030] S21, Obtain the original document and perform structured parsing on the original document to obtain a formatted text document.
[0031] As a preferred embodiment, the specific implementation process of step S21 includes the following steps:
[0032] S211, Extract page text from the original document. For example, extract page text from the original document using an OCR model.
[0033] S212, Perform layout analysis on the page text.
[0034] Specifically, structures such as titles, paragraphs, lists, and tables are identified from the page text.
[0035] S213, perform hierarchical reconstruction on the page text.
[0036] Specifically, the chapter structure in the page text is restored based on numbering rules and layout features.
[0037] S214, the page text is converted into a structured data format to form the formatted text document, which facilitates subsequent analysis, reduces manual construction costs, improves training data production efficiency, and ensures data consistency.
[0038] In this embodiment, the formatted text document after structured parsing retains the document title, chapter level, paragraph structure, clause number, and body content.
[0039] S22, the formatted text document is segmented to form multiple content units.
[0040] In a preferred embodiment, step S22 involves segmenting the parsed formatted text document according to a preset segmentation length threshold to avoid semantic loss caused by content fragmentation. During segmentation, the positional relationship of each content unit in the original document is recorded to provide an index basis for subsequent context expansion.
[0041] For example, if the total number of words in a formatted text document is N and the preset segmentation length threshold is L, then the number of segmentation units M satisfies: M=ceil(N / L), where ceil represents the rounding up function, and preferably, L is 1000.
[0042] S23, perform question type judgment on each of the content units to determine the judgment result of the question type that matches the content unit.
[0043] As a preferred embodiment, the specific implementation process of step S23 includes the following steps:
[0044] S231, based on a combination of rule features and model discrimination, comprehensively determine the question type of each content unit and obtain the judgment result of the question type. The question types of the content unit include conceptual questions, analytical questions, and application questions.
[0045] Specifically, based on rule features, rule features are extracted from the content unit, and the feature probabilities of the corresponding rule features for the content unit are obtained. The rule features include definition features, analysis features, and / or application features. Therefore, the feature probabilities corresponding to the rule features include the feature probability Fdef of the definition features, the feature probability Fana of the analysis features, and the feature probability Fapp of the application features.
[0046] Definition features are used to characterize whether content units contain defining expressions such as concept explanations, term definitions, attribute descriptions, and principle listings. Definition features can be obtained through keyword matching, sentence structure rule recognition, or semantic feature extraction. In this embodiment, the keywords for definition features include: "refers to," "defined as," "includes," "belongs to," "basic principle," "main feature," and "applies to."
[0047] For example, when the content unit contains the statement: "Fire protection facilities refer to equipment and systems used for fire prevention, alarm, fire extinguishing, evacuation and rescue," it can be determined that the content has strong definitional characteristics.
[0048] Analytical features are used to characterize whether content units contain analytical expressions such as causal analysis, explanation of function, influence relationships, and strategy comparisons. In this embodiment, the keywords of analytical features include: "cause," "function," "influence," "lead to," "purpose," "strategy," "mechanism," and "comparison."
[0049] For example, when the content unit contains the statement: "Setting up an automatic sprinkler system is beneficial for controlling the spread of fire in the early stages of a fire," it can be determined that the content has strong analytical characteristics.
[0050] Application features are used to characterize whether there are practical expressions such as rectification measures, operational procedures, scenario responses, and implementation steps in the content unit. In this embodiment, the keywords of application features include: "rectification", "measures", "steps", "procedures", "should be taken", "disposal", and "operation".
[0051] For example, when a content unit contains the statement: "If an evacuation route is found to be blocked, the obstruction should be cleared immediately," it can be determined that the content has strong application characteristics.
[0052] S232, the content unit is input into a pre-trained language model, and the question type is classified through the pre-trained language model to obtain the question type matching probability of the content unit belonging to each question type. In this embodiment, the content unit is classified into one of three types: conceptual question type, analytical question type, and application question type, or multiple types, or the classification cannot be determined. In this embodiment, the matching probability (Pmodel) of the content unit belonging to each question type includes the question type matching probability of belonging to the conceptual question type, the question type matching probability of belonging to the analytical question type, or the question type matching probability of belonging to the application question type.
[0053] S233, based on the feature probability and the question type matching probability, a comprehensive score is given to the question type of the content unit. When the comprehensive score of a question type is greater than the scoring threshold of that question type, the judgment result of the question type of the content unit is determined. The judgment result of the question type is a single type, multiple types, or question type that cannot be determined.
[0054] In a preferred implementation, step S233 uses a comprehensive scoring method to comprehensively score the question types of the content unit. This comprehensive scoring method involves assigning weight parameters to each feature probability and each question type matching probability, multiplying each feature probability by its corresponding weight parameter to obtain a feature score, multiplying the question type matching probability by its corresponding weight parameter to obtain a question type matching score, and finally adding the feature score and the question type matching score to obtain the comprehensive score.
[0055] Specifically, the comprehensive scoring method can be expressed by the following formula: S(type) = α·Fdef + β·Fana +γ·Fapp + δ·Pmodel, where the weight parameters for the probability of each feature and the matching probability of each question type, namely α, β, γ, and δ, are obtained in the following way:
[0056] 1. Human experience allocation; 2. Optimize based on labeled training data;
[0057] 3. Dynamically adjust based on historical classification accuracy.
[0058] This embodiment improves the accuracy and robustness of question type judgment by combining "rule features + pre-trained language model" with comprehensive scoring and threshold judgment. It enhances the adaptability to fuzzy mixed question types. Through comprehensive scoring and threshold mechanism, it allows for single, multiple, or undetermined outputs, which is more in line with the situation where the boundaries of question types are unclear in actual test questions.
[0059] S24, based on the judgment result of the question type, each content unit is assigned to the corresponding production line to generate candidate questions; the production line is a question-answering generation model pre-built for different question types, including conceptual production lines, analytical production lines, and application production lines. Each production line corresponds to a set of question generation strategies, prompt word templates, and answer generation constraint mechanisms to improve the relevance and consistency of different types of training data. This application distinguishes between conceptual, analytical, and application production lines to ensure that different training objectives correspond to different sample structures, which helps to enhance the clarity and relevance of training data organization.
[0060] For conceptual production lines, this embodiment generates answers around specific concepts, terms, characteristics, and principles. The core feature is that answers must strictly quote the original text of the relevant clauses, prohibiting any generalizations or subjective interpretations. Answers are also required to strictly reproduce the corresponding content in the quoted blocks to ensure the accuracy and rigor of policy-related concept transmission. This approach is applicable to policy regulations, national standards, local standards, and industry standards.
[0061] For analytical production lines, this embodiment generates questions around the functions, effects, causes, and strategies, focusing on the understanding and extraction of text. It requires the construction of question-and-answer pairs to be based on the content and language organization, allowing reasonable summarization, explanation, and analysis, but the source must be clearly marked, and multiple information points must be organized and summarized. It is suitable for standards, guidelines, and explanatory materials with high knowledge density.
[0062] For application-oriented production lines, the generation of questions in this embodiment revolves around scenario response, rectification measures, operation methods, and implementation processes. It focuses on the extraction and transformation of practical content from the text, requiring the model to generate operable solutions or implementation steps based on the measures, methods, and processes in the document. It emphasizes the ability to respond to specific scenarios and solve practical problems, and constructs practice-oriented answers by combining the conditions, steps, and constraints in the context. It is applicable to documents such as management systems, solutions, operation guidelines, and emergency plans.
[0063] As a preferred embodiment, the specific implementation process of step S24 includes the following steps:
[0064] S241, when the question type is determined to be a single type, the content unit is assigned to the corresponding production line. When the question type is determined to be multiple types, the content unit is assigned to multiple production lines in parallel. When the question type is determined to be an undetermined type, the content unit is assigned to the analytical production line by default.
[0065] In step S242A, when the content unit is assigned to the conceptual production line, defining expressions are extracted from the content unit to identify the conceptual object. Subsequently, core terms, attribute descriptions, and limiting conditions are extracted from the content unit. Then, candidate questions are generated through the conceptual production line. Finally, subject completion, semantic standardization, and duplication verification are performed on the generated candidate questions, and conceptual candidate questions are output. In this embodiment, the generation of conceptual candidate questions is connected to the "strict citation mode" in subsequent step S27, enabling the generated candidate questions to directly correspond to the normative expressions in the citation context block, thereby ensuring the traceability of the answer source and the accuracy of the conceptual expression.
[0066] For example, a conceptual candidate question generation example: when the content unit contains: "The person in charge of fire safety refers to the person who is fully responsible for the fire safety work of the unit", the question "What is the definition of the person in charge of fire safety?" can be generated.
[0067] In step S242B, when the content unit is assigned to the analytical production line, causal relationships, action relationships, and influence relationships are identified from the content unit. Subsequently, the analysis object and related information are extracted from the content unit. Then, candidate questions are generated through the analytical production line. Finally, the generated candidate questions are checked for logical consistency and relevance, and analytical candidate questions are output. In this embodiment, the generation of analytical candidate questions is connected to the "inductive analysis mode" in subsequent step S27, enabling the generated questions to form a logical and structured analytical answer based on multiple reference information points.
[0068] For example, an example of generating an analytical candidate question: when the content unit contains: "Automatic alarm systems can detect fires in a timely manner and activate fire-fighting facilities", the question "What role do automatic alarm systems play in fire response?" can be generated.
[0069] In step S242C, when the content unit is assigned to the application-oriented production line, the scenario conditions, risk status, and practical expressions are identified from the content unit. Subsequently, corrective measures, operational steps, and execution actions are extracted from the content unit. Next, a scenario-based process structure is constructed. Then, candidate questions are generated through the application-oriented production line. Finally, executability and process integrity checks are performed on the candidate questions, and application-oriented candidate questions are output. In this embodiment, the generation of application-oriented candidate questions is connected to the "practice integration mode" in subsequent step S27, enabling the generated questions to further form scenario-based answers that include measures, conditions, steps, and precautions.
[0070] For example, an example of generating an application-oriented candidate question: when the content unit contains: "When an evacuation route is found to be blocked, the obstruction should be cleared immediately", the question "How should the situation of blocked evacuation routes be rectified?" can be generated.
[0071] Preferably, each content unit generates 3 to 5 candidate questions per production line. During the question generation process, the question structure is constrained by prompt word templates to ensure that the question subject is complete (based on document title or context completion), that the semantics are singular (avoiding multiple questions combined into one), and that it does not contain specific law names, standard names, or document names.
[0072] S25, Screen candidate questions to improve the quality of question-and-answer samples.
[0073] As a preferred embodiment, the specific implementation process of step S24 includes the following steps:
[0074] S251, Remove duplicate questions from the candidate questions.
[0075] Preferably, step S251 is achieved by calculating the similarity between two candidate questions, and removing duplicate questions when the similarity is greater than or equal to the duplicate determination threshold.
[0076] S252, the generated candidate questions are further screened. If the question type of the candidate question is inconsistent with the judgment result of the question type, the generated candidate question is eliminated.
[0077] S253, remove questions without a definite object from the generated candidate questions.
[0078] Preferably, step S253 can be based on syntactic analysis or rule matching methods to detect whether there are missing subjects, unclear referents, or incomplete semantics in the questions. For example, questions without a clear object, such as "How to handle it?" or "Why did it happen?", are eliminated.
[0079] S254, perform an out-of-scope detection on the generated candidate questions. If the candidate question is detected as an out-of-scope question, then remove the corresponding candidate question.
[0080] Prior to this, if the answer to a candidate question requires external knowledge or cross-document information, the candidate question is considered to be beyond the scope of the question and is therefore eliminated.
[0081] S255, detect the correlation between the generated candidate questions and the content unit, and when the correlation between the two is lower than a preset correlation threshold, remove the corresponding candidate questions.
[0082] Preferably, in this embodiment, the relevance between the candidate question and the content unit is calculated by semantic matching.
[0083] S26. For the filtered candidate questions, extract the reference context blocks from their corresponding formatted text documents. The reference context blocks derived from the content units are a set of semantic fragments from the original text that can cover the answer content. Furthermore, the reference scope of the reference context blocks differs for different question types, in order to adapt to the semantic density and logical span requirements of different question types through differentiation. For example, the reference scope for conceptual questions is the extraction of M words before and after the question, the reference scope for analytical questions is the extraction of N words before and after the question, and the reference scope for application questions is the extraction of P words before and Q words after the question.
[0084] In this embodiment, since the reference context block and the candidate question have the following relationship: each candidate question corresponds to a unique reference context block, and the question is so difficult that it must be completed or mainly comes from the reference context block, the reference context block serves as the sole semantic basis for answer generation.
[0085] This embodiment enhances the completeness and stability of answer generation through a differentiated context extraction strategy, and reduces the semantic fragmentation problem caused by content segmentation.
[0086] Specifically, the implementation process of step S26 includes the following steps:
[0087] For each candidate question, determine its central content unit; based on this central content unit, expand adjacent content units forward and backward according to the question type, and splice them together to form the reference context block.
[0088] S27. Generate an answer that matches the candidate question based on the candidate question, document title, and corresponding reference context block.
[0089] In this embodiment, different answer generation strategies are used for different question types. The specific generation process of step S27 includes the following steps:
[0090] S271A, when the candidate question is a conceptual question, the clause content corresponding to the conceptual question is located from the reference context block, and the original text is directly extracted, retaining the original document structure and expression, to form an answer that matches the conceptual question. In this embodiment, the extracted original text cannot be rewritten, summarized, or expanded.
[0091] For example, a conceptual candidate question: What is the definition of a device?
[0092] Answer: Directly use the original text of the standard clause.
[0093] S271B: When the candidate question is an analytical question, extract multiple relevant information points from the reference context block, establish logical relationships between the information points, and organize and express them to form an answer that matches the analytical question.
[0094] For example, an analytical candidate question: What are the effects and impacts of a certain measure?
[0095] Answer: Integrate the content of multiple clauses to form a structured analysis and explanation.
[0096] S271C: When the candidate question is an application-oriented question, extract measures, processes, operational steps, applicable conditions, and limiting factors from the reference context block, and organize them in a logical order to form an answer that matches the application-oriented question.
[0097] For example, a candidate question: What measures should be taken in a certain scenario?
[0098] Answer: Output structured content consisting of "conditions + steps + precautions".
[0099] S28, generate question-and-answer content from the candidate questions and their matching answers, and output the relevant question-and-answer content as a supervised fine-tuning training sample. In this embodiment, the supervised fine-tuning training sample includes fields such as question, thought chain, answer, document title, question type, and source information, so as to be used for subsequent supervised fine-tuning training of the large language model in the fire protection field.
[0100] It is not difficult to see that the embodiments of this application realize the automatic conversion of fire protection documents into supervised fine-tuning samples through a supervised fine-tuning data generation scheme based on formatted text documents, thereby improving the traceability of training data sources, the rigor of answers, the adaptability of scenarios, and the overall usability. It is applicable to the data construction of fire protection regulations, standards, systems, guidelines, emergency plans, and related knowledge documents.
[0101] The steps of the various methods described above are only for clarity. In practice, they can be combined into one step or some steps can be split into multiple steps. As long as they include the same logical relationship, they are all within the scope of protection of this application. Adding insignificant modifications or introducing insignificant designs to the algorithm or process, but without changing the core design of the algorithm and process, are also within the scope of protection of this application.
[0102] Example 3
[0103] This embodiment provides an electronic device. The electronic device can be various forms of digital computer, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, mainframe computers, cellular phones, smartphones, wearable devices, and other similar computing devices.
[0104] The electronic device includes: one or more processors; and a memory storing computer program instructions, which, when executed, cause the processor to perform the steps of the supervised fine-tuning data generation method provided in any one or more of the above embodiments.
[0105] Figure 3 An exemplary structural diagram of the electronic device is disclosed. The electronic device includes one or more processors 1101, a memory 1102, an input device 1103, and an output device 1104. The various components are interconnected via a bus or other means (the diagram shows an example of bus connection). The processor 1101 can be used to execute instructions stored in the memory 1102 to control the overall operation of the electronic device. The memory 1102 may include a program storage area and a data storage area, wherein the program storage area stores the operating system and applications required for at least one function; the data storage area stores data created according to the use of the electronic device, etc. The memory 1102 may include high-speed random access memory and may also include non-transitory memory, such as disk storage devices, flash memory devices, or other non-transitory solid-state storage devices. In some embodiments, the memory 1102 may also include storage resources located remotely to the processor and accessible via a network.
[0106] Input device 1103 can be used to receive input numerical or character information or user operation signals, such as a touch screen, keypad, mouse, trackpad, touchpad, indicator, one or more mouse buttons, trackball, joystick, etc. Output device 1104 may include display devices (such as liquid crystal displays, light-emitting diode displays, plasma displays, and optional touch screens), auxiliary lighting devices (such as LEDs), and haptic feedback devices (such as vibration motors), etc.
[0107] To facilitate user interaction, the electronic device may be configured to include a display device (such as an LCD or CRT monitor) and input devices such as a keyboard and pointing devices (e.g., a mouse or touchpad). Feedback can be any form of sensory feedback (e.g., visual feedback, auditory feedback); input may also be received via voice, touch, or other means.
[0108] This application also relates to a computer-readable medium storing a computer program / instructions thereon, which, when executed by a processor, implement the steps of the supervised fine-tuning data generation method provided in any one or more of the above embodiments. The computer-readable medium may be a memory included in an electronic device, or it may be a standalone storage medium not assembled into the device.
[0109] It should be noted that the computer-readable medium described in this application can be a computer-readable signal medium, a computer-readable storage medium, or a combination of both. Examples include, but are not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or any combination thereof. Specific examples of storage media include, but are not limited to, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory, optical fibers, portable CD-ROMs, optical storage devices, magnetic storage devices, etc., or any suitable combination thereof. The computer-readable medium can store one or more programs that can be used by or in conjunction with an instruction execution system. The medium can be permanent or non-permanent, removable or non-removable, and information storage can be achieved through any method or technology. The information can be computer-readable instructions, data structures, program modules, or other data.
[0110] The computer program code used to implement the operations of this application can be written in any combination of one or more programming languages, including object-oriented programming languages (such as Java, Smalltalk, and C++) and conventional procedural programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer, partially on a remote computer, or entirely on a remote computer or server. The remote computer can be connected to the user's computer via any network (including a local area network or a wide area network) or can be connected to an external computer.
[0111] In the above embodiments, the functions can be implemented in whole or in part by software, hardware, firmware, or any combination thereof, for example, by using application-specific integrated circuits, general-purpose computers, or other similar hardware devices. In some embodiments, the software program of this application can be executed by a processor to implement the steps or functions; it can also be implemented by hardware, for example, as a circuit that works in conjunction with the processor to execute the steps or functions.
[0112] This application also provides a computer program product, including one or more computer programs / instructions, which, when executed by a processor, generate all or part of the processes or functions described in this application. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium or transmitted from one storage medium to another via wired (e.g., DSL) or wireless (e.g., wireless, microwave) means. The computer-readable storage medium may be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. The available medium may be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state drive).
[0113] The flowcharts or block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of devices, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-specific system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0114] The scope of this application is defined by the appended claims rather than the foregoing description, and is therefore intended to encompass all variations falling within the meaning and scope of equivalents of the claims. No reference numerals in the claims should be construed as limiting the scope of the claims. Furthermore, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices recited in a device claim may also be implemented by a single unit or device in software or hardware. Terms such as "first," "second," etc., are used only for distinguishing descriptions and do not indicate any particular order, nor should they be construed as indicating or implying relative importance.
[0115] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily made by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims, and the above embodiments should be regarded as exemplary and non-limiting.
Claims
1. A method for supervising fine-tuning data generation, characterized in that, include: Get a formatted text document; The formatted text document is segmented to form multiple content units; Each content unit is assessed for question type to determine the appropriate question type for that content unit. Based on the judgment result of the question type, each of the content units is assigned to the corresponding production line to generate candidate questions; the production line is a question-answering generation model pre-built for different question types. Candidate questions are filtered, and for the filtered candidate questions, reference context blocks are extracted from their corresponding formatted text documents; the reference context block is a collection of original text semantic fragments that can cover the answer content; when the candidate question is a conceptual question, the clause content corresponding to the conceptual question is located from the reference context block, the original text is directly extracted, and the original document structure and expression are preserved to form an answer that matches the conceptual question; When the candidate question is an analytical question, multiple relevant information points are extracted from the reference context block, and logical relationships are established between the information points. These information points are then organized and expressed to form an answer that matches the analytical question. When the candidate question is an application-oriented question, extract the measures, processes, operational steps, applicable conditions, and limiting factors from the reference context block, and organize them into an answer that matches the application-oriented question in a logical order; The candidate questions and their matching answers are used to generate question-and-answer content, and the relevant question-and-answer content is then used to construct supervised fine-tuning training samples before being output.
2. The supervised fine-tuning data generation method according to claim 1, characterized in that, Before the step of obtaining the formatted text document, the method further includes: obtaining the original document and performing structured parsing on the original document; wherein, the step of performing structured parsing on the original document to obtain the formatted text document includes: Extract the page text from the original document; Perform layout analysis on the text of the page; The page text is reconstructed hierarchically; The page text is converted into a structured data format to form the formatted text document.
3. The method for generating supervised fine-tuning data according to claim 1, characterized in that, The step of determining the question type for each content unit to identify the appropriate question type includes: comprehensively judging the question type of each content unit based on a combination of rule features and model discrimination, and obtaining the question type judgment result; wherein the question types of the content units include conceptual questions, analytical questions, and application questions; wherein the step of comprehensively judging the question type of each content unit based on a combination of rule features and model discrimination includes: extracting rule features from the content unit based on rule features and obtaining the feature probabilities of the rule features corresponding to the content unit; wherein the rule features include definition features, analytical features, and / or application features; The content unit is input into a pre-trained language model, and the pre-trained language model is used to classify the question types and obtain the question type matching probability of the content unit belonging to each question type. The pre-trained language model classifies the content unit into one of three types: conceptual, analytical, and application, or multiple types, or it cannot be determined. The matching probability of the content unit belonging to each question type includes the question type matching probability of belonging to the conceptual type, the question type matching probability of belonging to the analytical type, or the question type matching probability of belonging to the application type. Based on the feature probability and the question type matching probability, the question types of the content unit are comprehensively scored. When the comprehensive score of a question type is greater than the scoring threshold of that question type, the judgment result of the question type of the content unit is determined. The judgment result of the question type is a single type, multiple types, or question type that cannot be determined.
4. The supervised fine-tuning data generation method according to claim 3, characterized in that, The content unit's question types are comprehensively scored using a comprehensive scoring method. This comprehensive scoring method involves assigning weight parameters to each feature probability and each question type matching probability, multiplying each feature probability by its corresponding weight parameter to obtain a feature score, multiplying the question type matching probability by its corresponding weight parameter to obtain a question type matching score, and adding the feature score and the question type matching score to obtain a comprehensive score.
5. The method for generating supervised fine-tuning data according to claim 3, characterized in that, Based on the judgment result of the question type, each of the aforementioned content units is assigned to its corresponding production line. The steps for generating candidate questions include: When the judgment result of the question type is a single type, the content unit is assigned to the corresponding production line; the production lines include conceptual production lines, analytical production lines, and application production lines; When the judgment result of the question type is of multiple types, the content unit is distributed to multiple production lines in parallel; When the question type cannot be determined, the content unit will be assigned to the analytical production line by default. When the content unit is assigned to the conceptual production line, a definitional expression is extracted from the content unit to identify the conceptual object; then, core terms, attribute descriptions, and limiting conditions are extracted from the content unit; then, candidate questions are generated through the conceptual production line; finally, subject completion, semantic standardization, and duplication verification are performed on the generated candidate questions to output the conceptual candidate questions. When the content unit is assigned to the analytical production line, causal relationships, action relationships, and influence relationships are identified from the content unit; then, the analysis object and related information are extracted from the content unit; next, candidate questions are generated through the analytical production line; finally, logical consistency and relevance checks are performed on the generated candidate questions, and analytical candidate questions are output. When the content unit is assigned to the application-type production line, the scenario conditions, risk status, and practical expressions are identified from the content unit; then, rectification measures, operation steps, and execution actions are extracted from the content unit; next, a scenario-based process structure is constructed; then, candidate issues are generated through the application-type production line; finally, the feasibility and process integrity of the candidate issues are verified, and the application-type candidate issues are output.
6. The method for generating supervised fine-tuning data according to claim 1, characterized in that, The step of filtering candidate questions and generating answers that match the candidate questions includes filtering candidate questions that meet preset requirements, which includes: Eliminate duplicate questions from the candidate questions; The generated candidate questions are further screened. If the question type of the candidate question does not match the judgment result of the question type, the generated candidate question is eliminated. Eliminate questions without a clearly defined object from the generated candidate questions; The generated candidate questions are checked for being out of scope; if a candidate question is detected as out of scope, the corresponding candidate question is removed. The correlation between the generated candidate questions and the content units is detected. When the correlation between the two is lower than a preset correlation threshold, the corresponding candidate questions are removed.
7. An electronic device, characterized in that, The electronic device includes: One or more processors; and A memory storing computer program instructions, which, when executed, cause the processor to perform the steps of the supervised fine-tuning data generation method as described in any one of claims 1 to 6.
8. A computer-readable medium having a computer program / instructions stored thereon, characterized in that, When the computer program / instructions are executed by the processor, they implement the steps of the supervised fine-tuning data generation method according to any one of claims 1 to 6.
9. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instructions are executed by the processor, they implement the steps of the supervised fine-tuning data generation method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Industrial instruction fine tuning data set automatic generation method and system
CN120297402A