A method, device and medium for constructing a data set for a large language model

By obtaining professional document data and using hierarchical progressive construction strategies and probability distribution characteristics to construct a large language model data set, the problems of low data set construction efficiency and insufficient information in the existing technology are solved, and the professionalism and generalization ability of the model are improved. , which enhances the layering and depth of the data set.

CN118378634BActive Publication Date: 2024-09-06INSPUR GENERSOFT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410804921.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-21
Publication Date
2024-09-06
Estimated Expiration
2044-06-21

AI Technical Summary

Technical Problem

The construction efficiency of existing large language model data sets is low, with incomplete information, narrow information coverage, and weak information hierarchy, which cannot meet the needs of professional fields.

Method used

By obtaining professional document data, a hierarchical progressive construction strategy is used to generate a subset of knowledge question and answer data and a subset of case analysis data. Combined with the information of the large language model data set, a large language model dedicated data set is constructed, and the probability distribution characteristics and analysis are used Case information performs data subset building and expansion, blending common data sets to improve data set quality and diversity.

Benefits of technology

It improves the pertinence and professionalism of the large language model, enhances the generalization ability and adaptability of the model in professional fields, ensures that the data set contains diverse features and patterns, improves the layering and depth of the data set, and reduces manual intervention and errors, enhancing the interpretability and credibility of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118378634B
    Figure CN118378634B
Patent Text Reader

Abstract

The embodiments of this specification disclose a data set construction method, device and medium for a large language model, which relate to the field of data processing technology. The method includes: obtaining professional document data in a specified professional field to determine the large language model data set information based on the professional document data, and the target task types include professional knowledge question and answer and specific case analysis; constructing question and answer pairs for the professional document data through a pre-set hierarchical progressive construction strategy to generate a knowledge question and answer data subset corresponding to the professional document data; analyzing the professional document data to determine the analysis case information corresponding to the professional document data to construct a case analysis data subset according to the probability distribution characteristics and the analysis case information; based on the large language model data set information, constructing a large language model-specific data set corresponding to the specified professional field according to the knowledge question and answer data subset and the case analysis data subset.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present specification relates to the field of data processing technology, and in particular to a method, device and medium for constructing a data set for a large language model. Background Art

[0002] Artificial intelligence plays a vital role in diverse fields such as healthcare, education, transportation, finance, media, and government affairs. Generative artificial intelligence represented by the Transformer architecture, namely the big language model, has shown great application value in complex tasks such as natural language processing, information retrieval, and decision support. Data, algorithms, and computing power are the three cores of the big language model, among which high-quality corpus data is the key to improving the performance of the big language model. In order to improve the application value of the big language model in professional fields, it is necessary to build high-quality professional data sets.

[0003] At present, document data and knowledge graphs are the main sources for building professional data sets. Among them, extracting information from knowledge graphs to build professional data sets requires a certain threshold, and requires the professional field to have specific knowledge graph support. Therefore, extracting information from document data to build professional data sets is the main way. At present, information is extracted from document data to build data sets mainly through manual methods and large language models. Manually building data sets is time-consuming and labor-intensive, and the efficiency is extremely low, especially when dealing with large-scale documents; while the large language model-assisted data set construction has problems such as incomplete information generalization, narrow information scope, and weak information hierarchy. Incomplete information generalization may cause the data set to lack key information, and the narrow information scope may limit the breadth and diversity of the data set, while the weak information hierarchy may affect the depth and quality of the data set. Therefore, the current data set construction is limited by the construction method, the construction efficiency is low, and there are problems such as incomplete information in the data set, narrow information scope, and weak information hierarchy, which makes the large language model unable to meet the professional needs of the professional field. Summary of the invention

[0004] One or more embodiments of the present specification provide a method, device and medium for constructing a dataset for a large language model, which are used to solve the following technical problems: the current dataset construction is limited by the construction method, the construction efficiency is low, and there are problems such as incomplete information in the dataset, narrow information scope, and weak information hierarchy, which makes the large language model unable to meet the professional needs of professional fields.

[0005] One or more embodiments of this specification adopt the following technical solutions:

[0006] One or more embodiments of the present specification provide a method for constructing a dataset for a large language model, the method comprising: obtaining professional document data in a specified professional field to determine large language model dataset information based on the professional document data, wherein the large language model dataset information includes multiple dataset target task types and target task ratios of the multiple dataset target task types, and the target task types include professional knowledge question and answer and specific case analysis; constructing question and answer pairs for the professional document data through a pre-set hierarchical progressive construction strategy to generate a knowledge question and answer data subset corresponding to the professional document data; analyzing the professional document data to determine analysis case information corresponding to the professional document data to construct a case analysis data subset based on probability distribution characteristics and the analysis case information, wherein the analysis case information includes variable type information corresponding to the analysis case; based on the large language model dataset information, constructing a large language model-specific dataset corresponding to the specified professional field according to the knowledge question and answer data subset and the case analysis data subset.

[0007] Furthermore, through a preset hierarchical progressive construction strategy, question-answer pairs are constructed for the professional document data to generate a knowledge question-answer data subset corresponding to the professional document data, specifically including: obtaining large language model input restriction information and natural separator information in the professional document data; processing the professional document data according to the large language model input restriction information and the natural separator information in the professional document data to generate multiple segments; using each of the segments as input of the large language model, generating a segmentation question corresponding to each segment through preset prompt words, expanding the segmentation question through synonym replacement to generate multiple expanded segmentation questions; through prompt word engineering, combining the multiple expanded segmentation questions and the professional document data to generate a segmentation answer corresponding to each expanded segmentation question, and constructing a segmentation question-answer pair; based on the multiple segmentation question-answer pairs, generating a knowledge question-answer data subset corresponding to the professional document data.

[0008] Furthermore, according to the large language model input restriction information and the natural separator information in the professional document data, the professional document data is processed to generate multiple segments, specifically including: segmenting the professional document data according to the natural separator information in the professional document data to determine multiple first segments; determining a first segmentation order corresponding to the multiple first segments according to the order of the natural separator information in the professional document data; according to the large language model input restriction information, accumulating the segmentation word count information of the first segments in sequence according to the first segmentation order to obtain the accumulated accumulated segmentation word count information; merging multiple specified first segments according to the accumulated segmentation word count information and the large language model input restriction information to determine multiple second segments.

[0009] Furthermore, based on the probability distribution characteristics and the analysis case information, a case analysis data subset is constructed, specifically including: obtaining the variable type information of each variable corresponding to the analysis case in the analysis case information; constructing at least one case analysis question-and-answer pair corresponding to each variable type according to a predetermined uniform distribution rule; determining the total number of historical case variables corresponding to the analysis case and the number of historical case variable generation times corresponding to each variable type, and determining the occurrence probability of each variable type through the number of historical case variable generation times and the total number of historical case variables; according to the normal distribution principle, each case analysis question-and-answer pair is expanded according to the occurrence probability of each variable type to construct a case analysis data subset.

[0010] Furthermore, according to a predetermined uniform distribution rule, at least one case analysis question-answer pair corresponding to each variable type is constructed, specifically including: designing questions for each of the variable types to generate at least one case analysis question corresponding to each of the variable types; answering each of the case analysis questions based on the professional document data through a large language model to determine the case analysis answer corresponding to each of the case analysis questions; and constructing at least one case analysis question-answer pair corresponding to each of the variable types based on at least one case analysis question corresponding to each of the variable types and the case analysis answer corresponding to each of the case analysis questions.

[0011] Furthermore, based on the professional file data, the large language model data set information is determined, specifically including: obtaining historical large language model input and output information corresponding to the specified professional field of the professional file data; identifying the historical large language model input and output information, and determining multiple historical task types to determine the multiple data set target task types; counting the number of tasks of each of the historical task types, and determining the target task ratio of the multiple data set target task types according to the ratio between the number of tasks of multiple historical task types.

[0012] Further, based on the large language model dataset information, according to the knowledge question and answer data subset and the case analysis data subset, a large language model-specific dataset corresponding to the specified professional field is constructed, specifically including: obtaining the target task ratio of the multiple dataset target task types in the large language model dataset information; respectively determining the number of knowledge question and answer question and answer pairs and the number of case analysis question and answer pairs in the knowledge question and answer data subset and the case analysis data subset; judging whether the knowledge question and answer data subset and the case analysis data subset meet the target task ratio according to the number of knowledge question and answer pairs and the number of case analysis question and answer pairs; when the knowledge question and answer data subset and the case analysis data subset do not meet the target task ratio, the case analysis data subset is expanded according to the target task ratio to obtain an extended case analysis data subset, so as to construct the large language model-specific dataset corresponding to the specified professional field according to the knowledge question and answer data subset and the extended case analysis data subset according to the target task ratio.

[0013] Furthermore, after constructing the large language model dedicated dataset corresponding to the specified professional field, the method also includes: obtaining a large language model general dataset and determining the current data volume in the large language model dedicated dataset; determining the amount of general data to be mixed in according to a preset mixing ratio and the current data volume, wherein the mixing ratio is used to represent the mixing ratio of the large language model dedicated dataset and the general dataset; extracting data from the large language model general dataset according to the amount of general data to be mixed in through a preset script code to determine the general dataset to be mixed in; mixing the general dataset to be mixed in the large language model dedicated dataset to construct a large language model dataset.

[0014] One or more embodiments of this specification provide a data set construction device for a large language model, including:

[0015] at least one processor; and,

[0016] a memory communicatively connected to the at least one processor; wherein,

[0017] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the above method.

[0018] One or more embodiments of the present specification provide a non-volatile computer storage medium storing computer executable instructions, wherein the computer executable instructions are configured to: obtain professional file data in a specified professional field to determine a large language model data set information based on the professional file data, wherein the large language model data set information includes multiple data set target task types and target task ratios of the multiple data set target task types, and the target task types include professional knowledge question and answer and specific case analysis; construct question and answer pairs for the professional file data through a pre-set hierarchical progressive construction strategy to generate a knowledge question and answer data subset corresponding to the professional file data; analyze the professional file data to determine analysis case information corresponding to the professional file data to construct a case analysis data subset according to probability distribution characteristics and the analysis case information, wherein the analysis case information includes variable type information corresponding to the analysis case; and construct a large language model-specific data set corresponding to the specified professional field based on the large language model data set information and the knowledge question and answer data subset and the case analysis data subset.

[0019] At least one of the above-mentioned technical solutions adopted in the embodiments of this specification can achieve the following beneficial effects: through the above-mentioned technical solutions, by directly acquiring data from professional file data in a specified professional field, the knowledge question and answer data subset and the case analysis data subset constructed will directly reflect the professional knowledge and application scenarios in the field, making the large language model dedicated data set closer to actual needs and business scenarios, thereby improving the pertinence and professionalism of the model; the multiple data set target task types and the corresponding target task ratios contained in the large language model data set information can ensure that the data set contains both general professional knowledge questions and answers and specific case analyses. This mixed data set helps the model learn more diverse features and patterns during the training process, thereby improving the generalization ability and adaptability of the model; the knowledge question and answer data subset generated by the hierarchical progressive construction strategy can ensure that the question and answer The quality and quantity of the data meet the needs of model training, which can improve the sense of hierarchy in the construction of professional data sets and improve the ability of large models to answer micro and macro questions in professional fields. The case analysis data subset constructed based on probability distribution characteristics and analysis of case information not only improves the breadth and depth of professional data set construction, but also further improves the comprehensiveness and accuracy of large models in professional fields. The pre-set hierarchical progressive construction strategy and the probability distribution characteristics of analysis case information can be used to automatically or semi-automatically construct data sets, reduce manual intervention and errors, and improve the quality and construction efficiency of data sets. By constructing specific case analysis data subsets, the model can combine specific case information when generating predictions or suggestions, and provide more detailed and accurate explanations, thereby enhancing the interpretability and credibility of the model, making the results of the model easier for users to accept and understand. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the technical solutions in the embodiments of this specification or the prior art, the following briefly introduces the drawings required for use in the embodiments or the prior art description. Obviously, the drawings described below are only some embodiments recorded in this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative labor. In the drawings:

[0021] Figure 1 A flowchart of a method for constructing a data set for a large language model provided in an embodiment of this specification;

[0022] Figure 2 A schematic diagram of a construction process of a knowledge question and answer data subset provided in an embodiment of this specification;

[0023] Figure 3 A schematic diagram of a construction process of a case analysis data subset provided in an embodiment of this specification;

[0024] Figure 4 A schematic diagram of a normal distribution provided in the embodiments of this specification;

[0025] Figure 5 A schematic diagram of the structure of a data set construction device for a large language model provided in an embodiment of this specification. DETAILED DESCRIPTION

[0026] In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments of this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this specification.

[0027] The embodiments of this specification provide a method for constructing a data set for a large language model. It should be noted that the execution subject in the embodiments of this specification can be a server or any device with data processing capabilities. Figure 1 A flowchart of a method for constructing a data set for a large language model provided in an embodiment of this specification is shown in FIG. Figure 1 As shown, it mainly includes the following steps:

[0028] Step S101 : acquiring professional document data in a specified professional field, so as to determine large language model data set information based on the professional document data.

[0029] The large language model data set information includes multiple data set target task types and target task ratios of the multiple data set target task types, and the target task types include professional knowledge question and answer and specific case analysis.

[0030] In one embodiment of the present specification, professional document data in a specified professional field is obtained, where the specified professional field refers to the professional field of the business corresponding to the large language model, and the professional document data here can be a professional PDF file, such as an air conditioning maintenance manual PDF file, and an enterprise reimbursement system PDF file.

[0031] Based on the professional file data, determine the large language model data set information, specifically including: obtaining the historical large language model input and output information of the specified professional field corresponding to the professional file data; identifying the historical large language model input and output information, and determining multiple historical task types to determine the multiple data set target task types; counting the number of tasks of each of the historical task types, and determining the target task ratio of the multiple data set target task types according to the ratio between the number of tasks of multiple historical task types.

[0032] In one embodiment of the present specification, analyzing professional document data and analyzing professional PDF files to determine the target task ratio is to determine the target tasks that need to be solved in constructing a data set. Usually, professional fields include two major types of tasks, namely professional knowledge question and answer and specific case analysis. For example, a dedicated data set is constructed from a PDF file of a certain model of air conditioner maintenance manual. For the professional knowledge clearly visible in the manual, a knowledge question and answer data set can be constructed, while a case analysis data set needs to be constructed when logical reasoning is needed to analyze the possible damage and expected life of air conditioner components.

[0033] When analyzing professional file data, you can refer to the historical question and answer information of the big language model using professional file data, that is, the historical big language model input and output information. In the system that stores the historical data of the big language model, retrieve and obtain the historical file data in the specified professional field corresponding to the professional file data. Extract the input (user questions or instructions) and output (model-generated answers or execution results) of the big language model from the historical file data. According to the characteristics of the professional field, predefine a series of possible task types, such as knowledge question and answer and case analysis. Use natural language processing (NLP) technology, such as text classification, named entity recognition, etc., to identify the extracted input and output information and determine the task type to which it belongs. Determine the target task type of the data set corresponding to this professional file data through multiple historical task types. Count the number of occurrences of each historical task type in the total number of tasks, and calculate the ratio between them according to the number of occurrences of each task type, that is, determine the target task ratio of multiple data set target task types. In general, the ratio of knowledge question and answer target tasks to case analysis target tasks is generally between 1:1 and 1:5. By determining the target task ratio, data can be collected, organized and labeled in a more targeted manner, thereby improving data quality and efficiency; by adjusting the distribution of training data according to the target task ratio, the model can pay more attention to important task types during training, thereby improving the performance and generalization ability of the model; as the professional field develops and changes, the target task ratio can also be adjusted accordingly to make data collection and model training more in line with the development trend of the field; by confirming the historical question and answer information of the big prediction model that uses professional file data, the target task type corresponding to this professional file data is guaranteed to match the professional file data with the task type; in addition, the target task ratio is determined by the ratio between the historical task times, so that the ratio of the corresponding data set can be determined according to the target task ratio, avoiding subjective interference in the process of manually setting the ratio, and ensuring the accuracy of the ratio of the data set corresponding to each task type.

[0034] Step S102, constructing question-answer pairs for the professional document data through a preset hierarchical progressive construction strategy to generate a knowledge question-answer data subset corresponding to the professional document data.

[0035] Through a preset hierarchical progressive construction strategy, question-answer pairs are constructed for the professional document data to generate a knowledge question-answer data subset corresponding to the professional document data, specifically including: obtaining input restriction information of a large language model and natural separator information in the professional document data; processing the professional document data according to the input restriction information of the large language model and the natural separator information in the professional document data to generate multiple segments; using each of the segments as input of the large language model, generating a segmentation question corresponding to each segment through preset prompt words, expanding the segmentation question through synonym replacement to generate multiple expanded segmentation questions; through prompt word engineering, the multiple expanded segmentation questions and the professional document data are combined to generate a segmentation answer corresponding to each of the expanded segmentation questions, and constructing a segmentation question-answer pair; based on the multiple segmentation question-answer pairs, a knowledge question-answer data subset corresponding to the professional document data is generated.

[0036] According to the large language model input restriction information and the natural separator information in the professional document data, the professional document data is processed to generate multiple segments, specifically including: according to the natural separator information in the professional document data, the professional document data is segmented to determine multiple first segments; according to the order of the natural separator information in the professional document data, a first segmentation order corresponding to the multiple first segments is determined; according to the large language model input restriction information, according to the first segmentation order, the segmentation word count information of the first segments is accumulated in sequence to obtain the accumulated accumulated segmentation word count information; according to the accumulated segmentation word count information and the large language model input restriction information, multiple specified first segments are merged to determine multiple second segments.

[0037] In one embodiment of this specification, Figure 2 A schematic diagram of a construction process of a knowledge question and answer data subset provided in an embodiment of this specification, such as Figure 2 As shown, a progressive strategy is adopted, and the generated question-answer pairs have a sense of hierarchy, containing information from small to large in sequence. The process includes setting rules according to the number of words and content relevance to segment the PDF file, the large language model generates sentence and paragraph level questions based on the PDF file, the large language model generates sentence and paragraph level question-answer pairs and reviews the question-answer pairs, the large language model generates large paragraph level questions based on the PDF file, the large language model generates large paragraph level question-answer pairs and reviews the question-answer pairs, etc.

[0038] In one embodiment of the present specification, the professional document data is segmented according to the rules set according to the word count and content relevance to meet the requirements of the input word count limit of the large language model. First, the input limit information of the large language model is obtained. The input limit information here can be the input word count size limit. The large language model generally inputs about 32K words, and the set limit word count is about 14k. The natural separators in the professional document data, such as natural separators such as titles, are obtained, and the PDF file is divided into many small segments, that is, the first segment. The first segment order corresponding to the multiple first segments is determined by the order of the natural separator information in the professional document data, and then the first small segment is accumulated step by step, and when the total word count exceeds 14K, the small segments with a total number less than 14K are merged into a large segment, which is the second segment here; then the small segments with a total number exceeding 14K are accumulated as the new first small segment and continue to be accumulated with the following small segments, and the operation is cyclically operated to divide the professional PDF file into many large segments with content association and a total word count not exceeding 14K, that is, multiple second segments are obtained.

[0039] In one embodiment of the present specification, the large language model generates the level questions corresponding to the first segment according to the PDF file by designing prompt words. The key to the prompt words is "generate a question for each sentence or paragraph, as many questions as possible". The large language model understands the input PDF file information, and then condenses and extracts the questions, condensing one question for each sentence or paragraph. Then the large language model expands the questions by 2 to 3 times according to synonym replacement. For example, the original PDF file contains the following content: "If the reimbursement person fails to issue and submit paper reimbursement documents within 10 days from the date of completion of the audit, he shall not initiate a new reimbursement process." The first question generated by the large language model is "What are the consequences of not processing paper reimbursement documents in a timely manner?" Then, after the large language model performs synonym replacement, the new question expanded is "In the reimbursement process, when should the reimbursement person issue and submit paper documents?" The large language model generates sentence and paragraph-level question and answer pairs, and reviews the question and answer pairs. The generated sentence and paragraph-level questions and professional PDF file content are input into the large language model through the prompt word project. The large language model generates answers based on the professional PDF file, and then the questions and answers constitute multiple question and answer pair data sets corresponding to the first segment. The question and answer pairs generated by the large language model are filtered by setting conditions such as word limit and sensitive word check. When the question and answer pairs that do not meet the conditions are filtered, the question and answer pairs that do not meet the conditions are modified by deleting sensitive words and replacing words.

[0040] The large language model generates large paragraph-level questions based on the PDF file, that is, the second paragraph-level questions corresponding to the second segment. The prompt word project is still used. The key to the prompt word is "generating questions that summarize the content of the large paragraph, summarizing as comprehensively as possible and asking as few questions as possible". The large language model generates large paragraph-level questions by summarizing the content of the large paragraph. In this way, the questions generated by the large language model include both micro questions at the sentence and small paragraph level and macro questions at the large paragraph level, which improves the comprehensiveness and hierarchy of the professional data set construction. The large language model generates large paragraph-level question-answer pairs and reviews the question-answer pairs. The large paragraph-level questions and professional PDF file content are still input into the large language model through the prompt word project. The large language model generates answers based on the professional PDF file, and then the questions and answers constitute multiple question-answer pair data sets corresponding to the second segment. The question-answer pair data is still screened by setting conditions such as word limit, sensitive words, and content relevance. Data that does not meet the conditions is deleted or modified by word replacement. It should be noted that the sensitive words here refer to expressions that violate regulations, and sensitive words can be set in advance according to needs. By constructing knowledge question-answering datasets through a progressive strategy, we can improve the hierarchy of dataset construction in professional fields and enhance the ability of large language models to answer micro and macro questions in professional fields.

[0041] Step S103, analyzing the professional document data to determine analysis case information corresponding to the professional document data, so as to construct a case analysis data subset according to the probability distribution characteristics and the analysis case information.

[0042] The analysis case information includes variable type information corresponding to the analysis case.

[0043] According to the probability distribution characteristics and the analysis case information, a case analysis data subset is constructed, specifically including: obtaining the variable type information of each variable corresponding to the analysis case in the analysis case information; constructing at least one case analysis question and answer pair corresponding to each variable type according to a predetermined uniform distribution rule; determining the total number of historical case variables corresponding to the analysis case and the number of historical case variables generated corresponding to each variable type, and determining the occurrence probability of each variable type through the number of historical case variables generated and the total number of historical case variables; according to the normal distribution principle, each case analysis question and answer pair is expanded according to the occurrence probability of each variable type to construct a case analysis data subset.

[0044] According to a predetermined uniform distribution rule, at least one case analysis question-answer pair is constructed corresponding to each variable type, specifically including: designing questions for each variable type to generate at least one case analysis question corresponding to each variable type; answering each case analysis question based on the professional document data through a large language model to determine the case analysis answer corresponding to each case analysis question; based on at least one case analysis question corresponding to each variable type and the case analysis answer corresponding to each case analysis question, at least one case analysis question-answer pair is constructed corresponding to each variable type.

[0045] In one embodiment of this specification, Figure 3 A schematic diagram of a construction process of a case analysis data subset provided in an embodiment of this specification, such as Figure 3 As shown, the data set is constructed and expanded according to the characteristics of probability distribution. The process includes analyzing the variable type and quantity information involved in the case according to the PDF file, constructing at least one question-answer pair for each variable according to the principle of uniform distribution, sorting the variables according to the probability size, and expanding the question-answer pairs according to the probability size of the variables according to the principle of normal distribution.

[0046] Get the variable type and quantity information involved in the analysis case information corresponding to the PDF file, that is, when constructing a question-answer pair that requires logical reasoning of a large language model, you need to first analyze the variable type and quantity in the question. For example, in the professional business trip expense reimbursement business, when a business traveler travels to a certain city, the accommodation environment and reimbursement expenses need to be considered. The variables should be the level of the business traveler, the city type, and the number of days of the business trip. According to the principle of uniform distribution, at least one question-answer pair is constructed for each variable, which means that the question-answer pair is constructed according to the principle that each variable is involved, taking into account the breadth of the data set construction. Taking the business trip expense reimbursement business as an example, the level of the business traveler usually includes the chairman, general manager, manager, supervisor, director, implementer, etc. Each company contains different categories, and it is generally assumed that there are 3 major categories; city type, generally divided into municipalities, provincial capitals, ordinary prefecture-level cities, etc., also assumes that there are three major categories; the number of days of business trip, assuming that the maximum business trip is 15 days. Each type contains at least 3×3×15=135 data sets. Get the total number of historical case variables corresponding to the analysis case and the number of historical case variables corresponding to each variable type. Calculate the probability of occurrence of each variable type based on the number of historical case variables and the total number of historical case variables. Sort all variables by probability. For example, analyze the number of times the level of the business traveler, the type of business travel city, and the number of days of the business travel appear in the existing business travel expense reimbursement form, and sort the variables.

[0047] According to the principle of normal distribution, expand the question and answer pairs according to the probability of the variable. It should be noted that most real-life problems are similar to or close to normal distribution. Figure 4A normal distribution diagram provided in the embodiments of this specification is as follows: Figure 4 As shown, the probability density function of the standard normal distribution is , where the mean μ=0, the standard deviation σ=1. Considering the symmetry of the normal distribution, it is only necessary to calculate the probability on one side. The interval [0, 3] is partitioned according to the number of variables, and the probability on each partition is calculated. Then, given a total amount of data, the number of variables under each probability is calculated to expand the data set. Assuming that among the levels of business travelers, the third-level personnel have the most business trips, followed by the second-level personnel, and finally the first-level personnel, then the one-sided normal distribution probabilities are 0.341, 0.136, and 0.021, respectively. Assuming that the total number is 25, then the number of expanded question-answer pairs corresponding to the third-level personnel in the expanded data set is 25*0.341*2, which is 17.05, and the value is 17. According to the above method, the number of expanded question-answer pairs corresponding to the second-level personnel and the first-level personnel is 7 and 1, respectively. Using the characteristics of the normal distribution to construct data ensures both the breadth and depth of the data, and further improves the comprehensiveness and accuracy of the professional field of the large language model.

[0048] Step S104, based on the large language model dataset information, according to the knowledge question and answer data subset and the case analysis data subset, construct a large language model dedicated dataset corresponding to the specified professional field.

[0049] Based on the large language model dataset information, according to the knowledge question and answer data subset and the case analysis data subset, constructing the large language model dedicated dataset corresponding to the specified professional field, specifically including: obtaining the target task ratio of the multiple dataset target task types in the large language model dataset information; respectively determining the number of knowledge question and answer question and answer pairs and the number of case analysis question and answer pairs in the knowledge question and answer data subset and the case analysis data subset; judging whether the knowledge question and answer data subset and the case analysis data subset meet the target task ratio according to the number of knowledge question and answer pairs and the number of case analysis question and answer pairs; when the knowledge question and answer data subset and the case analysis data subset do not meet the target task ratio, expanding the case analysis data subset according to the target task ratio to obtain an extended case analysis data subset, so as to construct the large language model dedicated dataset corresponding to the specified professional field according to the knowledge question and answer data subset and the extended case analysis data subset according to the target task ratio.

[0050] In one embodiment of the present specification, first, determine the number of knowledge question and answer pairs in the knowledge question and answer data subset obtained in the above steps and the number of case analysis question and answer pairs in the case analysis data subset. Assume that the number of knowledge question and answer pairs is 100, the number of case analysis question and answer pairs is 150, and the target task ratio of knowledge question and answer class and case analysis class is 1:4. According to the number of knowledge question and answer pairs and the number of case analysis question and answer pairs, determine whether the knowledge question and answer data subset and the case analysis data subset meet the target task ratio. In the above example, the knowledge question and answer data subset and the case analysis data subset do not meet the target task ratio. In this case, according to the one-to-four relationship of the target task ratio, the case analysis data subset is expanded so that the ratio between the number of knowledge question and answer pairs and the number of extended case analysis class question and answer pairs in the expanded extended case analysis data subset satisfies the one-to-four relationship. It should be noted that when expanding here, it can be achieved by synonym expansion or other expansion methods. A large language model-specific data set corresponding to the specified professional field is constructed based on the knowledge question and answer data subset and the extended case analysis data subset.

[0051] After constructing the large language model dedicated dataset corresponding to the specified professional field, the method also includes: obtaining a large language model general dataset and determining the current data volume in the large language model dedicated dataset; determining the amount of general data to be mixed in according to a preset mixing ratio and the current data volume, wherein the mixing ratio is used to represent the mixing ratio of the large language model dedicated dataset and the general dataset; extracting data from the large language model general dataset according to the amount of general data to be mixed in through a preset script code to determine the general dataset to be mixed in; mixing the general dataset to be mixed in the large language model dedicated dataset to construct a large language model dataset.

[0052] In one embodiment of the present specification, data is extracted from a general data set according to a mixing ratio by designing a script code, and mixed into the constructed knowledge question and answer and case analysis data sets to form a large language model data set, wherein the ratio of the large language model special data set to the general data set can be a value between 1:5 and 1:10, which can be set here according to empirical data. Specifically, the following steps are included: first, a general data set of a large language model is obtained from a public data source or an internal database, and the general data set should contain diversified text data, covering a variety of topics and contexts. The number of existing text data or the amount of data in the special data set is counted. As needed, the subject distribution, quality, etc. of the data can be further analyzed. According to the preset mixing ratio (such as special data set: general data = 1:5) and the current data volume of the special data set, the amount of general data to be mixed is calculated, and the mixing ratio can be adjusted according to the specific needs and performance of the model. Using the pre-set script code, according to the calculated amount of general data to be mixed, data is extracted from the general data set randomly or according to a certain strategy (such as by topic distribution). The extracted data should ensure diversity and quality, and avoid introducing noise or duplicate data. The extracted general dataset to be mixed is merged with the special dataset. During the merging process, the original labels of the data can be retained or necessary preprocessing (such as deduplication, text cleaning, etc.) can be performed. After merging and possible preprocessing, the final large language model dataset is obtained. The final dataset should meet the needs of model training and have good generalization ability and adaptability.

[0053] By mixing in general datasets, the diversity and richness of the datasets can be increased, thereby improving the generalization ability of the large language model and enabling it to better handle various contexts and topics; mixed datasets can better simulate the data distribution in the real world, allowing the model to learn more useful features and patterns during the training process, thereby optimizing the performance of the model; by introducing general data of different topics and contexts, the adaptability of the large language model to different fields and scenarios can be enhanced, improving its practicality and scope of application; using pre-set mixing ratios and script codes for automatic data extraction and mixing can improve the efficiency of data utilization, reduce manual intervention and errors, and can adjust the mixing ratio and data extraction strategy according to actual needs, with high flexibility and scalability.

[0054] Through the above technical solution, by directly acquiring data from professional file data in designated professional fields, the constructed knowledge question and answer data subsets and case analysis data subsets will directly reflect the professional knowledge and application scenarios in the field, making the large language model dedicated data set closer to actual needs and business scenarios, thereby improving the pertinence and professionalism of the model; the multiple data set target task types and corresponding target task ratios contained in the large language model data set information can ensure that the data set contains both general professional knowledge questions and answers and specific case analyses. This mixed data set helps the model learn more diverse features and patterns during the training process, thereby improving the generalization ability and adaptability of the model; the knowledge question and answer data subset generated by the hierarchical progressive construction strategy can ensure that the quality and quantity of question and answer pairs meet the needs of model training. , which can improve the sense of hierarchy in the construction of professional data sets and improve the ability of large models to answer micro and macro questions in professional fields; and the case analysis data subsets constructed based on probability distribution characteristics and analysis case information have not only improved the breadth and depth of the construction of professional data sets, but also further improved the comprehensiveness and accuracy of large models in professional fields; using the pre-set hierarchical progressive construction strategy and the probability distribution characteristics of analysis case information, the data set can be constructed automatically or semi-automatically, reducing human intervention and errors, and improving the quality and construction efficiency of the data set; by constructing specific case analysis data subsets, the model can combine specific case information when generating predictions or suggestions, and provide more detailed and accurate explanations, thereby enhancing the interpretability and credibility of the model, making the model results easier for users to accept and understand.

[0055] The embodiment of this specification also provides a data set construction device for a large language model, such as Figure 5 As shown, the device includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the above method.

[0056] The embodiments of the present specification also provide a non-volatile computer storage medium storing computer executable instructions, wherein the computer executable instructions are configured to: obtain professional file data in a specified professional field, and determine a large language model data set information based on the professional file data, wherein the large language model data set information includes multiple data set target task types and target task ratios of the multiple data set target task types, and the target task types include professional knowledge question and answer and specific case analysis; construct question and answer pairs for the professional file data through a pre-set hierarchical progressive construction strategy to generate a knowledge question and answer data subset corresponding to the professional file data; analyze the professional file data to determine analysis case information corresponding to the professional file data, and construct a case analysis data subset according to probability distribution characteristics and the analysis case information, wherein the analysis case information includes variable type information corresponding to the analysis case; and construct a large language model-specific data set corresponding to the specified professional field based on the large language model data set information and the knowledge question and answer data subset and the case analysis data subset.

[0057] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device, equipment, and non-volatile computer storage medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0058] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0059] The above description is only one or more embodiments of this specification and is not intended to limit this specification. For those skilled in the art, one or more embodiments of this specification may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of one or more embodiments of this specification shall be included in the scope of the claims of this specification.

Claims

1. A method for constructing a dataset for a large language model, It is characterized in that The method comprises: Obtaining professional document data in a specified professional field to determine large language model data set information based on the professional document data, wherein the large language model data set information includes multiple data set target task types and target task ratios of the multiple data set target task types, and the target task types include professional knowledge question and answer and specific case analysis; Through a preset hierarchical progressive construction strategy, question-answer pairs are constructed for the professional document data to generate a knowledge question-answer data subset corresponding to the professional document data; Analyze the professional file data to determine analysis case information corresponding to the professional file data, so as to construct a case analysis data subset according to probability distribution characteristics and the analysis case information, wherein the analysis case information includes variable type information corresponding to the analysis case; Based on the large language model data set information, and according to the knowledge question and answer data subset and the case analysis data subset, construct a large language model dedicated data set corresponding to the specified professional field; The professional document data is constructed into question-answer pairs through a preset hierarchical progressive construction strategy to generate a knowledge question-answer data subset corresponding to the professional document data, specifically including: Obtaining large language model input restriction information and natural separator information in the professional document data; Processing the professional document data according to the large language model input restriction information and natural separator information in the professional document data to generate a plurality of segments; Taking each of the segments as input of the large language model, generating a segmentation question corresponding to each segment by using preset prompt words, and expanding the segmentation question by replacing synonyms to generate multiple expanded segmentation questions; By using prompt word engineering, the plurality of expanded segmented questions and the professional document data are combined to generate a segmented answer corresponding to each of the expanded segmented questions, and a segmented question-answer pair is constructed; Based on the plurality of segmented question-answer pairs, a knowledge question-answer data subset corresponding to the professional document data is generated.

2. A method for constructing a data set for a large language model according to claim 1, It is characterized in that According to the input restriction information of the large language model and the natural separator information in the professional document data, the professional document data is processed to generate multiple segments, specifically including: Segmenting the professional document data according to natural separator information in the professional document data to determine a plurality of first segments; Determine the first segment order corresponding to the plurality of first segments according to the order of the natural separator information in the professional file data; According to the large language model input restriction information, the segment word count information of the first segment is accumulated in sequence according to the first segmentation order to obtain the accumulated segment word count information; A plurality of designated first segments are merged by using the accumulated segment word count information and the large language model input restriction information to determine a plurality of second segments.

3. The method for constructing a data set for a large language model according to claim 1, It is characterized in that According to the probability distribution characteristics and the analysis case information, a case analysis data subset is constructed, specifically including: Obtaining variable type information corresponding to each variable in the analysis case in the analysis case information; According to a predetermined uniform distribution rule, construct at least one case analysis question-answer pair corresponding to each variable type; Determine the total number of historical case variables corresponding to the analysis case and the number of historical case variable generation corresponding to each variable type, and determine the occurrence probability of each variable type through the number of historical case variable generation and the total number of historical case variables; According to the normal distribution principle and based on the occurrence probability of each variable type, each case analysis question-answer pair is expanded to construct a case analysis data subset.

4. The method for constructing a data set for a large language model according to claim 3, It is characterized in that According to the predetermined uniform distribution rule, at least one case analysis question-answer pair corresponding to each variable type is constructed, including: Designing questions for each of the variable types to generate at least one case analysis question corresponding to each of the variable types; By using a large language model, each of the case analysis questions is answered according to the professional document data, and a case analysis answer corresponding to each of the case analysis questions is determined; Based on at least one case analysis question corresponding to each of the variable types and the case analysis answer corresponding to each of the case analysis questions, at least one case analysis question-answer pair corresponding to each of the variable types is constructed.

5. The method for constructing a data set for a large language model according to claim 1, It is characterized in that Based on the professional file data, determine the large language model data set information, specifically including: Obtaining historical large language model input and output information corresponding to the specified professional field of the professional document data; Identifying the historical large language model input and output information, determining a plurality of historical task types, and determining the plurality of data set target task types; The number of tasks of each of the historical task types is counted, and the target task ratios of the target task types of the multiple data sets are determined according to the ratios between the number of tasks of multiple historical task types.

6. The method for constructing a data set for a large language model according to claim 1, It is characterized in that Based on the large language model dataset information, and according to the knowledge question and answer data subset and the case analysis data subset, constructing a large language model dedicated dataset corresponding to the specified professional field, specifically including: Obtaining target task ratios of the target task types of the multiple data sets in the large language model data set information; Determine the number of knowledge question-answer pairs and the number of case analysis question-answer pairs in the knowledge question-answer data subset and the case analysis data subset respectively; According to the number of the knowledge question and answer pairs and the number of the case analysis question and answer pairs, judging whether the knowledge question and answer data subset and the case analysis data subset meet the target task ratio; When the knowledge question and answer data subset and the case analysis data subset do not meet the target task ratio, the case analysis data subset is expanded according to the target task ratio to obtain an extended case analysis data subset, so as to construct a large language model dedicated data set corresponding to the specified professional field according to the knowledge question and answer data subset and the extended case analysis data subset in accordance with the target task ratio.

7. The method for constructing a data set for a large language model according to claim 1, It is characterized in that After constructing the large language model dedicated dataset corresponding to the specified professional field, the method further includes: Acquire a large language model general data set, and determine a current amount of data in the large language model dedicated data set; Determining the amount of general data to be mixed in according to a preset mixing ratio and the current data amount, wherein the mixing ratio is used to represent the mixing ratio of the large language model dedicated data set and the general data set; By using a pre-set script code, data is extracted from the large language model general data set according to the amount of general data to be mixed in, so as to determine the general data set to be mixed in; The general data set to be mixed is mixed into the large language model dedicated data set to construct a large language model data set.

8. A data set construction device for a large language model, It is characterized in that The device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can perform the method according to any one of claims 1 to 7.

9. A non-volatile computer storage medium storing computer executable instructions, It is characterized in that The computer executable instructions are configured to: Obtaining professional document data in a specified professional field to determine large language model data set information based on the professional document data, wherein the large language model data set information includes multiple data set target task types and target task ratios of the multiple data set target task types, and the target task types include professional knowledge question and answer and specific case analysis; Through a preset hierarchical progressive construction strategy, question-answer pairs are constructed for the professional document data to generate a knowledge question-answer data subset corresponding to the professional document data; Analyze the professional file data to determine analysis case information corresponding to the professional file data, so as to construct a case analysis data subset according to probability distribution characteristics and the analysis case information, wherein the analysis case information includes variable type information corresponding to the analysis case; Based on the large language model data set information, and according to the knowledge question and answer data subset and the case analysis data subset, construct a large language model dedicated data set corresponding to the specified professional field; The professional document data is constructed into question-answer pairs through a preset hierarchical progressive construction strategy to generate a knowledge question-answer data subset corresponding to the professional document data, specifically including: Obtaining large language model input restriction information and natural separator information in the professional document data; Processing the professional document data according to the large language model input restriction information and natural separator information in the professional document data to generate a plurality of segments; Taking each of the segments as input of the large language model, generating a segmentation question corresponding to each segment by using preset prompt words, and expanding the segmentation question by replacing synonyms to generate multiple expanded segmentation questions; By using prompt word engineering, the plurality of expanded segmented questions and the professional document data are combined to generate a segmented answer corresponding to each of the expanded segmented questions, and a segmented question-answer pair is constructed; Based on the plurality of segmented question-answer pairs, a knowledge question-answer data subset corresponding to the professional document data is generated.